query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
2005e3ce76b1927fbf34d8a957115052
|
PUT /comments/1 PUT /comments/1.json
|
[
{
"docid": "07cc2d5d9e708241aef65eed93c147a0",
"score": "0.0",
"text": "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.js \n else\n format.js { render action: \"edit\" }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "1dbb9320c747e53a3ed8fbd81c7b2d14",
"score": "0.72931236",
"text": "def update\n @api_v1_comment = @post.comments.find(params[:id])\n params[:comment].delete :created_at\n params[:comment].delete :updated_at\n respond_to do |format|\n if @api_v1_comment.update_attributes(params[:comment])\n format.html { redirect_to @api_v1_comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "165becdb3c11a21a76a22d43bfda23d4",
"score": "0.71409035",
"text": "def update_comment(details={})\n self.class.post(\"/comments/update.json\", :body => details)\n end",
"title": ""
},
{
"docid": "91d07574eb837d4402daaaf93bc2ec8f",
"score": "0.70926297",
"text": "def update\n @user = current_user\n @comment = Comment.find(params[:id].to_i)\n @comments = Comment.all \n success = @comment.update(comment_params)\n if success \n render json: @comments\n else \n render json: errors.full_messages, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "dd320d5a83c5a410f269ce759761ccce",
"score": "0.7017118",
"text": "def update\n if @comment.update(comment_params)\n render json: @comment\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f2a44d9e7eb6f40df261cb78029002d9",
"score": "0.7008188",
"text": "def update\n @comment = @post.comments.find(params[:id])\n\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a85114f74c48a5c181b26c5a4471b21c",
"score": "0.6995546",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comments])\n format.html { redirect_to @comment, notice: 'Ticket was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9fa9c2b7686cf2ac9cd357a7fa8aeac7",
"score": "0.69741094",
"text": "def update\n comemnt = Comment.find(params[:id])\n if comment.update_attributes(comment_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => comment.errors}, :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8ecd698a8c7748c556ecfa59a7a2480c",
"score": "0.69489694",
"text": "def update\n if @comment.update(comment_params)\n render json: @comment\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ca2fbddc96faadc3d50b177dacb58f86",
"score": "0.6931817",
"text": "def update\n @comment = Comment.find(params[:id])\n\n if @comment.update_attributes(params[:comment])\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "d7d290e2ebb7d8f232f4306c60076378",
"score": "0.6926225",
"text": "def update\n\t\tif @comment.update(comment_params)\n\t\t\trender json: @comment, status: :ok\n\t\telse\n\t\t\trender json: @comment.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9145a0078fc9909e4bde8969c47ef002",
"score": "0.69114226",
"text": "def update\n @comment = Comment.find(params[:id])\n\n if @comment.update(params[:comment])\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "46dc71cce019a21c235e5aaf11cd8b56",
"score": "0.69052416",
"text": "def update\n @comment = Comment.find(params[:id])\n\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1e693b1de85b3607f96b10a92a167cd2",
"score": "0.68600935",
"text": "def update\n @comment.update(comment_params)\n head :no_content\n end",
"title": ""
},
{
"docid": "c3b1353dd8dc48ac58504e2bf0a5ae4b",
"score": "0.68379194",
"text": "def update\n if @comment.update(comment_params)\n render json: @comment, status: 200\n else\n render :json => @comment.errors, :status => 422\n end\n end",
"title": ""
},
{
"docid": "7c52bcb5b55e4ce04ccb71b0371bdcdd",
"score": "0.68308496",
"text": "def update\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @post.tailgate, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @post.tailgate, error: 'Unable to update comment' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "61a622527c43b9fedeb55912ccd4167a",
"score": "0.6828972",
"text": "def update\n comment = @post.comments.find_by(id: params[:id])\n if comment && comment.update_attributes(comment_params)\n render json: {success: true, auth_token: @current_user.authentication_token, comment_id: comment.id, post_id: comment.post_id}\n else\n render json: {success: false, message: \"not found or validation failed\"}, status: 422\n end\n\tend",
"title": ""
},
{
"docid": "ec8b1f53d116bb2c93e3c0e706a88b2d",
"score": "0.6814209",
"text": "def view\n\n\t\t###########################################\n\t\t# POST BODY PARAMETERS\t\t\n\t\t# comment_id\t\t\n\t\t##########################################\n\n\t\t# Retrieve request body\n\t\tdata = JSON.parse(request.body.read)\t\n\t\t\t\n\t\t# Retrieve comment object and update views\n\t\tcomment = Comment.find_by(id: data[\"comment_id\"])\n\t\tcomment.comment_views = comment.comment_views + 1\n\t\tcomment.save\n\n\t\tmessage = {status: \"success\", message: \"Comment edited successfully\"}\n\t\treturn render json: message\n\tend",
"title": ""
},
{
"docid": "8b29f1f9328146c2f3b805e9dc80a5c8",
"score": "0.6801451",
"text": "def update\n @comment = Comment.find(params[:id])\n @comment.update_attributes(params[:comment])\n respond_with(@comment)\n end",
"title": ""
},
{
"docid": "e5a73fadeb955748605f0a8ae818ba90",
"score": "0.67809606",
"text": "def update_comment(id, options)\n send(:put, \"comments/#{id}.json\", comment: options).status\n end",
"title": ""
},
{
"docid": "a2507d838a59230413c8a85952ca45ed",
"score": "0.6757423",
"text": "def update\n @comment.update(comment_params)\n respond_to do |format| \n format.json { render :json => { :status => :ok } }\n format.html { render :html => @comment.comment}\n end\n end",
"title": ""
},
{
"docid": "882f9c81d475e654960fa1ba91c35ced",
"score": "0.67471075",
"text": "def update\n @comment = @commentable.comments.new(params[:comment])\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @commentable, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85680c3ffdbe259d0bb29b9836df1ed3",
"score": "0.6743811",
"text": "def update\n if @comment.update(comment_params)\n render json: { data: @comment, status: 200, success: true }, include: 'user'\n else\n render json: { error: @comment.errors, status: 500, success: false }\n end\n end",
"title": ""
},
{
"docid": "ac89854d8d457fd76bae061b0d8b52bb",
"score": "0.6714527",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac89854d8d457fd76bae061b0d8b52bb",
"score": "0.6714527",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "baa1cec92c5be617868a89d155bfad00",
"score": "0.66991115",
"text": "def update\n json_update(innerComment, innerComment_params, InnerComment)\n end",
"title": ""
},
{
"docid": "f915b963539c4e1cc2d4ac2870e23930",
"score": "0.6643014",
"text": "def update\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to([@comment.post, @comment], :notice => 'Comment was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b91431ae64cd1f39f513dae0f40f133",
"score": "0.66290474",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n path = path_name(@comment)\n format.html { redirect_to path, notice: \"Comment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cdb5f50c05dc26756960558731d5ffc6",
"score": "0.66166174",
"text": "def update\n @comment.update!(comment_params)\n end",
"title": ""
},
{
"docid": "9fda681ef0f263c26cd5fa8e16475df7",
"score": "0.66126394",
"text": "def update\n post = Post.find(params[:post_id])\n @comment = post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update(comment_params)\n format.html {redirect_to([@comment.post, @comment], notice: 'Comment was successfully updated.')}\n format.json {render head :ok}\n else\n format.html {render :edit}\n format.json {render json: @comment.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "6322ced5ed365caf484dceac36e73ba7",
"score": "0.66119945",
"text": "def update\n\t\trespond_to do |format|\n\t\t\t@post = post\n\t\t\t@comment = @post.comments.create(comment_params)\n\t\t\tif @comment.update(comment_params)\n\t\t\t\tformat.html { redirect_to post_url(post), notice: 'Comentario ha sido actualizado correctamente' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @comment }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5bc52fa5b57464134c52252705fb0e55",
"score": "0.660774",
"text": "def update\n authorize @comment\n\n if @comment.update(comment_params)\n json_response(@comment.decorate, :ok)\n else\n json_response(@comment.errors, :unprocessable_entity)\n end\n end",
"title": ""
},
{
"docid": "b6d0c4ed771a7e4df42da09c6f41b08a",
"score": "0.66030174",
"text": "def update\n @comment = @commentable.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to build_path_comment(@comment), notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0ad6b61747347dc4f6f08904a2acd5a7",
"score": "0.66026217",
"text": "def update\n if @app && @comment\n @comment.update(comment_params)\n if @comment.valid?\n head :no_content\n else\n head :bad_request\n end\n else\n head :not_found\n end\n end",
"title": ""
},
{
"docid": "f37f64be589d9f4457115ef87f6ef6a9",
"score": "0.6598591",
"text": "def update\n begin \n comment = Comment.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n comment = nil\n end \n\n if comment != nil && comment.update_attributes(comment_params) \n render json: {status: 'SUCCESS', message:'Updated comment', data:comment},status: :ok\n else\n render json: {status: 'ERROR', message:'Comment not updated', data:\"comment.error - comment id does not exist\"},status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "aafffbcdb7bdb5814181134a95d4ee0f",
"score": "0.6596451",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Datos actualizados.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d94a5bf0de8d1425b3b511ef2d1d511",
"score": "0.65946716",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_slug_path(@comment.post.slug, :anchor => \"comment-#{@comment.id}\"), notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bf9edc6c00638ac27346108ad71f8c32",
"score": "0.65928644",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e04d10c6ea47c1b6844dba427b11950b",
"score": "0.6589037",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.post }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "042dd15b4ce5771bfa1b675695ff2ec4",
"score": "0.65823025",
"text": "def update\n @user = current_user\n @review_comment = ReviewComment.find(params[:id])\n @review_comment.update_attributes(comment_params)\n render json: @review_comment\n end",
"title": ""
},
{
"docid": "232be70437fbc4698ad886dc38fade53",
"score": "0.6574221",
"text": "def update\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@post, @comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6e6f27cce4aec877b47a281a46b872bc",
"score": "0.65654",
"text": "def update\n @comment = Comment.find(params[:id])\n\t\t@comment.user_id = @user.id\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "145b1e6ced891f44c568c76196c65652",
"score": "0.65652287",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment]) \n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc1c0631a4ce44f693c1b44583d28c73",
"score": "0.6562501",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc1c0631a4ce44f693c1b44583d28c73",
"score": "0.6562501",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc1c0631a4ce44f693c1b44583d28c73",
"score": "0.6562501",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc1c0631a4ce44f693c1b44583d28c73",
"score": "0.6562501",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc1c0631a4ce44f693c1b44583d28c73",
"score": "0.6562501",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74031b3367ba1cdad85689fbff7a6264",
"score": "0.6560088",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "684637ea68295e4c330a2df445dd68b8",
"score": "0.65584314",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.json { render json: @comment, status: :ok }\n format.xml { render xml: @comment, status: :ok }\n else\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n format.xml { render xml: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6bd9b081507c03c60555bed29505ad48",
"score": "0.65519506",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb1a5abfacea38b40d350e511a6a6f5a",
"score": "0.65464324",
"text": "def update\n post = Post.find(params[:post_id])\n @post = Post.find(params[:post_id])\n @comment = post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to ([@comment.post, @comment]) }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "225a645f2ed7f63c55ebe96216946a1a",
"score": "0.6539546",
"text": "def update\n if @comment.update_attributes edit_params\n respond_with @comment, notice: \"Comment updated.\"\n else\n render json: { errors: @comment.errors.full_messages }, \\\n alert: \"Error editing comment.\"\n end\n end",
"title": ""
},
{
"docid": "b590e44530695e7e168989939f3c34e0",
"score": "0.6538918",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1110e01f88ee6b8f76ca237f45e24a4a",
"score": "0.6535433",
"text": "def edit_comment\n verify_post_request\n require_parameters :key, :text\n\n text = Api::Utils.read_post_request_param(params[:text])\n comment = Internal.issues.editComment(params[:issue], text)\n render :json => jsonp({:comment => Issue.comment_to_hash(comment)})\n end",
"title": ""
},
{
"docid": "909e55c6e615e6d3dc0b166344a60723",
"score": "0.65299404",
"text": "def update\n if Comment.find_by(id: params[:id]).nil?\n render json: { errors: \"Not Found\" }, status: 404\n else\n @comment = Comment.find(params[:id])\n if api_user.id != @comment.user_id\n render json: { errors: \"Unauthorized\" }, status: 401\n else\n if @comment.update_attributes(text: params[:text])\n render :json => @comment\n else\n render json: { errors: \"Bad Request\" }, status: 400\n end\n end\n end\n end",
"title": ""
},
{
"docid": "56fbc9d6c6c443357b410839242d87dc",
"score": "0.6529818",
"text": "def update\n @comment.update_attributes comment_params\n\n respond_with @project, @environment, @bug, @comment\n end",
"title": ""
},
{
"docid": "dcd7fbbfb5de73e40d4fcf00536baf81",
"score": "0.65256256",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to root_url, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da5ea48a7c4ec0d03b0430ff767b46e5",
"score": "0.65115947",
"text": "def update\n @comment = @song.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @song.artist, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1073518a173a07122761db83e30ebde4",
"score": "0.6508907",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to associate_post_path(@associate, @post), notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "90e372d46cdd5d553a551bb5219e9f70",
"score": "0.65048075",
"text": "def update\n challenge = Challenge.find(params[:challenge_id])\n @comment = challenge.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:success] = 'Your comment was successfully updated'\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource comment\n format.html { redirect_to([@comment.challenge, @comment]) }\n format.xml { head :ok }\n else\n flash[:danger] = 'Your comment could not be updated. Please try again'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cdcea318cdd45d6291621d7bdce0de11",
"score": "0.65030324",
"text": "def update\n resource_path = \"/projects/#{project_id}/tickets/{#ticket_id}/comments/#{id}\"\n Request.put(resource_path, self.to_xml('ticket'))\n end",
"title": ""
},
{
"docid": "bc4533ac51753166bf4a6f0569c186cd",
"score": "0.6501285",
"text": "def update\n @task = Task.find(params[:task_id])\n @comment = @task.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to task_comment(@task, @comment), notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b3981d748df4333cae681a216fe111e",
"score": "0.6498486",
"text": "def update\n @user = current_user\n @movie_comment = MovieComment.find(params[:id])\n @movie_comment.update_attributes(comment_params)\n render json: @movie_comment\n end",
"title": ""
},
{
"docid": "c65a5961c39a9cd009819bd787cc5792",
"score": "0.6484737",
"text": "def update\n if @comment.update(params.permit(:content))\n render json: @comment\n else\n render json: @comment.errors, status: 422\n end\n end",
"title": ""
},
{
"docid": "22d1b3e6d23bdd3c663a98769da4ef7e",
"score": "0.6483438",
"text": "def update\n respond_to do |format|\n if @comment.update(params[:comment])\n format.html { redirect_to @comment, notice: \"Comment was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d128b991a41a4c69d0c69c99bb4e3d33",
"score": "0.6482035",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: t(\"comment_updated\") }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d21a4103d18a86e6051ea8de3a0b47bb",
"score": "0.6480593",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_path(@comment.post_id), notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac2078864a1b447dc2a97dd1698b67ea",
"score": "0.6460897",
"text": "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c2b4cc2298b961172218c5b3133ce516",
"score": "0.64551216",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.post, notice: 'Comment updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34b9c1c1e10c2558c2f6572c853eafd8",
"score": "0.64548975",
"text": "def update\n respond_to do |format|\n if @comment == nil # no comment exists for id in path\n format.json { render json: {id: \"no comment found for this id\"}, status: :not_found }\n elsif user_is_logged? && @comment.user == current_user\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :bad_request }\n end\n else # unauthorized\n format.html { redirect_to '/auth/google_oauth2' }\n format.json { render json: {error: \"provide API key in Token header field and make sure it matches the user who created the comment\"}, status: :unauthorized }\n end\n end\n end",
"title": ""
},
{
"docid": "b4209b8bb942c554981e506b91cbe829",
"score": "0.6452975",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render json: @comment, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff48eb794508a36778fbf48a205f635d",
"score": "0.64447826",
"text": "def update\n event_params.each do |k, v|\n @comment.send k + \"=\", v\n end\n if !@comment.save\n render status: 422\n end\n end",
"title": ""
},
{
"docid": "2afe8dc6574c3b61a56b02db077ac96c",
"score": "0.6442397",
"text": "def update_comment(repo, number, comment, options={})\n post(\"/repos/#{Repository.new(repo)}/issues/comments/#{number}\", options.merge({:body => comment}), 3)\n end",
"title": ""
},
{
"docid": "75703cfeb93875afceca246a2f76cb4a",
"score": "0.64394337",
"text": "def update\n @comment = current_user.comments.find(params[:id]) #cambio Comment por current_user.comments.-- busca solo en comentarios asociados a current_user\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84df0f97a57236346d2f55df5dc24005",
"score": "0.6438854",
"text": "def update_comment(repo, number, comment, options = {})\n patch \"#{Repository.path repo}/issues/comments/#{number}\", options.merge({:body => comment})\n end",
"title": ""
},
{
"docid": "b1873123db436a4f0991344009c851e1",
"score": "0.64357334",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to posts_url, notice: 'Your Comment Was Successfully Updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c3c626b5f290cce89c96538a1e447775",
"score": "0.643484",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: t('successfully_commented') }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "307316818e18499eee1d930727a5ba10",
"score": "0.6427474",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.song, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "059727574818a37150f776e63e4f4b18",
"score": "0.64265066",
"text": "def update\n if is_team_member? and is_commenter? and @comment.update(comment_params)\n render json: @comment\n else\n render json: @comment.errors, status: :unprocessable_entity \n end\n end",
"title": ""
},
{
"docid": "d10c026c8553836429d5563193a3632d",
"score": "0.64250153",
"text": "def update\n\t\trespond_to do |format|\n\t\t\tif @comment.update(comment_params)\n\t\t\t\tformat.html { redirect_to @comment.stop, notice: 'Comment was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a4ba26494b7b9469ef4e2f9df30c086a",
"score": "0.6422998",
"text": "def update\n @comment = @discussion.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to startup_discussion_path(@startup, @discussion), notice: 'comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0dfebc12700cee8a06153c5984287b5a",
"score": "0.64225656",
"text": "def update\n @context = context\n @context.comments.find(params[:id]).update(comment_params)\n redirect_to context_url(@context)\n end",
"title": ""
},
{
"docid": "53529fe8ddba349a686a00423624a601",
"score": "0.6422095",
"text": "def update\n service_result = Organizers::BuildJoinTableObjectsForComment.call(comment_params, :update)\n @comment = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :ok, location: @comment\n end\n end",
"title": ""
},
{
"docid": "17d546284a70edfdd57ff2944dcfdaa1",
"score": "0.64188325",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17d546284a70edfdd57ff2944dcfdaa1",
"score": "0.64188325",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17d546284a70edfdd57ff2944dcfdaa1",
"score": "0.64188325",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17d546284a70edfdd57ff2944dcfdaa1",
"score": "0.64188325",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17d546284a70edfdd57ff2944dcfdaa1",
"score": "0.64188325",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17d546284a70edfdd57ff2944dcfdaa1",
"score": "0.64188325",
"text": "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d38c58a1eb0f0eb002fa963541fbf3ff",
"score": "0.6410768",
"text": "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to Post.find_by_id(@comment.post_id), notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
391fd666bf64dd6ccb61d55109e8aebe
|
Copyright (c) 2013 University of Manchester and the University of Southampton. See license.txt for details.
|
[
{
"docid": "2737a1d4101f91b55eda2548f11e8381",
"score": "0.0",
"text": "def workflow_aux(action, opts = {})\n\n # Obtain object\n\n case action\n when 'create';\n return rest_response(401, :reason => \"Not authorised to create a workflow\") unless Authorization.check('create', Workflow, opts[:user], nil)\n if opts[:query]['id']\n ob, error = obtain_rest_resource('Workflow', opts[:query]['id'], opts[:query]['version'], opts[:user], action)\n else\n ob = Workflow.new(:contributor => opts[:user])\n end\n when 'view', 'edit', 'destroy';\n ob, error = obtain_rest_resource('Workflow', opts[:query]['id'], opts[:query]['version'], opts[:user], action)\n else\n raise \"Invalid action '#{action}'\"\n end\n\n return error if ob.nil? # appropriate rest response already given\n\n if action == \"destroy\"\n\n return rest_response(400, :reason => \"Cannot delete individual versions\") if opts[:query]['version']\n\n ob.destroy\n\n else\n\n data = LibXML::XML::Parser.string(request.raw_post).parse\n\n title = parse_element(data, :text, '/workflow/title')\n description = parse_element(data, :text, '/workflow/description')\n license_type = parse_element(data, :text, '/workflow/license-type')\n type = parse_element(data, :text, '/workflow/type')\n content_type = parse_element(data, :text, '/workflow/content-type')\n content = parse_element(data, :binary, '/workflow/content')\n preview = parse_element(data, :binary, '/workflow/preview')\n svg = parse_element(data, :text, '/workflow/svg')\n revision_comment = parse_element(data, :text, '/workflow/revision-comment')\n\n permissions = data.find_first('/workflow/permissions')\n\n # build the contributable\n\n if license_type\n if license_type == \"\"\n ob.license = nil\n else\n ob.license = License.find_by_unique_name(license_type)\n\n if ob.license.nil?\n ob.errors.add(\"License type\")\n return rest_response(400, :object => ob)\n end\n end\n end\n\n # handle workflow type\n\n if type\n\n ob.content_type = ContentType.find_by_title(type)\n\n if ob.content_type.nil?\n ob.errors.add(\"Type\")\n return rest_response(400, :object => ob)\n end\n\n elsif content_type\n\n content_types = ContentType.find_all_by_mime_type(content_type)\n\n if content_types.length == 1\n ob.content_type = content_types.first\n else\n if content_types.empty?\n ob.errors.add(\"Content type\")\n else\n ob.errors.add(\"Content type\", \"matches more than one registered content type\")\n end\n\n return rest_response(400, :object => ob)\n end\n end\n\n ob.content_blob_id = ContentBlob.create(:data => content).id if content\n\n # Handle versioned metadata. Priority:\n #\n # 1st = elements in REST request\n # 2nd = extracted metadata from workflow processor\n # 3rd = values from previous version\n\n metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data => content)\n\n if title\n ob.title = title\n elsif metadata[\"title\"]\n ob.title = metadata[\"title\"]\n end\n\n if description\n ob.body = description\n elsif metadata[\"description\"]\n ob.body = metadata[\"description\"]\n end\n\n # Handle the preview and svg images. If there's a preview supplied, use\n # it. Otherwise auto-generate one if we can.\n\n begin\n if preview.nil? and content\n metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data => content)\n preview = metadata[\"image\"].read if metadata[\"image\"]\n end\n\n if preview\n ob.image = preview\n end\n\n if svg.nil? and content\n metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data => content)\n svg = metadata[\"image\"].read if metadata[\"image\"]\n end\n\n if svg\n ob.svg = svg\n end\n\n rescue\n return rest_response(500, :reason => \"Unable to extract metadata\")\n end\n\n new_version = action == 'create' && opts[:query]['id'] != nil\n edit_version = action == 'edit' && opts[:query]['version'] != nil\n\n if new_version\n ob.preview = nil\n ob[:revision_comments] = revision_comment\n end\n\n success = ob.save\n\n if success\n case \"#{action} #{new_version || edit_version}\"\n when \"create false\"; Activity.create(:subject => opts[:user], :action => 'create', :objekt => ob, :auth => ob)\n when \"create true\"; Activity.create(:subject => opts[:user], :action => 'create', :objekt => ob.versions.last, :auth => ob)\n when \"edit false\"; Activity.create(:subject => opts[:user], :action => 'edit', :objekt => ob, :auth => ob)\n when \"edit true\"; Activity.create(:subject => opts[:user], :action => 'edit', :objekt => ob, :extra => ob.version, :auth => ob.workflow)\n end\n end\n\n return rest_response(400, :object => ob) unless success\n\n # Elements to update if we're not dealing with a workflow version\n\n if opts[:query]['version'].nil?\n begin\n update_permissions(ob, permissions, opts[:user])\n rescue NotAuthorizedException, NotFoundException\n end\n end\n\n # Extract internals and stuff\n if ob.is_a?(WorkflowVersion)\n ob.workflow.extract_metadata\n else\n ob.extract_metadata\n end\n end\n\n ob = ob.versioned_resource if ob.respond_to?(\"versioned_resource\")\n\n rest_get_request(ob, opts[:user], { \"id\" => ob.id.to_s })\nend",
"title": ""
}
] |
[
{
"docid": "a9dd648a5d0d2e7d56223e7c753f5e2e",
"score": "0.62940145",
"text": "def telegraphical()\n end",
"title": ""
},
{
"docid": "e44ae2cef169d29f78b2b6306add59da",
"score": "0.6180619",
"text": "def huddlingly()\n end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.6166529",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.6166529",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.6166529",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.6166529",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.6166529",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.6166529",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9de4306501711176ab8084b28395030d",
"score": "0.6020379",
"text": "def module; end",
"title": ""
},
{
"docid": "7ec57c3874853e50086febdbdd3221bf",
"score": "0.597329",
"text": "def wedding; end",
"title": ""
},
{
"docid": "3db157d82460cb0632778815b62dbc35",
"score": "0.59506696",
"text": "def dh; end",
"title": ""
},
{
"docid": "54a53621e5fd3fc0cc3d2ff2901a893e",
"score": "0.5942098",
"text": "def chazelle\n end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.59305906",
"text": "def in_use; end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.59305906",
"text": "def in_use; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.5917162",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.5917162",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.5917162",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.5917162",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.5917162",
"text": "def implementation; end",
"title": ""
},
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.58869493",
"text": "def desired; end",
"title": ""
},
{
"docid": "a24eeb4706a13ad1fb582849824772f7",
"score": "0.58649635",
"text": "def lup; end",
"title": ""
},
{
"docid": "8d0e128ad87cd20a86507c09c46a6f67",
"score": "0.58236104",
"text": "def termitidae()\n end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5793563",
"text": "def loc; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "4cf2b877abd310fa04accd2bc46536d0",
"score": "0.5764786",
"text": "def origin; end",
"title": ""
},
{
"docid": "b22b55ac75784dc3a9bcb40c0529af5d",
"score": "0.5751183",
"text": "def ss; end",
"title": ""
},
{
"docid": "b22b55ac75784dc3a9bcb40c0529af5d",
"score": "0.5751183",
"text": "def ss; end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.57235974",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.57235974",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.57235974",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.57235974",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.57235974",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5719629",
"text": "def from; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.56933224",
"text": "def setup; end",
"title": ""
},
{
"docid": "c8216d758c47c5c1acf2dd26692ffe03",
"score": "0.5682387",
"text": "def purpose; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.56735367",
"text": "def used; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.56735367",
"text": "def used; end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.56676143",
"text": "def anchored; end",
"title": ""
},
{
"docid": "0f4fb165548b4d7ab8c74f1e99d3f784",
"score": "0.5663834",
"text": "def stahp\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5649872",
"text": "def initialize\n end",
"title": ""
}
] |
8ed00556d4122e3eccfd9b5389522ebd
|
PUT /users/1 PUT /users/1.json
|
[
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.0",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "b5edb8a9b2cad14c7874c5f42c5809e9",
"score": "0.7438286",
"text": "def test_put_user\n json_data = '{\"name\":\"test\", \"last_name\":\"test\", \"document\" : \"098\"}'\n put '/users/4', json_data\n assert_equal 204, last_response.status, 'Código de respuesta incorrecto'\n end",
"title": ""
},
{
"docid": "bb443a428f2563539f43b17c71594928",
"score": "0.7251369",
"text": "def update_user(user_id, request)\n start.uri('/api/user')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end",
"title": ""
},
{
"docid": "1ebfa5c43a28c0c6ae3c7116c2834ee3",
"score": "0.72068095",
"text": "def update_user(user_id, request)\n start.uri('/api/user')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end",
"title": ""
},
{
"docid": "060d1f9e03ff05ffa8c109da1c913458",
"score": "0.71391344",
"text": "def update\n @user.update!(user_params)\n render json: @user\n end",
"title": ""
},
{
"docid": "f0686f191a0def3b6c3ad6edfbcf2f03",
"score": "0.7114921",
"text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n )\n end",
"title": ""
},
{
"docid": "699d9259b5511ca444c672d0fdd17ed2",
"score": "0.70365673",
"text": "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"title": ""
},
{
"docid": "0b4c2960540c3a0c5e7102619705473d",
"score": "0.70167965",
"text": "def update_user( name, data )\n response = put(\"#{@config['url']}/api/2.1/rest/users/#{name}\", data, {accept: :json, :cookies => cookies})\n return response.code\n end",
"title": ""
},
{
"docid": "072e5b03e910a6eec48902b51969403c",
"score": "0.69694865",
"text": "def update \n @user = User.find(params[:id])\n if @user.update(user_params)\n render json: @user \n else \n render status: 400, nothing: true \n end \n end",
"title": ""
},
{
"docid": "832c248ba3eb8c446af4c6ce62926569",
"score": "0.69656366",
"text": "def update\n if @api_v1_user.update(api_v1_user_params)\n render json: @api_v1_user\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "385ac3bc89323aa86c512d98dcdd5ca2",
"score": "0.69633806",
"text": "def update\n user = current_user\n if user.update(user_params)\n render json: user, status: 200, location: [:api_v1, user]\n else\n render json: { errors: user.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "0cb46e242a339293232b4f53c37d1deb",
"score": "0.6954546",
"text": "def update_user(opts = {})\n put 'user', opts\n end",
"title": ""
},
{
"docid": "568a6defa7393f06936468d8c0b16b0a",
"score": "0.6915363",
"text": "def update\n user = find_user\n user.update(user_params)\n render json: user\n end",
"title": ""
},
{
"docid": "d8054e3c41b8df3c2ec3d070c63961f3",
"score": "0.6909374",
"text": "def update\n puts params[:id]\n user = User.find(params[:id])\n user.update(name: params[:name], email: params[:email])\n render json: {success: \"Successful updating\"}\n end",
"title": ""
},
{
"docid": "ccf9ed09d600e760d6f263e0380c88ca",
"score": "0.6859365",
"text": "def update\n update_resource(@user)\n end",
"title": ""
},
{
"docid": "ccf9ed09d600e760d6f263e0380c88ca",
"score": "0.6859365",
"text": "def update\n update_resource(@user)\n end",
"title": ""
},
{
"docid": "9701fa7622582362b473432231ef2840",
"score": "0.68466485",
"text": "def update\n\t\tuser = find_user\n\t\tuser.update(user_params)\n\t\trender json: user\n\tend",
"title": ""
},
{
"docid": "c0f436afe080be01e3d9a900ae80f8ab",
"score": "0.68338895",
"text": "def update\n head :no_content\n # @api_v1_user = Api::V1::User.find(params[:id])\n\n # if @api_v1_user.update(api_v1_user_params)\n # head :no_content\n # else\n # render json: @api_v1_user.errors, status: :unprocessable_entity\n # end\n end",
"title": ""
},
{
"docid": "759be2484912d28bb67ffe03d6a24228",
"score": "0.6833536",
"text": "def update\n user = User.find(params[:id])\n\n if user.update_attributes(user_params)\n render json: user.to_json, status: 200\n else\n render json: {error: \"User update failed\", status: 400}, status: 400\n end\n end",
"title": ""
},
{
"docid": "c77c61632e7a5655fa8215c4d35a24f0",
"score": "0.68258655",
"text": "def update\n @user = User.find_by_name(params[:id])\n @user.update_attributes(params[:user])\n \n respond_with @user, :stautus => :ok\n end",
"title": ""
},
{
"docid": "d0a9ca650949efc2e171cbc48421587b",
"score": "0.6822829",
"text": "def update\n update_user(users_path)\n end",
"title": ""
},
{
"docid": "47f1b8bbb51dc45ffacf38d5030fd63d",
"score": "0.68002295",
"text": "def update\n user = User.find_by!(id: params[:id])\n if user \n user.name = params[:name]\n user.surname = params[:surname]\n user.role_id = params[:role_id]\n user.phone = params[:phone]\n user.job = params[:job]\n user.email = params[:email]\n user.adress = params[:adress]\n user.confirmed = params[:confirmed]\n user.save\n render json: user, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"title": ""
},
{
"docid": "488fbded3c7b2d58be882d2aa457befb",
"score": "0.6791412",
"text": "def update\n @user = User.find(params[:id])\n @user.name= params[:user][:name]\n @user.email = params[:user][:email]\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { render :json => @user }\n end\n\n end",
"title": ""
},
{
"docid": "4dcb9429c1396178cff3eed0c55252a1",
"score": "0.6784876",
"text": "def update\n current_user.update!(user_params)\n render json: current_user\n end",
"title": ""
},
{
"docid": "d190f524c5924d87588ecb666cbf5cc4",
"score": "0.6768373",
"text": "def update\n @user = User.find(params[:id])\n \n if @user.update(user_params)\n render json: @user, status: :ok \n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8cade912083e3e018feeeaaf930f4cf1",
"score": "0.676715",
"text": "def update_user id, payload\n\t\t\t\t\t(@connection.put USERS, id, payload).code\n\t\t\t\tend",
"title": ""
},
{
"docid": "018e1818e03cc3d12f1b20effb2bc0a8",
"score": "0.6761313",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "018e1818e03cc3d12f1b20effb2bc0a8",
"score": "0.6761313",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "018e1818e03cc3d12f1b20effb2bc0a8",
"score": "0.6761313",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "08157edea9cb74ae2a3906e7f885a93d",
"score": "0.6758149",
"text": "def update \n @user = User.find(params[:id])\n if @user.update_attributes(user_params) \n render json: @user, status: :updated\n else \n render json: @user.errors, status: :unprocessable_entity \n end \n end",
"title": ""
},
{
"docid": "ef6c6cbfc7de8fe531f74bc52240477b",
"score": "0.67570984",
"text": "def update\n user = User.find(params[:user][:user_id])\n params[:user].delete(:user_id)\n user.update(update_params)\n render json: { message: 'user updated' }\n end",
"title": ""
},
{
"docid": "999ac837f35b530d4bd762c41f60ff19",
"score": "0.67475224",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "063187b2898d88021d86c92b397ed77c",
"score": "0.6732597",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(resource_params)\n render json: @user, status: :created, location: user_url(@user)\n else\n render json: {\n errors: @user.errors\n }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8a4badd6a01a0bcfec7ca6e8d84e14bf",
"score": "0.67323476",
"text": "def update\n\t\tuser_id = params[:id]\n\t\t@user = User.find(user_id)\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @user.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n end",
"title": ""
},
{
"docid": "29ffafd0a884c0baaf0c44106d79b94e",
"score": "0.67277527",
"text": "def update\n if @user.update(user_params)\n render json: @user \n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "52120d456f84e9bcd29d003142e95e92",
"score": "0.6722102",
"text": "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user, status: :ok\n else\n render json: { errors: user.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "2dc50f32a6a1be907e61d6655f19f1ba",
"score": "0.67097217",
"text": "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a0d52b546f97d92c94f2906309376f8b",
"score": "0.6687499",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: { errors: @user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f2311cf292680016035c4213cc419c6d",
"score": "0.6687018",
"text": "def update_user(id, options)\n patch(\"/users/#{id}\", options)\n end",
"title": ""
},
{
"docid": "85554d9b1b0279f5b254674ca18b848d",
"score": "0.6681372",
"text": "def update\n user = current_user\n\n if user.update(user_params)\n render json: user, status: 200, location: [:api, user]\n else\n render json: { errors: user.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "b669a7cf098d6fee10b940cf572f5fb0",
"score": "0.66730917",
"text": "def update\n username = Username.new(username_params)\n username.update\n render json: username\n end",
"title": ""
},
{
"docid": "c5694c8d217cc016ffb3ea0daa9befc5",
"score": "0.6669934",
"text": "def update( params={ })\n normalize! params\n filter! DEFAULT_USER_OPTIONS, params\n\n put_request(\"/1.0/user\", DEFAULT_USER_OPTIONS.merge(params))\n\n end",
"title": ""
},
{
"docid": "b8dcd2491b197c0c62a8f6716a37c05a",
"score": "0.6667268",
"text": "def update\n # Atualiza as informações o usuário\n \tif @user.update(users_params) \n \t\trender json: :success, status: 200\n \telse\n \t\trender json: @user.errors, status: :unprocessable_entity\n \tend\n end",
"title": ""
},
{
"docid": "25b787bcfdea3803945cd20447f2f4bb",
"score": "0.66671634",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render :json => @user.errors, :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f372faa6dbb1d6bc23f764dc3d392f5f",
"score": "0.66617274",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "fc0f39f918df73dd51cfeaa86b3a4b50",
"score": "0.6654586",
"text": "def update\n # retrieve user data from request (params)\n email = params[:email]\n\n # query DB for the specific user \n user = User.where(:email => email)\n\n @user = user.update(user_params) #update the user \n json_response(@user) # return created user, to signify that the user was updated\n end",
"title": ""
},
{
"docid": "0df19676c7bc4da905ce423b3a17f004",
"score": "0.6653578",
"text": "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0df19676c7bc4da905ce423b3a17f004",
"score": "0.6653578",
"text": "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "257b82e17e5b1f88db9df740805e6185",
"score": "0.6652782",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: { status: 400, msg: 'Something went wrong' }\n end\n end",
"title": ""
},
{
"docid": "224d657a0871919d0f25b180f9c2446d",
"score": "0.6646385",
"text": "def update\n respond_with User.update(params[:id], params[:user])\n end",
"title": ""
},
{
"docid": "f2232536d3cf1f3f02bc5b90475f4ef0",
"score": "0.6636416",
"text": "def update\n authorize @user\n\n if @user.update(user_params)\n render json: { status: :ok, user: @user }\n else\n render json: { errors: @user.errors, status: :unprocessable_entity }\n end\n end",
"title": ""
},
{
"docid": "ee5a6d46ae0ee543c53228f424ad8451",
"score": "0.6627491",
"text": "def update\n respond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user, status: :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "691e3bde861cbda7d0bb533fcbb31672",
"score": "0.6625279",
"text": "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"title": ""
},
{
"docid": "bb6685f93098d590da8a15e2e3160b60",
"score": "0.6621819",
"text": "def update\n user = current_user\n if user.update(user_params)\n render json: user, status: 200\n else\n render json: { errors: user.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "a07e54b88d6350f77a698b6a706b1572",
"score": "0.66213304",
"text": "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",
"title": ""
},
{
"docid": "cd5963d908b40b1b87884d30b85d7a1e",
"score": "0.661804",
"text": "def update\n user = current_user\n if user.update(user_params)\n render json: user, status: 200, location: [:api, user]\n else\n failed_to_update(user, \"user\")\n end\n end",
"title": ""
},
{
"docid": "f2f8c20b7eef84bb400714fdc59a8b0e",
"score": "0.66176337",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:User])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f40637d728484ec41ef659e304a15a44",
"score": "0.6614916",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f40637d728484ec41ef659e304a15a44",
"score": "0.6614916",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ef86e31e230f2cf2499d83448f680ebc",
"score": "0.661172",
"text": "def update\n respond_with User.update(params[:id],params[:user])\n end",
"title": ""
},
{
"docid": "80e7b0afa5cc4038fef85a7d7967666c",
"score": "0.66096765",
"text": "def update\n @user = User.find(params[:id])\n\t\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1efa38cd3f293b88dcc2c6766709ede9",
"score": "0.66087455",
"text": "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n if @user.save\n render json: @user, status: :accepted\n else\n render json: { errors: @user.errors.full_messages }, status: :unprocessible_entity\n end\n end",
"title": ""
},
{
"docid": "d002d44210be9632166f45081da464a5",
"score": "0.6607135",
"text": "def update\n @user.update(user_params)\n if @user.errors.any? \n render json: @user.errors, status: :unprocessable_entity\n else \n render json: @user, status: 201\n end \n end",
"title": ""
},
{
"docid": "0c1d88a6a4cf4a5aff00bdd4b67eed08",
"score": "0.6591768",
"text": "def update\n if @user.update(user_params)\n render(json: @user.as_json, status: :ok) \n else\n render(json: {error: \"Erro ao atualizar usuário\"}, status: :ok) \n end\n end",
"title": ""
},
{
"docid": "7343e1d74a3d2f17fb1c4621860bce96",
"score": "0.65895",
"text": "def update\n if @user.update(user_params)\n render json:@user, status: :ok, serializer: UserSerializer\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7343e1d74a3d2f17fb1c4621860bce96",
"score": "0.65895",
"text": "def update\n if @user.update(user_params)\n render json:@user, status: :ok, serializer: UserSerializer\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f76cfbf4fd1722162b7a9e96fe471b14",
"score": "0.6588285",
"text": "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: { status: 200, msg: 'User details have been updated.' }\n end\n end",
"title": ""
},
{
"docid": "48c8f2e79ce951be44e74f43cd9ecf3b",
"score": "0.6585606",
"text": "def update\n @user = User.find(params[:id]) # for practice assessment, no update method \n if @user.update(user_params) # but you have to build it yourself\n redirect_to user(@user) # know the difference between create and update \n else\n render json:@user.errors.full_messages, status: unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "cd593b8d281f9ba376a1bc786702fe2f",
"score": "0.6581255",
"text": "def update(*args)\n arguments(args) do\n permit VALID_USER_PARAMS_NAMES\n end\n\n patch_request(\"/user\", arguments.params)\n end",
"title": ""
},
{
"docid": "2963118f3ea04813a21d6d6a6bf0d05f",
"score": "0.6580528",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update(user_update_params)\n format.json { render json: @user, status: :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "96d6039ed862a309382ea5a83efcec51",
"score": "0.6570835",
"text": "def update\n respond_to do |format|\n if @user.update(user_params)\n format.json { render @user, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8883f8815a6b9292435769a8a84d49f6",
"score": "0.65678954",
"text": "def update\n @user = User.patch(params[:id], params[:user])\n respond_with(@user)\n end",
"title": ""
},
{
"docid": "d93b3aa6659ae62851c0e2c5b2aff72c",
"score": "0.656618",
"text": "def update\n @user_1 = User1.find(params[:id])\n\n respond_to do |format|\n if @user_1.update_attributes(params[:user_1])\n format.html { redirect_to @user_1, notice: 'User 1 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_1.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0726961d8a40f7ef0082defff7e07181",
"score": "0.6562387",
"text": "def update\n @user = User.find(params[:id])\n\n if params[:tag] != nil\n @user.tag = params[:tag]\n @user.save\n end\n\n if params[:name] != nil\n if User.where(\"name = ?\", params[:name]).first == nil\n @user.name = params[:name]\n @user.save\n end\n\n respond_to do |format|\n format.html { render json: @user }\n format.json { render json: @user }\n end\n end\n end",
"title": ""
},
{
"docid": "adfff4175048d9c7f39b404371ccdaa6",
"score": "0.6560061",
"text": "def update\n @user = User.friendly.find(params[:id])\n # render json: @user\n # render json: params\n # render json: user_params\n # render json: params['user']\n\n respond_to do |format|\n if @user.update(user_params)\n @user.name = \"#{@user.first_name} #{@user.last_name}\"\n @user.slug = nil\n @user.save!\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84d001a77df4c6c16e42ac2b0f89b9c6",
"score": "0.6552784",
"text": "def update\n update_and_respond(@user, user_params)\n end",
"title": ""
},
{
"docid": "748ea080c08e00cbdc2f345f8393af81",
"score": "0.65518224",
"text": "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"title": ""
},
{
"docid": "67f08b8d6f982f4805b13cd8d6b1e2c1",
"score": "0.65491796",
"text": "def update\n @user.name = params[:user][:name]\n @user.email = params[:user][:email].downcase\n @user.nickname = params[:user][:nickname]\n\n respond_to do |format|\n if @user.update\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",
"title": ""
},
{
"docid": "4fbdfe5c2d8dc0cf9b6a2bc65f049e93",
"score": "0.6545136",
"text": "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_to do |format|\n format.html\n format.js\n format.json { render :json => @users }\n end\n end",
"title": ""
},
{
"docid": "0fd24b7eb0a8328a3ded207dd05ca359",
"score": "0.65374637",
"text": "def update\n @user = User.find_by_sim_serial_number(params[:id])\n\n params = user_params\n params.delete_if {|k,v| !params[k].present?}\n\n if @user.update(params)\n render json: @user\n .to_json(only: [:id, :sim_serial_number, :username, :role, :phone_number, :email, :first_name, :last_name, :address, :cached_votes_up, :cached_votes_down])\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6530534",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6530534",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6530534",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6530534",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6530534",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f97b9af2d44b331cfb3d2025b2c29702",
"score": "0.6523527",
"text": "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "582a4114e6a316d15f1cf1f545eb22d5",
"score": "0.6519265",
"text": "def update\n @user = User.find(session[:user_id])\n @user.update(user_params)\n render :json => @user\n end",
"title": ""
},
{
"docid": "18f12a44d2646af9dc7f75ae3e4b8b0e",
"score": "0.65189654",
"text": "def update\n @user.update(user_params)\n head :no_content\n end",
"title": ""
},
{
"docid": "03317a83bf1cd4ed4e1e182144ce524e",
"score": "0.65120107",
"text": "def update\n if @user.update_attributes(user_params)\n head :no_content, status: 200\n end\n end",
"title": ""
},
{
"docid": "c31cddefe755689a414c32259c1602fe",
"score": "0.6509967",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: { error: @user.errors }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6e330994c9e2d5c3f2ffe71077b0f26b",
"score": "0.6493632",
"text": "def update\n params.permit!\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully 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",
"title": ""
},
{
"docid": "c54a2b6c1d4b8ac5c8b393c83bf8043f",
"score": "0.64920384",
"text": "def update\n @user = User.get(params[:id])\n \n respond_to do |format|\n if @user.update(params[:user])\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n else\n format.json { render :text => \"Could not update user\", :status => :unprocessable_entity } \n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74870cc0f50d816f3c4d728651fe7d3e",
"score": "0.6479132",
"text": "def update\n\t user = User.find(params[:id])\n\t if user.update(user_params)\n\t render json: { status: 200, msg: 'User details have been updated.' }\n\t end\n\tend",
"title": ""
},
{
"docid": "a0b2e460320b934ac4d9a3d77a5fa079",
"score": "0.6479048",
"text": "def update\n if @user.update(user_params)\n \trender :json => @user, status: :created\n else\n \trender :json => @user.errors.as_json(full_messages: true), status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ca5a9b4918333eb8cfd2505d5f1391c4",
"score": "0.6476941",
"text": "def update\n @user = User.find(params[:id])\n if current_user != @user\n respond_to do |format|\n format.json { render json: {}, status: :forbidden }\n end\n return\n end\n @user.update!(user_params)\n respond_to do |format|\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "2783f0a71c40a342f49a3bbc7fd8f1db",
"score": "0.6469628",
"text": "def update_user(id, options={})\n payload = {user: options}\n request = put \"/1/users/#{id}\", payload\n Hashie::Mash.new request\n end",
"title": ""
},
{
"docid": "10515feb4bbf952534156179641733d7",
"score": "0.64681506",
"text": "def update\n @user.update(user_params)\n render json: { notice: 'Usuario actualizado exitosamente' }\n end",
"title": ""
},
{
"docid": "84c54b6cbf328b20e141f5ad495a7e3c",
"score": "0.64680237",
"text": "def create\n @user = current_api_v1_user\n if @user.update(user_params)\n render json: index\n else\n render json: { status: 400, message: 'Could not update profile' }\n end\n end",
"title": ""
},
{
"docid": "302fd13d7fd5b632d7924e0c6a21e2fd",
"score": "0.6467437",
"text": "def update_user(options)\n patch \"user\", options\n end",
"title": ""
},
{
"docid": "d25a98492709b07b6951f4fdabc78603",
"score": "0.646332",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, notice: \"User #{@user.name} was successfully 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",
"title": ""
},
{
"docid": "fad9f9a5663ff3109aa1ca711458461e",
"score": "0.64552915",
"text": "def user_update(username,options)\n make_request(:update,user_url(username),options)\n end",
"title": ""
},
{
"docid": "4ca1914328cc71b605f6951f6b137fb1",
"score": "0.6449248",
"text": "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\nend",
"title": ""
}
] |
808c10b4a58060480240a7725f5e94c9
|
Regresa todos los ejemplares que coincidan con el tipo de region,region id y idcat
|
[
{
"docid": "51023686f25342c3540bc1a957cf0698",
"score": "0.63708836",
"text": "def ejemplares\n tipo_region_a_llave_foranea\n \n # Hace el query en vivo, ya que es una cantidad relativamente pequeña de ejemplares\n if campo_tipo_region.present? && params[:region_id].present? \n self.resp = consulta_ejemplares_por_region\n else # Lo guarda en cache cuando no escogio una region en especifico\n self.resp = Rails.cache.fetch(\"br_#{params[:catalogo_id]}_#{params[:tipo_region]}_#{params[:region_id]}\", expires_in: eval(CONFIG.cache.busquedas_region)) do\n consulta_ejemplares_por_region\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "832a0b89435ed064cd3ce345706e2259",
"score": "0.62080926",
"text": "def consulta_ejemplares_por_region\n resultados = Geoportal::Snib.select(:id, :latitud, :longitud, :tipocoleccion).where(idnombrecatvalido: params[:catalogo_id])\n\n if campo_tipo_region.present? && params[:region_id].present?\n resultados = resultados.where(\"#{campo_tipo_region}=#{params[:region_id]}\")\n elsif campo_tipo_region.present? # Cuando son los registros de alguna division politica en particular\n resultados = resultados.where(\"#{campo_tipo_region} IS NOT NULL\") \n end\n\n return { estatus: false, msg: 'Sin resultados' } unless resultados.any?\n ejemplares = {}\n\n resultados.each do |r|\n ejemplares[r.tipocoleccion] = [] unless ejemplares[r.tipocoleccion].present?\n ejemplares[r.tipocoleccion] << [r.longitud, r.latitud, r.id]\n end\n \n { estatus: true, resultados: ejemplares } \n end",
"title": ""
},
{
"docid": "f8ac0218f3fa926291071bb13a193c6f",
"score": "0.57124853",
"text": "def set_tipo_region\n @tipo_region = TipoRegion.find(params[:id])\n end",
"title": ""
},
{
"docid": "9450082d773dc6a6d7ec1cc3d8ca6fa1",
"score": "0.5676989",
"text": "def set_regionais\n @regionais = Regional.order(:nome).select(:nome)\n end",
"title": ""
},
{
"docid": "f572518c63d814d0d02c0f31730f0673",
"score": "0.56622803",
"text": "def especies\n tipo_region_a_llave_foranea\n\n self.resp = Rails.cache.fetch(\"br_#{params[:tipo_region]}_#{params[:region_id]}\", expires_in: eval(CONFIG.cache.busquedas_region)) do\n consulta_especies_por_region\n end\n end",
"title": ""
},
{
"docid": "32374e8b3bc09a7c11e7e87b8c7108e5",
"score": "0.5629711",
"text": "def index\n @regions = Region.all.order(:reg_nombre)\n idEntidades = \"\"\n @regions.each do |h|\n idEntidades = idEntidades + h.reg_entidad_territorial_id.to_s + \",\"\n end\n \n idEntidades = idEntidades[0, idEntidades.length - 1]\n @entidadesTerritoriales = EntidadTerritorial.where(\"id IN (#{idEntidades})\")\n \n end",
"title": ""
},
{
"docid": "d2b0533f47c0ba17b467837b552df7ee",
"score": "0.5626462",
"text": "def tipo_region_a_llave_foranea\n case params[:tipo_region]\n when 'estado'\n self.campo_tipo_region = 'entid'\n when 'municipio'\n self.campo_tipo_region = 'munid'\n when 'anp'\n self.campo_tipo_region = 'anpid'\n when 'ecorregion'\n self.campo_tipo_region = 'ecorid'\n else \n self.campo_tipo_region = nil\n end \n end",
"title": ""
},
{
"docid": "c16aa327de686d8e9ffae191be5a4ce9",
"score": "0.5568123",
"text": "def set_controles\n @controles= Control.where(area_id: @consulta.area_id, paciente_id: @consulta.ficha_nutricional_pediatrica.paciente_id).limit(9).order(id: :desc)\n end",
"title": ""
},
{
"docid": "089a258f2378f6e765fda75314689d67",
"score": "0.5491516",
"text": "def set_empresa\n @empresa = Empresa.find(params[:id])\n @regionais = Regional.order(:nome)\n @uf= Uf.order(:nome)\n end",
"title": ""
},
{
"docid": "825110ae01794b7c4fedb8bf3960d3f0",
"score": "0.52810735",
"text": "def new\n\n # Borra Todas las notas antiguas e inservibles\n # SELETE FROM `notas` WHERE (resumen_id IS NULL AND created_at <= 'Hoy')\n # Nota.delete_all ([\"resumen_id IS ? AND created_at <= ?\", nil, Date.today])\n \n @resumenes = Resumen.creados_hoy.order(\"vocero_id DESC\")\n temas = Tema.joins(:resumenes).where('resumenes.created_at >= ?', Date.today)\n # @websites = Website.all\n @asuntos = Asunto.joins(:temas).where('temas.id' => temas).group(:id)\n \n @informe = Informe.new\n @informe.save\n if @resumenes\n @resumenes.each do |resumen|\n resumen.informe_id = @informe.id\n resumen.save\n end\n end\n # @informe.resumen = encabezado\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @informe }\n end\n end",
"title": ""
},
{
"docid": "83558146924f5be1b58cc11359b2ff83",
"score": "0.5267995",
"text": "def create\n\n @comuna_dic = {}\n @region = Region.all\n @region.each do |region|\n @comuna_dic[region.region] = Comuna.where(region_id: region.id).map{|c| c.comuna}\n end\n\n @crime = Crime.new(crime_params)\n @crime.estado = \"Borrador\"\n puts(@crime.carabineros_id)\n puts(@crime.fiscals_id)\n # puts(@comuna_dic[@crime.region]) Todas las comunas\n @crime.comuna = @comuna_dic[@crime.region][@crime.comuna.to_i]\n respond_to do |format|\n if @crime.save\n format.html { redirect_to @crime, notice: 'Procedimiento creado con éxito.' }\n format.json { render :show, status: :created, location: @crime }\n else\n format.html { render :new }\n format.json { render json: @crime.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "613aa1b8a045c3184ff9f868929a9e29",
"score": "0.52672476",
"text": "def guarda_registros\n valida_registros\n return resp unless resp[:estatus]\n equivalencias = { 'naturalista' => { tipo_coleccion: COLECCION_NATURALISTA, archivo: 'observaciones-naturalista-' }, 'snib' => { tipo_coleccion: COLECCION_SNIB, archivo: 'ejemplares-snib-' }}\n tipo_coleccion = equivalencias[params[:coleccion]][:tipo_coleccion]\n\n case params[:coleccion]\n when 'naturalista', 'snib'\n colecciones = Rails.cache.fetch(\"br_#{params[:catalogo_id]}__\")[:resultados].try(:keys)\n \n unless (colecciones & tipo_coleccion).any?\n # TODO: este if no tiene sentido de ir, es una aberracion hasta que sepamos modificar las apps\n if params[:coleccion] == 'naturalista' && params[:formato] == 'mapa-app'\n return self.resp = { estatus: true, registros: [[]] }\n else\n return self.resp = { estatus: false, msg: \"No tiene registros en el cache: br_#{params[:catalogo_id]}__\" } unless (colecciones & tipo_coleccion).any?\n end\n end\n\n case params[:formato]\n when 'json'\n carpeta = carpeta_geodatos\n ruta = carpeta.join(\"#{equivalencias[params[:coleccion]][:archivo]}#{params[:taxon].nombre_cientifico.estandariza}\")\n ruta_archivo = \"#{ruta}.#{params[:formato]}\"\n \n # Si el archivo existe entonces ya no se consulta a la base ni se crea\n unless File.exist?(ruta_archivo)\n self.registros = Geoportal::Snib.where(idnombrecatvalido: params[:catalogo_id], tipocoleccion: tipo_coleccion)\n archivo = File.new(ruta_archivo, 'w+')\n archivo.puts registros.to_json\n archivo.close\n end\n \n self.resp = { estatus: true, ruta_archivo: ruta_archivo }\n when 'kml'\n carpeta = carpeta_geodatos\n ruta = carpeta.join(\"#{equivalencias[params[:coleccion]][:archivo]}#{params[:taxon].nombre_cientifico.estandariza}\")\n ruta_archivo = \"#{ruta}.#{params[:formato]}\"\n \n # Si el archivo existe entonces ya no se consulta a la base ni se crea\n unless File.exist?(ruta_archivo)\n self.registros = Geoportal::Snib.where(idnombrecatvalido: params[:catalogo_id], tipocoleccion: tipo_coleccion)\n archivo = File.new(ruta_archivo, 'w+')\n to_kml\n archivo.puts kml\n archivo.close\n end\n \n self.resp = { estatus: true, ruta_archivo: ruta_archivo }\n when 'kmz'\n carpeta = carpeta_geodatos\n ruta = carpeta.join(\"#{equivalencias[params[:coleccion]][:archivo]}#{params[:taxon].nombre_cientifico.estandariza}\")\n ruta_archivo = \"#{ruta}.#{params[:formato]}\"\n\n # Si el archivo existe entonces ya no se consulta a la base ni se crea\n unless File.exist?(ruta_archivo)\n unless File.exist?(\"#{ruta}.kml\")\n self.registros = Geoportal::Snib.where(idnombrecatvalido: params[:catalogo_id], tipocoleccion: tipo_coleccion)\n archivo = File.new(\"#{ruta}.kml\", 'w+')\n to_kml\n archivo.puts kml\n archivo.close\n end\n kmz(ruta)\n end\n\n self.resp = { estatus: true, ruta_archivo: ruta_archivo }\n when 'mapa-app'\n self.registros = []\n \n (colecciones & tipo_coleccion).each do |col|\n self.registros << Rails.cache.fetch(\"br_#{params[:catalogo_id]}__\")[:resultados][col]\n end\n \n return self.resp = { estatus: true, registros: registros.flatten(1) }\n else\n return self.resp = { estatus: false, msg: \"No tiene el formato correcto de descarga\" }\n end\n\n else\n return self.resp = { estatus: false, msg: 'Opción inválida del tipo de registro' }\n end\n\n Rails.logger.debug \"Guardo ejempalres con catalogo_id: #{params[:catalogo_id]}, colección: #{params[:coleccion]}\"\n end",
"title": ""
},
{
"docid": "8eb3254289b705714a8eb90724a7df7a",
"score": "0.5264554",
"text": "def regions_for_select\n \t\tRegion.all.map { |p| [p.name, p.id] }\n \tend",
"title": ""
},
{
"docid": "0fec542df6845a5c9a69ac30a6e0e21c",
"score": "0.5244777",
"text": "def set_icfes_registro\n @icfes_registro = IcfesRegistro.find(params[:id])\n end",
"title": ""
},
{
"docid": "ab3142354cdb6f106d7e38b993227c22",
"score": "0.5222471",
"text": "def set_tipo_registro\n @tipo_registro = TipoRegistro.find(params[:id])\n end",
"title": ""
},
{
"docid": "41536a2ad5fb1106b62b8f4a92df76b2",
"score": "0.51982975",
"text": "def find_regions\n find_dependent Occi::InfrastructureExt::Mixins::Region.new\n end",
"title": ""
},
{
"docid": "c5e633c977e1c95857c27b889515f3e6",
"score": "0.5192096",
"text": "def create\n # @resumenes = Resumen.creados_hoy.order(\"vocero_id DESC\")\n resumenes_ids = params[:resumenes_ids]\n \n # puts \"RESUMEN: #{resumenes_ids}\"\n @informe = Informe.new(params[:informe])\n\n respond_to do |format|\n if @informe.save\n resumenes_ids.each do |id|\n resumen = Resumen.find id\n if resumen\n resumen.informe_id = @informe.id\n resumen.save\n end\n end\n Website.limpiar_todos_usuarios\n session[:website_selecionada] = nil\n flash[:success] = 'Informe creado Satisfactoriamente.'\n format.html { redirect_to @informe }\n format.json { render json: @informe, status: :created, location: @informe }\n else\n format.html { render action: \"paso5\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7d244e592aa45d38c33e66c81995377",
"score": "0.5175481",
"text": "def cities_belongs_to_regions\n unless regions.any? && cities.any? && (cities.map { |city| city.region.id } - region_ids).empty?\n errors.add(:cities, I18n.t('shared.errors.city_not_from_region'))\n end\n end",
"title": ""
},
{
"docid": "b2db10f82a0c02a1a8fa2381b22c3da2",
"score": "0.5174571",
"text": "def add_taxa\n\n ecosystems_ids=params[:ecosystems_ids].split(',')\n taxa_ids=params[:taxa_ids].split(',')\n\n taxa_ids.each do |taxon_id|\n t=Taxon.find(taxon_id)\n ecosystems_ids.each do |ecosystem_id|\n e=Ecosystem.find(ecosystem_id)\n t.ecosystems << e unless t.ecosystems.include?(e)\n end\n end\n\n respond_to do |format|\n format.xml { render :nothing => true }\n format.json { render :json => nil }\n end\n\n end",
"title": ""
},
{
"docid": "fcc8b5d31b680f56bf60d3e8f6646e8b",
"score": "0.5167526",
"text": "def set_region_militar\n @region_militar = RegionMilitar.find(params[:id])\n end",
"title": ""
},
{
"docid": "6ba61ad03b17a1f7ba50aa9ba0b46f84",
"score": "0.51065445",
"text": "def set_gestion_tipo_auditoria\n @gestion_tipo_auditoria =Gestion::TipoAuditoria.all.find(params[:id]) \n #Le he agregao all porque sino arroja error de procedimiento almacenado\n end",
"title": ""
},
{
"docid": "ecfcb546109233c6971237ec8c6dc4b0",
"score": "0.5100348",
"text": "def uniq_parcelles\n # self.reload\n tab = []\n if self.parcelles.count > 0\n self.parcelles.each do |parcelle|\n # parcelle deja enregistree\n if tab.include?(parcelle.id)\n # recherche de l'element a supprimer\n if self.kind_of?(Facture)\n elt = self.factoparcelles.find(:first, :conditions => [\"parcelle_id = ?\", parcelle.id])\n elsif self.kind_of?(Labour)\n elt = self.labtoparcelles.find(:first, :conditions => [\"parcelle_id = ?\", parcelle.id])\n elsif self.kind_of?(Pulve)\n elt = self.putoparcelles.find(:first, :conditions => [\"parcelle_id = ?\", parcelle.id])\n elsif self.kind_of?(Vente)\n elt = self.ventoparcelles.find(:first, :conditions => [\"parcelle_id = ?\", parcelle.id])\n end\n elt.destroy if elt\n else\n tab << parcelle.id\n end\n end\n end\n end",
"title": ""
},
{
"docid": "14ed488ea3289efdaaa2a9f6947efb2f",
"score": "0.50920063",
"text": "def get_existing_location_list(type, element_id)\n existing_location_list = []\n\n q = SolrQuery.new\n\n # One solr search required for these types - this is because they exist in the Entry object\n if (type == \"entry_type\") || (type == \"language\") || (type == \"section_type\") || (type == \"subject\")\n\n search_term2 = type + \"_tesim:\" + element_id\n q.solr_query(search_term2, fl = \"id, folio_ssim, entry_no_tesim\", rows = 100000, sort = \"id ASC\")[\"response\"][\"docs\"].map do |result|\n element = []\n id = result[\"id\"]\n folio_id = result[\"folio_ssim\"].join\n entry_no = result[\"entry_no_tesim\"].join\n folio = q.solr_query(\"id:\" + folio_id, fl = \"preflabel_tesim\", rows = 100000, sort = \"id ASC\")[\"response\"][\"docs\"].map.first[\"preflabel_tesim\"].join\n element[0] = id\n element[1] = folio_id\n element[2] = folio + \" (Entry No = \" + entry_no + \")\"\n existing_location_list << element\n end\n\n # Two solr searches required for these types - this is because they exist in sub-objects of the ENtry object\n # i.e. Date, Related Place and Related Agent\n else\n\n search_term1 = \"\"\n\n if type == \"date_role\"\n search_term1 = \"date_role_tesim\"; fl_term = \"entryDateFor_ssim\"\n end\n if type == \"descriptor\"\n search_term1 = \"person_descriptor_tesim\"; fl_term = \"relatedAgentFor_ssim\"\n end\n if type == \"person_role\"\n search_term1 = \"person_role_tesim\"; fl_term = \"relatedAgentFor_ssim\"\n end\n if type == \"place_role\"\n search_term1 = \"place_role_tesim\"; fl_term = \"relatedPlaceFor_ssim\"\n end\n if type == \"place_type\"\n search_term1 = \"place_type_tesim\"; fl_term = \"relatedPlaceFor_ssim\"\n end\n if type == \"person_same_as\"\n search_term1 = \"person_same_as_tesim\"; fl_term = \"relatedAgentFor_ssim\"\n end\n if type == \"place_same_as\"\n search_term1 = \"place_same_as_tesim\"; fl_term = \"relatedPlaceFor_ssim\"\n end\n\n # First find the Date, Related Place or Related Agent objects which contain the element\n q.solr_query(search_term1 + \":\" + element_id, fl = fl_term, rows = 100000, sort = \"id ASC\")[\"response\"][\"docs\"].map do |result|\n unless result[fl_term].nil?\n search_term2 = \"id:\" + result[fl_term].join\n # Then find out which entries contain them\n q.solr_query(search_term2, fl = \"id, folio_ssim, entry_no_tesim\", rows = 100000, sort = \"id ASC\")[\"response\"][\"docs\"].map do |result|\n element = []\n id = result[\"id\"]\n folio_id = result[\"folio_ssim\"].join\n entry_no = result[\"entry_no_tesim\"].join\n folio = q.solr_query(\"id:\" + folio_id, fl = \"preflabel_tesim\", rows = 100000, sort = \"id ASC\")[\"response\"][\"docs\"].map.first[\"preflabel_tesim\"].join\n element[0] = id\n element[1] = folio_id\n element[2] = folio + \" (Entry No = \" + entry_no + \")\"\n existing_location_list << element\n end\n end\n end\n end\n\n existing_location_list\n rescue => error\n log_error(__method__, __FILE__, error)\n raise\n end",
"title": ""
},
{
"docid": "da4ec3618023d833a04f1411c01847e3",
"score": "0.5043299",
"text": "def set_nombr_regione\n @nombr_regione = NombreRegion.find(params[:id])\n end",
"title": ""
},
{
"docid": "e6769da825052ef1d05f08dc45008ded",
"score": "0.50419027",
"text": "def nz_regions_facet_for_solr\n region_ids = []\n for ci in role.contactinfos\n ci.initialize_contactinfo_associated_with_another_contactinfo( ci.default_contactinfo ) unless ci.default_contactinfo.blank?\n region_ids << ci.region_id\n end\n \n # puts \"REGION IDS:\"+region_ids.to_yaml\n result = FacetHelper.remove_duplicates_and_blank(region_ids)\n # puts \"FILTERED REGION_IDS:\"+result.to_yaml\n # puts result.length\n # puts \"=======\"\n for region_id in result\n # puts \"REGION_ID:#{region_id}\"\n if !Region.find(region_id).country == Country::NEW_ZEALAND\n result.delete(region_id)\n end\n end\n result.join(', ')\n end",
"title": ""
},
{
"docid": "317ba2b287ff1966bb20b6d0b8061f34",
"score": "0.5041507",
"text": "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 @transport_types = TransportType.all.collect{ |tt| [tt.name, tt.id] }\n\n @food_types = region.food_types.collect { |food_type| [food_type.name, food_type.id] }\n @scale_types = region.scale_types.collect { |scale_type| [\"#{scale_type.name} (#{scale_type.weight_unit})\", scale_type.id] }\n\n @regions = Region.all\n end",
"title": ""
},
{
"docid": "affe0d6a9bbdf20d5297190fc12e20a9",
"score": "0.5022424",
"text": "def process_ldap_regions(ldap_regions, task)\n process_elements(ldap_regions, LdapRegion, task)\n end",
"title": ""
},
{
"docid": "fb3bd33441517365572cf150bc331751",
"score": "0.5013711",
"text": "def all_classifier_region\n @regions = Rails.cache.fetch(\"all_classifier_region\", expiries: 1.month) do\n Modules::Classifier.all.group_by{|classf| classf.sk_ter}\n end\n # @classf= Modules::Classifier.where(town:nil).all\n # respond_to do |format|\n # format.html { send_data @classf.to_csv, filename: \"users-#{Date.today}.csv\" }\n # format.csv { send_data @classf.to_csv, filename: \"users-#{Date.today}.csv\" }\n # end\n # classf.save\n end",
"title": ""
},
{
"docid": "fb3bd33441517365572cf150bc331751",
"score": "0.5013711",
"text": "def all_classifier_region\n @regions = Rails.cache.fetch(\"all_classifier_region\", expiries: 1.month) do\n Modules::Classifier.all.group_by{|classf| classf.sk_ter}\n end\n # @classf= Modules::Classifier.where(town:nil).all\n # respond_to do |format|\n # format.html { send_data @classf.to_csv, filename: \"users-#{Date.today}.csv\" }\n # format.csv { send_data @classf.to_csv, filename: \"users-#{Date.today}.csv\" }\n # end\n # classf.save\n end",
"title": ""
},
{
"docid": "d0b7e06328d35792c04920ec8aca7251",
"score": "0.5002836",
"text": "def index\n @tipos_regiones = TipoRegion.all\n end",
"title": ""
},
{
"docid": "edb0c07f77a310f5e28108195548181b",
"score": "0.49798736",
"text": "def datos(params={})\n return [] unless cadena_especies.present?\n taxones = []\n\n # Por default muestra todos\n Especie.caso_rango_valores('especies.id',cadena_especies).order('nombre_cientifico ASC').limit(params[:limit] ||= 300000).each do |taxon|\n\n cols = columnas.split(',')\n cols.each do |col|\n\n case col\n when 'x_snib_id'\n if proveedor = taxon.proveedor\n taxon.x_snib_id = proveedor.snib_id\n end\n when 'x_snib_reino'\n if proveedor = taxon.proveedor\n taxon.x_snib_reino = proveedor.snib_reino\n end\n when 'x_naturalista_id'\n if proveedor = taxon.proveedor\n taxon.x_naturalista_id = proveedor.naturalista_id\n end\n when 'x_categoria_taxonomica'\n taxon.x_categoria_taxonomica = taxon.categoria_taxonomica.nombre_categoria_taxonomica\n when 'x_estatus'\n taxon.x_estatus = Especie::ESTATUS_SIGNIFICADO[taxon.estatus]\n when 'x_foto_principal'\n if adicional = taxon.adicional\n taxon.x_foto_principal = adicional.foto_principal\n end\n when 'x_nombre_comun_principal'\n if adicional = taxon.adicional\n taxon.x_nombre_comun_principal = adicional.nombre_comun_principal\n end\n when 'x_nombres_comunes'\n nombres_comunes = taxon.nombres_comunes.order(:nombre_comun).map{|nom| \"#{nom.nombre_comun} (#{nom.lengua})\"}.uniq\n next unless nombres_comunes.any?\n taxon.x_nombres_comunes = nombres_comunes.join(',')\n when 'x_tipo_distribucion'\n tipos_distribuciones = taxon.tipos_distribuciones.map(&:descripcion).uniq\n next unless tipos_distribuciones.any?\n taxon.x_tipo_distribucion = tipos_distribuciones.join(',')\n when 'x_nom'\n nom = taxon.estados_conservacion.where('nivel1=4 AND nivel2=1 AND nivel3>0').distinct\n next unless nom.length == 1\n taxon.x_nom = nom[0].descripcion\n when 'x_iucn'\n iucn = taxon.estados_conservacion.where('nivel1=4 AND nivel2=2 AND nivel3>0').distinct\n next unless iucn.length == 1\n taxon.x_iucn = iucn[0].descripcion\n when 'x_cites'\n cites = taxon.estados_conservacion.where('nivel1=4 AND nivel2=3 AND nivel3>0').distinct\n next unless cites.length == 1\n taxon.x_cites = cites[0].descripcion\n else\n next\n end\n end\n\n # Para agregar todas las categorias taxonomicas que pidio, primero se intersectan\n cats = COLUMNAS_CATEGORIAS & cols\n\n if cats.any?\n next unless taxon.ancestry_ascendente_directo.present?\n ids = taxon.ancestry_ascendente_directo.gsub('/',',')\n\n Especie.select('nombre, nombre_categoria_taxonomica').categoria_taxonomica_join.caso_rango_valores('especies.id',ids).each do |ancestro|\n categoria = 'x_' << I18n.transliterate(ancestro.nombre_categoria_taxonomica).gsub(' ','_').downcase\n next unless COLUMNAS_CATEGORIAS.include?(categoria)\n eval(\"taxon.#{categoria} = ancestro.nombre\") # Asigna el nombre del ancestro si es que coincidio con la categoria\n end\n end\n\n taxones << taxon\n end\n taxones\n end",
"title": ""
},
{
"docid": "f9e545bbf0ce633f1e51b85cdd52fbae",
"score": "0.49635932",
"text": "def create\n @cities = RegionData.cities.pluck(:name_with_type, :id)\n @project = Project.new(project_params)\n authorize @project\n respond_to do |format|\n if @project.save\n format.html { redirect_to edit_admin_project_path(@project.id), notice: 'Dự án đã được tạo thành công.' }\n format.json { render :edit, status: :created, location: @project }\n else\n customer_city_id = @project.region.present? && @project.region.city.present? ? @project.region.city.id : ''\n customer_district_id = @project.region.present? && @project.region.district.present? ? @project.region.district.id : ''\n @district_children = RegionData.where(parent_id: customer_city_id).order(:name).pluck(:name_with_type, :id)\n @ward_children = RegionData.where(parent_id: customer_district_id).order(:name).pluck(:name_with_type, :id)\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f813cbf7bcecabcfa0631ade7f96588e",
"score": "0.49593654",
"text": "def formulario_estagios\n @comites = Comite.find(:all,:select=>\"id,nome\") #select id,nome from ...\n @comite = Comite.find_by_id(params[:id]) #seleciona o comite pelo o id que esta no request\n \n @formulario = @comite.formularios.formulario_activo(2) #vai buscar o formulario que esta activo de estagio que é o 2\n @recrutamento = @formulario.recrutamento unless @formulario.nil?\n \n @perguntum = Perguntum.new\n @pergunta_form = PerguntaForm.new\n \n end",
"title": ""
},
{
"docid": "e0af1df3204f710fe58780563ba4fb02",
"score": "0.49561507",
"text": "def create\n location_params = params.require(:location).permit(:titre, :adresse, :description, :etat, :prix, :duree, :type_id, :nombre_adulte, :nombre_enfant, :nombre_salon, :nombre_chamber, :nombre_toillete, :nom_bailleur, :email_bailleur, :telephone_bailleur, :adresse_bailleur, :user_id, images_attributes: [:id, :location, :libelle], caracteristique_ids: [])\n\n params[:location][:adresse].inspect\n @location = current_user.locations.new(location_params) if user_signed_in?\n\n respond_to do |format|\n if @location.save\n # Enregistrement des images de l'appartement\n\n if is_image?\n params[:images]['libelle'].each do |a|\n @image = @location.images.create!(:libelle => a)\n end\n end\n\n format.html { redirect_to show_location_path(@location.slug), notice: 'Location créée avec succès.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d3aea8f69e6baa2757450e357e5a5d9",
"score": "0.49520832",
"text": "def set_datos_registro\n @datos_registro = DatosRegistro.find(params[:id])\n end",
"title": ""
},
{
"docid": "b04f03440a144da5b1ef5bb5060396a5",
"score": "0.49285612",
"text": "def set_datos_generales_empresa\n @datos_generales_empresa = DatosGeneralesEmpresa.find(params[:id])\n end",
"title": ""
},
{
"docid": "a9c73d70c265f5aa09bcc3225b85ef58",
"score": "0.49274093",
"text": "def set_registro_de_residuo\n @registro_de_residuo = RegistroDeResiduo.find(params[:id])\n end",
"title": ""
},
{
"docid": "d261cc75443f4c0db37f422820fcb81e",
"score": "0.4926762",
"text": "def set_inventario_cosa_registro\n @inventario_cosa_registro = InventarioCosaRegistro.find(params[:id])\n end",
"title": ""
},
{
"docid": "f67de7361aad161457a4409ae81209ef",
"score": "0.49257842",
"text": "def destroy\n regions = Region.all\n regions.each do |region|\n region.recipe.ingredients.each do |ingredient|\n if ingredient.model.to_s == CustomGeography.name && self.name == ingredient.attributes[:name]\n return false\n end\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "f2828f7614cafa9e28b03f5681c96498",
"score": "0.49239257",
"text": "def set_tipoareaespecial\n @tipoareaespecial = Tipoareaespecial.find(params[:id])\n end",
"title": ""
},
{
"docid": "580bf0c94363eefe750b8e2bc144b914",
"score": "0.49236396",
"text": "def contains\n @municipalities = []\n\n Region.all.sort_by! { |r| r.name }.each do |region|\n municipalities_group = []\n region.municipalities.each do |municipality|\n if municipality.name.downcase.match(/#{params[:name].downcase}/)\n municipality_hash = Hash.new\n municipality_hash[\"id\"] = municipality.id\n municipality_hash[\"text\"] = municipality.name + \" (\" + municipality.province.abbreviation + \")\"\n municipalities_group = municipalities_group << municipality_hash \n end\n end\n\n if !municipalities_group.empty?\n region_group = Hash.new\n region_group[\"text\"] = region.name\n region_group[\"children\"] = municipalities_group\n @municipalities = @municipalities << region_group\n end\n end\n\n respond_to do |format|\n format.json { render json: @municipalities }\n end\n end",
"title": ""
},
{
"docid": "5ad1e86543185a902e738222b2e63715",
"score": "0.49212602",
"text": "def buscarart(cat_id)\n @categoris=Categori.where(cat_cat_cod: cat_id)\n @categoris.each do |cat|\n @articulos = Articulo.where(cat_cod: cat.cat_cod)\n @articulos.each do |articulo| \n @imagenes.each do |imagen|\n if current_user && current_user.role=='vendedor'\n @instancis=@instancis+(Instanci.where(art_cod: articulo.art_cod))\n else\n @instancis=@instancis+(Instanci.where(ins_cod_prov: imagen.ins_cod_prov, art_cod: articulo.art_cod))\n end\n end\n end\n buscarart(cat.cat_cod)\n end\n end",
"title": ""
},
{
"docid": "0f98eb3430022cc2828e535f0721c1c7",
"score": "0.49191162",
"text": "def show_type\n logger.info \"show typeeeeeeeeee\"\n hrtgdsconf = GDS::HotelReservationThroughGdsConfiguration.find(params[:id])\n logger.info \"ssssssssssssssss\"\n hrtgdsconf.reload\n logger.info \"77777777777777777777\"\n @paramscheckin = hrtgdsconf.name\n logger.info @paramscheckin\n @paramscheckout = hrtgdsconf.to_date\n logger.info @paramscheckout\n #from this i need to fetch \n hrtgdsconf.line_ids.each do |elid|\n elid.reload\n elid.categ_id.reload\n end\n all_cat_name = []\n hrtgdsconf.line_ids.each do |elid|\n all_cat_name << elid.categ_id.name\n end\n @all_cat_name = all_cat_name.uniq\n \n end",
"title": ""
},
{
"docid": "5eb3f1c117113cf0e2e7c41becde085f",
"score": "0.49111083",
"text": "def get_areas\n areas_id = RelacionSupAreaArea.find(\n :all,\n :conditions => {\n 'sup_area_id' => self.object\n }\n ).map{|rel| rel.area_id} \n end",
"title": ""
},
{
"docid": "6532ebcdffcd274bf83f50a6928ae017",
"score": "0.49079755",
"text": "def set_registro\n @objeto = Registro.find(params[:id])\n end",
"title": ""
},
{
"docid": "257f011155c3d069cc61202f7584ba46",
"score": "0.490647",
"text": "def detail_element\n @pe=ProjectElement.find(:all, :conditions=> [\"project_id= ?\",self.id])\n \n #elements id correspondant à ce projet\n @t=@pe.collect do |el|\n el.element_id\n end\n \n #elements correspondant recuperés dans table element\n @e= @t.collect do |e|\n Element.find(:all, :conditions=>[\"id=?\",e]) \n end\n \n \n \n @i=[]\n @type=@e.collect do |test| \n test.collect do |e|\n if e.element_type ==\"culture\"\n @i+=Culture.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf culture controller::create\n \n elsif e.element_type ==\"extraction\"\n @i+=Extraction.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf extraction controller::create\n \n elsif e.element_type ==\"library\"\n @i+=Library.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf library controller::create\n \n elsif e.element_type ==\"EM_PCR\"\n @i+=EmPcr.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf EM-PCR controller::create\n \n elsif e.element_type ==\"sequencing\"\n @i+=Sequencing.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf sequencing controller::create\n \n elsif e.element_type ==\"submission\"\n @i+=Submission.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf submission controller::create \n \n elsif e.element_type ==\"data\"\n @i+=Datum.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf data controller::create\n \n elsif e.element_type ==\"genome\"\n @i+=Genome.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf genome controller::create\n \n elsif e.element_type ==\"metagenome\"\n @i+=Metagenome.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf metagenome controller::create\n \n elsif e.element_type ==\"16s_pyro\"\n @i+=Seizespyro.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf seizespyro controller::create\n \n elsif e.element_type ==\"RNAseq\"\n @i+=Rnaseq.find(:all, :conditions=> [\"element_id= ?\",e.id] ) #cf rnaseq controller::create\n \n else puts \"probleme methode detail_element\"\n end\n \n end \n end \n \n #elements id correspondant à ce projet\n @t=@i.collect do |el|\n el.id\n end\n @t\n end",
"title": ""
},
{
"docid": "78c156274dec09a976f4174e9bb60f3d",
"score": "0.49011403",
"text": "def set_reglas_juego\n @reglas_juego = ReglasJuego.find(params[:id])\n end",
"title": ""
},
{
"docid": "c10d504c1126c88a14604c8c9ac2b794",
"score": "0.489908",
"text": "def load_Selectores\n @tipovehiculo = Tipovehiculo.all\n @tipoproducto = Tipoproducto.all\n @aseguradora = Aseguradora.all\n @destacado = Destacado.all\n @vigencia = Vigencia.where( activado: true).order(\"orden ASC\")\n end",
"title": ""
},
{
"docid": "2f4eedeb1c52102b2e08ea644647b854",
"score": "0.48950082",
"text": "def abrir_recrutamento\n\n tipo = params[:tipo].to_i #tipo=1 é pra membros e tipo=2 é pra estagios\n @comite = Comite.find_by_id(params[:id]) #seleciona o comite pelo o id que esta no request\n @formulario = @comite.formularios.formulario_activo(tipo) #vai buscar o formulario que esta activo de membros\n \n if tipo == 1\n @formulario_membro_novo = @comite.formularios.build(:nome=>\"Formulario Membros\",:comite_id=> @comite.id,:tipo=>1)\n else\n @formulario_membro_novo = @comite.formularios.build(:nome=>\"Formulario Estagios\",:comite_id=> @comite.id,:tipo=>2)\n end\n\n if !@formulario.nil?\n @formulario.estado = 0 #altera o estado do formulario antigo outro para 0\n @formulario.save \n end #salva o formulario antigo\n \n @formulario_membro_novo.save #guarda o formulario novo\n\n\n @formulario.pergunta_forms.each do |p| # copia todas as perguntas do formulario antigo para o novo\n p = @formulario_membro_novo.pergunta_forms.build(pergunta_id:p.pergunta_id,ordem:p.ordem,obrigatoria:p.obrigatoria)\n p.save\n end\n \n @formulario_membro_novo.save #guarda o formulario novo\n\n \n\n respond_to do |format|\n format.html { redirect_to path }\n format.json { head :no_content }\n end\n\n end",
"title": ""
},
{
"docid": "f78bc526fdf005f98b9ebcc7518730d7",
"score": "0.48872152",
"text": "def read_regions\n json = csv_to_json 'public/uploads/document/regions.csv'\n Region.delete_all\n json.each do |data|\n Region.create(data)\n end\n\n end",
"title": ""
},
{
"docid": "edb1ac74be4c26d5b18ee72fc71c4333",
"score": "0.48831213",
"text": "def leer\n @formularios = params[:id]\n @formularios = Formulariocontacto.where(id: @formularios)\n end",
"title": ""
},
{
"docid": "8ba96319abf9d7e5394b6c2e62beb557",
"score": "0.48808876",
"text": "def set_areas_conocimiento\n @areas_conocimiento = AreasConocimiento.find(params[:id])\n end",
"title": ""
},
{
"docid": "2a2f340e045f63abee74fe262f1bd1f5",
"score": "0.4875729",
"text": "def set_intranet_regiao\n @intranet_regiao = Intranet::Regiao.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a77cca60e9e7ac60fb78653bdd2a19d",
"score": "0.4870802",
"text": "def create_duplicates\n materia = Materia.new(name: self.subject, order_id: self.order_id,topic: self.topic,student_id: self.order.student_id)\n case self.status\n when \"closed\"\n materia.materia_status_id = 5\n when \"confirm\"\n materia.materia_status_id = 5\n when \"avaible\"\n materia.materia_status_id = 2\n when \"reserved\"\n materia.materia_status_id = 3\n end\n materia.save!\n self.tutoria_instances.each do |ti|\n instance = MateriaInstance.new(duration: ti.duration,at_date: ti.at_date,at_time: ti.at_time,materia_id: materia.id,tutor_id: ti.tutor_id)\n case ti.status\n when \"paid\"\n instance.materia_instance_status_id = 5\n when \"confirm\"\n instance.materia_instance_status_id = 3\n when \"avaible\"\n instance.materia_instance_status_id = 1\n when \"reserved\"\n instance.materia_instance_status_id = 2\n end\n instance.save!\n end\n end",
"title": ""
},
{
"docid": "1ff43bc1e625009a7744072fb63b7777",
"score": "0.48702538",
"text": "def set_utilizador\n @utilizador = Utilizador.find(params[:id])\n # @utilizador = @current_utilizador\n @noticias = @utilizador.noticium\n @competencias = @utilizador.competencium\n @cursos = @utilizador.curso\n @empregos = @utilizador.emprego\n @contactos = @utilizador.contacto\n @contactos_aceites = Array.new\n @contactos.each do |c|\n if c.estado == \"Aceite\"\n @contactos_aceites.push(c)\n end\n end\n if !(@empregos.size)==0\n @colegas = Empresa.find(@empregos.last.empresa_id).emprego\n end\n# @contactos_colegas = Array.new\n# @contactos_aceites.each do |c|\n# if @empregos.last == Utilizador.find(c.utilizador2_id).emprego.last\n# @contactos_colegas.push(c)\n# end\n# end\n\n end",
"title": ""
},
{
"docid": "ead191b5cde5585624f7e34d8d82e088",
"score": "0.4860794",
"text": "def set_gestion_auditoria\n #gestion_auditoria =Gestion::Auditoria.includes(:registro,:usuario).limit(1).find(params[:id]) \n @gestion_auditoria =Gestion::Auditoria.find(params[:id])\n #Le he agregado all porque sino arroja error de procedimiento almacenado\n end",
"title": ""
},
{
"docid": "1a418a8887af592d0a10bec59bbec282",
"score": "0.48607615",
"text": "def set_caracteristica_tipo\n @caracteristica_tipo = CaracteristicaTipo.find(params[:id])\n end",
"title": ""
},
{
"docid": "aeb3083768a0a0375223b00def4a60f2",
"score": "0.48596355",
"text": "def incluir_inicial\n ['casoid', 'fecharec', 'oficina',\n 'nusuario'\n ]\n end",
"title": ""
},
{
"docid": "d0020f8cc63e3e18f277eb29026cf62d",
"score": "0.4851374",
"text": "def get_actividad_particular tipo, archivos_agregados, archivos_modificados, archivos_eliminados\n actividad = Hash.new\n nombre_atributo = \"pattern_#{tipo}\"\n filtro = self.send(nombre_atributo.to_sym)\n archivos_agregados = filtro.filtrar(archivos_agregados)\n archivos_modificados = filtro.filtrar(archivos_modificados)\n archivos_eliminados = filtro.filtrar(archivos_eliminados)\n \n simbolo_agregados = \"#{tipo.to_s}_agregados\".to_sym\n simbolo_modificados = \"#{tipo.to_s}_modificados\".to_sym\n simbolo_eliminados = \"#{tipo.to_s}_eliminados\".to_sym\n\n actividad[simbolo_agregados] = archivos_agregados.size\n actividad[simbolo_modificados] = archivos_modificados.size\n actividad[simbolo_eliminados] = archivos_eliminados.size\n \n actividad\n end",
"title": ""
},
{
"docid": "8b920e8066d552c3feed00c4aac90a80",
"score": "0.4849517",
"text": "def after_save\n %w[settore area ateneo].each do |attr|\n klass = Kernel.const_get(attr.capitalize)\n Array(send(attr)).each { |name| klass.find(:nome => name).any? || klass.create(:nome => name) }\n end\n end",
"title": ""
},
{
"docid": "b8c64ccbddb35673e74a712bc553ce7d",
"score": "0.48466608",
"text": "def edit\n\t @carTypes = Type.all.map{ |type| [type.name,type.id]}\n\tend",
"title": ""
},
{
"docid": "e503819c198f7a5b355e8620dad1ed08",
"score": "0.48383093",
"text": "def process_location_data\n regions = get_location_data\n \n regions.each do |region|\n area = save_area_data region\n \n prefectures = region[\"Prefecture\"].is_a?(Array) ? region[\"Prefecture\"] : [region[\"Prefecture\"]] \n prefectures.each do |prefecture|\n pref = save_prefecture_data area.id, prefecture\n \n large_areas = prefecture[\"LargeArea\"].is_a?(Array) ? prefecture[\"LargeArea\"] : [prefecture[\"LargeArea\"]] \n large_areas.each do |large_area|\n l_area = save_large_area_data pref.id, large_area\n \n places = large_area[\"SmallArea\"].is_a?(Array) ? large_area[\"SmallArea\"] : [large_area[\"SmallArea\"]]\n places.each do |place|\n save_place_data area.id, l_area.id, place\n end\n end\n end \n end\nend",
"title": ""
},
{
"docid": "f20bbd06607c2334d956228a06b1a9d1",
"score": "0.48291802",
"text": "def personas_procesa_filtros_sivel2_gen(que1, tablas1, where1, que3, \n tablas3, where3)\n @filtrosegun.each do |e, r|\n if (params[:filtro] && params[:filtro][r[:nomfiltro]] && \n params[:filtro][r[:nomfiltro]] != '') \n if r[:metodo_id] == :id\n ids = r[:coleccion].where(\n id: params[:filtro][r[:nomfiltro]].select{|x| x!= ''}.\n map(&:to_i)\n ).pluck(:id)\n else # e.g sexo\n\n ids = r[:coleccion].map(&:last).select {|id| \n id && id.to_s != '' && params[:filtro][r[:nomfiltro]].\n map(&:to_s).include?(id.to_s)\n }\n end\n if ids.count == 0\n where1 =ampliar_where_sinap(where1, 'TRUE', 'FALSE', '=')\n elsif r[:nomfiltro] == :aniosnac\n where1 += (where1 != '' ? ' AND ' : '') + \n \"(persona.anionac IS NULL OR persona.anionac IN ('\" +\n ids.sort.join(\"', '\") + \"'))\"\n else\n where1 = ampliar_where_sinap(\n where1, r[:campocons], \"('\" + \n ids.sort.join(\"', '\") + \"')\", ' IN '\n )\n end\n end\n\n end\n\n return [que1, tablas1, where1, que3, tablas3, where3]\n end",
"title": ""
},
{
"docid": "0d1565cdd7368b88045625bbcc11f898",
"score": "0.4829125",
"text": "def update\n resumenes_ids = params[:resumenes_ids] if params[:resumenes_ids]\n @informe = Informe.find(params[:id]) \n respond_to do |format|\n if @informe.update_attributes(params[:informe])\n if resumenes_ids\n resumenes_ids.each do |id|\n resumen = Resumen.where(:id => id).first\n if resumen\n resumen.informe_id = @informe.id\n resumen.save\n end\n end\n end\n # Website.all.each{|w| w.usuario_id = nil; w.save}\n # session[:website_selecionada] = nil\n flash[:success] = 'Informe Actualizado.'\n format.html { redirect_to @informe }\n format.json { }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "45a73d2b53f0562a53bd2e0ba06bb06c",
"score": "0.4821726",
"text": "def set_areas_formacion\n @areas_formacion = AreasFormacion.find(params[:id])\n end",
"title": ""
},
{
"docid": "e52267695396ca17ef5e0fa38d2bc00f",
"score": "0.48177546",
"text": "def set_tipo_instituto\n @tipo_instituto = TipoInstituto.find(params[:id])\n end",
"title": ""
},
{
"docid": "1af6e1b23106b567504db55794f67738",
"score": "0.48150837",
"text": "def set_registro_accione\n @registro_accione = RegistroAccione.find(params[:id])\n end",
"title": ""
},
{
"docid": "1e4a7314bf5af40f5bd354acc912098d",
"score": "0.48139966",
"text": "def consulta_classe\n\n if params[:type_of].to_i == 1\n w=session[:grupo]=params[:crianca][:grupo4_id]\n w1=session[:regiao]=params[:crianca][:regiao4_id]\n t=0\n @criancas = Crianca.find( :all,:conditions => [\"status = 'NA_DEMANDA' AND regiao_id=? AND grupo_id=? \", session[:regiao], session[:grupo] ],:order => \"servidor_publico DESC, transferencia DESC, trabalho DESC, declaracao DESC, autonomo DESC, created_at ASC\")\n render :update do |page|\n page.replace_html 'criancas', :partial => 'criancas_regiao'\n end\n else if params[:type_of].to_i == 2\n w=session[:opcao] = params[:crianca][:regiao2_id]\n w1=session[:classe] =(params[:crianca][:classe_id])\n @criancas = Crianca.find( :all,:conditions => [\"status = 'NA_DEMANDA' AND regiao_id=? AND grupo_id=?\", session[:opcao], session[:classe] ],:order => \"servidor_publico DESC, transferencia DESC, trabalho DESC, declaracao DESC, autonomo DESC, created_at ASC\")\n render :update do |page|\n page.replace_html 'criancas', :partial => \"criancas_regiao\"\n end\n else if params[:type_of].to_i == 3\n session[:grupo] = params[:crianca][:grupo3_id]\n session[:unidade_ref] =(params[:crianca][:unidade_ref])\n @criancas = Crianca.find( :all,:conditions => [\"status = 'NA_DEMANDA' AND grupo_id=? AND unidade_ref=?\", session[:grupo], session[:unidade_ref] ],:order => \"servidor_publico DESC, transferencia DESC, trabalho DESC, declaracao DESC, autonomo DESC, created_at ASC\")\n render :update do |page|\n page.replace_html 'criancas', :partial => \"criancas_regiao\"\n end\n\n end\n end\n end\n\n\ndef relatorio_geral_ant\nt=0\n @criancas = Crianca.find(:all, :conditions => [\"status = 'NA_DEMANDA'\" ], :order => 'nome')\n t=0\n @unidades11 = Unidade.find(:all, :conditions=> [\"nome like? AND ativo = 1 \", \"%\"+\"CC \" +\"%\"], :order => 'nome')\n @unidades12 = Unidade.find(:all, :conditions=> [\"nome like? AND ativo = 1 \", \"%\"+\"CR \" +\"%\"], :order => 'nome')\n @unidades13 = Unidade.find(:all, :conditions=> [\"nome like? AND ativo = 1 \", \"%\"+\"FIL. \" +\"%\"], :order => 'nome')\n @unidades14 = Unidade.find(:all, :conditions=> [\"nome like? AND ativo = 1 \", \"%\"+\"CONV. \" +\"%\"], :order => 'nome')\n @unidades15 = Unidade.find(:all, :conditions=> [\"nome like? AND ativo = 1 \", \"%\"+\"EMEI \" +\"%\"], :order => 'nome')\n\n\n\n end\nend",
"title": ""
},
{
"docid": "e56be2839b208ccdf2ac78bb2d4b1ccc",
"score": "0.48091283",
"text": "def set_tiendas_coleccionable\n @tiendas_coleccionable = TiendasColeccionable.find(params[:id])\n end",
"title": ""
},
{
"docid": "9f440f1e90ec909f8d19c293326b67d7",
"score": "0.48084173",
"text": "def set_registro_insumos_reactivo\n @registro_insumos_reactivo = RegistroInsumosReactivo.find(params[:id])\n end",
"title": ""
},
{
"docid": "20f11242dafcdac257d7b365a2f10427",
"score": "0.48063937",
"text": "def create\n\n respond_to do |format|\n aux= params[:participacao][:pessoa_id]\n if aux.size > 1\n\n\n for x in aux\n if x == \"\"\n break#a ultima posição do array e um \"\" e isso não é um id por tanto da erro entao esse if resolve isso\n end\n @pessoa=Pessoa.find(x) #aqui eupego a pessoa com o id q ta no x\n\n @participacao = Participacao.new(participacao_params)#colocando o new dentro for me permite fazer varias participacao com id diferentes o que evida erro se o id foce o mesmo nao seria create e sim update de fk de pessoa \n @reuniao = Reuniao.find(@participacao.reuniao) \n\n if Participacao.search(@pessoa.id, @reuniao.id) == [] #com esse if eu evito que se convoque a mesma pessoa 2 vezes\n @participacao.pessoa=@pessoa# passo o objeto para convocado\n @participacao.save\n end\n\n end\n @reuniao = Reuniao.find(@participacao.reuniao) \n\n\n format.html { redirect_to @reuniao, notice: 'Participacao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n \n else\n\n\n format.html { redirect_to reuniao_path(@participacao.reuniao), notice: 'Desculpe mas,você não selecionou ninguem.' }\n end\n end\n end",
"title": ""
},
{
"docid": "064e72d399a4b72dd6939f59caee153c",
"score": "0.4803963",
"text": "def set_tiempos_de_entrega\n @tiempos_de_entrega = TiemposDeEntrega.find(params[:id])\n end",
"title": ""
},
{
"docid": "6ba2a6da960dae3132f7bb321c01fa93",
"score": "0.48023298",
"text": "def filter\n @nuit = params[:nuit]\n @mois = params[:mois]\n\n @types = params.dig(:location, :type_ids)\n\n if !@types.nil?\n @types = params[:location][:type_ids]\n else\n @types = Type.select(:id)\n end\n \n # Locations par durée\n if !@nuit.nil? && !@mois.nil?\n @locations = Location.where(duree: 'nuit').or(Location.where(duree: 'mois')).where(type: @types).includes(:images, :type)\n\n elsif !@nuit.nil? && @mois.nil?\n @locations = Location.where(duree: 'nuit').where(type: @types).includes(:images, :type)\n\n elsif @nuit.nil? && !@mois.nil?\n @locations = Location.where(duree: 'mois').where(type: @types).includes(:images, :type)\n\n else\n @locations = Location.where(duree: 'nuit').or(Location.where(duree: 'mois')).where(type: @types).includes(:images, :type)\n end\n\n respond_to do |format|\n format.js\n format.html\n end\n\n \n\n end",
"title": ""
},
{
"docid": "62eb1560dd45a91c01187ba3ee697b17",
"score": "0.4800805",
"text": "def municipalities_from_region_istat # :doc:\n province_istats = provinces_from_region_istat.map(&:istat)\n municipalities_from_province_istats(province_istats)\n end",
"title": ""
},
{
"docid": "40689e939a249b2e12d08743eed01e80",
"score": "0.47961238",
"text": "def create_regions\n template.region_templates.each do |t|\n region = Region.create!(:region_template => t, :world => self)\n end\n end",
"title": ""
},
{
"docid": "499efd1813ed96313794879194945b11",
"score": "0.4795151",
"text": "def set_ubicacion_egresados_empresa\n @ubicacion_egresados_empresa = UbicacionEgresadosEmpresa.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e402a5ae39262524c03d861763f447a",
"score": "0.478747",
"text": "def regions\n self.campus.map {|x| x.city.region_id}\n end",
"title": ""
},
{
"docid": "2e402a5ae39262524c03d861763f447a",
"score": "0.478747",
"text": "def regions\n self.campus.map {|x| x.city.region_id}\n end",
"title": ""
},
{
"docid": "a28deb105f04c8081281fa742110a32b",
"score": "0.4786748",
"text": "def set_articulos_agregado\n @articulos_agregado = ArticulosAgregado.find(params[:id])\n end",
"title": ""
},
{
"docid": "2f7e10db84644f077278a78e28537b56",
"score": "0.47861353",
"text": "def verificar_empregados_iguais\n self.errors.add(:tb_empregado_gerente_id, 'não poder ao mesmo tempo o empregado avaliado!')\n end",
"title": ""
},
{
"docid": "ef3a3c2ae8058c36b7ab584f6a6f9c36",
"score": "0.4784637",
"text": "def create\n @tipo_acc = TipoAcc.new(params[:tipo_acc])\n\t \t@sel = @tipo_acc.estado_accions.where(:codigo =>0).collect(&:id)\n\t \t$op = 0\n\t \t\n\t\tif params[:estados_dest] && !params[:estados_ori]\n\t\t\t@estadosDest = params[:estados_dest] \n\t\t\t@estadosAll = @estadosDest\n\t\t\t$op = 1\t\n\t\tend\n\t\tif params[:estados_dest] && params[:estados_ori]\n\t\t\t@estadosDif = params[:estados_ori] & params[:estados_dest]\t\t\t\t\t\n\t\t\t@estadosDest = params[:estados_dest] - @estadosDif\n\t\t\t@estadosOri = params[:estados_ori] - @estadosDif\n\t\t\t@estadosAll = @estadosDest + @estadosOri + @estadosDif\n\t\t\t$op = 2\n\t\tend\n\t\t\n respond_to do |format|\n if @tipo_acc.save\n \tif $op != 0\n @tipo_acc.update_attributes(:estado_ids => @estadosAll)\n \n \tif $op == 1 \n \t\t@tipo_acc.estado_accions.each do |e|\n\t\t\t\t\t\t e.update_attributes(:codigo=>2)\n\t\t\t\t\tend\t \n \telse\n @tipo_acc.estado_accions.each do |e|\n\n\t\t\t\t\tif @estadosOri.include? (e.estado_id.to_s)\n\t \te.update_attributes(:codigo=>1)\n \t\t\t\telsif @estadosDest.include? (e.estado_id.to_s) \t\n \t e.update_attributes(:codigo=>2)\n \telse\n \t e.update_attributes(:codigo=>3)\n \tend \n\t\t\t\tend # end del if $op\n\t\t\tend # end del if $op != 0\n\t\tend\t\t\t\t\t\t\n \n \n format.html { redirect_to tipo_accs_path, notice: 'SE HAN GUARDADO LOS CAMBIOS' }\n format.json { render json: @tipo_acc, status: :created, location: @tipo_acc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_acc.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "59e3a9f3e645715246db4ca5e9e74af5",
"score": "0.4783774",
"text": "def add_regions(aff, values)\n regions = Region.list(aff.aff_id)\n return if regions.empty?\n\n values['region_list'] = regions.map do |region|\n res = { 'reg_name' => region.reg_name }\n add_rds(region, res)\n res\n end\n end",
"title": ""
},
{
"docid": "c941b43fc937bd7592d4b6533646b6e6",
"score": "0.47791564",
"text": "def orariolezioni\n @periodididattici = Periododidattico.find(:all)\n @laboratori = Codificaaula.find(:all, :select =>\"DISTINCT tipolab\", :conditions => [\"laboratorio =?\",\"S\"]) \n end",
"title": ""
},
{
"docid": "f28ead4ab3b58fd3ef89821094a3bd20",
"score": "0.47775507",
"text": "def set_regiao\n @regiao = Regiao.find(params[:id])\n end",
"title": ""
},
{
"docid": "e91190a7bb1736fca21459c2aa1a5800",
"score": "0.47729546",
"text": "def actualiza_catalogocentralizado(archivo)\n # Borra la anterior informacion de IUCN en catalogocentralizado\n #EspecieCatalogo.where(catalogo_id: [25,26,27,28,29,30,31,32,1022,1023]).destroy_all\n\n #datos = {}\n #csv_path = Rails.root.join('public', 'IUCN', archivo)\n #return unless File.exists? csv_path\n\n #CSV.foreach(csv_path, :headers => true) do |row|\n datos.each do |dato| \n #next if SALTA_CASOS.include?(row['observaciones'])\n \n # Caso mas \"simple\" cuando es busqueda exacta\n if row['mensaje'] == 'Búsqueda exacta'\n datos[row['IdCAT válido']] = { 'iucn' => '', 'observaciones' => '', 'iucn_sinonimos' => [], 'nombre valido CAT' => '' } unless datos[row['IdCAT válido']].present?\n datos[row['IdCAT válido']]['nombre valido CAT'] = row['Nombre válido CAT']\n datos[row['IdCAT válido']]['iucn'] = row['Categoría en IUCN']\n\n sinonimos = datos[row['IdCAT válido']]['iucn_sinonimos']\n if sinonimos.any?\n # Hubo alguna categoria de IUCN que coincidio con el sinonimo y valido, caso 2\n if (sinonimos.map{ |s| s[1] } & [row['Categoría en IUCN']]).any?\n mensaje_caso2 = \"En IUCN Red List #{VERSION_IUCN} con categoría #{CATEGORIAS_IUCN[row['Categoría en IUCN']]}, como \"\n mensaje_taxa_caso2 = [] \n\n sinonimos.each do |sinonimo|\n if sinonimo[1] == row['Categoría en IUCN']\n mensaje_taxa_caso2 << sinonimo[0]\n end\n end\n\n datos[row['IdCAT válido']]['observaciones'] = mensaje_caso2 + row['Nombre válido CAT'] + ', ' + mensaje_taxa_caso2.join(', ') + '(ver relaciones de sinonimia).'\n end\n\n # El valido y el sinonimo tienen 2 categorias diferentes, caso 3\n if (sinonimos.map{ |s| s[1] } - [row['Categoría en IUCN']]).any?\n mensaje_caso3 = \"Nombres válido y sinónimo con diferente categoría en IUCN Red List #{VERSION_IUCN}. \"\n mensaje_caso3 += \"#{row['Nombre válido CAT']} con categoría #{CATEGORIAS_IUCN[row['Categoría en IUCN']]}, \"\n mensaje_taxa_caso3 = [] \n\n sinonimos = datos[row['IdCAT válido']]['iucn_sinonimos']\n sinonimos.each do |sinonimo|\n mensaje_taxa_caso3 << \"#{sinonimo[0]} con categoría #{CATEGORIAS_IUCN[sinonimo[1]]}\"\n end\n\n if datos[row['IdCAT válido']]['observaciones'].present?\n datos[row['IdCAT válido']]['observaciones'] += mensaje_caso3 + mensaje_taxa_caso3.join(', ') + '(ver relaciones de sinonimia).'\n else\n datos[row['IdCAT válido']]['observaciones'] = mensaje_caso3 + mensaje_taxa_caso3.join(', ') + '(ver relaciones de sinonimia).'\n end\n \n end\n end\n\n elsif row['mensaje'] == 'Búsqueda exacta y era un sinónimo'\n if datos[row['IdCAT válido']].present?\n datos[row['IdCAT válido']]['iucn_sinonimos'] << [row['Nombre válido CAT'], row['Categoría en IUCN']]\n else\n datos[row['IdCAT válido']] = { 'iucn' => '', 'observaciones' => '', 'iucn_sinonimos' => [], 'nombre valido CAT' => '' }\n datos[row['IdCAT válido']]['iucn_sinonimos'] << [row['Nombre válido CAT'], row['Categoría en IUCN']]\n #datos[row['IdCAT válido']]['nombre valido CAT'] = row['Nombre válido CAT']\n end\n end\n\n end\n end",
"title": ""
},
{
"docid": "17a15e1d79014748c19abe98faa14986",
"score": "0.47706512",
"text": "def create\n respond_to do |format|\n @cartorio = Cartorio.new(cartorio_params)\n @cartorio.numero = -1\n @cartorio.complemento = 'inexistente'\n if @cartorio.save\n for atr_id in params[:cartorio][:atribuicaos]\n if atr_id != '' && atr_id != nil\n @atribuicaosCartorios = AtribuicaosCartorios.new\n @atribuicaosCartorios.cartorio_id = @cartorio.id\n @atribuicaosCartorios.atribuicao_id = atr_id\n @atribuicaosCartorios.save\n end\n end\n format.html { redirect_to @cartorio, notice: 'Cartorio nao foi criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @cartorio }\n else\n @tipoRegistros = TipoRegistro.order('nome asc')\n @comarcas = Comarca.order('nome asc')\n @estados = Estado.order(\"nome asc\")\n @estado = Estado.find(@cartorio.cidade.estado_id)\n @cidades = Cidade.where(\"estado_id = ?\", @estado.id).order('nome asc')\n @atribuicaos = []\n @tipoRegistro = nil\n format.html { render action: 'new' }\n format.json { render json: @cartorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c442b2231928c0645197110dc06c0d4d",
"score": "0.47677913",
"text": "def associated_businesses(ident, ident_cc = 'EST')\n begin\n msg = {\n 'fyysilise_isiku_kood' => ident,\n 'fyysilise_isiku_koodi_riik' => country_code_3(ident_cc)\n }\n Rails.logger.info \"[Ariregister] Request sent with data: #{msg.inspect}\"\n\n response = @client.call :paringesindus_v4, message: body(msg)\n content = extract response, :paringesindus_v4_response\n Rails.logger.info \"[Ariregister] Got response with data: #{content.inspect}\"\n\n if content.present? && content[:ettevotjad].key?(:item)\n business_ident = items(content, :ettevotjad).map{|item| item[:ariregistri_kood]}\n else\n business_ident = []\n end\n\n {\n ident: ident,\n ident_country_code: ident_cc,\n # ident_type: 'priv',\n retrieved_on: Time.now,\n associated_businesses: business_ident\n }\n rescue Savon::SOAPFault => fault\n Rails.logger.error \"[Ariregister] #{fault} Äriregister arireg #{self.class.username} at #{self.class.host }\"\n raise NotAvailableError.new(exception: fault)\n rescue HTTPI::SSLError => ssl_error\n Rails.logger.error \"[Ariregister] #{ssl_error} at #{self.class.host}\"\n raise NotAvailableError.new(exception: ssl_error)\n rescue SocketError => sock\n Rails.logger.error \"[Ariregister] #{sock}\"\n raise NotAvailableError.new(exception: sock)\n end\n end",
"title": ""
},
{
"docid": "ee716af165fb5d76be91b37da94ba2b7",
"score": "0.47658455",
"text": "def index\n @nombres_regiones = NombreRegion.all\n end",
"title": ""
},
{
"docid": "0748c75f68f1dea2578a6a3d618c4354",
"score": "0.476064",
"text": "def consulta_from_ficha\n @consulta= Consulta.new\n @paciente= Paciente.find(params[:paciente])\n @area= Area.find(params[:area_id])\n get_doctores\n #new\n end",
"title": ""
},
{
"docid": "d8e3e0e9f446efc244b5a9f93e145b60",
"score": "0.47576505",
"text": "def set_asistencia_reunion_evangelist\n @asistencia_reunion_evangelist = AsistenciaReunionEvangelist.find(params[:id])\n end",
"title": ""
},
{
"docid": "166794d861fe2899dbe19fa81082b733",
"score": "0.4752508",
"text": "def set_tipo_infraccion\n @tipo_infraccion = TipoInfraccion.find(params[:id])\n end",
"title": ""
},
{
"docid": "0612188106e5f33c9b118408a42715a8",
"score": "0.47374892",
"text": "def incluir_inicial\n ['casoid', 'contacto', 'fecharec', 'oficina', \n 'nusuario', 'fecha', 'statusmigratorio',\n 'ultimaatencion_fecha', 'memo'\n ]\n end",
"title": ""
},
{
"docid": "7da19d9a716015a2930fd7550203df1c",
"score": "0.473378",
"text": "def update\n @categorias = Categoria.where(id: params[:produto][:categoria])\n\n if !@categorias.empty?\n respond_to do |format|\n if @produto.update(produto_params)\n #busca as categorias que foram desmarcadas\n @categorias_produtos = CategoriasProduto.where.not(categoria_id: @categorias).where(produto_id: @produto.id)\n\n @categorias.each do |categoria|\n #busca todas as categorias cadastradas\n @all_categorias = CategoriasProduto.where(categoria_id: categoria.id, produto_id: @produto.id)\n\n if @all_categorias.blank?\n CategoriasProduto.create(categoria_id: categoria.id, produto_id: @produto.id)\n end\n end\n\n @categorias_produtos.destroy_all\n\n format.html { redirect_to @produto, notice: 'Produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:notice] = 'Selecione pelo menos uma categoria!'\n redirect_to edit_produto_path\n end\n end",
"title": ""
},
{
"docid": "1bb98526bfddf18fa977a7827434a941",
"score": "0.47315136",
"text": "def get_ids_seriadas\n ids_array = Array.new\n self.seriadas.each {|seriada| ids_array << seriada.get_id_seriada}\n\n ids_array\n end",
"title": ""
},
{
"docid": "ae8c220aa6ca5d4442ab37b5fb12d6eb",
"score": "0.47252628",
"text": "def set_atractivo\n @atractivo = Atractivo.find(params[:id])\n @provs = Prov.find(@atractivo.prov)\n @cants = Cant.where(\"prov_id = ?\", @atractivo.cant)\n @parrs = Parr.where(\"cant_id = ?\", @atractivo.parr)\n\n @categs = Categ.where(@atractivo.categ)\n @tipos = Tipo.where(@atractivo.tipo_id)\n @subtipos = Subtipo.where(\"tipo_id = ?\", @atractivo.subtipo)\n end",
"title": ""
},
{
"docid": "1c5cb66604c2ee78ef5b0f1bcd45e87a",
"score": "0.47248563",
"text": "def imprimir_sector\n \n #aqui guardo todos los datos que necesito para imprimirlos en las variable\n @form_title=''\n @seguimientos = SeguimientoVisita.find(:all,:conditions => ['id = ?', params[:id]]) \n \n @solicitudes = Solicitud.find(@seguimientos[0].solicitud_id)\n \n @unidad_produccion=UnidadProduccion.find(@solicitudes.unidad_produccion_id) \n \n if !@solicitudes.cliente.persona_id.nil?\n @es_no=1 \n @datos_cliente=Persona.find(@solicitudes.cliente.persona_id) \n else\n @es_no=2 \n @datos_cliente=Empresa.find(@solicitudes.cliente.empresa_id) \n @empresa_integrante = EmpresaIntegrante.find(:all, :conditions=> \"empresa_id = #{@datos_cliente.id}\")\n @empresa_unidad_produccion = Empresa.find(@unidad_produccion.Cliente.empresa_id) \n unless @empresa_integrante.empty?\n condi=\"(\"\n @empresa_integrante.each{ |empresa|\n\n condi+=empresa.id.to_s << \",\" \n }\n condi=condi[0,condi.length-1] \n condi+=\")\" \n @empresa_integrante_tipo = EmpresaIntegranteTipo.find(:first, :conditions=> \"empresa_integrante_id in #{condi} and tipo = 'R'\")\n @datos_empresa=EmpresaIntegrante.find(@empresa_integrante_tipo.empresa_integrante_id).persona \n @conppa=UnidadProduccion.find(:first,:conditions=>\"cliente_id = #{@empresa_unidad_produccion.cliente_empresa.id}\")\n else\n @empresa_integrante=[]\n @datos_empresa=[]\n end \n end\n\n @tecnico_visita=SeguimientoVisita.find_by_solicitud_id(@seguimientos[0].solicitud_id) \n \n unless @solicitudes.usuario_pre_evaluacion.nil? \n @tecnico_campo=TecnicoCampo.find(:all,:conditions => ['cedula = ?', Usuario.find_by_nombre_usuario(@solicitudes.usuario_pre_evaluacion).cedula]) \n else \n @tecnico_campo=[]\n end\n\n @tecnico_supervisor=Oficina.find(@solicitudes.oficina_id)\n\n @prestamos=Prestamo.find(:all,:conditions => ['solicitud_id = ? ', @solicitudes.id])\n\n @siniestro_informacion=Siniestro.find(:all,:conditions => ['solicitud_id = ?', @solicitudes.id])\n\n @seguimiento_cultivo=SeguimientoCultivo.find_by_seguimiento_visita_id(@seguimientos[0].id)\n @decision_informacion=DecisionVisita.find_by_seguimiento_visita_id(@seguimientos[0].id)\n\n @pastizales_potreros=PastizalesPotreros.find(:all,:conditions=>\"seguimiento_visita_id = #{params[:id]}\")\n \n @manejo_instalacion=ManejoInstalaciones.find_by_seguimiento_visita_id(params[:id])\n @sanidad_animal=SanidadAnimal.find(:all,:conditions=>\"seguimiento_visita_id = #{params[:id]}\")\n\n unless @sanidad_animal.empty?\n cont=0\n condi='(' \n while (cont < @sanidad_animal.length)\n condi+=@sanidad_animal[cont].id.to_s+',' \n cont+=1\n end\n condi=condi[0,condi.length-1] if @sanidad_animal.length!=0\n condi+=')'\n @vacunacion=Vacunacion.find_by_sql(\"select distinct on (vacuna_id) * from vacunacion where sanidad_animal_id in #{condi}\")\n\n else\n @vacunacion=[]\n end\n @arreglo_desembolso=[]\n @arreglo_orden=[]\n @plan_inversion_desembolso=[]\n @plan_inversion_orden=[]\n @cantidad_plan_inversion_orden=0\n @cantidad_plan_inversion_desembolso=0\n\n @semovientes=Semovientes.find_by_seguimiento_visita_id(params[:id])\n\n\n @sumado_montos_desembolso=Desembolso.sum(:monto,:conditions=>\"solicitud_id = #{@solicitudes.id} and seguimiento_visita_id < #{@seguimientos[0].id} \")\n\n @sumado_montos_orden=OrdenDespacho.sum(:monto,:conditions=>\"solicitud_id = #{@solicitudes.id} and seguimiento_visita_id < #{@seguimientos[0].id} \")\n\n\n #fin\n\n if !Desembolso.find_by_seguimiento_visita_id(@seguimientos[0].id).nil? \n @es_desembolso=1 \n @desembolso=Desembolso.find(:all,:conditions=>['seguimiento_visita_id = ? and solicitud_id = ?',@seguimientos[0].id,@solicitudes.id]) \n desembolso_contador=DesembolsoDetalle.count(:all,:conditions=>['desembolso_id = ?',@desembolso[0].id])\n cont=0\n @arreglo_desembolso=[]\n condi='(' \n @desembolso_detalle=DesembolsoDetalle.find(:all,:conditions=>['desembolso_id = ?',@desembolso[0].id],:order=>\"plan_inversion_id\")\n while (cont < desembolso_contador)\n \n condi+=@desembolso_detalle[cont].plan_inversion_id.to_s+','\n @arreglo_desembolso[cont]=@desembolso_detalle[cont].monto \n\n cont+=1\n end\n condi=condi[0,condi.length-1] if desembolso_contador!=0 \n condi+=')'\n \n if desembolso_contador!=0\n logger.info \"condicion para el plan de inversion \" << condi\n\n @plan_inversion_desembolso=PlanInversion.find_by_sql(\"select * from plan_inversion where id in #{condi} and solicitud_id = #{@solicitudes.id} order by id\")\n @cantidad_plan_inversion_desembolso=(PlanInversion.find_by_sql(\"select * from plan_inversion where id in #{condi} and solicitud_id = #{@solicitudes.id}\")).length\n logger.info \"plan de inversion desembolso \" << @plan_inversion_desembolso.inspect\n\n else\n \n @plan_inversion_desembolso=[]\n @cantidad_plan_inversion_desembolso=0\n end\n \n elsif !OrdenDespacho.find_by_seguimiento_visita_id(@seguimientos[0].id).nil? \n @es_desembolso=0\n @orden=OrdenDespacho.find(:all,:conditions=>['seguimiento_visita_id = ? and solicitud_id = ?',@seguimientos[0].id,@solicitudes.id])\n orden_contador=OrdenDespachoDetalle.count(:all,:conditions=>['orden_despacho_id = ?',@orden[0].id])\n logger.debug \"orden contador ssssssssssssssssssssssssss \" << orden_contador.to_s\n\n cont=0\n @arreglo_orden=[]\n condi='(' \n @orden_detalle=OrdenDespachoDetalle.find(:all,:conditions=>\"orden_despacho_id= #{@orden[0].id.to_s}\",:order=>\"plan_inversion_id\")\n\n logger.debug \"orden detalee ssssssssssssssssssssssssss \" << @orden_detalle.inspect \n while (cont < orden_contador)\n\n\n condi+=@orden_detalle[cont].plan_inversion_id.to_s+','\n @arreglo_orden[cont]=@orden_detalle[cont].monto_recomendado \n\n cont+=1\n end\n condi=condi[0,condi.length-1] if orden_contador!=0 \n condi+=')'\n logger.debug \"Condeicones ssssssssssssssssssssssssss \" << condi.to_s \n if orden_contador !=0\n @plan_inversion_orden=PlanInversion.find_by_sql(\"select * from plan_inversion where id in #{condi} and solicitud_id = #{@solicitudes.id} order by id\")\n @cantidad_plan_inversion_orden=(PlanInversion.find_by_sql(\"select * from plan_inversion where id in #{condi} and solicitud_id = #{@solicitudes.id}\")).length\n\n logger.debug \"plan de inversion orden despacho \" << @plan_inversion_orden.inspect\n else \n @plan_inversion_orden=[]\n @cantidad_plan_inversion_orden=0\n end\n else\n @arreglo=[]\n @arreglo_desembolso=[]\n @arreglo_desembolso=[]\n @plan_inversion_orden=[]\n @cantidad_plan_inversion_orden=0\n @plan_inversion_desembolso=[]\n @cantidad_plan_inversion_desembolso=0\n\n end\n @arreglo=@arreglo_desembolso+@arreglo_orden\n @plan_inversion=@plan_inversion_desembolso+@plan_inversion_orden\n @cantidad_plan_inversion=@cantidad_plan_inversion_desembolso + @cantidad_plan_inversion_orden\n \n @acumulador1=0\n @acumulador2=0\n @acumulador3=0\n indice=0\n\n\n unless @arreglo.empty?\n @arreglo.each{ |monto|\n @acumulador3+=monto\n @acumulador1+=(@plan_inversion[indice].monto_financiamiento)\n indice+=1\n\n }\n end\n\n\n @produccion_leche_carne=ProduccionLecheCarne.find_by_seguimiento_visita_id(params[:id])\n\n @condiciones_acuicultura=CondicionesAcuicultura.find(:all,:conditions => \"solicitud_id = #{@solicitudes.id}\") \n @calidad_agua_alimento=CalidadAguaAlimento.find(:all,:conditions => \"solicitud_id = #{@solicitudes.id}\")\n @cultivo_laguna=CultivoLaguna.find(:all,:conditions => \"solicitud_id = #{@solicitudes.id}\")\n\n \n @embarcacion=Embarcacion.find(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]],:order=>'id')\n @embarcacion_cantidad=Embarcacion.count(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]])\n\n\n @motor=Motores.find(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]],:order=>'id')\n @motor_cantidad=Motores.count(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]])\n\n @arte_pesca=ArtePesca.find(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]],:order=>'id')\n @arte_pesca_cantidad=ArtePesca.count(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]])\n\n\n\n @equipo_seguridad=EquipoSeguridad.find(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]],:order=>'id')\n @equipo_seguridad_cantidad=EquipoSeguridad.count(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]])\n\n\n @faenas_pesca=FaenasPesca.find(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]],:order=>'id')\n @faenas_pesca_cantidad=FaenasPesca.count(:all,:conditions => ['seguimiento_visita_id = ? ', params[:id]])\n\n @sect=Sector.find(@solicitudes.sector_id)\n\n case params[:tipo]\n when \"VE\"\n @vista = 'view_planilla_vegetal_forestal' \n when \"AN\"\n @vista = 'view_planilla_animal' \n when \"AC\"\n @vista = 'view_planilla_acuicola' \n when \"PE\"\n @vista = 'view_planilla_pesca' \n else \n\n joins= \" INNER JOIN solicitud ON solicitud.id=#{SeguimientoVisita.find(@seguimientos[0].id).solicitud_id} and solicitud.estatus_id=10110 and solicitud.por_inventario=true \"\n @maquinarias = Catalogo.find(:all,:joins=>joins, :conditions=>[\"catalogo.estatus='R' and catalogo.solicitud_id=solicitud.id\"])\n \n @solicitud = Solicitud.find(@solicitudes.id)\n @visita = SeguimientoVisita.find(:first, :conditions=>['solicitud_id = ?', @solicitud.id], :order=>'id')\n @tipo_maquinaria = TipoMaquinaria.find(:all, :order=>'nombre')\n\n @vista = 'view_planilla_maquinaria'\n end \n\n end",
"title": ""
},
{
"docid": "8a897c75e4a134c9621a728989f4b29a",
"score": "0.47139487",
"text": "def actualiza_IUCN(archivo)\n csv_path = Rails.root.join('public', 'IUCN', archivo)\n bitacora.puts 'Nombre científico en IUCN,Categoría en IUCN,Nombre en CAT,IdCAT,Estatus nombre,IdCAT válido,Nombre válido CAT,observaciones'\n return unless File.exists? csv_path\n\n CSV.foreach(csv_path, :headers => true) do |r|\n self.row = r\n self.datos = []\n self.datos[0] = row['scientificName']\n self.datos[1] = row['redlistCategory']\n\n v = Validacion.new\n\n if row['subpopulationName'].present? # Quita la zona del nombre cientifico ... bien IUCN\n v.nombre_cientifico = row['scientificName'].gsub(row['subpopulationName'], '')\n else\n v.nombre_cientifico = row['scientificName']\n end\n\n v.encuentra_por_nombre\n self.validacion = v.validacion\n self.datos[7] = validacion[:msg]\n\n if validacion[:estatus] # Hubo al menos una coincidencia\n if validacion[:taxon].present? # Solo un resultado\n valida_extras\n end\n else\n if validacion[:taxones].present? # Mas de un resultado\n cuantos_encontro = []\n\n validacion[:taxones].each do |taxon|\n validacion[:taxon] = taxon\n next unless valida_extras\n cuantos_encontro << validacion[:taxon].id\n end\n\n cuantos_encontro.uniq!\n\n if cuantos_encontro.length == 1 # Caso mas sencillo de solo encontrar uno\n self.datos[7] = 'Búsqueda exacta'\n elsif cuantos_encontro.length > 1\n self.datos[2] = nil\n self.datos[3] = nil\n self.datos[4] = nil\n self.datos[5] = nil\n self.datos[6] = nil\n self.datos[7] = \"[REVISAR] - Existe más de una coincidencia: #{validacion[:taxones].map{ |t| t.scat.catalogo_id }.join('|')}\"\n else\n self.datos[2] = nil\n self.datos[3] = nil\n self.datos[4] = nil\n self.datos[5] = nil\n self.datos[6] = nil\n self.datos[7] = 'Sin coincidencias'\n end\n\n end\n end\n\n bitacora.puts datos.join(',')\n end\n\n bitacora.close\n end",
"title": ""
},
{
"docid": "6105dfd01402b3adfcf35c5ff3e8d192",
"score": "0.47126508",
"text": "def set_plantillahcr\n @registro = @plantillahcr = Plantillahcr.find(params[:id])\n end",
"title": ""
},
{
"docid": "00e2136701baceb529d0e8a68bbe5c54",
"score": "0.4711468",
"text": "def atributos_form\n atributos_transf_habilitado - [\"id\", :id]\n end",
"title": ""
},
{
"docid": "f1bd827ee75987794840e8ee1ab4cb26",
"score": "0.47055915",
"text": "def incluir_inicial\n ['casoid', 'contacto', 'fecharec', 'oficina', \n 'nusuario', 'fecha', 'statusmigratorio',\n 'ultimafechaatencion', 'memo'\n ]\n end",
"title": ""
},
{
"docid": "291617e890abaa7479be74580d7980ca",
"score": "0.47048438",
"text": "def update\n respond_to do |format|\n if @cartorio.update(cartorio_params)\n @atribuicaosCartorioss = AtribuicaosCartorios.where(\"cartorio_id = ?\", @cartorio.id)\n for atribuicaosCartorios in @atribuicaosCartorioss \n atribuicaosCartorios.destroy\n end\n for atr_id in params[:cartorio][:atribuicaos]\n if atr_id != '' && atr_id != nil\n @atribuicaosCartorios = AtribuicaosCartorios.new\n @atribuicaosCartorios.cartorio_id = @cartorio.id\n @atribuicaosCartorios.atribuicao_id = atr_id\n @atribuicaosCartorios.save\n end\n end\n format.html { redirect_to @cartorio, notice: 'Cartorio nao foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n @tipoRegistros = TipoRegistro.order('nome asc')\n @estados = Estado.order(\"nome asc\")\n @estado = Estado.find(@cartorio.cidade.estado_id)\n @cidades = Cidade.where(\"estado_id = ?\", @estado.id).order('nome asc')\n @comarcas = Comarca.order('nome asc')\n @atribuicaos = []\n @tipoRegistro = nil\n format.html { render action: 'edit' }\n format.json { render json: @cartorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
3304d9f05a66068f74c893f2074f4315
|
all functions here in the following format: [problem number]: [problem summary] ([answer]) def problem[problem number] ...code... end 3: find largest prime factor of 600851475143 (6857)
|
[
{
"docid": "492437f2e991f148c8eecc8ab4f4f8d5",
"score": "0.77306485",
"text": "def problem3\n primeFactors(600851475143)[-1]\nend",
"title": ""
}
] |
[
{
"docid": "fd373a56539b5320e7ec4bc9f4d23180",
"score": "0.8251594",
"text": "def p3\n require 'Prime'\n puts \"The largest prime factor of 600,851,475,143 is:\"\n puts 600851475143.prime_division.last[0]\n end",
"title": ""
},
{
"docid": "a59c5edd9c4b5bbad96ac5921bb76303",
"score": "0.80426294",
"text": "def problem3\n\t\tfactoring(600851475143).last\n\t\t#600851475143.prime_divison.last[0]\n\tend",
"title": ""
},
{
"docid": "3c1254fba9637cd86789b01962be48dd",
"score": "0.7879593",
"text": "def run\n puts largest_prime_factor(21)\n \n puts largest_prime_factor(13195)\n #=> 29\n\n puts largest_prime_factor(600851475143)\n #=> ??\nend",
"title": ""
},
{
"docid": "ed49c8d0157517e50a9a4347300eed6a",
"score": "0.7813252",
"text": "def problem3\n\tUtils.prime_factorization(600851475143).keys.last\nend",
"title": ""
},
{
"docid": "16fe0032b5abb8d065d2df08e9a029e1",
"score": "0.7732557",
"text": "def largest_prime_factor(num)\n\nend",
"title": ""
},
{
"docid": "9257ae686c06bded024bca4eee7b85b2",
"score": "0.76958597",
"text": "def largest_prime_factor(num)\n \nend",
"title": ""
},
{
"docid": "c56923fed48b47864e9bbdbd8039b4da",
"score": "0.7675384",
"text": "def highest_prime_factor(n)\nend",
"title": ""
},
{
"docid": "d762d51bb613dfc92dc248eb281e5cb8",
"score": "0.7665525",
"text": "def test_largest_prime_factor_for_600851475143\n largest_pf = LargestPrimeFactor.new\n assert_equal 6857, largest_pf.factor(600851475143)\n end",
"title": ""
},
{
"docid": "aafcd324791f1cd2aa798c93ec68399e",
"score": "0.76475585",
"text": "def problem_3a(num = 600851475143, ret_factors = false)\n primes = lambda do |&block|\n n = 3\n primes = [2]\n is_prime = lambda {|v| !primes.find {|p| v % p == 0}}\n loop do\n if is_prime.call(n)\n primes << n\n block.call n\n end\n n += 2\n end\n end\n max = 0\n primes.call do |p|\n max = p if (num % p).zero?\n puts p\n return(max) if p*p >= num\n end\nend",
"title": ""
},
{
"docid": "93c696d3fdc362498c5c59702442de1a",
"score": "0.7634123",
"text": "def largest_prime_factor(max = 600851475143)\n i = 2\n while i < max do\n while max % i == 0 do\n max = max/i\n end\n i += 1\n end\n max\nend",
"title": ""
},
{
"docid": "36d924dcee3e59aee6abc1b8a5dfa499",
"score": "0.7621346",
"text": "def problem_3\n def factors_for(num)\n return [] if num == 1\n factor = (2..num).find { |x| num % x == 0 }\n [factor] + factors_for(num / factor)\n end\n\n factors_for(600_851_475_143).max\nend",
"title": ""
},
{
"docid": "a41aa6133aacd416aa711bc818926c56",
"score": "0.75856876",
"text": "def largest_prime_factor\n num = 600851475143\n factors = []\n\n def is_prime?(n)\n for x in (2...n) do\n if n % x == 0\n return false\n end\n end\n return true\n end\n\n for y in (2...1000) do\n if num % y == 0 && is_prime?(y) == true\n factors.push(y)\n end\n end\n\n return factors.max\nend",
"title": ""
},
{
"docid": "103d7d03e4b2f831dd3a1a754b6ccafb",
"score": "0.7580592",
"text": "def problem3(n)\r\n\tlargest_factor = 0\r\n\tprime_counter = 2\r\n\twhile prime_counter * prime_counter <= n do\r\n\t\tif n % prime_counter == 0\r\n\t\t\tn /= prime_counter\r\n\t\t\tlargest_factor = prime_counter\r\n\t\telse\r\n\t\t\tprime_counter += 1\r\n\t\tend\r\n\tend\r\n\tif n > largest_factor\r\n\t\tlargest_factor = n\r\n\tend\r\n\tlargest_factor\r\nend",
"title": ""
},
{
"docid": "c278b7ce906af8204e991b9215a563b7",
"score": "0.7556177",
"text": "def run!\n puts primes(600_851_475_143).max\nend",
"title": ""
},
{
"docid": "72bfb3c31f8944337a931198cd834b44",
"score": "0.7519718",
"text": "def solution_3\n value = 600851475143\n $primes.each do |x|\n while value % x == 0\n value /= x\n end\n return x if value == 1\n end\n end",
"title": ""
},
{
"docid": "6a30a6715b4aac59a37401afb2a6e142",
"score": "0.7505207",
"text": "def largest_prime_factor(num)\n(2..num).reverse_each do |numero|\n if factor(numero) && num % numero == 0\n return numero\n end\nend\nreturn 1\nend",
"title": ""
},
{
"docid": "c310972b1ce69772d54e016cbb5eb460",
"score": "0.7472272",
"text": "def problem_03(number)\n prime_list = find_primes_below(Math.sqrt(number).floor)\n prime_factors = Array.new()\n\n prime_list.each do |i|\n if is_factor_of(number, i)\n prime_factors.push(i)\n end\n end\n\n partial_fact = array_product(prime_factors)\n while partial_fact <= Math.sqrt(number)\n remaining_fact = number/partial_fact\n is_divisible_by = find_divisor(remaining_fact, prime_list)\n unless is_divisible_by\n prime_factors.push(remaining_fact)\n end\n partial_fact = array_product(prime_factors)\n end\n\n return prime_factors.max\nend",
"title": ""
},
{
"docid": "5d632dfe878de96f095994c70eb33d1d",
"score": "0.7463088",
"text": "def largest_prime_factor(number)\n max = 0\n\n (2..number).each do |divisor| \n if (number % divisor == 0) && prime?(divisor) && max < divisor \n max = divisor \n end\n \n end\n\n max \n\nend",
"title": ""
},
{
"docid": "e0511b1e7e40d75a423c2f9069df52ec",
"score": "0.74354523",
"text": "def largest_prime_factor(num)\n pf=0\n (2..num).each do |factor|\n if num%factor==0 && prime?(factor)\n pf=factor\n end\n end\n pf\n\nend",
"title": ""
},
{
"docid": "b01c43280384456524174a2d1a22661c",
"score": "0.7420964",
"text": "def largest_factor(num)\n arr = find_primes(10000)\n arr.select{|n| num % n == 0}.last\nend",
"title": ""
},
{
"docid": "b5c01961e1329f6b7b20239fb743e01e",
"score": "0.7416222",
"text": "def largest_prime_factor\n \n number = 600851475143\n prime_arr = []\n i = 1\n while i < 775146\n if number % i == 0 && prime?(i)\n prime_arr << i \n end\n i += 1\n end \n prime_arr.last \nend",
"title": ""
},
{
"docid": "f36482ad885c38223f068e579ca36f2f",
"score": "0.7405277",
"text": "def problem3\n num = 600851475143\n factors = []\n fact = 2\n while fact < num\n factors << fact if (num%fact).zero?\n # print \"#{factors}\\n\"\n fact += 1 \n if factors.inject(&:*) == num\n return factors.last\n end\n end\nend",
"title": ""
},
{
"docid": "c13ef7ff9df55fd884b4af2ca4f1c44e",
"score": "0.74046004",
"text": "def largest_prime_factor(num)\n answer = 0\n sqrt = Math.sqrt(num)\n (2..sqrt).each { |x| if (num % x) == 0 && is_prime?(x) then answer = x end }\n return \"#{answer}\"\nend",
"title": ""
},
{
"docid": "f5ae9a0ab53c0c68be9f4f895e6ab9a1",
"score": "0.73794824",
"text": "def largestPrimeFactor number\n\ti = 2\n\tbiggest_divisor = 0\n\twhile i < number\n\t\tif number % i == 0\n\t\t\tbiggest_divisor = i\n\t\t\tnumber = number / i\n\t\t\ti = 2\n\t\telse\n\t\t\ti += 1\n\t\tend\n\tend\n\tnumber\nend",
"title": ""
},
{
"docid": "a7771ab65df2cba2072cf9e93e99c76f",
"score": "0.7355173",
"text": "def largest_prime_factor(input)\n prime_factors(input).max\nend",
"title": ""
},
{
"docid": "27a3273a102281ffdad63a67d654ad43",
"score": "0.73376507",
"text": "def max_prime_factor n\n if prime_2 n\n return n\n else\n div = n/2\n while div >= 2\n if (prime_2 div) && (n % div == 0) # do not forget to put parenthesis\n return div\n end\n div -= 1\n end\n end\nend",
"title": ""
},
{
"docid": "425a0fe23e5b31db6e90686b77321e0d",
"score": "0.7333134",
"text": "def euler3\n largest_prime = 0\n\n Prime.each(300851475143) do |prime|\n if (600851475143 % prime).zero?\n largest_prime = prime\n p largest_prime\n end\n end\nend",
"title": ""
},
{
"docid": "47c1c0d24b456ae14fe3f4526a74a8eb",
"score": "0.72914803",
"text": "def largest_prime_factor n\n return n if Prime.prime?(n)\n (2..(n)).each do |i|\n return n/i if (n%i).zero? && Prime.prime?(n/i)\n end\nend",
"title": ""
},
{
"docid": "37fa90a74aaa5a9707f86b755d821965",
"score": "0.7289456",
"text": "def largest_prime_factor(number)\n dividers = []\n (2..number).each do |factor|\n if number % factor == 0\n dividers << factor\n end\n end \n retNum = 0\n dividers.each do |i|\n if prime?(i) == true\n retNum = i\n end\n end\n retNum\nend",
"title": ""
},
{
"docid": "9156be792ec35ab224fbdca8765f8e6e",
"score": "0.72675997",
"text": "def largest_prime_factor(num)\n div=num\n while div>=2 \n return div if num%div==0 && is_prime?(div)\n div-=1\n end\nend",
"title": ""
},
{
"docid": "aabc7da0416c1b6c699fd9c9ffc463cd",
"score": "0.7264137",
"text": "def largest_prime_factor(num)\n divisors = []\n prime_divisors = []\n (1..num).each do |y|\n if num % y == 0\n divisors << y\n end\n end\n divisors.each do |z|\n if prime?(z)\n prime_divisors << z\n end\n end\n prime_divisors.inject() do |l, r|\n if l > r\n l\n elsif r > l\n r\n end\n end\nend",
"title": ""
},
{
"docid": "64ef16416318282bc4b6e8cde4054721",
"score": "0.72584134",
"text": "def find_largest_prime(number)\n\tnumber_factors = []\n\tfor i in 1..number/2\t# Change 'number/2' to 7000 to try function on 600851475143\n\t\tif number % i == 0\t\n\t\t\tnumber_factors.push(i)\n\t\tend\n\tend\n\tlargest_prime_factor = 0\n\tnumber_factors.each do |i|\n\t\tif is_prime(i)\n\t\t\tlargest_prime_factor = i\n\t\tend\n\tend\n\tputs largest_prime_factor\nend",
"title": ""
},
{
"docid": "7af83cb2aa3a095f9017d36aabbc7236",
"score": "0.72518086",
"text": "def largest_prime_factor(num)\n primes = (2..num).select { |i| is_prime?(i) }\n\n primes.select { |i| num % i == 0 }.max\nend",
"title": ""
},
{
"docid": "4d1308521f82ef7cec4954bea8a1673c",
"score": "0.7243519",
"text": "def largest_prime_factor(n)\n Prime.prime_division(n).last.first\nend",
"title": ""
},
{
"docid": "266f770446ece7907049c7c8f6254a1b",
"score": "0.72425103",
"text": "def three\n 600851475143.prime_division.last.first\n end",
"title": ""
},
{
"docid": "a2af540ce4fc8ea4f44b0b555c8807e7",
"score": "0.72346324",
"text": "def largest_prime_factor(num)\n return num if is_prime?(num)\n\n largest = 0\n\n (2..Math.sqrt(num)).each do |n|\n largest = n if num % n == 0 && is_prime?(n)\n end\n\n largest\n\nend",
"title": ""
},
{
"docid": "329993690cb6775df65a4ca01f1eee4d",
"score": "0.72296804",
"text": "def largest_prime_factor(number)\n i = 2\n while i * i <= number \n while number % i == 0 \n number = number / i \n break if number == i\n end\n i += 1\n end\n number\nend",
"title": ""
},
{
"docid": "c8671f9e0cd025060edf1756a310f1ec",
"score": "0.7216274",
"text": "def largest_prime_factor n\n return n if Prime.prime?(n)\n largest_prime_factor(next_factor(n))\n\nend",
"title": ""
},
{
"docid": "a4f778213209fe3347e874fc7d176f78",
"score": "0.721345",
"text": "def problem_3(max)\n Prime.prime_division(max).flatten.max\n end",
"title": ""
},
{
"docid": "e46b693ccad4cccbaa264785401c2ecf",
"score": "0.7208668",
"text": "def largest_prime_factor(number)\n # large = 0\n # (1..number).each do |factor|\n # if is_prime?(factor) && number % factor == 0\n # large = factor\n # end\n # end\n # large\n number.downto(2) do |factor| \n if number % factor == 0 && is_prime?(factor)\n return factor\n end\n end\nend",
"title": ""
},
{
"docid": "9c2558f50bbf3f4d3e05913e753c1edc",
"score": "0.7204807",
"text": "def test_largest_prime_factor_for_strings\n largest_pf = LargestPrimeFactor.new\n assert_equal 6857, largest_pf.factor(\"600851475143\")\n assert_equal 0, largest_pf.factor(\"koombea\")\n end",
"title": ""
},
{
"docid": "0501b77be6fb740b0eb03a9aeed9f126",
"score": "0.7199653",
"text": "def highest_prime_factorial(x)\n\tfor i in 2..(x/2)\n\t\tif x % (x/i) == 0\n\t\t\tabort((x/i).to_s) if (x/i).prime?\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "134e31e291a18aab78c5dc15f91f95dc",
"score": "0.71912265",
"text": "def largest_prime_factor_of(n)\n n.prime_division.map{|n| n[0]}.last\nend",
"title": ""
},
{
"docid": "4da9dd9573b6486f1252d2557df9620a",
"score": "0.7188643",
"text": "def largest_prime_factor(num)\n max = 0\n (1..num).each do |n|\n max = n if num % n == 0 && prime?(n)\n end\n max\nend",
"title": ""
},
{
"docid": "9e2ac1d3e7430764570e29806176ebe0",
"score": "0.7186876",
"text": "def solve( n = 600_851_475_143 )\n n.prime_factors[-1]\n end",
"title": ""
},
{
"docid": "fc155c28a501a9b4fa54fb6750f614cf",
"score": "0.7185765",
"text": "def largest_prime_factor(num)\n primes = primes_up_to(approx_sqr(num))\n\n primes.select { |i| num % i == 0 }.max\nend",
"title": ""
},
{
"docid": "b0e6e0507e4b885719fc9c8d5acbe892",
"score": "0.7184531",
"text": "def factor(num)\n range = 1..(num**0.5)\n range.select{|x| x.prime?}.select do |i|\n num % i == 0\n end.compact.max\nend",
"title": ""
},
{
"docid": "14434525ced7051afea4ad464e87f716",
"score": "0.7178414",
"text": "def prob3Mod\n\ttime do\n\t\tn = 600851475143\n\t\t# use the method from the explanation, dividing out factors as many times as possible\n\t\tif n % 2 == 0\n\t\t\tn = n.div(2)\n\t\t\tlastFact = 2\n\t\t\twhile n % 2 == 0\n\t\t\t\tn = n.div(2)\n\t\t\tend\n\t\telse\n\t\t\tlastFact = 1\n\t\tend\n\t\tfact = 3\n\t\tfactMax = Math.sqrt(n)\n\t\twhile n > 1 && fact < factMax\n\t\t\tif n % fact == 0\n\t\t\t\tn = n.div(fact)\n\t\t\t\tlastFact = fact\n\t\t\t\twhile n % fact == 0\n\t\t\t\t\tn = n.div(fact)\n\t\t\t\tend\n\t\t\t\tfactMax = Math.sqrt(n)\n\t\t\tend\n\t\t\tfact = fact + 2\n\t\tend\n\t\tif n == 1\n\t\t\tsol = lastFact\n\t\telse\n\t\t\tsol = n\n\t\tend\n\t\tputs \"The largest prime factor is #{sol}\"\n\tend\nend",
"title": ""
},
{
"docid": "8b07ff526270182172408f04f25929d5",
"score": "0.7177268",
"text": "def largest_prime_factor_cheat(number)\n Prime.instance\n number.prime_division.last[0]\nend",
"title": ""
},
{
"docid": "1cf7bc1e4664a8740c4722ad0c4201e8",
"score": "0.71689415",
"text": "def largest_prime_factor(num)\n (Prime.prime_division(num))[-1][0]\nend",
"title": ""
},
{
"docid": "6e256c597800e41afb5971cc47c2f657",
"score": "0.71675307",
"text": "def largest_prime_factor(num)\n num.downto(2).each do |i|\n if is_prime?(i) && num % i == 0\n return i \n end \n end \nend",
"title": ""
},
{
"docid": "b93988132c94aa028abb63d20999cea6",
"score": "0.7162968",
"text": "def largest_prime_factor(n)\n\tmax_prime = 0\n\twhile max_prime < 1\n\t\t(2..n).each do |i|\n\t\t\tif n % i == 0 and Prime.prime?(n/i)\n\t\t\t\tmax_prime = n/i\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tputs max_prime\nend",
"title": ""
},
{
"docid": "fa7c6568172aef1385cbdbf0302d874e",
"score": "0.71517944",
"text": "def problem_5(numbers = 20)\n facs = (2..numbers).reduce(Hash.new(0)) do |t,n|\n f = prime_factors(n).reduce(Hash.new(0)) do |h,v|\n h[v] += 1\n h\n end\n t.merge(f) {|h,ov,nv| [ov,nv].max }\n end\n facs.reduce(1) do |a,v|\n a * v[0] ** v[1]\n end\nend",
"title": ""
},
{
"docid": "2f7b6571645976d292423808b0adb89d",
"score": "0.71470964",
"text": "def largest_prime_factor(number)\n prime_factors = get_factors(number).select { |factor| prime?(factor) }\n prime_factors.max\nend",
"title": ""
},
{
"docid": "282c8b59b2bc3988a29840b6b9ddc6d5",
"score": "0.71467924",
"text": "def largest_factor(n=600851475143, largest=1, plus_one=3)\r\n return largest if plus_one > n\r\n largest, n = plus_one, (n / plus_one) if (n % plus_one == 0) && prime_rec?(plus_one)\r\n largest_factor(n, largest, plus_one + 2)\r\nend",
"title": ""
},
{
"docid": "c727611219d671a4512a352c8a484939",
"score": "0.7130978",
"text": "def largest_prime_factor(num)\n # debugger\n iterator = num\n while iterator > 0\n if num % iterator == 0 && is_prime?(iterator)\n return iterator\n end\n iterator = iterator - 1\n end\nend",
"title": ""
},
{
"docid": "fbd0a8231fb2c8f74b2c3743e7945ff7",
"score": "0.71210235",
"text": "def largest_prime_factor_v1(number)\n largest_factor = 0\n\n 2.upto(Math.sqrt(number).floor) do |i|\n if factor?(number, i)\n if prime?(i)\n if largest_factor < i\n largest_factor = i\n end\n end\n end\n end\n\n return largest_factor\nend",
"title": ""
},
{
"docid": "df3921f8d435ebbe5a9bd0da1baf3822",
"score": "0.7117251",
"text": "def largest_prime_factor(num)\n num.downto(2).each do |divisor|\n return divisor if num % divisor == 0 && is_prime?(divisor)\n end\nend",
"title": ""
},
{
"docid": "55209c46188931549d085585422785e2",
"score": "0.7116881",
"text": "def largest_prime_factor(num)\n\tlargest_factor = 1\n\twhile num % 2 == 0\n\t\tlargest_factor = 2\n\t\tnum = num/2\n\tend\n\tprime = 3\n\twhile num != 1\n\t\twhile num % prime == 0\n\t\t\tlargest_factor = prime\n\t\t\tnum = num/prime\n\t\tend\n\t\tprime += 2\n\tend\n\t\"Largest Prime Factor: #{largest_factor}\"\nend",
"title": ""
},
{
"docid": "f228c8412e47a71169bffe2769188081",
"score": "0.7102943",
"text": "def largest_prime_factor(number)\n number.downto(0) do |x|\n return x if number % x == 0 && prime?(x)\n end\n\n\nend",
"title": ""
},
{
"docid": "80c56ac26680798761bbc1cf506152b7",
"score": "0.7095455",
"text": "def largest_prime_factor(number)\n divisors = []\n i = -1\n\n if is_prime?(number)\n return number\n else\n (2...number).each { |n| divisors << n if number % n == 0 }\n end\n\n largest_prime = divisors.select { |prime| prime if is_prime?(prime) }\n largest_prime[-1]\nend",
"title": ""
},
{
"docid": "84cd451945585ff5b4efeb3f27610707",
"score": "0.70903504",
"text": "def problem_12(num = 500)\n # I have two versions, the top yields each prime and then does\n # the maths directly for the number of times each prime goes into\n # the number. The second uses Primes.factors to return the array\n # of prime factors and the big magic line does the maths\n n = 1\n sum = 0\n loop do\n sum += n\n n += 1\n print \"Sum = #{sum} => \"\n\n if true\n divisors = 1\n s = sum\n Primes.each do |p|\n break if p > s\n d_count = 1\n while (s % p).zero? && s != 1\n d_count += 1\n s /= p\n end\n divisors *= d_count\n end\n else\n fac = Primes.factors(sum)\n print \"#{fac.join(' ')} => \"\n # Map to an array of [num,times] values\n # Give the factors, the number of divisors multiplication of the\n # number each of times each prime goes into the number + 1\n divisors = fac.group_by(&:to_i).map {|v,a|\n [v,a.length]}.reduce(1) {|a1,v1| a1 * (v1[1]+1)}\n end\n puts divisors\n return sum if divisors >= num\n end\nend",
"title": ""
},
{
"docid": "44ec35fab4705b4016a3551ea6d6d7f4",
"score": "0.7090228",
"text": "def largest_prime_factor(num)\n largest_prime_number = 0\n (2..Math.sqrt(num)).each do |small_num|\n if num % small_num == 0\n if is_prime?(small_num)\n largest_prime_number = small_num\n end\n end\n end\n return largest_prime_number\nend",
"title": ""
},
{
"docid": "94f5f739fb2a1970ab03073f65d9e122",
"score": "0.70867074",
"text": "def largest_prime_factor(n)\n largest_prime = 0\n (2..n).each do |i|\n if prime?(i) && n % i == 0\n largest_prime = i\n end\n end\n largest_prime\nend",
"title": ""
},
{
"docid": "d1d9e401f17324cabc8d7eac097ca1e0",
"score": "0.7085734",
"text": "def largest_prime_factor(num)\n\n def prime?(num)\n return false if num < 2\n \n (2...num).each do |factor|\n if num % factor == 0\n return false\n end\n end\n true\n end\n\n ((2..num).filter { |divisor| prime?(divisor) && num % divisor == 0 }).max\nend",
"title": ""
},
{
"docid": "9f4b66c6646641abe386e468830eb468",
"score": "0.70772964",
"text": "def largest_prime_factor(number)\n\tputs \"starting ...\"\n\tnumber_half = number / 2\n\tlargest_prime_factor = 0\n\n\tputs 'testing prime numbers from largest ...'\t\n\twhile largest_prime_factor == 0\n\t\tb = (number_half..0).first\n\t\tputs b\n\n\t\t(1..number_half).reverse_each do |num|\n\n\t\t\tdividable_by = []\n\t\t\t# check if prime.\n\t\t\t\t# Prime number only devisable by 1 and itself\n\t\t\t(1..num).each do |div_n|\n\t\t\t\tif num % div_n == 0\n\t\t\t\t\tdividable_by << div_n\n\t\t\t\tend\n\t\t\t\tbreak if dividable_by.length > 3\n\t\t\tend\n\t\t\t# build array with primes\n\t\t\tif dividable_by.length == 2\n\t\t\t\tputs \"prime number: #{num} tested as highest factor\"\n\t\t\t\tif number % num == 0\n\t\t\t\t\tputs \"Success! The highest prime factor is: #{num}\"\n\t\t\t\t\tlargest_prime_factor = num\n\t\t\t\tend\n\t\t\tend\n\t\t\tbreak if largest_prime_factor != 0\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "8ded712e06d9fa58a86bcb0a3465a96e",
"score": "0.70568395",
"text": "def largest_prime_factor(num)\n factors = (1..num).select { |factor| num % factor == 0}\n factors.select { |el| is_prime?(el) }.max\nend",
"title": ""
},
{
"docid": "44b54c70e61f4abfd78e385283ab19dd",
"score": "0.7047697",
"text": "def largest_prime_factor(inputnum)\n\ttestnum = Math.sqrt(inputnum).floor;\n\tif(testnum%2==0)\n\t\ttestnum +=1;\n\tend\n\n\t#keep looping until found\n\tuntil false\n\t\tif(is_prime(testnum))\n\t\t\tif(inputnum % testnum ==0)\n\t\t\t\treturn testnum;\n\t\t\tend\n\t\tend\n\n\t\ttestnum -=2; #prime number must be odd, in higher term\n\tend\nend",
"title": ""
},
{
"docid": "16195730681cee9e1d7003ca9b74b71b",
"score": "0.7041825",
"text": "def largest_prime_factor(input)\n div = 2\n (input%div==0 ? input/=div : div+=1) until is_prime?(input)\n input\nend",
"title": ""
},
{
"docid": "e60175844fa076bb699917c18dbe07f5",
"score": "0.7040848",
"text": "def calculate_largest_prime_factor(num)\r\n\r\n candidate_factor = 2\r\n largest_factor = candidate_factor\r\n quotient = nil\r\n\r\n while (!candidate_is_prime?(num))\r\n if candidate_is_prime?(candidate_factor)\r\n while num % candidate_factor == 0\r\n \tquotient = num / candidate_factor\r\n \tputs candidate_factor\r\n \tnum = quotient\r\n end\r\n candidate_factor += 1\r\n else\r\n candidate_factor += 1\r\n end\r\n end\r\n puts quotient\r\n puts \"DONE\"\r\nend",
"title": ""
},
{
"docid": "98131b4a0c37d9c3e24d575692409ce2",
"score": "0.70395064",
"text": "def largest_prime_factor(num)\n (1..num).inject do |max, factor|\n isPrime?(factor) && factor > max && num%factor==0 ? factor :max\n end\nend",
"title": ""
},
{
"docid": "269bd2c3d50ba16d6ad9be00727c4b02",
"score": "0.70376056",
"text": "def largest_prime_factor(num)\n return nil if num == 0 || num == 1\n (1..num).select { |i| num % i == 0 && prime?(i) }.last\nend",
"title": ""
},
{
"docid": "519668d7333bf878fbd3965b7873e9c6",
"score": "0.7035356",
"text": "def factor(num)\n # next line and line 13 for checking time spent on calculations \n time = Time.now\n (2...num).each do |i|\n next unless (num % i).zero?\n next unless prime?(num / i)\n\n puts \"the largest prime factor of #{num} is #{num / i}\"\n break\n end\n puts Time.now - time\nend",
"title": ""
},
{
"docid": "faf2625f11e1321167bc4edb9049a471",
"score": "0.7034843",
"text": "def largest_prime_factor(num)\n if num % 2 == 0\n num /= 2 until num % 2 != 0\n end\n factor = 3\n while num > 1\n if num % factor == 0\n num /= factor until num % factor != 0\n else\n factor += 2\n end\n return num if factor * factor > num && num > 1\n end\n factor\nend",
"title": ""
},
{
"docid": "e26976919a460675317986faa75853c4",
"score": "0.7034138",
"text": "def largest_prime_factor(num)\n (2..num).reverse_each do |n|\n if num % n == 0\n return n if prime?(n)\n end\n end\n nil\nend",
"title": ""
},
{
"docid": "bb263dd25f3f6a294cef9bf4fd61f9c8",
"score": "0.70214885",
"text": "def largest_prime_factor(num)\n (1..num).reverse_each do |i|\n return i if num % i == 0 && prime?(i)\n end\nend",
"title": ""
},
{
"docid": "056afe18c033381227105797c0c04225",
"score": "0.70136034",
"text": "def largest_prime_factor(n) \n largest_factor = 1;\n\n # Remove factors of 2 first\n while (n % 2 === 0)\n largest_factor = 2\n n = n / 2\n end\n\n # Now probe odd factors\n p = 3\n while (n != 1)\n while (n % p == 0)\n largest_factor = p\n n = n / p\n end\n p += 2\n end\n\n return largest_factor\n\nend",
"title": ""
},
{
"docid": "9774951195ad779bee935ea07c6158df",
"score": "0.7011925",
"text": "def largest_prime_factor(num)\n if prime?(num)\n return num\n end\n\n (num-1).downto(2).each do |factor|\n if prime?(factor) && num % factor == 0\n return factor\n end\n end\nend",
"title": ""
},
{
"docid": "057c6856da980cf5355e6a3c5f65ec12",
"score": "0.70109403",
"text": "def largest_prime_factor(number)\n i = number\n while i > 1\n if number % i == 0 && prime?(i)\n return i\n end\n i -= 1\n end\nend",
"title": ""
},
{
"docid": "9eb88b6092dc28f618d5c494ae1d819e",
"score": "0.7001587",
"text": "def largest_prime_factor(num)\n # should return the largest divisor of the number that is also a prime number\n factor_array = []\n (2..num).each do |factor|\n if num % factor == 0\n factor_array << factor\n end\n end\n prime_array = factor_array.select{|n| prime?(n)}\n prime_array[-1]\nend",
"title": ""
},
{
"docid": "a7031d0859c0b3f54c2569efe71c329b",
"score": "0.7000854",
"text": "def largest_prime_factor(number)\n array = []\n (2..number).each do |x| \n if (number % x == 0) && Prime.prime?(x)\n array << x\n end \n end\n array.sort!.last\nend",
"title": ""
},
{
"docid": "314b8d7811043e7bd3b7dfb2be3f6f97",
"score": "0.69893867",
"text": "def largest_prime_factor(num)\n i = num\n while i > 1\n if prime?(i) && num % i == 0\n return i\n end\n\n i -= 1\n end\n\nend",
"title": ""
},
{
"docid": "9aead1c051c8d154980b02197b6fd388",
"score": "0.69843316",
"text": "def largest_prime_factor(num)\n divisors = []\n divisor = 2\n\n while num > 1\n if num % divisor == 0\n num /= divisor\n divisors << divisor\n else\n divisor += 1\n end\n end\n\n divisors.max\nend",
"title": ""
},
{
"docid": "853b1de0591219c985f03e6f15cd50fc",
"score": "0.69781905",
"text": "def largest_prime_factor(number)\n candidate_greatest_prime = number / 2\n \n while candidate_greatest_prime > 1\n return candidate_greatest_prime if number % candidate_greatest_prime == 0 && is_prime?(candidate_greatest_prime)\n candidate_greatest_prime -= 1\n end\n \nend",
"title": ""
},
{
"docid": "117dd9e874b0bf018988ee123d3d74c2",
"score": "0.697715",
"text": "def largest_prime_factor(num)\n return num if prime?(num)\n largest = 0\n\n (2..num-1).each do |i|\n largest = i if num % i == 0 && prime?(i)\n end\n largest\nend",
"title": ""
},
{
"docid": "6cc79cbaa5c846df3f14ca3493ebaa7a",
"score": "0.697423",
"text": "def largest_prime_factor(n)\n i = n\n while i >= 2\n return i if is_prime?(i) && n % i == 0\n i -= 1\n end\nend",
"title": ""
},
{
"docid": "34f4f3dadf7cfe513cec3c10a1337e54",
"score": "0.6972464",
"text": "def find_largest_prime(number)\n sol_space = number / 2\n for num in sol_space.downto(3)\n if is_prime?(num)\n if number % num == 0\n return num\n end\n end\n end\n return \"There are no prime factors\"\nend",
"title": ""
},
{
"docid": "5ecb7a7dd9c22bfbe36da907b6188a71",
"score": "0.69720495",
"text": "def largestPrimeFactor(n)\n i = 2\n max = n\n while i <= n\n while max % i == 0\n if max = i\n return max\n end\n max = max / i\n end\n i += 1\n end\nend",
"title": ""
},
{
"docid": "42171c37cc184a2c95a8f849e42e4da7",
"score": "0.6970433",
"text": "def largest_prime_factor_of(limit, factor=2)\n while limit > 1\n limit % factor == 0 ? limit /= factor : factor += 1\n end\n factor\nend",
"title": ""
},
{
"docid": "cd91610cfc33513c0b7274a10e6fada1",
"score": "0.6966034",
"text": "def problem41\n max = 0\n 1.upto(9) do |n|\n (1..n).to_a.permutation.to_a.each do |x|\n test = x.join.to_i\n max = test if isPrime(test) && test > max\n end\n end\n max\nend",
"title": ""
},
{
"docid": "a41951886eda4f3867d5b711fb7100e3",
"score": "0.69603825",
"text": "def max_prime_factor(number, factor)\n factor += 1 while number % factor != 0\n if (number > factor)\n return [factor, max_prime_factor(number / factor, factor)].max\n end\n return factor\nend",
"title": ""
},
{
"docid": "8289fb86558219de05397402ca355b28",
"score": "0.69585806",
"text": "def largest_prime_factor(num_input)\r\n\t# copy input since num will be modified\r\n\tnum = num_input\r\n\t# stores prime factors\r\n\tprime_factors = Hash.new\r\n\r\n\t# check each possible prime factor (other than num itself)\r\n\t(2..(num / 2)).each do |prime|\r\n\t\t# until every power of prime as been factored out of num\r\n\t\tuntil num % prime != 0\r\n\t\t\tprime_factors[prime] = true\r\n\t\t\tnum /= prime\r\n\t\tend\r\n\r\n\t\t# break if all prime factors have been factored out of num\r\n\t\tbreak if num == 1\r\n\tend\r\n\r\n\t# if prime_factors is empty, then num is prime\r\n\tprime_factors.empty? ? num : prime_factors.keys.max\r\nend",
"title": ""
},
{
"docid": "4b1e4d00aa28a2ce182dbee493685afc",
"score": "0.693779",
"text": "def largest_prime_factor(n)\n def prime?(x)\n if x < 2\n return false\n else\n (2..x-1).each do |e|\n if x % e == 0\n return false\n end\n end\n return true\n end\n end\n count = n\n while (count >= 2)\n if n % count == 0 and prime?(count)\n return count\n else\n count = count - 1\n end\n end\nend",
"title": ""
},
{
"docid": "d38d3f254f2a401c5ac1eff03eda6cc8",
"score": "0.6934531",
"text": "def largest_prime_factor(num)\n num.downto(2) do |factor|\n return factor if num % factor == 0 && is_prime?(factor)\n end\nend",
"title": ""
},
{
"docid": "7367d9101eab8d8ebdb74ba80ccb4e5f",
"score": "0.69337094",
"text": "def getResult()\n\n\tn = 600851475143\n\n\tlargestPrime = 1\n\n\tdivisor = n\n\n\ti = 2\n\twhile i < divisor\n\t\tif divisor % i == 0\n\t\t\tdivisor = divisor / i\n\t\tend\n\t\ti = i + 1\n\tend\n\treturn divisor\nend",
"title": ""
},
{
"docid": "8165a6f2a065ee08e2b5a3c5df76e734",
"score": "0.6931116",
"text": "def greatest_prime_factor(n)\n if (prime?(n))\n return n\n end\n i = 3\n while i < Math.sqrt(n).to_i\n if ( n % i == 0 )\n return greatest_prime_factor(n/i)\n end\n i += 2\n end\nend",
"title": ""
},
{
"docid": "098dbc03009db050b8d3dab18457169e",
"score": "0.69281024",
"text": "def largest_prime_factor(num)\n divisor = 1 \n (1..num).each do |value|\n if num % value == 0 && prime?(value) && value > divisor\n divisor = value\n end\n end\n return divisor\nend",
"title": ""
},
{
"docid": "a3af5403fc4ca7de6861d8d3c0b71279",
"score": "0.6925285",
"text": "def largest_prime_factor(number)\n prime_factors(number)\n p @factor_array.last\nend",
"title": ""
},
{
"docid": "5770242792e4a8f013513f43cb3f0cca",
"score": "0.69246835",
"text": "def prime_factorization(num)\n\n end",
"title": ""
},
{
"docid": "e7f7d69071207354b865cdf412fd938c",
"score": "0.69210243",
"text": "def largest_prime_factor(num)\n num.downto(2) do |factor|\n return factor if num % factor == 0 && is_prime?(factor)\n end\nend",
"title": ""
}
] |
dffe0ed0ce7b2f755ba2d3754309077d
|
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement.
|
[
{
"docid": "b92a9c1b97b0e6382f86571a6809f75f",
"score": "0.55734766",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT DISTINCT title ,SUM(amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title\n SQL\nend",
"title": ""
}
] |
[
{
"docid": "f29c03f41fcbf7f3deef5c9ec9edc233",
"score": "0.91981363",
"text": "def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"title": ""
},
{
"docid": "3c34955a35dbbb73618bec24984ca15e",
"score": "0.70684034",
"text": "def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'music';\n\"\nend",
"title": ""
},
{
"docid": "8d2be6a26afc98cae0393fec8f6b6b1b",
"score": "0.69916224",
"text": "def current_categories(db)\r\n\tretrieve_categories = '\r\n\tSELECT name FROM categories'\r\n\tcategories = db.execute(retrieve_categories)\r\nend",
"title": ""
},
{
"docid": "c4f76ed91df4df2654314a47509c3f22",
"score": "0.6651801",
"text": "def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT projects.category, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects\nON pledges.project_id = projects.id \nWHERE projects.category = 'books';\"\nend",
"title": ""
},
{
"docid": "356fcd21fc5fa68ddc97af123c980329",
"score": "0.66231173",
"text": "def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT Projects.category, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id WHERE Projects.category = 'books';\"\nend",
"title": ""
},
{
"docid": "f6fe22cfa37831451d9e0c39fe2cfe7e",
"score": "0.6513625",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\nend",
"title": ""
},
{
"docid": "7d3ab7a638338ac5909da55e7daaba83",
"score": "0.64876",
"text": "def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end",
"title": ""
},
{
"docid": "097175eac4d7f48bb988381f11bd9f23",
"score": "0.6324443",
"text": "def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end",
"title": ""
},
{
"docid": "5104810a4b6187d2645c416f104eefbd",
"score": "0.6061143",
"text": "def get_category_name(category_id)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category = db.get_first_value(\"select name from category where id = ?\", [category_id])\n\n return categor\nend",
"title": ""
},
{
"docid": "dc06d8b49c15c447915085f18067ecdd",
"score": "0.59409004",
"text": "def projects\n where(:_type => ProjectCategory.name)\n end",
"title": ""
},
{
"docid": "1d828fedcda69d7fed54105e5f350201",
"score": "0.5938305",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title ORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "bb73e4210d613036633546bf7c02149f",
"score": "0.5936245",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(amount) FROM projects\n INNER JOIN pledges ON project_id = projects.id\n GROUP BY title;\"\nend",
"title": ""
},
{
"docid": "898c2dafcfe12105930b5555bc4e64db",
"score": "0.5900887",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title\"\n\n# FROM owners\n# INNER JOIN cats_owners\n# ON owners.id = cats_owners.owner_id\n# JOIN cats ON cats_owners.cat_id = cats.id\n# WHERE cats_owners.owner_id = 2;\n\nend",
"title": ""
},
{
"docid": "34358073b89eeb0e0137f0517b39fcc3",
"score": "0.5882952",
"text": "def current_categorized_expenses(db, user_name)\r\n\tretrieve_categorized_expenses = '\r\n\tSELECT categories.name, amount FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE users.name = ?'\r\n\tcategorized_expenses = db.execute(retrieve_categorized_expenses, [user_name])\r\nend",
"title": ""
},
{
"docid": "7095c83e30fdcb1673aed32c269fabb3",
"score": "0.5870606",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY(projects.title) ;\"\nend",
"title": ""
},
{
"docid": "99f556cf1cee45bb926693bc0797098f",
"score": "0.58542585",
"text": "def getCategories(_, _, _)\n @db.categories\n end",
"title": ""
},
{
"docid": "301fb0e8465c6f6633474d69349f3882",
"score": "0.5853712",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n sql = <<-SQL\n SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title;\n SQL\n\nend",
"title": ""
},
{
"docid": "dfec73b4ae952a35a8ffaabc1a8d7f5c",
"score": "0.5840277",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n <<-SQL\n SELECT projects.title , sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title\n SQL\nend",
"title": ""
},
{
"docid": "816a9bfa92385f9f820a6e5355267a34",
"score": "0.5819194",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\n \n\"SELECT projects.title, SUM(amount) \nFROM pledges \nINNER JOIN projects \nON pledges.project_id = projects.id GROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "64857ec0435fb89211fad9436a8aac50",
"score": "0.5785329",
"text": "def category(id)\n db = connect()\n return db.execute('SELECT Id,Title FROM discussions WHERE CatId=?', id), db.execute('SELECT * FROM categories WHERE Id=?', id)\n end",
"title": ""
},
{
"docid": "0ba768f929630633c95055f7c24e6828",
"score": "0.57822204",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title ORDER BY title\"\nend",
"title": ""
},
{
"docid": "acbe22f3b1d117ccb56deadf1ed3312d",
"score": "0.5699265",
"text": "def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"title": ""
},
{
"docid": "88be64a952ea3303da08e3d89b654a83",
"score": "0.5697001",
"text": "def get_category_id(category)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category_id = db.get_first_value(\"select id from category where name = ?\", [category])\n\n return category_id\nend",
"title": ""
},
{
"docid": "b1fe3e607d9801df3b536d6bea4b2243",
"score": "0.56910396",
"text": "def select(db); end",
"title": ""
},
{
"docid": "b1fe3e607d9801df3b536d6bea4b2243",
"score": "0.56910396",
"text": "def select(db); end",
"title": ""
},
{
"docid": "54f6c2b7fb918eec919a85201ad53554",
"score": "0.569008",
"text": "def get_records_for_category categ\n if categ.nil? or categ == \"\"\n #return @records\n get_data \"select * from todo\"\n else\n #return @records.select { |row| row[0] == categ }\n get_data \"select * from todo where categ = '#{categ}' \"\n end\n end",
"title": ""
},
{
"docid": "6a0fcf95cbd41f4c8ac105a6f71eff5d",
"score": "0.568214",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL \n SELECT projects.title, SUM(pledges.amount)\n FROM projects \n INNER JOIN pledges on projects.id = pledges.project_id \n GROUP BY projects.title\n ORDER BY projects.title\n SQL\nend",
"title": ""
},
{
"docid": "6801f0ff14e50ab78210f2b6e0fbc64a",
"score": "0.5679455",
"text": "def project_statement\n project_clauses = []\n active_subprojects_ids = []\n\n active_subprojects_ids = project.descendants.active.map(&:id) if project\n if active_subprojects_ids.any?\n if has_filter?(\"subproject_id\")\n case operator_for(\"subproject_id\")\n when '='\n # include the selected subprojects\n ################\n # Smile specific : [project.id] + removed\n ids = values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!'\n # exclude the selected subprojects\n\n ################\n # Smile specific : [project.id] + removed\n ids = active_subprojects_ids - values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!*'\n # main project only\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n else\n # all subprojects\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n end\n elsif Setting.display_subprojects_issues?\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n else\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n elsif project\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n project_clauses.any? ? project_clauses.join(' AND ') : nil\n end",
"title": ""
},
{
"docid": "6c0b8dc1270a70a37154e2b9d5f317be",
"score": "0.563316",
"text": "def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end",
"title": ""
},
{
"docid": "b98c48529debf8485981cfa450134f2f",
"score": "0.56282234",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\nSQL\nend",
"title": ""
},
{
"docid": "75fde2eee6245e5b7edf1a4e78e1e306",
"score": "0.56202763",
"text": "def index\n\n # @sql = \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n @sql = params[:name].present? ? \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" : \"Projects.name ILIKE '%' \"\n @sql += \"OR Projects.description ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n\n @sql += \"and Projects.category ILIKE '#{'%'+params[:categorysdigital]+'%'}' \" if params[:categorysdigital].present?\n if params[:categorysdigital].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n end\n\n if params[:categorysdigital].present? || params[:categorysmarketing].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n end\n\n @sql += \"and Projects.progress = #{params[:progresspropose].to_i} \" if params[:progresspropose].present?\n if params[:progresspropose].present?\n @sql += \"or Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n else\n @sql += \"and Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n end\n\n if params[:progressselected].present?\n @sql += \"or Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n else\n @sql += \"and Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n end\n\n # @sql += \"ORDER progress\"\n @projects = Project.where(@sql).order(:progress)\n @count = @projects.count\n @count_tt = Project.count\n end",
"title": ""
},
{
"docid": "17ad9a425c47242cc53c106d852af787",
"score": "0.562004",
"text": "def projects_countries(site, category_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"title": ""
},
{
"docid": "44a7b1f202ca5ccfe78ec8b692f3919a",
"score": "0.561618",
"text": "def projects_countries(site, category_id = nil)\n if category_id.present?\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now())\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"title": ""
},
{
"docid": "0bac6e5314789cfaf1134d8d6c006a61",
"score": "0.5589269",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects \nON pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "fccbb01eb09aab72d0d8c4a7e8a4b806",
"score": "0.558222",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n# Select projects title column and the sum of the pledges amount column\n# from the projects database,\n# join the pledges (Join table)\n# with projects.id and the pledges project id. Match these numbers\n# Group the tables together by Projects title and then\n# sort by projects.title\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM Projects\n JOIN Pledges\n ON Projects.id = Pledges.project_id\n GROUP BY Projects.title\n ORDER BY Projects.title;\n\"\nend",
"title": ""
},
{
"docid": "051705c572158a6a436e2aae52c0aeb2",
"score": "0.55741537",
"text": "def get_project_name(id)\n con = PG::Connection.connect(\"localhost\",5432,nil,nil,\"aaa\",\"admin\")\n sql = \"SELECT name \"\n sql += \"FROM projects \"\n sql += \"WHERE id='#{id}' \"\n res = con.exec(sql)\n con.close\n name = \"NA\"\n name = res[0]['name'] if res.num_tuples > 0\nend",
"title": ""
},
{
"docid": "94c958bd2e4c25d68806d565b3a77fa4",
"score": "0.55726343",
"text": "def sql\n <<-SQL\n -- Search learning paths\n SELECT DISTINCT\n c.id,\n c.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_path' AS content_type,\n c.id AS learning_path_id,\n 0 AS learning_objective_id\n FROM courses c\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = c.id AND ts.taggable_type = 'LearningPath'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = c.id AND cc.contentable_type = 'LearningPath'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_course_worklow_clause}\n #{construct_name_sql}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning objectives\n SELECT DISTINCT\n cm.id,\n cm.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_objective' AS content_type,\n cm.context_id::bigint AS learning_path_id,\n cm.id::bigint AS learning_objective_id\n FROM context_modules cm\n INNER JOIN courses c\n ON c.id = cm.context_id\n AND cm.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = cm.id AND ts.taggable_type = 'LearningObjective'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = cm.id AND cc.contentable_type = 'LearningObjective'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('cm')}\n #{construct_name_sql('cm')}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning learning_event\n SELECT DISTINCT\n ct.id,\n ct.title AS name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_event' AS content_type,\n ct.context_id::bigint AS learning_path_id,\n ct.context_module_id::bigint AS learning_objective_id\n FROM content_tags ct\n INNER JOIN courses c\n ON c.id = ct.context_id\n AND ct.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = ct.id AND ts.taggable_type = 'LearningEvent'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = ct.id AND cc.contentable_type = 'LearningEvent'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('ct')}\n #{construct_name_sql('ct', 'title')}\n #{construct_all_tags_search('t', 'name')}\n SQL\n end",
"title": ""
},
{
"docid": "12783c137d9809e3bf45e1db7c8faa26",
"score": "0.556879",
"text": "def get_category_name\n Category.find(:first, :select => ['name'],:conditions=>['has_complexity=?',false]).name rescue ''\n end",
"title": ""
},
{
"docid": "cb4fcc23ac24580103813b1893f1373d",
"score": "0.55442446",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"\nSELECT \nProjects.title,\nSUM(Pledges.amount)\nFROM Pledges\nINNER JOIN Projects\nON Pledges.project_id = Projects.id\nGROUP BY Projects.title\nORDER BY Projects.title\n\"\nend",
"title": ""
},
{
"docid": "02024b3d38348c0fda890b38cec2a45f",
"score": "0.55411935",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(pledges.amount) \nFROM projects \nJOIN pledges \nON Projects.id = pledges.project_id \nGROUP BY title\"; \nend",
"title": ""
},
{
"docid": "17a3f2fffe2dddb3815c1173e7141f7f",
"score": "0.5527624",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges \nON projects.id=pledges.project_id\nGROUP BY projects.id\nORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "43dd3ce30a81adfa389baf3d399a5259",
"score": "0.5487611",
"text": "def makeQueryTableAll(tableName)\n #sql = \"SELECT * FROM [\" << tableName << \"]\"\n sql = \"SELECT * FROM [\" << tableName << \"]\" << \" WHERE id < 3\"\n #puts(sql) #debug\n return sql\nend",
"title": ""
},
{
"docid": "f42e6a5004a2a8ee6ff8db7a78bd67b2",
"score": "0.5480295",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"SELECT projects.title, sum_pledges FROM (SELECT pledges.project_id, SUM(pledges.amount) AS sum_pledges FROM pledges GROUP BY pledges.project_id) INNER JOIN projects ON projects.id = project_id ORDER BY projects.title\"\nend",
"title": ""
},
{
"docid": "5f74267edd1e69bd113ae5da88396027",
"score": "0.54792297",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\nSELECT projects.title, SUM(pledges.amount) \nFROM projects \nINNER JOIN pledges on projects.id = pledges.project_id\nGROUP BY (pledges.project_id)\nORDER BY projects.title;\nSQL\nend",
"title": ""
},
{
"docid": "6e1eecba85933cb3f973f3faabab5392",
"score": "0.5478854",
"text": "def category_totals(db, user_name, number)\r\n\tretrieve_totals = '\r\n\tSELECT categories.name, SUM(amount) FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE categories.id = ?\r\n\tAND users.name = ?'\r\n\ttotals = db.execute(retrieve_totals, [number, user_name])[0]\r\nend",
"title": ""
},
{
"docid": "1d9339fceb54779a30f19ad46b5856e0",
"score": "0.5475931",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\r\n\"SELECT title, SUM(pledges.amount) FROM projects\r\nJOIN pledges ON projects.id = pledges.project_id\r\nGROUP BY projects.id\r\nORDER BY title ASC\"\r\nend",
"title": ""
},
{
"docid": "7bcdd1ccfeeb1d38c3d4d6421cfa4a6d",
"score": "0.5466553",
"text": "def add_category(db, category)\r\n\tnew_category = '\r\n\tINSERT INTO categories (name)\r\n\tVALUES (?)'\r\n\tdb.execute(new_category, [category])\r\nend",
"title": ""
},
{
"docid": "a6127d8903788016cb435702be92705f",
"score": "0.54620075",
"text": "def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"title": ""
},
{
"docid": "a1eb2aa0209990f07fe3db0eec625186",
"score": "0.54591227",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Select title, amount from projects, pledges where projects.id = pledges.id order by title ASC;\"\nend",
"title": ""
},
{
"docid": "ddaf05c5be466e1fb39b37973edfce2f",
"score": "0.54512274",
"text": "def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"title": ""
},
{
"docid": "a8697d8e9d878a18a82eacd5a3f4c4ac",
"score": "0.5447939",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id=pledges.project_id GROUP BY projects.title;\"\n## FROM - where are they talking to each other - where is the scotch tape\nend",
"title": ""
},
{
"docid": "760c4894c4131bea7a6a9365fe1584e5",
"score": "0.5432765",
"text": "def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"title": ""
},
{
"docid": "688b8a310d816a3b8358c6bec4130db3",
"score": "0.5430723",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title,\n SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\n\nend",
"title": ""
},
{
"docid": "a44ab649d30399e7766b73d29eaeca76",
"score": "0.5429964",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, \nSUM(pledges.amount) \nFROM projects\nJOIN pledges ON pledges.project_id = projects.id\nGROUP BY projects.title\nORDER BY projects.title ASC;\"\nend",
"title": ""
},
{
"docid": "3d91f01b2f5106847268898fb4669073",
"score": "0.5428628",
"text": "def select_all(sql, name = nil) end",
"title": ""
},
{
"docid": "775c4e257e584b8080ea13ff3cfc1b53",
"score": "0.54243755",
"text": "def select\n @pds_projects = PdsProject.includes(:company).where('ProjectID in (?)', PROJECT_LIST)\n end",
"title": ""
},
{
"docid": "5a8653185913dc5b389b64d283a5562c",
"score": "0.5423199",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(amount) AS pledge_amount\nFROM pledges\nJOIN projects\nWHERE pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "32d87bb2a763e7ef6cc7b1476a0dc642",
"score": "0.5422102",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL\n SELECT\n title, sum(amount)\n FROM\n projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY\n title\n ORDER BY\n title\n SQL\nend",
"title": ""
},
{
"docid": "00d663cbaee44bd9b46cdddc8dd54b16",
"score": "0.5416082",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount )\nFROM projects \nJOIN pledges\nON projects.id = pledges.project_id \nGROUP BY projects.title \nORDER BY projects.title \";\nend",
"title": ""
},
{
"docid": "0ff788035032dccf88856175c3c88d8e",
"score": "0.54076433",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title,(SELECT SUM(pledges.amount))\n FROM projects\n INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "3fab4dd936523fff2099bd3b5ec8f53e",
"score": "0.5393256",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title ASC;\n \"\nend",
"title": ""
},
{
"docid": "fc37a65712eccd147e0b0c7fa93f11cc",
"score": "0.5386254",
"text": "def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"title": ""
},
{
"docid": "b40bfbd87ad714a33707c9af5a9452f8",
"score": "0.53844714",
"text": "def get_category(cate, limitl, limitr)\n return Product.find_by_sql(\"select * from products where tag like '%#{cate}%' order by id limit #{limitl}, #{limitr}\")\n end",
"title": ""
},
{
"docid": "2650e90e5df8a3d69709acc43027c42d",
"score": "0.5382238",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title \"\nend",
"title": ""
},
{
"docid": "23c199c286d238b2465371b2cf7edf00",
"score": "0.53815633",
"text": "def select_project\n @projects = Project.find(:all)\n end",
"title": ""
},
{
"docid": "3c3fcd54f2feb196e2ab253d696b0e58",
"score": "0.5381353",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "5fc1078ef1f80244d73c5388418ed839",
"score": "0.53730273",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "b74419f2035da65fe45dd5ec3705c0fb",
"score": "0.5361857",
"text": "def sql_statement_find\n @sql_statement_find ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :project_plan AS project_plan,\n application_data -> :why_selected_project AS why_selected_project,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice,\n hstore_to_json_loose(slice(application_data, ARRAY[:student0_attrs])) AS student0,\n hstore_to_json_loose(slice(application_data, ARRAY[:student1_attrs])) AS student1\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id\n AND applications.id = :id;\n SQL\n end",
"title": ""
},
{
"docid": "c2ed7a7d11a0d5019117782ff8faf752",
"score": "0.5352266",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM projects\n JOIN pledges\n ON Projects.id = Pledges.project_id\n GROUP BY project_id\n ORDER BY Projects.title\"\nend",
"title": ""
},
{
"docid": "322ddc88b2f65f399b6b63c58fc7defb",
"score": "0.5351445",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON pledges.project_id = projects.id\n GROUP BY projects.title\n ORDER BY projects.title\n\"\nend",
"title": ""
},
{
"docid": "4cd8f58643548772768636790b2089c3",
"score": "0.5348369",
"text": "def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"title": ""
},
{
"docid": "c95081a8e8ae00d212550ecb4a77ff58",
"score": "0.5348134",
"text": "def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"title": ""
},
{
"docid": "bc9cf405743ceafda64e9b140446e8b5",
"score": "0.53479743",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nJOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "3f5ba25356f3f110797a8f12dde545ca",
"score": "0.53419787",
"text": "def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\t@page.css('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\t@db.execute 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend",
"title": ""
},
{
"docid": "f33016c10be3b714b56807349dfc8016",
"score": "0.53407365",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM (pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title ASC;\"\nend",
"title": ""
},
{
"docid": "e36b566121cefd99bfd2755c8dfd4bc2",
"score": "0.5332726",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id GROUP BY Projects.title;\"\nend",
"title": ""
},
{
"docid": "63caa32988f66bf7a735a8ba3300797a",
"score": "0.5332524",
"text": "def add_project_name_to_jql jql_string\n unless jql_string.empty?\n jql_string.insert(0, \"project=#{@project} AND \")\n else\n \"project=#{@project}\"\n end\n end",
"title": ""
},
{
"docid": "01814f1b9198798b6b045e174be9d9c7",
"score": "0.53219175",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.id ORDER BY title;\"\nend",
"title": ""
},
{
"docid": "118c7869e7b829f744cd91ba70acea34",
"score": "0.5321195",
"text": "def search(category, query_term)\nresult = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\");\n puts student\n result.each do |student|\n puts \"#{k}: #{v}\"\n end\nend",
"title": ""
},
{
"docid": "23e050441d0c1a4f74f15dcccde656c1",
"score": "0.531972",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY(projects.title);\"\nend",
"title": ""
},
{
"docid": "f1a0f715e9bd9e50a2af2997a8370a56",
"score": "0.5312044",
"text": "def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"title": ""
},
{
"docid": "f1a0f715e9bd9e50a2af2997a8370a56",
"score": "0.5312044",
"text": "def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"title": ""
},
{
"docid": "972624844c09200db914e1124f14d1f7",
"score": "0.5306883",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(pledges.amount) FROM projects INNER JOIN pledges on pledges.project_id=projects.id group by pledges.project_id ORDER BY projects.title ASC\"\nend",
"title": ""
},
{
"docid": "8b178945ec5206f4d215f4b98a3326e3",
"score": "0.52992225",
"text": "def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend",
"title": ""
},
{
"docid": "2a4160c29ee0e9d3e926816565014acd",
"score": "0.52966166",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "8561432e3a9e3001e5e5b52a58e244e6",
"score": "0.5290944",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id=projects.id GROUP BY projects.title ORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "261f4b97c39f38837d037f17e9a70c9d",
"score": "0.5286729",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id GROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "afa004d6447a0f845323cf665f00d8ae",
"score": "0.5284725",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n # SELECT titles, amounts FROM projects, pledges ORDER BY titles ASC\n #SELECT titles.projects, pledges.amounts ORDER BY titles ASC\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges \n ON pledges.project_id = projects.id \n GROUP BY(pledges.project_id)\n ORDER BY projects.title ASC\n \";\nend",
"title": ""
},
{
"docid": "9c3cef6b3516409448a2a83a348fc1f3",
"score": "0.5284546",
"text": "def sql_statement_all\n @sql_statement_all ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id;\n SQL\n end",
"title": ""
},
{
"docid": "910aa5df96ab6194f47e359dfade6cd3",
"score": "0.5284275",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges ON pledges.project_id = projects.id\n GROUP BY title\n ORDER BY title ASC;\"\nend",
"title": ""
},
{
"docid": "f33b5253f0b6136cb1fffd56ac800e1a",
"score": "0.5283349",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title ASC;\"\nend",
"title": ""
},
{
"docid": "4580af5254f3b93cae03da5359169f92",
"score": "0.5276348",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"select\nprojects.title,\nsum(pledges.amount) as sum_all_pledges\nfrom projects\ninner join pledges\non projects.id = pledges.project_id\ngroup by projects.title\norder by projects.title;\n\"\nend",
"title": ""
},
{
"docid": "1c4fdf47f2813d38b6c1a1d53d08243d",
"score": "0.52737325",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) \n FROM projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY projects.title;\"\nend",
"title": ""
},
{
"docid": "f94b9104da65960ca5f4f0bc10c8c19b",
"score": "0.52729166",
"text": "def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"title": ""
},
{
"docid": "f0a91748ef9cd2d0cf9a97dc20573947",
"score": "0.5268388",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nLEFT JOIN pledges\nON projects.id=pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"title": ""
},
{
"docid": "7f0a9f7f8d8bd1ffda53d6f049dfecd1",
"score": "0.52644706",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n #SELECT title, SUM(quantity) FROM groceries GROUP BY aisle ORDER BY SUM(quantity);\n\n \"SELECT projects.title, sum( pledges.amount)\nFROM projects\nJOIN pledges\nwhere projects.id=pledges.project_id\ngroup by projects.title order by projects.title\n;\"\n\nend",
"title": ""
},
{
"docid": "0f5c7919ce54cd4d1589aa152a4adb3f",
"score": "0.5259389",
"text": "def frey_example\n # Find all the cats that are the same color as the cat named 'Freyja'.\n # Including 'Freyja' in the results.\n # DO NOT USE A SUBQUERY\n\n execute(<<-SQL)\n SELECT\n color_cats.name\n FROM\n cats AS freyja_cats\n JOIN\n cats AS color_cats ON freyja_cats.color = color_cats.color\n WHERE\n freyja_cats.name = 'Freyja';\n SQL\nend",
"title": ""
},
{
"docid": "6ac2a165974fa9f51597a8937eb1eeb1",
"score": "0.5256466",
"text": "def select &blck\n @projects.select(&blck)\n end",
"title": ""
},
{
"docid": "6ac2a165974fa9f51597a8937eb1eeb1",
"score": "0.5256466",
"text": "def select &blck\n @projects.select(&blck)\n end",
"title": ""
},
{
"docid": "edc5d2bed2b6e34e44eacf3f4048925a",
"score": "0.52551633",
"text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT p.title, SUM(pl.amount) FROM pledges pl INNER JOIN projects p ON pl.project_id = p.id GROUP BY pl.project_id ORDER BY p.title\"\nend",
"title": ""
}
] |
685015d75cb079efb0c62e696a38e26b
|
additional names for convieniencee
|
[
{
"docid": "789ecd92951eb3974efe57289b3fc79b",
"score": "0.0",
"text": "def user \n\t\tself.viewer\n\tend",
"title": ""
}
] |
[
{
"docid": "40ba36ef5bb45ebc29ece43ad379653c",
"score": "0.6810477",
"text": "def possible name ; end",
"title": ""
},
{
"docid": "0430b5e3f4873113d804699ac5b29902",
"score": "0.67880803",
"text": "def cop_names; end",
"title": ""
},
{
"docid": "9f9409c4583549771b4c0f529aa94f09",
"score": "0.6702104",
"text": "def name ; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.65215665",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6520685",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6520366",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6520366",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
},
{
"docid": "6e1ada2a1ca2235d1d4411d51623a583",
"score": "0.6519791",
"text": "def name; end",
"title": ""
}
] |
0fadf911b35d29dbe16f67e23c8b28cc
|
DELETE /subdomains/1 DELETE /subdomains/1.xml
|
[
{
"docid": "722a7a65e4c52b6e746f2eb6957daeec",
"score": "0.738915",
"text": "def destroy\n @subdomain = Subdomain.find(params[:id])\n @subdomain.delete\n\n respond_to do |format|\n format.html { redirect_to(subdomains_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
}
] |
[
{
"docid": "264301fd08fa640264e85ab33b603fc4",
"score": "0.67641795",
"text": "def delete(*args)\n url, subdomain, path, = parse_args(*args)\n rewrap_errors do\n RestClient.delete(build_url(url || subdomain, path), headers)\n end\n end",
"title": ""
},
{
"docid": "f81ac6ffd0feeb7e902319ebf46598b0",
"score": "0.6520768",
"text": "def destroy\n @ensembl_subdomain.destroy\n respond_to do |format|\n format.html { redirect_to ensembl_subdomains_url, notice: 'Ensembl subdomain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "694c4c1f68f8d94bc08b6ee7062bbaf1",
"score": "0.64874214",
"text": "def domains_slaves_axfrout_delete(domain, axfrip)\n result = call('domains.slaves.axfrout.delete', :domain => domain, :axfrip => axfrip)\n result[:domain] ||= domain\n result\n end",
"title": ""
},
{
"docid": "b44108af4c65c4bf9c06b64d4a948660",
"score": "0.64504397",
"text": "def destroy\n @subdomain.destroy\n redirect_to @user, notice: \"Successfully destroyed subdomain.\"\n end",
"title": ""
},
{
"docid": "3815e1963069aa7b642bf790d0ca21ba",
"score": "0.6440212",
"text": "def destroy\n @subdomain.destroy\n respond_to do |format|\n format.html { redirect_to subdomains_url, notice: 'Subdomain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a9cdf07abd2f7a88bb3bcc4c652167b8",
"score": "0.6403753",
"text": "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"title": ""
},
{
"docid": "346cfb3499ac40a4bffd6d6c147ba1d7",
"score": "0.6340213",
"text": "def destroy\n @email_domain = Email::Domain.find(params[:id])\n @email_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_domains_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1f4d01fefb6c9dab5dbdfd8a947d3c22",
"score": "0.62867856",
"text": "def delete_domain(session,id)\n result = @connection.rest_request(\n method: :get,\n path: \"/mps_setup/delete_domain/#{id}\",\n session: session\n )\n xml = result.body.sub(/(?<=\\<n:delete_domainResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:delete_domainResponse).*?(?=\\>)/,\"delete_domainResponse\")\n return Hash.from_xml(xml).to_json\n end",
"title": ""
},
{
"docid": "d05cf3b8c46dfd01df9200a5beafba45",
"score": "0.62555975",
"text": "def destroy\n @domain = Domain.find(params[:id])\n @domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(domains_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0c7deb90812bea4ec3c0c91b4ede148d",
"score": "0.6180233",
"text": "def destroy\n @domain = DOMAIN.first_or_get(params[:id])\n @domain.destroy if @domain\n\n respond_to do |format|\n flash[:notice] = 'Domain was successfully deleted.'\n format.html { redirect_to(domains_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9c9ef725f610b1c08ce8b2e7ab9457d1",
"score": "0.61604017",
"text": "def domain_delete(domain)\n response = send_request(domain_delete_xml(domain))\n\n get_result(response)\n end",
"title": ""
},
{
"docid": "54d0a6f99d934c56f88ae2b91bc45450",
"score": "0.61467797",
"text": "def destroy\n @domain.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "cd05208f1579180f72480c15c74978e1",
"score": "0.61459935",
"text": "def tenant_delete(tenant_id)\n\t\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = tenant_id\n\t\t end\n\t\t\n\t\tputs \"invoked tenant delete\"\n\tend",
"title": ""
},
{
"docid": "de6a1909b07be0cc30fadbded5b829b2",
"score": "0.6088693",
"text": "def delete(domain_name)\n domain_name = @client.url_encode(domain_name)\n @client.call(method: :delete, path: \"tracking-domains/#{domain_name}\")\n end",
"title": ""
},
{
"docid": "309869a82a4aa03159c6cf378da80802",
"score": "0.6084797",
"text": "def destroy\n @subsite = Subsite.find(params[:id])\n @subsite.destroy\n\n respond_to do |format|\n format.html { redirect_to subsites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c1592c9a7c989d01a99d8c2f4e789eab",
"score": "0.6059525",
"text": "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"title": ""
},
{
"docid": "a4120cb5db590848c82567056750f1cc",
"score": "0.5999935",
"text": "def destroy\n @sub = Sub.find(params[:id])\n @sub.destroy\n\n respond_to do |format|\n format.html { redirect_to(subs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d05421e60e37ab4f3b63c08aa1ba0124",
"score": "0.59850746",
"text": "def domain_ns_del(domain, ns_list)\n call('domain_ns_del', domain, ns_list)\n end",
"title": ""
},
{
"docid": "ff835644dc94bc693944ae6d103b8417",
"score": "0.5979973",
"text": "def destroy\n name, type = resource[:name].split('/')\n case type\n when 'MX'\n @dnsres.each do |res|\n preference = res.preference\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} MX #{preference} #{target}.\n send\")\n end\n when 'SRV'\n @dnsres.each do |res|\n priority = res.priority\n weight = res.weight\n port = res.port\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n rdata = @dnsres.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} #{type} #{rdata}\n send\")\n end\n end",
"title": ""
},
{
"docid": "76cd613c0c7cb9fa4b8974e35141b45d",
"score": "0.5941845",
"text": "def delete_terms_in_domain(domain)\n before = query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' RETURN COUNT(term)\")[\"data\"].first.first\n query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' DETACH DELETE term\")\n after = query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' RETURN COUNT(term)\")[\"data\"].first.first\n raise \"Not all were deleted (before: #{before}, after: #{after})\" if after.positive?\n before\n end",
"title": ""
},
{
"docid": "00391f84453845780d4945efd8b5b736",
"score": "0.593025",
"text": "def delete\n @options[:connection].delete(\"/namespaces/#{path}\") && true\n end",
"title": ""
},
{
"docid": "2d3fd8ff79da0733787e855b7a644735",
"score": "0.5900633",
"text": "def delete_node(domain, node)\n redis.smembers(\"pubsub:#{domain}:subscribers_#{node}\") do |subscribers|\n redis.multi\n subscribers.each do |jid|\n redis.srem(\"pubsub:#{domain}:subscriptions_#{jid}\", node)\n end\n redis.del(\"pubsub:#{domain}:subscribers_#{node}\")\n redis.srem(\"pubsub:#{domain}:nodes\", node)\n redis.exec\n end\n end",
"title": ""
},
{
"docid": "5f7b93426283a24b223cc43dbd8b9fa0",
"score": "0.5895649",
"text": "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end",
"title": ""
},
{
"docid": "973c7c831fa6b5589f5d6f4bccbb7c4c",
"score": "0.5891568",
"text": "def destroy\n @subrelation = Subrelation.find(params[:id])\n @subrelation.destroy\n\n respond_to do |format|\n format.html { redirect_to(subrelations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ef8fce892177d523fddafeee3a401b57",
"score": "0.5867683",
"text": "def delete_agent_domain\n return false unless validate_domain\n render json: dme.delete_domain(params[:domain])\n end",
"title": ""
},
{
"docid": "b8136ddc1a9b97240be506c691a0cf3a",
"score": "0.5866152",
"text": "def destroy\n # TODO: refactor models so that externaluserdomain is in portal namespace?\n # @external_user_domain = Portal::ExternalUserDomain.find(params[:id])\n @external_user_domain = ExternalUserDomain.find(params[:id])\n @external_user_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_external_user_domains_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6fd6e92c4da0474c412fcae2d3dc8226",
"score": "0.58554345",
"text": "def destroy\n @sub_page = SubPage.find(params[:id])\n @sub_page.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_pages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8c5aabdfe4b86ea2b251ebcca556d381",
"score": "0.58500844",
"text": "def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2f5bd7c5dc44808bb2f7b1e7d3abc53b",
"score": "0.58452666",
"text": "def domains_slaves_delete(domain)\n result = call('domains.slaves.delete', :domain => domain)\n result[:domain] ||= domain\n result\n end",
"title": ""
},
{
"docid": "4c1c164b581dbae14285797e584e8fb7",
"score": "0.5834581",
"text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"title": ""
},
{
"docid": "69b205c158f7212cc750ed38fc878f1c",
"score": "0.5834353",
"text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"title": ""
},
{
"docid": "d2e28d5ee109df1a7d73f2ee3d148014",
"score": "0.58283854",
"text": "def destroy\n @subentry = Subentry.find(params[:id])\n @subentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(subentries_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "55506056c4941b179dee60df2c8bf6a4",
"score": "0.5815933",
"text": "def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end",
"title": ""
},
{
"docid": "cc19e78689760288852e87599808a795",
"score": "0.5798634",
"text": "def web_dav_delete(*args, &block)\n args = web_dav_args args\n map_method :delete, args, &block\n end",
"title": ""
},
{
"docid": "3f57db61f4b81e6f1d5bfacccaaf6951",
"score": "0.5775966",
"text": "def delete(connection)\n r = connection.execute(%(<SiteDeleteRequest session-id=\"#{connection.session_id}\" site-id=\"#{@id}\"/>))\n r.success\n end",
"title": ""
},
{
"docid": "e5d6a64b542392a282346ed297ad76ae",
"score": "0.57635444",
"text": "def destroy\n\t\t\t @sub = Sub.find(params[:id])\n\t\t\t @sub.destroy\n\t\t\t head :no_content\n\t\t end",
"title": ""
},
{
"docid": "ca97b4c8095898e7413008c34bfc5060",
"score": "0.5760321",
"text": "def destroy\n @domain = Domain.find(params[:id])\n @domain.destroy\n\n respond_to do |format|\n format.html { redirect_to domains_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2d8764b1f2f25110816a17f73f497f0e",
"score": "0.5754114",
"text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"title": ""
},
{
"docid": "d644fe827d3b003133ebdeb8701a7080",
"score": "0.5751325",
"text": "def destroy\n @subsubtopic = Subsubtopic.find(params[:id])\n @subsubtopic.destroy\n\n respond_to do |format|\n format.html { redirect_to(subsubtopics_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d0a7147c7a402181f21c55e81e61357c",
"score": "0.57512105",
"text": "def delete(id)\n _params = {:id => id}\n return @master.call 'subaccounts/delete', _params\n end",
"title": ""
},
{
"docid": "4f0c22f39b2cdea823e055066baf22b0",
"score": "0.5744948",
"text": "def destroy\n @domain.destroy\n redirect_to domains_url\n flash[:notice] = \"Deleted successfully\"\n end",
"title": ""
},
{
"docid": "560cf4b6a38ef2b6df6774f83d7e8e6c",
"score": "0.57254004",
"text": "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to(contact_info_admin_websites_url) }\n format.xml { head :ok }\n end\n add_log(user: current_user, action: \"Deleted website: #{@website.url}\")\n end",
"title": ""
},
{
"docid": "12b86c71df3c9245c32ea02dcf2468ca",
"score": "0.57151634",
"text": "def destroy\n\t\t\t @appsubs = AppSub.find(params[:id])\n\t\t\t @appsubs.destroy\n\t\t\t head :no_content\n\t\t end",
"title": ""
},
{
"docid": "66909fcbf43761a4081f86c2d222a1a7",
"score": "0.5699767",
"text": "def destroy\n @subcategory = Subcategory.find(params[:id])\n @subcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to(subcategories_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f7bbb7772290cc6eed6ee3a67a7105fc",
"score": "0.5690196",
"text": "def delete(domain_guid)\n domain = @client.domain(domain_guid)\n domain.delete(:recursive => true)\n end",
"title": ""
},
{
"docid": "8bfa9c88dbab4e2c3781f5d700088f54",
"score": "0.5688073",
"text": "def destroy\n r = self.class.delete(\"/domains/#{@@parent_id}/records/#{self.id}\")\n if r.code == 200\n self\n else\n raise StandardError, 'Could not delete the record'\n end \n end",
"title": ""
},
{
"docid": "8535f07dfa3f295a5372eb3235eb03e8",
"score": "0.56639904",
"text": "def delete_dns_record(domain, record_id)\n connection.post \"/dns/delete/#{domain}\", { :record_id => record_id }\n end",
"title": ""
},
{
"docid": "97688feca71ab3c8f971e170b49fe211",
"score": "0.566346",
"text": "def delete(id)\n post('deleteSubAccount', userId: id)\n end",
"title": ""
},
{
"docid": "38fdfe9917bbd7a513fe4e00337ae972",
"score": "0.56568086",
"text": "def remove_domain(domain_id)\n delete(\"dns/#{domain_id}\")\n end",
"title": ""
},
{
"docid": "34264605c47edda6ffe32df87c7a7266",
"score": "0.5654336",
"text": "def delete\n delete_from_server single_url\n end",
"title": ""
},
{
"docid": "d8bd83770acacaca53e942e1ce7527f0",
"score": "0.5643023",
"text": "def delete_domain(domain)\n raise MogileFS::ReadOnlyError if readonly?\n ! @backend.delete_domain(:domain => domain).nil?\n end",
"title": ""
},
{
"docid": "38f23ff7aa0362fadc307ce7be5af17e",
"score": "0.5642676",
"text": "def destroy\n @sub_region = SubRegion.find(params[:id])\n @sub_region.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_regions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "fc724e25161efca7a35f45a92c5f89c5",
"score": "0.563226",
"text": "def destroy\n @crm_domain.destroy\n respond_to do |format|\n format.html { redirect_to crm_domains_url, notice: 'Домен удален.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6122b6abf01035a7046744c6601d5d2f",
"score": "0.5618244",
"text": "def destroy\n @can_sub = CanSub.find(params[:id])\n @can_sub.destroy\n\n respond_to do |format|\n format.html { redirect_to(can_subs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f078db2a9f27fd44389b1de9826567f1",
"score": "0.5615796",
"text": "def destroy\n @short_domain = ShortDomain.find(params[:id])\n @short_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to short_domains_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "93691ae0153b86f63317b84cd0265d3d",
"score": "0.5613436",
"text": "def destroy\n @subcategory = @category.subcategories.find(params[:id])\n @subcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to(kadmin_category_subcategories_url(@category)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8e3b6114441a7f21fd10a5ebebc98244",
"score": "0.56014866",
"text": "def deleteEntityWebsite( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/website\",params)\n end",
"title": ""
},
{
"docid": "69b6f12d527fbe53b741a0faed4a6aa9",
"score": "0.55931103",
"text": "def destroy\n#find all subcategories where subname id is = to given subname id\n @subcategories = Subcategory.find_all(:conditions => [\":subname_id =?\", subname_id])\n#Go through each subcategory and see if it is removable\n for subcategory in @subcategories\n subcategory.destroy\n end\n#then see whether the subname has any associated subcategories. if it doesn't, destroy it.\n @subcategories = Subcategory.find_all(:conditions => [\":subname_id =?\", subname_id])\n if @subcategories.length>1\n @subname.destroy\n end\n#end\n flash[:notice] = 'Operation complete'\n\n respond_to do |format|\n format.html { redirect_to url_for(:controller =>\"cactus/admin\", :action => \"index\") }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "684945f60ac1cca76ba5528fd40a850e",
"score": "0.5592574",
"text": "def destroy\n domain = @record.domain_id\n @record.destroy\n respond_to do |format|\n format.html { redirect_to domain_path(domain), notice: 'Record foi apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1f566f58243b5dddb26a064d6b42d69d",
"score": "0.5591608",
"text": "def destroy\n @subsidiary = Subsidiary.find(params[:id])\n unless @subsidiary.people.empty?\n flash[:error]=\"Exclusão negada. A filial possui usuários.\"\n else\n @subsidiary.destroy\n end\n respond_to do |format|\n format.html { redirect_to(subsidiaries_url) }\n format.xml { head :ok } \n end\n end",
"title": ""
},
{
"docid": "0ab6ceeca2c50b8bcf510651cecd29b5",
"score": "0.55913365",
"text": "def destroy\n @virtual_domain.destroy\n respond_to do |format|\n format.html { redirect_to virtual_domains_url, notice: 'Virtual domain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d13afa3c75d9626cc5ed2be1a7405e5e",
"score": "0.5586859",
"text": "def delete(address)\n \tMailgun.submit :delete, list_url(address)\n end",
"title": ""
},
{
"docid": "8f06e8310f316354874315f66071a977",
"score": "0.5577416",
"text": "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end",
"title": ""
},
{
"docid": "beda59fb75d5096f243ac7a8dd5f16ce",
"score": "0.5571516",
"text": "def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end",
"title": ""
},
{
"docid": "477837f1a581edaceda10809e5f308e0",
"score": "0.55683124",
"text": "def destroy\n sub = @post.sub\n @post.destroy\n redirect_to sub_url(sub)\n end",
"title": ""
},
{
"docid": "36c3a1bec81703939f7e11d8b4f93650",
"score": "0.5567287",
"text": "def destroy\n @subcomment = Subcomment.find(params[:id])\n @subcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to(subcomments_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a49f4b1a3a867255f7cb9f076bfd482d",
"score": "0.55588585",
"text": "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"title": ""
},
{
"docid": "9d4f3f17f19a6b39faa5c339ae30e9e0",
"score": "0.55583876",
"text": "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend",
"title": ""
},
{
"docid": "00c5eec9bfc1fbee543cca36e26ca700",
"score": "0.5557089",
"text": "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_websites_url }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1b4d1aaa263c32535cc608c1b8a6204b",
"score": "0.5557055",
"text": "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "037015ea11331ffb0ae025e72669238a",
"score": "0.55547804",
"text": "def destroy\n @sub.destroy\n redirect_to subs_url, notice: \"Sub #{@sub.name} successfully deleted!\"\n end",
"title": ""
},
{
"docid": "24c85100bfbcddd45e29041e46177891",
"score": "0.55528283",
"text": "def destroy\n @tmp_domain_name.destroy\n respond_to do |format|\n format.html { redirect_to tmp_domain_names_url, notice: 'Tmp domain name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0aabfd70910b8480a97cffeb53be8800",
"score": "0.5550986",
"text": "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"title": ""
},
{
"docid": "80c5b313511cb82adb94d201033e78ed",
"score": "0.5542796",
"text": "def delete_sub_subject\n @sub_subject=SubSubject.find_by(:id=>params[:id])\n @sub_subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: @sub_subject.show_name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fff685a73860c0cb65d9497ee9115d9a",
"score": "0.55424625",
"text": "def destroy\n @mailuser = Mailuser.find(params[:id])\n\t\t@domain = @mailuser.domain\n\t\tif @currentuser.administrator or @currentuser == @domain.owner \n \t@mailuser.destroy\n\t\tend\n\n respond_to do |format|\n\t\t\tformat.html { redirect_to(:action => \"show\", :controller => \"domains\", :id => @domain.id) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ac34cd5c654afa6fcfb0dc41f9146340",
"score": "0.5541453",
"text": "def delete_api subpath, category=nil, &block\n\t\t\t@request_queue.delete \"/api/#{api_key}#{subpath}\", category, &block\n\t\tend",
"title": ""
},
{
"docid": "7227c4fc057755f0759781cbd95dc69e",
"score": "0.5534032",
"text": "def destroy\n @domain.destroy\n respond_to do |format|\n format.html do\n redirect_to domains_url, notice: 'Domain deleted.'\n end\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6fe59e1d9853438faf0665b36c04d3aa",
"score": "0.55326957",
"text": "def destroy\n @corporate_health_package_child = CorporateHealthPackageChild.find(params[:id])\n @corporate_health_package_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(corporate_health_package_children_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5a6b473490a63ed88e608d88fc330bd8",
"score": "0.5528361",
"text": "def delete_pubsub_node(domain, node)\n @pubsub.delete_node(domain, node)\n end",
"title": ""
},
{
"docid": "13ab69c0ad42b249c4e5d47c6368adb5",
"score": "0.5526663",
"text": "def destroy\n #@sub = Sub.find(params[:id])\n @sub.destroy\n redirect_to root_path\n end",
"title": ""
},
{
"docid": "1bbf4512ec869159affa4e8df81d41d4",
"score": "0.5524347",
"text": "def destroy\n @tenant = Tenant.find(params[:id])\n @tenant.destroy\n\n respond_to do |format|\n format.html { redirect_to(tenants_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "65882609f98cadcb165eded2e2ddc17c",
"score": "0.55241495",
"text": "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1065717427fbf95714f581178924af19",
"score": "0.5519545",
"text": "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9682bf3daebfac969f1b83e960dcedd",
"score": "0.5517805",
"text": "def destroy\n @subtask = Subtask.find(params[:id])\n @subtask.destroy\n\n respond_to do |format|\n format.html { redirect_to(subtasks_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c1a621669cdfedf7cdb68f86584ed0e7",
"score": "0.55127066",
"text": "def update_subdomains\n backup_subdomains\n parse_subdomains\n end",
"title": ""
},
{
"docid": "7dbbcd0e3095c4d29b393121c313e565",
"score": "0.55068606",
"text": "def destroy\n @sub_content.destroy\n respond_to do |format|\n format.html { redirect_to sub_contents_url, notice: 'Sub content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5f53e8fd6bac21563af2c744551142d6",
"score": "0.5496068",
"text": "def destroy\n @response_domain_text = ResponseDomainText.find(params[:id])\n @response_domain_text.destroy\n\n respond_to do |format|\n format.html { redirect_to(response_domain_texts_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "240d1666f8572b7b02d242b521aa1135",
"score": "0.5490968",
"text": "def delete\n start { |connection| connection.request http :Delete }\n end",
"title": ""
},
{
"docid": "f16cf4887fd8e037fb45378038fbe3b5",
"score": "0.54908794",
"text": "def delete(*uris); end",
"title": ""
},
{
"docid": "73ecf52b6bf2adfaeef1f7a2db265821",
"score": "0.5478542",
"text": "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to(websites_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d0de4af2759eccaf2993ba8bd9b4bf6e",
"score": "0.54759604",
"text": "def service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend",
"title": ""
},
{
"docid": "503db12ed82e0d56f1e5d02f01cbe7b0",
"score": "0.5473308",
"text": "def destroy\n @subaccount = @auxiliar.subaccount\n @auxiliar.destroy\n respond_to do |format|\n format.html { redirect_to subaccount_path(@subaccount), notice: 'Auxiliar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eda8d0cad950f3dc8ca6212a1ac6a126",
"score": "0.5459836",
"text": "def delete\n Iterable.request(conf, base_path).delete\n end",
"title": ""
},
{
"docid": "1652c0fa213623ff25a49e79e26591d9",
"score": "0.5454669",
"text": "def deleteSite _args\n \"deleteSite _args;\" \n end",
"title": ""
},
{
"docid": "30003bd427ec3e87967f437e3fcbbc2a",
"score": "0.5451692",
"text": "def test_urls_cascade_delete\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal '5', res[0]['person_id']\n\t\tDB.exec(\"DELETE FROM people WHERE id=5\")\n\t\tres = DB.exec(\"SELECT person_id FROM urls WHERE id=8\")\n\t\tassert_equal 0, res.ntuples\n\tend",
"title": ""
},
{
"docid": "5ad8effb793240282f698c286765761f",
"score": "0.5451155",
"text": "def destroy\n group = Group.find(params[:group_id])\n\n @subgroup = group.subgroups.find(params[:id])\n @subgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_subgroups_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e1d6f603cb5ea1e475ea71422432aeae",
"score": "0.54500735",
"text": "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"title": ""
},
{
"docid": "3bbe532f009f1a184b0c02732cbe4aaf",
"score": "0.54386586",
"text": "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"title": ""
},
{
"docid": "66b5902c8fe9fe3acde7d54bc7a99e35",
"score": "0.5425195",
"text": "def delete!\n\t\t\tClient.delete @root\n\t\tend",
"title": ""
},
{
"docid": "c264fff3033d88a38d6f3ef5bb244d6c",
"score": "0.5419622",
"text": "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend",
"title": ""
}
] |
43412067cbc5bf0d64472bc416edd294
|
When a user is setting up a new vagrant, prompt them for their full name and email. We'll set these within vagrant so we avoid people accidently commiting as the "vagrant" user.
|
[
{
"docid": "8cc5e1251bb22626318060bde0edd58e",
"score": "0.5306732",
"text": "def generate_git_commiter_facts()\n existing_details = fetch_git_commiter_details_from_file()\n # don't set the git configs if the user opted out\n if existing_details.has_key? 'optout'\n return\n end\n\n if existing_details.any?\n full_name = existing_details.fetch 'full_name', nil\n email = existing_details.fetch 'email', nil\n elsif existing_details.has_key? 'optout'\n full_name = nil\n email = nil\n else\n @env[:ui].warn \\\n \"You'll be prompted to enter your full name and eventbrite email.\\n\"\\\n \"We'll set these for you within your vagrant's .gitconfig.\\n\"\\\n \"This will avoid accidentally committing code as 'vagrant'.\\n\"\\\n \"If you ever want to reset these, remove\\n\"\\\n \"#{@vagrant_git_commiter_details} from your vagrant directory.\\n\"\n full_name = @env[:ui].ask 'Enter your full name: '\n email = @env[:ui].ask 'Enter your eventbrite email: '\n write_git_commiter_details(full_name, email)\n end\n if !full_name.empty? || !email.empty?\n @env[:ui].success \"Will setup global github details in vagrant.\"\\\n \" Full Name: #{full_name}, Email: #{email}\"\n end\n # NB: We have to escape single quotes for the bash command line.\n # These facts will get run with puppet_apply like:\n # FACTER_github_username='Brian O'Niell'. We use this special\n # escaping to concat an escaped single quote with the rest of the\n # string, outputting: FACTER_github_username='Brian O'\\''Niell'\n @puppet_fact_generator.add_fact(\n 'github_full_name',\n full_name.gsub(\"'\", \"'\\\\\\\\''\")\n )\n @puppet_fact_generator.add_fact('github_email', email)\n end",
"title": ""
}
] |
[
{
"docid": "b52ca0f1ef8c3341734d3890cc81d2ae",
"score": "0.6425329",
"text": "def vagrant_vm_name(name)\n return \"vagrant-#{name}-#{ENV['USER']}\"\nend",
"title": ""
},
{
"docid": "0237e9c424098e7137ab8fcf4d367cff",
"score": "0.615175",
"text": "def determine_default_user_email\n Cadenero.default_user_email = options[\"default-user-email\"].presence ||\n ask(\"What will be the email for the default user owner of the default account? [testy@example.com]\").presence ||\n 'testy@example.com'\n end",
"title": ""
},
{
"docid": "663342414954eb6f8249fd1bb3e6111d",
"score": "0.60631984",
"text": "def signup_confirmation(user_name, user_email)\n @user_name = user_name\n @user_email = user_email\n mail to: user_email, subject: \"Dum dum de dum... get started with Bridled!\"\n end",
"title": ""
},
{
"docid": "0efc4ed4fddc3b2358d4ea1902bb3de5",
"score": "0.6054995",
"text": "def setup_user\n login_as(User.where(email: 'masterchef@cookbook.com').first, scope: :user)\n end",
"title": ""
},
{
"docid": "b1246f6b9378657a9f443b7d97d55871",
"score": "0.60531455",
"text": "def ask_credentials\n self.email = cli.prompt \"Your Pivotal Tracker email: \"\n self.password = cli.prompt_secret \"Your Pivotal Tracker password (never stored): \"\n end",
"title": ""
},
{
"docid": "079718775a980768444b75bbb34046fe",
"score": "0.58495146",
"text": "def basic_config(vm)\n hosts = NODES.map { |hostname, array| \"#{array[0]} #{hostname}\" }.join(\"\\n\")\n bashrc=\"/home/vagrant/.bashrc\"\n vm.provision \"shell\", inline: <<-SHELL\n if ! grep -q \"git-core\" #{bashrc} ; then \n echo \"customizing ~/bashrc\"\n echo \"\\n\\n# Customizations from Vagrantfile:\" >> #{bashrc}\n echo \"export PS1='\\\\[\\\\033[31;1m\\\\]\\\\h\\\\[\\\\033[0;32m\\\\] \\\\w\\\\[\\\\033[00m\\\\]: '\" >> #{bashrc}\n echo export PATH=\"\\$PATH:/usr/lib/git-core:/home/vagrant/teleport/build\" >> #{bashrc}\n echo export GREP_OPTIONS=\"--color=auto\" >> #{bashrc}\n echo \"alias ll='ls -lh'\" >> #{bashrc}\n echo \"alias tsh='tsh --insecure'\" >> #{bashrc}\n fi\n if ! grep -q \"Teleport\" /etc/hosts ; then \n echo \"# Teleport entries added by Vagrant:\" >> /etc/hosts\n echo -e \"#{hosts}\" >> /etc/hosts\n fi\n mkdir -p /var/lib/teleport\n chown vagrant:vagrant /var/lib/teleport\n SHELL\nend",
"title": ""
},
{
"docid": "34be528ec6e85ec0fbe7d208d950ee33",
"score": "0.5844587",
"text": "def ask_for_creds(user=nil)\n if user\n @username = user\n else\n print \"Enter your GApps email address: \"\n @username = gets.chomp.strip.downcase \n # using highline for input on more than one run of a loop causes intermittent errors\n # in Ruby 1.8.7 on Mac OS X 10.8 for some reason. Changed from the highline 'ask' below\n # to the 'print/gets' above.\n #@username = ask(\"Enter your GApps email address: \").strip.downcase if @username == nil\n end\n @password = ask(\"Enter your password: \") { |q| q.echo = \"x\" }\n end",
"title": ""
},
{
"docid": "53d0de5c92f6755ee38427185b6f8680",
"score": "0.58199877",
"text": "def signup_confirmation user\n @user = user\n mail to: user.email, subject: \"Welcome to the Clone\"\n end",
"title": ""
},
{
"docid": "93ed06a9b9019d063ea23a8d9d010c6f",
"score": "0.58026475",
"text": "def vagrant_provision\n if @env\n puts \"Running vagrant provision.\"\n @env.cli(\"provision\") && FileUtils.touch('.vagrant_last_provisioned')\n else\n puts \"Setting up vagrant environment.\"\n setup_vagrant && FileUtils.touch('.vagrant_last_provisioned')\n end\nend",
"title": ""
},
{
"docid": "72d2e786fbc6ddc65c195fa8439a5e6f",
"score": "0.5759665",
"text": "def sign_up_helper\n username = prompt.ask(\"Enter Username\")\n while User.find_by(name: username.downcase)\n puts \"This username is already taken, please create a different username\"\n username = prompt.ask(\"Enter Username\")\n end\n password = prompt.ask(\"Enter Password\")\n self.user = User.create(name: username, password: password)\n puts \"Sign up complete.\"\n sleep(0.8)\n puts \"Let's Get Cookin #{self.user.name.upcase}!!!\"\n sleep(1.5)\n main_menu\n end",
"title": ""
},
{
"docid": "8c9ed45d62f203cfa8b2669afffa3077",
"score": "0.5698079",
"text": "def configure_admin\n @config[\"config\"][\"admin\"] = {}\n if @args.empty?\n box(\"You will now need to input credentials for the admin user you would like to create.\")\n @config[\"config\"][\"admin\"][\"email\"] = @prompt.ask(prompt_box(\"What is your admin\\'s email?\"), default: @config[\"config\"][\"contact\"][\"email\"], required: true) { |q| q.validate :email, \"Invalid email\" }\n @config[\"config\"][\"admin\"][\"password\"] = @prompt.mask(prompt_box(\"What is your admin\\'s password?\"), required: true) { |q| q.validate /^.{6,}$/, \"Must be at least 6 characters\" }\n @config[\"config\"][\"admin\"][\"first_name\"] = @prompt.ask(prompt_box(\"What is your admin\\'s first name?\"), required: true)\n @config[\"config\"][\"admin\"][\"last_name\"] = @prompt.ask(prompt_box(\"What is your admin\\'s last name?\"), required: true)\n else\n @config[\"config\"][\"admin\"][\"email\"] = get_argument_value(\"admin_email\", true, nil)\n @config[\"config\"][\"admin\"][\"password\"] = get_argument_value(\"admin_password\", true, nil)\n @config[\"config\"][\"admin\"][\"first_name\"] = get_argument_value(\"admin_first_name\", false, \"Admin\")\n @config[\"config\"][\"admin\"][\"last_name\"] = get_argument_value(\"admin_last_name\", false, \"User\")\n end\n success_prompt(\"Admin user created.\")\nend",
"title": ""
},
{
"docid": "f0d7dd9d0204ac45aea7b21be17c0794",
"score": "0.5690288",
"text": "def default_guest_name\n \"Anonymous\"\n end",
"title": ""
},
{
"docid": "c10085d839230565dc79adc1270dbd14",
"score": "0.5682661",
"text": "def configure_ssh(vm)\n vm.provision \"shell\", inline: <<-SHELL\n mkdir -p /home/vagrant/.ssh\n rm -rf /home/vagrant/.ssh/id_rsa*\n chown vagrant:vagrant /home/vagrant/.ssh\n SHELL\n vm.provision \"file\", source: '~/.ssh/id_rsa', destination: '~/.ssh/id_rsa'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/id_rsa.pub'\nend",
"title": ""
},
{
"docid": "90286add35a871134958f94d05d1d889",
"score": "0.56748337",
"text": "def configure_ssh(vm)\n vm.provision \"shell\", inline: <<-SHELL\n mkdir -p /home/vagrant/.ssh\n rm -rf /home/vagrant/.ssh/id_rsa*\n chown vagrant:vagrant /home/vagrant/.ssh\n SHELL\n vm.provision \"file\", source: '~/.ssh/id_rsa', destination: '~/.ssh/id_rsa'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/id_rsa.pub'\n vm.provision \"file\", source: '~/.ssh/id_rsa.pub', destination: '~/.ssh/authorized_keys'\n vm.provision \"file\", source: '~/.screenrc', destination: '~/' if File.exists? \"~/.screnrc\"\nend",
"title": ""
},
{
"docid": "b4580ed5d00862222d3e6c34c1d38c9d",
"score": "0.56529933",
"text": "def git_init\n git.config('user.name', ENV['MACHINE_USER_NAME'])\n git.config('user.email', ENV['MACHINE_USER_EMAIL'])\n end",
"title": ""
},
{
"docid": "12ab909f76d171e3359a7a20e1f4e3d9",
"score": "0.56437546",
"text": "def prompt_for_user_password!\n e.execute_as_user('')\n end",
"title": ""
},
{
"docid": "6090f394b2cb02efc2760e48e327442e",
"score": "0.56341213",
"text": "def signup_user(name=nil)\n if name.nil?\n puts \"Please enter your name to signup\"\n name = CLI.gets_with_quit\n end\n if self.user_exists(name)\n message = \"Sorry that name is already taken :(\"\n options = [ \"Go To Login\", \"Try Again\", \"Back to Main Menu\"]\n choice = PROMPT.select(message, options)\n case options.index(choice)\n when 0 then self.login_user\n when 1 then self.signup_user\n when 2 then CLI.start\n end\n else\n password = PROMPT.mask(\"Enter your password:\")\n user = User.create(name: name)\n user.set_password = password\n CLI.active_user = user\n end\n end",
"title": ""
},
{
"docid": "ae370578a74c31697fae46ba60adc6dc",
"score": "0.5620464",
"text": "def new_user(user_name, email)\n @user_name = user_name\n @email = email\n\n mail to: \"Susie Ye <susie@baserails.com>\", subject: \"Free User: #{email}\"\n end",
"title": ""
},
{
"docid": "c8bbf8de9cc4216288d5cf21a9049156",
"score": "0.56183445",
"text": "def vagrant_user?(node)\n node.key?('etc') && node['etc'].key?('passwd') && node['etc']['passwd'].key?('vagrant')\n end",
"title": ""
},
{
"docid": "eff97f3c4fd77ce13b81c81c84e0cad9",
"score": "0.56130147",
"text": "def puppet_user(host)\n puppet_config(host, 'user', section: 'master')\n end",
"title": ""
},
{
"docid": "5112132b4ecc5e7954452ba68f06c3ae",
"score": "0.56066084",
"text": "def ask_credentials\n self.username = cli.prompt \"Your GitHub username: \"\n self.password = cli.prompt_secret \"Your GitHub password (never stored): \"\n end",
"title": ""
},
{
"docid": "d57975bcf1c07e4f5e8b6cc225d2d29e",
"score": "0.5593595",
"text": "def sign_up(new_user)\n @user = new_user\n @notify_subject = strip_tags \"NEW SIGN UP AT #{ENV['APPLICATION_CONFIG_name']}\"\n mail( :to => ENV['APPLICATION_CONFIG_admin_notification_address'], :subject => @notify_subject)\n end",
"title": ""
},
{
"docid": "0afa272f1673293bd7e215ab0c94bffb",
"score": "0.5577974",
"text": "def devbox_user_command(cmd)\n command(\"sudo -u vagrant bash -i -c '#{cmd}; exit $?'\")\nend",
"title": ""
},
{
"docid": "393596577d2b9865072bc7a255ed9b4a",
"score": "0.55746",
"text": "def user_name\n @options[:user_name] ||= @options[:repository].config['pivotal.full-name'] || @options[:repository].config['user.name']\n end",
"title": ""
},
{
"docid": "9e439c415b5071f09375d29746514123",
"score": "0.554437",
"text": "def sign_up\n opt_sign_up = @@prompt.select(\"Would you like to sign-up, log-in or exit\", %W(sign-up log-in exit))\n case opt_sign_up\n when \"sign-up\"\n system(\"clear\")\n get_useranme\n get_password\n get_account\n confirm_account\n when \"log-in\"\n system(\"clear\")\n log_in\n when \"exit\"\n greet = Greet.new\n system(\"clear\")\n greet.bye_msg\n exit\n end\n end",
"title": ""
},
{
"docid": "27f61f7776dbfbfeae0e7d7ae5f282b1",
"score": "0.5524472",
"text": "def determine_default_user_password\n Cadenero.default_user_password = options[\"default-user-password\"].presence ||\n ask(\"What will be the password for the default user owner of the default account? [change-me]\").presence ||\n 'change-me'\n end",
"title": ""
},
{
"docid": "dbc9939658381c8c10da544428a616e2",
"score": "0.55152345",
"text": "def create\n if (params[:user][:email] == \"guest@example.com\")\n prep_guest\n end\n super\n end",
"title": ""
},
{
"docid": "8438c9544d55c6d96ef40342d810978b",
"score": "0.55025345",
"text": "def sign_up_new_user\n user = User.make\n visit \"/\"\n find('#join_now_link').click\n click_link 'Sign up with Email'\n fill_in 'Full name', with: user.full_name\n fill_in 'Email', with: user.email\n find('#user_password').set user.password\n find('#user_password_confirmation').set user.password\n click_button 'Sign up'\n user\nend",
"title": ""
},
{
"docid": "e96bbf8b579f66d081228c3868e5475f",
"score": "0.5495156",
"text": "def sign_up\n puts \"What's your username\"\n username = gets.chomp\n puts \"What's your password\"\n password = gets.chomp\n puts \"Confirm the password\"\n password_confirmation = gets.chomp\n \nend",
"title": ""
},
{
"docid": "b4e8a7696891e95db946429f040a8922",
"score": "0.548648",
"text": "def configure_git\n run_simple 'git config user.name Cucumber'\n run_simple 'git config user.email cucumber@`hostname --fqdn`'\nend",
"title": ""
},
{
"docid": "fa982877a6745ee091f1c0956fce8e27",
"score": "0.5446279",
"text": "def default_value_for_email\n git_global_config_for(\"user.email\") do |email_val|\n warn(\"Using email from git as: #{email_val}\")\n end\n end",
"title": ""
},
{
"docid": "65af0ec86ebb8c32b03b39ce4b5cefca",
"score": "0.54353994",
"text": "def sign_up_with(**args)\n email = args.fetch(:email, 'john.rambo@test.com')\n password = args.fetch(:password, '12345678')\n password_confirmation = args.fetch(:password_confirmation, '12345678')\n\n within '#new_user' do\n fill_in 'Email', with: email\n fill_in 'Password', with: password\n fill_in 'Password confirmation', with: password_confirmation\n click_on 'Sign up'\n end\n end",
"title": ""
},
{
"docid": "47f8d958aff4f00ef87f41fea30d1557",
"score": "0.5429708",
"text": "def signup_email\n @greeting = \"Hi\"\n\n mail to: @user.email, subject: \"Welcome to CheeseBae! Please confim your email!\"\n end",
"title": ""
},
{
"docid": "8534f611604c33e2c5921ed9a81b2b11",
"score": "0.54113555",
"text": "def new_user_setup\n \t@person = Person.find(:first, :conditions => {:email_address => params[:email_address]})\n \tif @person.nil?\n \t\tflash[:error] = \"Invalid Email Address.\"\n \t\tredirect_to :action => 'register'\n\t\telsif !@person.password_hash.blank?\n \t\tflash[:error] = \"Your account has already been set up. See the system administrator for help logging in.\"\n \t\tredirect_to :action => 'index'\n \telsif params[:password] != params[:password_confirm]\n \t\tflash[:error] = \"Passwords don't match. Please try again.\"\n \t\tredirect_to :action => 'register'\n \telse\n \t\t@person.password = params[:password]\n \t\t@person.save!\n \t\tredirect_to home_url(@person)\n \tend\n end",
"title": ""
},
{
"docid": "c7f5abd74f04edaa128af42c00a2d82d",
"score": "0.5394043",
"text": "def signup_greeting(user, mode = :normal_signup)\n @user = user\n @need_password = (mode == :free_money_signup)\n swapidy_sendmail :to => @user.email, :subject => \"Welcome to Swapidy\"\n end",
"title": ""
},
{
"docid": "772f9e18376b864592cc3eedebe4f6de",
"score": "0.5392169",
"text": "def signed_up(user)\n @user = user\n \n mail to: @user.email, subject: 'Sign Up Confirmation.'\n end",
"title": ""
},
{
"docid": "39f6b65322779db295b5292d6996fc49",
"score": "0.5386307",
"text": "def create_guest_user\n u = User.create(name: 'guest', email: \"guest_#{Time.current.to_i}#{rand(99)}@example.com\")\n # u.skip_confirmation!\n u.save!(validate: false)\n u\n end",
"title": ""
},
{
"docid": "edacd7016335f321c1f1b078865cc9d4",
"score": "0.5379895",
"text": "def signed_up(user)\n @user = user\n\n mail to: user.email\n end",
"title": ""
},
{
"docid": "f8605565cdf505be948dfb36c022205f",
"score": "0.53794664",
"text": "def name_confirmation\n puts \"Been here before? (y/n)\"\n user_response = gets.chomp.downcase\n system \"clear\" \n if user_response == \"y\"\n find_user\n elsif user_response == \"n\"\n create_user\n else\n name_confirmation\n end\n end",
"title": ""
},
{
"docid": "021ecd6028738e0fb3787a5ed23da4ed",
"score": "0.53733003",
"text": "def guest_user\r\n guest = GuestUser.new\r\n guest.name = 'Guest User'\r\n guest.first_name = 'Guest'\r\n guest.last_name = 'User'\r\n guest.email = 'guest@test.com'\r\n guest\r\n end",
"title": ""
},
{
"docid": "f3359d65da74f46c03184b58e85d2581",
"score": "0.53695494",
"text": "def signed_up(user)\n @user = user\n mail to: @user.email\n end",
"title": ""
},
{
"docid": "ee4c4dc0d8171bba58be7957dc4e96c3",
"score": "0.53675264",
"text": "def basic_config(vm)\n bashrc=\"/home/vagrant/.bashrc\"\n vm.provision \"shell\", inline: <<-SHELL\n if ! grep -q \"git-core\" #{bashrc} ; then \n echo \"customizing ~/bashrc\"\n echo \"\\n\\n# Customizations from Vagrantfile:\" >> #{bashrc}\n echo \"export PS1='\\\\[\\\\033[31;1m\\\\]\\\\h\\\\[\\\\033[0;32m\\\\] \\\\w\\\\[\\\\033[00m\\\\]: '\" >> #{bashrc}\n echo export PATH=\"\\$PATH:/usr/lib/git-core:/home/vagrant/teleport/build\" >> #{bashrc}\n echo export GREP_OPTIONS=\"--color=auto\" >> #{bashrc}\n echo \"alias ll='ls -lh'\" >> #{bashrc}\n fi\n SHELL\nend",
"title": ""
},
{
"docid": "41e376f191a6178ff31a601b802d3add",
"score": "0.5366022",
"text": "def new_account(user)\n @user = user\n @user_name = @user.full_name\n @user_email = @user.email\n\n mail(to: @user.email, subject: 'Welcome to the jungle')\n end",
"title": ""
},
{
"docid": "44ece53fb494301d412efd2081365ba7",
"score": "0.53611416",
"text": "def prompt_username\n TTY::Prompt.new.ask(\"Redacted username?\", required: true, modify: :strip)\n end",
"title": ""
},
{
"docid": "e661f476f03b554d120dd01de863f2db",
"score": "0.53609914",
"text": "def new_email(user)\n @user = user\n \n mail to: @user.email, subject: \"Create your ParDIY credentials\"\n end",
"title": ""
},
{
"docid": "0a687ceee8d5cb438b8b1c3357545a27",
"score": "0.535407",
"text": "def docker_login_vagrant(config)\n\n config.vm.provision \"shell\", privileged: false, inline: <<-SHELL\n docker login --username=testuser --password=testpassword util.io\n SHELL\n\nend",
"title": ""
},
{
"docid": "0dae05821ce31f0afb9e8fc6c2b84805",
"score": "0.5344497",
"text": "def signup_confirmation(user)\n @user = user\n @greeting = \"Hi\"\n\n mail to: @user.email, subject: \"Hello new friend!\"\n end",
"title": ""
},
{
"docid": "50fadcd79ad437d8713c9ba03b0c78e5",
"score": "0.5337581",
"text": "def setup_before(skel_name, options)\n environment.skeleton(skel_name)\n environment.env['VBOX_USER_HOME'] = environment.homedir.to_s\n assert_execute('vagrant', 'box', 'add', \"vagrantr10kspec\", options[:box])\n end",
"title": ""
},
{
"docid": "7d42ab516ddf083b4daac79d8de0cf98",
"score": "0.53198755",
"text": "def notify_about_sign_up(user, admin)\n @user = user\n mail(:to => admin.email, :subject => \"New User | #{user.name}\", :reply_to => \"new_user@ambitionspotlight.com\")\n end",
"title": ""
},
{
"docid": "50084e70989b0afe0a0c03e678e2f518",
"score": "0.5313281",
"text": "def setup\n @user = User.find_by_email('markmilman@gmail.com')\n login_as @user, scope: :user\n end",
"title": ""
},
{
"docid": "6cad6586321d3111ea7bdfda5b92e80b",
"score": "0.5312048",
"text": "def new_user_signed_up _user, _request\n @user = _user\n @request_info = build_request_info(_request)\n @domain = Settings.fetch(:app,:hostname)\n mail(\n to: Settings.fetch(:app,:admin_notification_email),\n subject: \"New user created at #{@domain}\"\n )\n end",
"title": ""
},
{
"docid": "c6c2dc4b27b7e43180789aba4ec40b32",
"score": "0.53006315",
"text": "def cmd_notify_set_user(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the Slack handle to #{args[0]}\")\n\t\t\t\t\t@user_name = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "e344ea7a4c3f97bf021ecf495d9d6f85",
"score": "0.5298203",
"text": "def create_vagrantfile\n output << bold(color(\"localhost$\", :green)) << \" cd #{@vagrant_path}\\n\"\n FileUtils.mkdir_p(@vagrant_path)\n File.open(File.expand_path(File.join(@vagrant_path, \"Vagrantfile\")), 'w') do |f|\n f.write('Vagrant.configure(\"2\") do |c|' + \"\\n\")\n nodes.each do |k,v|\n ps = v.provider_specifics[provider_type]\n default_options = { 'mac' => randmac }\n options = default_options.merge(v.options || {})\n\n node_config = \" c.vm.define '#{k}' do |v|\\n\"\n node_config << \" v.vm.hostname = '#{k}'\\n\"\n node_config << \" v.vm.box = '#{ps['box']}'\\n\"\n node_config << \" v.vm.box_url = '#{ps['box_url']}'\\n\" unless ps['box_url'].nil?\n node_config << customize_vm(k,options)\n node_config << \" v.vm.provider '#{vagrant_provider_name}' do |prov, override|\\n\"\n node_config << customize_provider(k,options)\n node_config << \" end\\n\"\n node_config << \" end\\n\"\n\n f.write(node_config)\n end\n f.write(\"end\\n\")\n end\n nil\n end",
"title": ""
},
{
"docid": "b07ca4b824acff13463c6ad15a42ceb1",
"score": "0.5298161",
"text": "def ask_token\n self.username = cli.prompt \"Your GitHub username: \"\n self.user_defined_token = cli.prompt_secret \"Your GitHub API token: \"\n end",
"title": ""
},
{
"docid": "e9b67900161bc74ece66699fd4297bb7",
"score": "0.5297773",
"text": "def vagrant?(node)\n vagrant_key?(node) || vagrant_domain?(node) || vagrant_user?(node)\n end",
"title": ""
},
{
"docid": "ec1e49d7bbf995fd5a0eb1401d4283f2",
"score": "0.5295383",
"text": "def setup\n @frank = users(:frank)\n @mike = users(:mike)\n end",
"title": ""
},
{
"docid": "409432483c13a76ef217eb813de66415",
"score": "0.52896404",
"text": "def create_guest_user\n u = User.create(email: \"guest_#{Time.now.to_i}#{rand(99)}@example.com\")\n #u.skip_confirmation!\n u.save!(validate: false)\n u\n end",
"title": ""
},
{
"docid": "4803b513e6bf33859147605aa33b3ba3",
"score": "0.5288177",
"text": "def new_user(user) \n @user = user\n if Rails.env.production?\n \tmail to: \"info@showandtour.com\", subject: \"New User Signup!\"\n else\n \tmail to: \"foster154@gmail.com\", subject: \"(DEV) New User Signup!\"\n\t\tend\n end",
"title": ""
},
{
"docid": "ed979e59bee26c41c857a3e5e788ed48",
"score": "0.52779865",
"text": "def new_user(user)\n @greeting = \"Hey, it's Josh from CDA.com!\"\n @name = user.name\n @email = user.email\n mail to: @email\n end",
"title": ""
},
{
"docid": "fd5700d966bfa428a974aa451da37cc3",
"score": "0.5277759",
"text": "def prompt_password\n @member = current_member\n end",
"title": ""
},
{
"docid": "58e587ca809015080d61c0ca5ed5c92b",
"score": "0.5273561",
"text": "def guess_email\n @guessed_email ||= begin\n e = `git config user.email`.strip\n # TODO: Guess based on hg and other possibile tools\n raise UnknownEmail, \"Email could not be obtained via git settings\" if e.empty?\n e\n end\n end",
"title": ""
},
{
"docid": "f3c423f5771763ed50fa2a6864dba2ec",
"score": "0.5272788",
"text": "def create_vagrantfile\n output << bold(color(\"localhost$\", :green)) << \" cd #{@vagrant_path}\\n\"\n FileUtils.mkdir_p(@vagrant_path)\n File.open(File.expand_path(File.join(@vagrant_path, \"Vagrantfile\")), 'w') do |f|\n f.write('Vagrant.configure(\"2\") do |c|' + \"\\n\")\n nodes.each do |k,v|\n ps = v.provider_specifics['vagrant']\n default_options = { 'mac' => randmac }\n options = default_options.merge(v.options || {})\n\n node_config = \" c.vm.define '#{k}' do |v|\\n\"\n node_config << \" v.vm.hostname = '#{k}'\\n\"\n node_config << \" v.vm.box = '#{ps['box']}'\\n\"\n node_config << \" v.vm.box_url = '#{ps['box_url']}'\\n\" unless ps['box_url'].nil?\n node_config << customize_vm(k,options)\n node_config << \" v.vm.provider 'virtualbox' do |vbox|\\n\"\n node_config << customize_virtualbox(k,options)\n node_config << \" end\\n\"\n node_config << \" end\\n\"\n\n f.write(node_config)\n end\n f.write(\"end\\n\")\n end\n nil\n end",
"title": ""
},
{
"docid": "6c090a976b7380ed9e9f4b2105a5a915",
"score": "0.52718914",
"text": "def user_setup\n\t\tif self.id.blank?\n\t\t\tself.id = self.email\n\t\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "721618cbb7043bb26e46e9a8a4220f6a",
"score": "0.5268364",
"text": "def vagrant?\n @vagrant ||= `id vagrant 2>&1`.index 'uid'\n end",
"title": ""
},
{
"docid": "c9d40f00ca7d7b92b470eacf28cff4a8",
"score": "0.5263697",
"text": "def setup \n \t@user = User.create(email: 'example@mail.com', password: '123456789', \n \t\tpassword_confirmation: '123456789')\n \t@request.env[\"devise.mapping\"] = Devise.mappings[:user]\n \t@user1 = users(:one)\n \t@user1.account = accounts(:one)\n end",
"title": ""
},
{
"docid": "2503f3a7202d17e63ad2f6c5e97a14ee",
"score": "0.52630216",
"text": "def setup\n @user = users(:brock)\n end",
"title": ""
},
{
"docid": "114f06e9d009a839dfe0a809f69197db",
"score": "0.5262415",
"text": "def setup_user\n User.new( \n age: 5,\n bio: \"My test bio\",\n password: SecureRandom.hex(6),\n email: SecureRandom.hex(4) + \"@example.com\",\n picture: \"blah.jpg\",\n sex: \"M\",\n username: SecureRandom.hex(4)\n )\n end",
"title": ""
},
{
"docid": "66279da7d188171c7cb49f41ce1b731d",
"score": "0.52592736",
"text": "def createnewuser_prompt\n header\n puts \"\\n\\nPlease enter a username.\\n\"\n self.createnewuser_input = STDIN.gets.strip\n self.createnewuser_valid?\nend",
"title": ""
},
{
"docid": "91d3251d3ac86f5e5bdd64550d20af1d",
"score": "0.52564156",
"text": "def signup_confirmation(user)\n @user = user\n mail to: user.email, subject: \"Welcome\"\n end",
"title": ""
},
{
"docid": "73306e313a9c18953ccdf32f6d430fc8",
"score": "0.5256399",
"text": "def _test_change_user_sets_user\n host = @remote_host ; user = @remote_user\n assert_equal(user, Execute.run!('whoami', :host => host, :user => user)[:stdout].strip,\n \"failed to change user\")\n end",
"title": ""
},
{
"docid": "0c38b9d91de396d7e2e329b7065c9192",
"score": "0.525597",
"text": "def signup_confirmation(user)\n @greeting = \"Hi\"\n @user = user\n\n mail to: user.email, subject: \"Sign up confirmation!\"\n end",
"title": ""
},
{
"docid": "5fd75839c70b7b3adbf1f932af871102",
"score": "0.52553886",
"text": "def new_signup(user, email)\n @greeting = \"Hi\"\n @user = user\n @email = email\n mail to: @email, subject: \"Your Account has been created on blogApp\"\n end",
"title": ""
},
{
"docid": "8abf7cbf99e23606cdf422511a94b255",
"score": "0.5250471",
"text": "def new_user_advice(user)\n @user = user\n mail(\n :to=>ENV['MAIL_USER_NAME'],\n :subject=>'ouverture d\\'un nouveau compte')\n end",
"title": ""
},
{
"docid": "5cd365e1424ea9f93e13c5802036b5cd",
"score": "0.52410483",
"text": "def welcome(user)\n @the_new_user_who_signed_up = user\n\n mail to: user.email, from: \"jeff@startergrill.com\"\n end",
"title": ""
},
{
"docid": "92b123c058f31c8afc490dd3cd60bea9",
"score": "0.52394044",
"text": "def default_user_email\n return default_email( DEFAULT_USER )\n end",
"title": ""
},
{
"docid": "6f3c4d83b943a3726c9cec4de2bdf34f",
"score": "0.52352506",
"text": "def admin_create_user_email(user)\n @user = user\n mail :to => \"#{user.name} <#{user.email}>\", :subject => \"An Account Has Been Created For You\"\n end",
"title": ""
},
{
"docid": "defe35023810e12026bba53e0178b90d",
"score": "0.52351326",
"text": "def signup(email)\n \n @greeting = \"Hi\"\n\n mail to: email\n end",
"title": ""
},
{
"docid": "c196ce1e8087217e4475ed85011eac14",
"score": "0.5235",
"text": "def login_signup\n customer_username = $prompt.ask(\"Username:\", value: \"\")\n @customer = User.find_or_create_by(username: customer_username)\nend",
"title": ""
},
{
"docid": "ac8a075f2e536693be0e2481c0b21d53",
"score": "0.52328885",
"text": "def signup_as_invitee!(user, prompt, &block)\n self.attributes = user if user\n logged = prompt and validate_password_with_openid?\n save_with_block(logged, &block)\n end",
"title": ""
},
{
"docid": "526ef1ef98fa14e767088395eaa1dfb9",
"score": "0.5231092",
"text": "def set_hostname(server)\r\n\tserver.vm.provision 'shell', inline: \"hostname #{server.vm.hostname}\"\r\nend",
"title": ""
},
{
"docid": "bff5a9a5f2d9ff66ff94cb27658444b6",
"score": "0.5230122",
"text": "def setup\n \n @user = users(:david)\n \n end",
"title": ""
},
{
"docid": "e8c26f902bb4c448b870d46e33d2adef",
"score": "0.5229162",
"text": "def sudo_prompt\n fetch(:sudo_prompt, \"sudo password: \")\n end",
"title": ""
},
{
"docid": "005ede76f649670dc0e365bc16c50686",
"score": "0.5226465",
"text": "def create_cleaner_account_confirmation(account)\n\t\t@first_name = account.first_name\n\t\t@last_name = account.last_name\n\t\t@email = account.email\n\n mail(:to => \"tom@cleanjay.ca\", :subject => \"New Cleaner Signup!\")\n end",
"title": ""
},
{
"docid": "946e60ddcfe20db409df48bcb955b8f0",
"score": "0.5225217",
"text": "def set_username\n self.username = \"#{self.email.split('@').first}#{Faker::Number.number(3)}\"\n end",
"title": ""
},
{
"docid": "fe41f01785795b79d69309bacbc0d51a",
"score": "0.5224262",
"text": "def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"title": ""
},
{
"docid": "ed5083584b1d9f46cefff1fc8db538c3",
"score": "0.52225953",
"text": "def signup\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"title": ""
},
{
"docid": "49ede045115b910604ffce8fa35c5563",
"score": "0.520991",
"text": "def signup_confirmation(member)\n @member = member\n\n mail to: member.email, subject: \"Welcome to the community!\"\n end",
"title": ""
},
{
"docid": "233fbafcf02ac1d34fbc2639206eaf94",
"score": "0.5200233",
"text": "def checkout_as_existing_user(email, password)\n checkout_as_existing_user_form.user_email_input.set email\n checkout_as_existing_user_form.user_password_input.set password\n checkout_as_existing_user_form.user_checkout_btn.click\n end",
"title": ""
},
{
"docid": "36e5ef8b99d97179c07c9619487d99c0",
"score": "0.51973295",
"text": "def current_user_dev\n @current_user ||= User.new(email: \"user@nyu.edu\", firstname: \"Julius\", username: \"jcVI\", admin: true, admin_collections: [\"global\"])\n end",
"title": ""
},
{
"docid": "8c028975c1c53406e7416c572f0c5cfb",
"score": "0.51928675",
"text": "def confirm_creation(user, welcome_message, host)\n locale = user.locale.blank? ? Ubiquo.default_locale : user.locale\n subject I18n.t('ubiquo.auth.new_user_created', \n :app_title => Ubiquo::Config.get(:app_title), \n :locale => locale)\n recipients user.email\n from Ubiquo::Config.get(:notifier_email_from)\n \n body :user => user, :host => host, :welcome_message => welcome_message, :locale => locale\n end",
"title": ""
},
{
"docid": "6a281a007b256c2905a83104191da5db",
"score": "0.51889575",
"text": "def setup \n @user = current_user\n end",
"title": ""
},
{
"docid": "68f33c44a3b45c7841e9375a2e4fbf1c",
"score": "0.5187761",
"text": "def signup\n @greeting = \"Hi\"\n\n mail to: \"ajayashok.01@gmail.com\"\n end",
"title": ""
},
{
"docid": "421999992e9917a186e64106f5f8d581",
"score": "0.51804495",
"text": "def setup_dns(node)\n # Set up /etc/hosts\n node.vm.provision \"setup-hosts\", :type => \"shell\", :path => \"ubuntu/vagrant/setup-hosts.sh\" do |s|\n s.args = [\"enp0s8\", node.vm.hostname]\n end\n # Set up DNS resolution\n node.vm.provision \"setup-dns\", type: \"shell\", :path => \"ubuntu/update-dns.sh\"\nend",
"title": ""
},
{
"docid": "d15f9e764aecca9be7ebdde0fb928b81",
"score": "0.51767474",
"text": "def registration_confirmation(user)\n @account = user\n mail(:to => named_email(user), :subject => \"Outcircle - Welcome\")\n end",
"title": ""
},
{
"docid": "6666f0ab932e7a985986dc675cf6b788",
"score": "0.51766825",
"text": "def signup_confirmation(user)\n @user= user\n debugger\n mail to: @user.email , subject: \"MovieBox Sign Up Confirmation\"\n \n end",
"title": ""
},
{
"docid": "854c3ed0effa182e188cf7bc4e30ca97",
"score": "0.5174376",
"text": "def set_hostname(server)\n server.vm.provision 'shell', inline: \"hostname #{server.vm.hostname}\"\nend",
"title": ""
},
{
"docid": "c9ddddf76409855aa64b91a5b4762cb1",
"score": "0.51720005",
"text": "def signup_confirmation(user, root_url)\n @user = user\n @url = root_url + 'login'\n mail(to: user.username, subject: 'Sign Up Confirmation')\n end",
"title": ""
},
{
"docid": "5fd5431cb9391a0fb55ad28584bc2ca3",
"score": "0.5164918",
"text": "def sign_up_users(first_name, last_name, email, password)\n find_by_id('com.yelp.android:id/first_name').send_key first_name\n find_by_id('com.yelp.android:id/last_name').send_key last_name\n find_by_id('com.yelp.android:id/email_address').send_key email\n find_by_id('com.yelp.android:id/password').send_key password\n find_name('Gender')\n find_name('Male')\n end",
"title": ""
},
{
"docid": "20cf03515a9f4bc4d43eb6ba210a3577",
"score": "0.5164174",
"text": "def setup\n @user = users(:michael)\n end",
"title": ""
},
{
"docid": "8bbfe5c58a9b6014d6b2525866e2d839",
"score": "0.5162371",
"text": "def register_vbox_vm(client_name,client_os)\n message = \"Registering:\\tVM \"+client_name\n command = \"VBoxManage createvm --name \\\"#{client_name}\\\" --ostype \\\"#{client_os}\\\" --register\"\n execute_command(message,command)\n return\nend",
"title": ""
}
] |
5de939ccd957f3702c21862065a79d3e
|
test basic guest level requests
|
[
{
"docid": "7dc3be34db03d43a323771846102a599",
"score": "0.6999567",
"text": "def test_default_guest_gives_login_screen\n get '/'\n assert last_response.ok?\n assert last_response.body.include?('log in to continue')\n end",
"title": ""
}
] |
[
{
"docid": "a62a6bf40caeda4e8af2cce0bcd95a3b",
"score": "0.6861626",
"text": "def get_a_guest(args = {}) \n get(\"/guestaccess.json/#{args[:guestId]}\", args)\nend",
"title": ""
},
{
"docid": "a62a6bf40caeda4e8af2cce0bcd95a3b",
"score": "0.6861626",
"text": "def get_a_guest(args = {}) \n get(\"/guestaccess.json/#{args[:guestId]}\", args)\nend",
"title": ""
},
{
"docid": "77ca875d0c5f1199013be8fd494acdd7",
"score": "0.6761",
"text": "def list_guests_for_guest_access_portal(args = {}) \n get(\"/guestaccess.json/#{args[:portalId]}/guest\", args)\nend",
"title": ""
},
{
"docid": "7231828068df8abc3b9e303a0e6a0d78",
"score": "0.660173",
"text": "def test_guest_can_check__in\n assert_equal()\n end",
"title": ""
},
{
"docid": "c22dcadab669f5064728419caa8484ea",
"score": "0.6572655",
"text": "def search_for_a_guest(args = {}) \n get(\"/guestaccess.json/search\", args)\nend",
"title": ""
},
{
"docid": "6f3ea23e7f82c51703274da167f1bbd2",
"score": "0.6518707",
"text": "def list_all_guests(args = {}) \n get(\"/guestaccess.json/all\", args)\nend",
"title": ""
},
{
"docid": "6f3ea23e7f82c51703274da167f1bbd2",
"score": "0.6518707",
"text": "def list_all_guests(args = {}) \n get(\"/guestaccess.json/all\", args)\nend",
"title": ""
},
{
"docid": "9fe9513b51b04f9c8929296f5db727f6",
"score": "0.6500377",
"text": "def test_ID_25877_profile_public_as_guest\n guest_user\n click_on_any_group_as_guest \"Police\"\n $group_for_guest_user.when_present(60).click\n sleep 5\n verify_text \"test_ID_25877_profile_public_as_guest\",\"Managed Groups\", \"Posts\", \"Following\", \"Comments\", \"Recent Activity\"\n verify_edit_button_not_exist\n click_group_icon_verify_redirect \"food-and-drink\"\n click_group_name_verify_redirect \"food-and-drink\"\n click_follow_verify_redirect\n end",
"title": ""
},
{
"docid": "fe2b3f72ced711788bd3a45d122a1b61",
"score": "0.63223934",
"text": "def test_check_guest_into_room_and_charge_entry()\n @room1.check_in_guest(@guest1)\n assert_equal(1, @room1.count_guests())\n assert_equal(12, @guest1.cash)\n end",
"title": ""
},
{
"docid": "d79557cc80b7d4f3068355d8ebc9c176",
"score": "0.63102406",
"text": "def test_guest_check_in()\n @room1.check_in(@guest1)\n assert_equal(1, @room1.guests.length)\n end",
"title": ""
},
{
"docid": "6c16c024ce4e28c809f61423cc4da701",
"score": "0.62931585",
"text": "def test_access_worker \n \n #client \n login_as('worker') \n \n msg = \"Worker don't have privileges to access invoice_system/\"\n \n #list\n get :list\n assert_response :success\n assert_template 'error' , msg + \"list\" \n \n #show\n get :show\n assert_response :success\n assert_template 'error' , msg + \"show\" \n \n #new\n get :new\n assert_response :success\n assert_template 'error' , msg + \"new\" \n \n #create\n get :create\n assert_response :success\n assert_template 'error' , msg + \"create\" \n \n #update\n get :update\n assert_response :success\n assert_template 'error' , msg + \"update\" \n \n #update_client_requests\n get :update_client_requests\n assert_response :success\n assert_template 'error' , msg + \"update_client_requests\" \n \n #delete\n get :delete\n assert_response :success\n assert_template 'error' , msg + \"delete\" \n \n #update_done_approved\n get :update_done_approved\n assert_response :success\n assert_template 'error' , msg + \"update_done_approved\" \n \n #list_client_requests\n get :list_client_requests\n assert_response :success\n assert_template 'error' , msg + \"list_client_requests\" \n \n logout() \n end",
"title": ""
},
{
"docid": "fd16fbe66ef6c92f4e37de178aa291a5",
"score": "0.6273502",
"text": "def cmd_test(m, params)\n # access control: require authentication\n nick, user = auth m, true\n return if not user\n\n regged = nickserv? m.source\n\n # valid email/api-secret combination?\n if valid?(user[:email], user[:api_secret])\n m.reply \"Zeitgeist authentication test #{Bold}successful#{NormalText} \" +\n \"for #{nick} using #{Bold}#{user[:email]}#{NormalText}. (#{regged ? 'nickserv registered' : 'not registered'})\"\n else\n m.reply \"Zeitgeist authentication test #{Bold}failed#{NormalText} \" +\n \"for #{nick} using #{Bold}#{user[:email]}#{NormalText}. (#{regged ? 'nickserv registered' : 'not registered'})\"\n end\n end",
"title": ""
},
{
"docid": "e28caed7c79f1ed9fc0fda0b3b5a49d0",
"score": "0.6240269",
"text": "def test_can_check_guest_into_selected_room__can_afford\n @karaoke_bar.check_guest_in(10, @room1, @guest1)\n assert_equal(1, @room1.number_of_guests_in_room)\n assert_equal(1010, @karaoke_bar.till())\n assert_equal(40, @guest1.wallet())\n end",
"title": ""
},
{
"docid": "0fb700f96ef0a9f03b568500acf8c5db",
"score": "0.6198923",
"text": "def test_logged_in_user_access_to_userland_approved\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('Welcome root.') \n end",
"title": ""
},
{
"docid": "911ac3095d09a3cf83b381a73e618be0",
"score": "0.61967343",
"text": "def test_check_in_guest\n @room1.check_in_guest(@guest_name1)\n stepa = @room1.guest\n actual = stepa.count\n assert_equal(1, actual)\n end",
"title": ""
},
{
"docid": "40db1af3f6d2fc66c4a3063efacd73a6",
"score": "0.61857253",
"text": "def get_guest_access_portal(args = {}) \n get(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend",
"title": ""
},
{
"docid": "40db1af3f6d2fc66c4a3063efacd73a6",
"score": "0.61857253",
"text": "def get_guest_access_portal(args = {}) \n get(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend",
"title": ""
},
{
"docid": "6c8c9b5e7011ba9af41773c2e1dbd4b7",
"score": "0.6144528",
"text": "def test_check_in_guests__room_has_guests\n result1 = @room1.check_in_guests(@guest_group1)\n result2 = @room1.check_in_guests(@guest_group2)\n guests_in_room = @room1.current_guests()\n guest1_money = @guest1.money().round(3)\n guest4_money = @guest4.money().round(3)\n takings = @room1.takings()\n assert_equal(@guest_group1, guests_in_room)\n assert_equal(5.000, guest1_money)\n assert_equal(15.000, guest4_money)\n assert_equal([\"Woohoo!\", \"Woohoo!\"], result1)\n assert_nil(result2)\n assert_equal(50, takings)\n end",
"title": ""
},
{
"docid": "215b94385e2bac8607f243cb0a523268",
"score": "0.6135899",
"text": "def test_access_worker \n \n #client \n login_as('worker') \n \n msg = \"Worker don't have privileges to access client_requests/\"\n \n #new\n get :new\n assert_response :success\n assert_template 'error' , msg + \"new\" \n \n #create\n get :create\n assert_response :success\n assert_template 'error' , msg + \"create\" \n \n #edit\n get :edit\n assert_response :success\n assert_template 'error' , msg + \"edit\" \n \n #update\n get :update\n assert_response :success\n assert_template 'error' , msg + \"update\" \n \n #delete\n get :delete\n assert_response :success\n assert_template 'error' , msg + \"delete\" \n \n #update_positions\n get :update_positions\n assert_response :success\n assert_template 'error' , msg + \"update_positions\" \n \n #done_and_approved\n get :done_and_approved\n assert_response :success\n assert_template 'error' , msg + \"done_and_approved\" \n \n #create_discussion\n get :create_discussion\n assert_response :success\n assert_template 'error' , msg + \"create_discussion\" \n \n \n #delete_discussion\n get :delete_discussion\n assert_response :success\n assert_template 'error' , msg + \"delete_discussion\" \n \n #create_thread\n get :create_thread\n assert_response :success\n assert_template 'error' , msg + \"create_thread\" \n \n \n #upload\n get :upload\n assert_response :success\n assert_template 'error' , msg + \"upload\" \n \n #upload_file\n get :upload_file\n assert_response :success\n assert_template 'error' , msg + \"upload_file\" \n \n logout() \n end",
"title": ""
},
{
"docid": "5e04646415c114b66442e07c88fd192b",
"score": "0.60940737",
"text": "def test_check_in_guests__guests_cannot_afford\n result = @room1.check_in_guests(@guest_group3)\n guests_in_room = @room1.current_guests()\n guest4_money = @guest4.money()\n takings = @room1.takings()\n assert_equal([],guests_in_room)\n assert_nil(result)\n assert_equal(15,guest4_money)\n assert_equal(0, takings)\n end",
"title": ""
},
{
"docid": "4eefab0464191ed6644db6869e136ae1",
"score": "0.60744333",
"text": "def add_guest_access_portal(args = {}) \n post(\"/guestaccess.json/gap/\", args)\nend",
"title": ""
},
{
"docid": "4eefab0464191ed6644db6869e136ae1",
"score": "0.60744333",
"text": "def add_guest_access_portal(args = {}) \n post(\"/guestaccess.json/gap/\", args)\nend",
"title": ""
},
{
"docid": "db13195a0b255fd4cfc32323c01f3eaf",
"score": "0.6018115",
"text": "def test_return_network_request\n\n # Test same-domain request (response code and content of secret_page.html)\n response = RestClient.post \"#{RESTAPI_MODULES}/#{@@hb_session}/#{@@mod_debug_test_network}?token=#{@@token}\",\n #override only a few parameters, the other ones will have default values from modules's module.rb definition\n {\"domain\" => ATTACK_DOMAIN, \"port\" => \"3000\", \"path\" => \"/demos/secret_page.html\"}.to_json,\n :content_type => :json,\n :accept => :json\n assert_equal 200, response.code\n assert_not_nil response.body\n result = JSON.parse(response.body)\n success = result['success']\n assert success\n\n cmd_id = result['command_id']\n sleep 3.0\n response = RestClient.get \"#{RESTAPI_MODULES}/#{@@hb_session}/#{@@mod_debug_test_network}/#{cmd_id}\", {:params => {:token => @@token}}\n assert_equal 200, response.code\n assert_not_nil response.body\n result = JSON.parse(response.body)\n data = JSON.parse(result[\"data\"])\n res = JSON.parse(data[\"data\"])\n assert_not_nil res\n assert_equal 200, res[\"status_code\"]\n assert res[\"response_body\"].include?(\"However you should still be capable of accessing it\\n\\t\\tusing the Requester\")\n\n end",
"title": ""
},
{
"docid": "6c6f0bf89fbc39dc4640b2ab24ec70b8",
"score": "0.6009109",
"text": "def test_guest_checkin_room\n @room.guest_checkin_room(@guest1)\n assert_equal(1,@room.guest.length)\n end",
"title": ""
},
{
"docid": "114dd5ab0d864660914dec77ab03bcc6",
"score": "0.60029894",
"text": "def test_guest_access_to_userland_gives_login_screen\n get '/in/index'\n follow_redirect!\n \n assert last_request.url.ends_with?(\"/login\")\n assert last_response.ok?\n assert last_response.body.include?('log in to continue') \n end",
"title": ""
},
{
"docid": "3f555e0cf3c46eb64620d9964f472051",
"score": "0.59996784",
"text": "def test_sign_in__capacity_full\n @room.sign_in(@guest2)\n @room.sign_in(@guest3)\n assert_equal(2, @room.guests.length)\n end",
"title": ""
},
{
"docid": "a530c32130711e9051e93bdd69ea77ea",
"score": "0.5991614",
"text": "def list_guest_access_portals(args = {}) \n get(\"/guestaccess.json/gap/\", args)\nend",
"title": ""
},
{
"docid": "a530c32130711e9051e93bdd69ea77ea",
"score": "0.5991614",
"text": "def list_guest_access_portals(args = {}) \n get(\"/guestaccess.json/gap/\", args)\nend",
"title": ""
},
{
"docid": "4744cf9ab4604642d8a01ee214bbda02",
"score": "0.5985962",
"text": "def test_can_check_guest_into_selected_room__guest_already_in_room\n @karaoke_bar.add_guest_to_room(@room1, @guest1)\n @karaoke_bar.check_guest_in(10, @room1, @guest1)\n guest_already_in_room = @karaoke_bar.check_guest_in(10, @room1, @guest1)\n assert_equal(\"#{@guest1.name} is already in this room!\", guest_already_in_room)\n assert_equal(1, @room1.number_of_guests_in_room())\n assert_equal(1000, @karaoke_bar.till())\n assert_equal(50, @guest1.wallet())\n end",
"title": ""
},
{
"docid": "d3b091f34449671997372b246c788ee4",
"score": "0.59583986",
"text": "def test_require_http_auth_for_all\n @request.host=\"dennis.ublip.com\"\n get :all, {}#, {:user => users(:dennis), :user_id => users(:dennis), :account_id => accounts(:dennis)}\n assert_equal @response.body, \"Couldn't authenticate you\"\n end",
"title": ""
},
{
"docid": "1b774a0f42e36b454e399468edad2632",
"score": "0.59427834",
"text": "def test_check_in\n @single_room.check_in(@guest3)\n assert_equal(@guest3, @single_room.current_guest)\n end",
"title": ""
},
{
"docid": "e8b4682272c2e07d09a3ce13efdf46f3",
"score": "0.5941172",
"text": "def test_add_guest\n guest = Guest.new(\"Ed\", 100, \"Blink 182 - Anthem Part 2\")\n @room.add_guest(guest)\n result = @room.count_guests()\n assert_equal(1, result)\n end",
"title": ""
},
{
"docid": "c036f8133c600fc5b422430e456e859a",
"score": "0.5931923",
"text": "def test_shold_not_show_to_guest\n sign_out :user\n get :show\n assert_response :redirect\n end",
"title": ""
},
{
"docid": "22e4d3fbb54f07d81abcbc5171d37de4",
"score": "0.5925071",
"text": "def test_can_check_guest_into_selected_room__capacity_not_exceeded\n @karaoke_bar.add_guest_to_room(@room3, @guest1)\n @karaoke_bar.check_guest_in(10, @room3, @guest4)\n assert_equal(2, @room3.number_of_guests_in_room())\n assert_equal(1010, @karaoke_bar.till())\n assert_equal(70, @guest4.wallet())\n end",
"title": ""
},
{
"docid": "c4efc7442e2b58e5b545373c97c8aa57",
"score": "0.5922909",
"text": "def test_welcome\n # Step 1\n params = {\n 'request_host' => 'http://www.xx.com',\n 'source' => 'WEB',\n 'user_id' => @user.id\n }\n\n post '/em/welcome', params\n assert_response(@response, :success)\n assert_match(@parsed_response['MailingID'], @parsed_response['Location'], @parsed_response)\n end",
"title": ""
},
{
"docid": "1bcd86f01d77b1146d8230e577a79d0e",
"score": "0.591587",
"text": "def test_can_check_guest_out_of_selected_room__guest_is_in_room\n @karaoke_bar.check_guest_in(10, @room1, @guest1)\n @karaoke_bar.check_guest_in(10, @room1, @guest2)\n @karaoke_bar.check_guest_out(@room1, @guest1)\n assert_equal(1, @room1.number_of_guests_in_room())\n end",
"title": ""
},
{
"docid": "b22fd20f956d7585357f2c6af8301b03",
"score": "0.5915822",
"text": "def test_02_guestuser_share_story()\n\t\t\n\t\tputs \"------------------------ START OF SCENARIO 1 --------------------\"\n\t\tsearchOrg(\"Minnesota Community Foundation\")\n\t\tdonateUsingNewCard(\"10.00\", \"Sample UserFF\", \"2nd Street\", \"Washington DC\", \n\t\t\t\t\t\"Washington\", \"95008\", \"4111111111111111\", \"123\", \"sampleuserff@aol.com\")\n\t\tguestUserSharePage(\"sharepage@aol.com\")\n\t\tputs \"------------------------ END OF SCENARIO 1 --------------------\"\n\tend",
"title": ""
},
{
"docid": "8fdbd4fa76a7c79d8a5741f94aaa476b",
"score": "0.59117156",
"text": "def test_room_check_in\n @room.add_guest(@guest1)\n assert_equal([@guest1], @room.get_guests)\n @room.add_guest(@guest2)\n assert_equal([@guest1, @guest2], @room.get_guests)\n end",
"title": ""
},
{
"docid": "8e015c25b0b8af951264c5eb6a7072fb",
"score": "0.5909255",
"text": "def test_veto_request_simple_self_not_admin\n s = \"/StudentDashboard\"\n r = CourseList.vetoRequest(\"daisy\", s) { false }\n refute r, \"self simple not admin\"\n end",
"title": ""
},
{
"docid": "5bb7681342d544f6748098d12ace2d9d",
"score": "0.5906677",
"text": "def test_sign_in__cannot_afford\n @room.sign_in(@guest4)\n assert_equal(1, @room.guests.length)\n end",
"title": ""
},
{
"docid": "a4460b91e240e28857491da9529235e6",
"score": "0.5903653",
"text": "def test_logged_in_user_access_to_userland_approved\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end",
"title": ""
},
{
"docid": "9a1cb6618f209f33da90f5d8712ec7d9",
"score": "0.5897077",
"text": "def test_access_lead \n \n #client \n login_as('lead') \n \n msg = \"Lead don't have privileges to access lead/\"\n \n #new\n get :new\n assert_response :success\n assert_template 'error' , msg + \"new\" \n \n #show\n get :show\n assert_response :success\n assert_template 'error' , msg + \"show\" \n \n #create\n get :create\n assert_response :success\n assert_template 'error' , msg + \"create\" \n \n #edit\n get :edit\n assert_response :success\n assert_template 'error' , msg + \"edit\" \n \n #update\n get :update\n assert_response :success\n assert_template 'error' , msg + \"update\" \n \n #destroy\n get :destroy\n assert_response :success\n assert_template 'error' , msg + \"destroy\" \n \n \n \n \n logout() \n end",
"title": ""
},
{
"docid": "ec0f5e89f0ba3dcf385428b952e82c36",
"score": "0.5866191",
"text": "def test_restful_hooks\n BeefTest.new_victim\n sleep 2.0\n response = RestClient.get \"#{RESTAPI_HOOKS}\", {:params => {:token => @@token}}\n assert_equal 200, response.code\n assert_not_nil response.body\n result = JSON.parse(response.body)\n @@hb_session = result[\"hooked-browsers\"][\"online\"][\"0\"][\"session\"]\n assert_not_nil @@hb_session\n end",
"title": ""
},
{
"docid": "1c13c448f83c7e1b01bf001cdddc0a22",
"score": "0.5861861",
"text": "def test_get_guest_name()\n assert_equal(\"Name\", @guest1.name())\n end",
"title": ""
},
{
"docid": "d13183a63f662b76676135493146097b",
"score": "0.5854342",
"text": "def test_get_hosts_valid_session\n rest_response = nil\n assert_nothing_raised do\n rest_response = RestClient.get(\"#{RESTAPI_NETWORK}/hosts/#{@@hb_session}\", :params => {:token => @@token})\n end\n check_rest_response(rest_response)\n result = JSON.parse(rest_response.body)\n assert(result['count'])\n assert(result['hosts'])\n assert_not_equal(0, result['count'])\n\n result['hosts'].each do |host|\n assert_equal(@@hb_session, host['hooked_browser_id'])\n end\n end",
"title": ""
},
{
"docid": "ae0cad149532c2a255f07bbc0a7bf969",
"score": "0.58503515",
"text": "def test_should_allow_post_if_logged_in\n login_as :trevor\n get :show, :id => 1\n assert_response :success\n assert_select \"span#reply\"\n end",
"title": ""
},
{
"docid": "2773d9c4ce7ef1ecb3a51b0d425c9bc1",
"score": "0.58454365",
"text": "def call( request ) ; test( request ) ; end",
"title": ""
},
{
"docid": "d48b0ea7411c2b78ee30e5f0ce74893a",
"score": "0.58448726",
"text": "def test_can_not_check_guest_into_selected_room__capacity_exceeded\n @karaoke_bar.add_guest_to_room(@room3, @guest1)\n @karaoke_bar.add_guest_to_room(@room3, @guest2)\n @karaoke_bar.check_guest_in(10, @room3, @guest4)\n assert_equal(2, @room3.number_of_guests_in_room())\n assert_equal(1000, @karaoke_bar.till())\n assert_equal(80, @guest4.wallet())\n end",
"title": ""
},
{
"docid": "1cc377a0796f127d7010cc9e4c9019bf",
"score": "0.5843434",
"text": "def testRolesViewing\n puts '[-] Test1: Checking if Current User can check existing roles'.cyan\n path = '/d2l/api/lp/1.4/roles/'\n http_method = 'GET'\n test_uri = create_authenticated_uri(path, http_method)\n puts '[-] Authenticated URI Created For: ' + path\n # General Brightspace API response behaviors\n get_query(test_uri)\n puts \"[+] Test1 Succeeded\\n\".green\nrescue\n puts '[!] Test1 failed'.red\nend",
"title": ""
},
{
"docid": "0f356a238477db861fed69ee0bfda12d",
"score": "0.58429235",
"text": "def test_sign_in\n @room.sign_in(@guest2)\n assert_equal(0, @guest2.monies)\n assert_equal(2, @room.guests.length)\n assert_equal(2, @room.profit)\n assert_equal(2, @guest2.spendings)\n end",
"title": ""
},
{
"docid": "69655a7eb95b651f7123c34618da8188",
"score": "0.58300817",
"text": "def init_for_testing()\n\n $config[\"http\"].each do |doc|\n\n port = doc[1][\"adminPort\"]\n host = doc[1][\"host\"]\n\n http = Net::HTTP.new(host, port)\n request = Net::HTTP::Post.new(\"/admin/test/init\")\n request.basic_auth(\"admin@system\",\"adminadmin\")\n\n response = http.request(request)\n response.code.should == \"200\"\n end\n\nend",
"title": ""
},
{
"docid": "6e3a1a3ef42f042680a6959247ca2493",
"score": "0.58123565",
"text": "def guest?\n false\n end",
"title": ""
},
{
"docid": "d5f66c8a55b2d5ae9b6ac414f94c5ed7",
"score": "0.58016473",
"text": "def atest_ID_25878_profile_page\n # this test covered by test_ID_25877_profile_public_as_guest\n end",
"title": ""
},
{
"docid": "9c47eabc22d2dc1078c3bec81a9d68ff",
"score": "0.5800832",
"text": "def guest?\n group.access_level == 10\n end",
"title": ""
},
{
"docid": "27ba26b759bcce63e3126f09767aeb60",
"score": "0.5800821",
"text": "def test_checking_rooms_capacity\n result = @room_1.guest_checkin(@guest_1)\n assert_equal(\"Sorry, we are full booked\", result)\nend",
"title": ""
},
{
"docid": "bf6b3f8e09939b327b68d34751e0f8f8",
"score": "0.57938164",
"text": "def test_login_attempt_good__username_and_password_gives_user_home_screen\n post '/login', {:username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n assert last_response.ok?\n assert last_response.body.include?('Welcome root.') \n end",
"title": ""
},
{
"docid": "c10f033b9970339f5519da11219681b3",
"score": "0.5788514",
"text": "def test_request_button_auth_redirect\n skip \"Horizon Unavailable\" if horizon_unavailable?\n visit '/catalog/bib_305929'\n first('div.holding-visible').click\n first('a.item-children-link').click\n first('a.request').click\n assert page.has_no_content?('Network Error')\n assert page.has_content?('Login')\n end",
"title": ""
},
{
"docid": "f8c8ddd8779c10cb9a78d82f17fff707",
"score": "0.57793176",
"text": "def test_can_get_guest_name\n assert_equal(\"Ken Adams\", @guest3.name())\n end",
"title": ""
},
{
"docid": "4cc54c70e30cb01ef7c5596fa9e45fab",
"score": "0.5773136",
"text": "def test_add_guest_to_full_room\n @room1.add_a_guest(@guest4)\n assert_equal(@room1.capacity, @room1.guest_list.count())\n end",
"title": ""
},
{
"docid": "1c0f2de94cfc4a2c35ba69af3b7f271f",
"score": "0.5752777",
"text": "def test_admin_login_correct\n post '/user_logged_in', :@userHandle => 'username', :@userPassword => 'password'\n response = get '/cars'\n assert_equal 200, response.status\n end",
"title": ""
},
{
"docid": "3946f56e1701fb0e010fd7a19e3cb9a9",
"score": "0.5751882",
"text": "def check_in_guest(guest)\n return \"Room #{@number.to_s} is full.\" unless check_availability\n return \"#{guest.name} doesn't have the entry fee.\" unless guest.check_affordable(@fee)\n guest.pay_money(@fee)\n @guests << guest\n # This should send the result to viewer.\n guest.cheer_for_song(@playlist)\n return \"Check in successful\"\n end",
"title": ""
},
{
"docid": "68d3496ca93b0cc56c0cf77b34d69825",
"score": "0.57504976",
"text": "def test_guest_check_out_rooms\n @rooms.checkout_guest(@guest_3)\n assert_equal(2, @rooms.guests_count())\nend",
"title": ""
},
{
"docid": "0a051015ab1a62c6e6e32e9394ef2fc6",
"score": "0.5747214",
"text": "def test_discovery\n options '*', {}, {'HTTP_ACCEPT' => Rack::TCTP::TCTP_DISCOVERY_MEDIA_TYPE}\n assert last_response.ok?\n assert_equal last_response.body, Rack::TCTP::DEFAULT_TCTP_DISCOVERY_INFORMATION\n end",
"title": ""
},
{
"docid": "726c8b0fa95c3ca79bf2c07716787549",
"score": "0.5746138",
"text": "def testauth\n return false # we don't support authenticated nodes yet\n end",
"title": ""
},
{
"docid": "6f87724556a0f39dd67ff6940918ce23",
"score": "0.57440364",
"text": "def test_access_lead \n \n #client \n login_as('lead') \n \n msg = \"Lead don't have privileges to access invoice_system/\"\n \n #delete\n get :delete\n assert_response :success\n assert_template 'error' , msg + \"delete\" \n \n logout() \n end",
"title": ""
},
{
"docid": "77aac375af02521153d2f5cb08308d73",
"score": "0.57440156",
"text": "def test_a_request\n response = client.get 'test.echo'\n assert response =~ /stat=\"fail\"/\n assert response =~ /code=\"100\"/\n assert response =~ /msg=\"Invalid API Key \\(Key not found\\)\"/\n end",
"title": ""
},
{
"docid": "398798e1cdd0cc221ef07fe64bfbff22",
"score": "0.574045",
"text": "def test_if_guest_is_in_room_list__true\n @karaoke_bar.add_guest_to_room(@room1, @guest1)\n check = @karaoke_bar.check_if_guest_in_room(@room1, @guest1)\n assert_equal(true, check)\n end",
"title": ""
},
{
"docid": "1f5687e53b219ad60899a199a0beb1b3",
"score": "0.5734788",
"text": "def test_is_guest_in_room__yes()\n assert_equal(true, @room1.is_guest_in_room(@guest2.guest_name))\n end",
"title": ""
},
{
"docid": "e658d042abffbc924788eb6c833ef423",
"score": "0.5734712",
"text": "def test_guest_cannot_afford_room()\n @room5.add_guests(@guest7)\n assert_equal(6, @guest7.money)\n assert_equal(0, @room5.guests.length)\n end",
"title": ""
},
{
"docid": "143aee21ecd5776ac61082c9113855ef",
"score": "0.57203394",
"text": "def test_veto_request_courses_self_not_admin\n s=\"/StudentDashboard/courses/abba.json\"\n r = CourseList.vetoRequest(\"abba\", s) { false }\n refute r, \"request my courses not admin\"\n end",
"title": ""
},
{
"docid": "a1e43c923f626c5c0f3c496c22dd0829",
"score": "0.570499",
"text": "def test_check_in_guests__more_guests_than_room_capacity\n result = @room1.check_in_guests(@guest_group2)\n guests_in_room = @room1.current_guests()\n takings = @room1.takings()\n assert_equal([],guests_in_room)\n assert_nil(result)\n assert_equal(0, takings)\n end",
"title": ""
},
{
"docid": "0864d944836f07471cb1bc869080c96a",
"score": "0.57044977",
"text": "def test_check_out_guest_r1_capacity2\n @room1.check_in_guest(@guest_name1)\n @room1.check_in_guest(@guest_name2)\n @room1.check_out_guest(@guest_name1)\n stepa = @room1.guest\n actual = stepa.count\n assert_equal(1, actual)\n end",
"title": ""
},
{
"docid": "47832216d827dbb4952fdfb9e0c95ef9",
"score": "0.56806505",
"text": "def test_guest_can_check_out\n @rooms.check_guest_in(@guests)\n @rooms.check_guest_out(@guests1)\n @rooms.check_guest_out(@guests2)\n result = @rooms.check_guest_out(@guests)\n assert_equal(1, result.length)\n end",
"title": ""
},
{
"docid": "d19de71f761e6c0a73c0fce010d57115",
"score": "0.5680469",
"text": "def generate_new_password_for_guest(args = {}) \n post(\"/guestaccess.json/#{args[:guestId]}/newpassword\", args)\nend",
"title": ""
},
{
"docid": "d19de71f761e6c0a73c0fce010d57115",
"score": "0.5680469",
"text": "def generate_new_password_for_guest(args = {}) \n post(\"/guestaccess.json/#{args[:guestId]}/newpassword\", args)\nend",
"title": ""
},
{
"docid": "501f496bce2b1895808ed27d6fd26f3b",
"score": "0.56771755",
"text": "def test_mage_checkout\n @custom_number_of_users.times do |i|\n puts '[INFO] Checking out as guest... Running test for user #'+i.to_s\n start_time = Time.now\n add_to_cart @helper.get_yaml_data @application['data']\n get_a_shipping_quote\n @helper.proceed_to_checkout\n assert_section 'checkout'\n finalize_checkout_as_guest\n final_time = Time.now - start_time\n puts \"[INFO] It took #{final_time} seconds to complete the order\"\n end\n end",
"title": ""
},
{
"docid": "0f02dc21020b75e017786f9ec08d01b9",
"score": "0.5669054",
"text": "def can_guest_come_in(guest, room) \n if is_room_at_capacity() == true\n # if pay_entry(guest) == true\n #guest.give_cash(room)\n #add_cash_to_room()\n #get_guest(guest)\n return true #{}\"#{guest.name} in you go, have a good time!\"\n # end\n end\n end",
"title": ""
},
{
"docid": "8dd05f77038dce7e1ebfb704ae8b48ae",
"score": "0.5665693",
"text": "def fetch_guest\n id = params[:guest_id]\n\n @guest = Guest.where(guestId: id).first\n head :not_found unless @guest\n end",
"title": ""
},
{
"docid": "c461731bd92483d73f5896bbfdf81c68",
"score": "0.56649077",
"text": "def test_guests\n assert_equal(@guests, @room.guests)\n end",
"title": ""
},
{
"docid": "95f0b01985a05bb3c00b815eca1fc014",
"score": "0.56614023",
"text": "def test_get()\n\t\tget '/'\n\t\tassert last_response.ok?\n\t\tassert(last_response.body.include?('Hooray'), 'Basic get test')\n\tend",
"title": ""
},
{
"docid": "5e1d120cd7e0095d8b72977c5609e9c9",
"score": "0.56479776",
"text": "def test_check_out_guests__guests_are_in_room\n @room1.check_in_guests(@guest_group1)\n @room1.check_out_guests(@guest_group1)\n guests_in_room = @room1.current_guests()\n assert_equal([],guests_in_room)\n end",
"title": ""
},
{
"docid": "41fd0d9707c8798bf6dfb90e4fbcb225",
"score": "0.5638645",
"text": "def test_live_flag_triggers_live_mode\n #stub setup\n Excon.stub({:method => :post, :body => {\n emails: nil,\n list: List.new(home + '/personal/groceries').to_h\n }.to_json}, {:status => 200,:body => '\"DEADBEEF\"'})\n\n #stub checks\n 3.times do |i|\n Excon.stub({:method => :post, :path => \"/DEADBEEF/check/#{i}\" },\n {:status => 200})\n end\n 3.times { console.in_stream.expect :gets, \"y\" }\n check \"start groceries --live\"\n end",
"title": ""
},
{
"docid": "f4f7f7972fc6735caf1f1bb15d8e578d",
"score": "0.5636564",
"text": "def test_simple_request\n client = TestClientOK.new()\n assert_equal(\"no arg\", client.request(\"no\"))\n assert_equal(\"one arg\", client.request(\"one\", \"one arg\"))\n assert_equal(2, client.request(\"two\", 1, 2))\n assert_equal(3.0, client.request(\"three\", 1.0, 2.0, 3.0))\n client.close()\n end",
"title": ""
},
{
"docid": "e0b32bd89a56397b010d36f03d9be821",
"score": "0.56353694",
"text": "def test_check_out_guest_r2_capacity3\n @room2.check_in_guest(@guest_name1)\n @room2.check_in_guest(@guest_name2)\n @room2.check_in_guest(@guest_name3)\n @room2.check_out_guest(@guest_name1)\n stepa = @room2.guest\n actual = stepa.count\n assert_equal(2, actual)\n end",
"title": ""
},
{
"docid": "d0034dce61a594342fe89dd557663651",
"score": "0.563359",
"text": "def test_add_guest_to_room()\n @room1.add_guest_to_room(@guest5.guest_name, @guest5.guest_cash)\n @guest5.guest_pays(@room1.room_fee_per_guest)\n @bar.bar_accepts_fee(@room1.room_fee_per_guest)\n @room1.compare_songs(@guest5.guest_fav_song)\n assert_equal(3, @room1.guests_already_in_room)\n assert_equal(50, @guest5.guest_cash)\n assert_equal(510,@bar.bar_cash)\n assert_equal(\"YES! My favourite song!\",\n @room1.compare_songs(@guest5.guest_fav_song))\n end",
"title": ""
},
{
"docid": "bd3acbfae6fb21eee7f930da78a5d873",
"score": "0.562488",
"text": "def send_test_request\n\t\t\tdispatch_request({ \n\t\t\t\t:url => \"http://www.example.com/\", # IANA (192.0.32.10) ftw !\n\t\t\t\t:operation => :head, \n\t\t\t\t:repeat => true,\n\t\t\t\t:error_handler => lambda { |error| no_connection(error) }\n\t\t\t}) \n\t\tend",
"title": ""
},
{
"docid": "520a3d1eeb1517b7ad85a7e9f639c758",
"score": "0.5622964",
"text": "def test_check_with_ham_returns_false\n spam, = @client.check('ip', 'ua', user_role: 'administrator')\n assert_equal false, spam\n end",
"title": ""
},
{
"docid": "bcc05b245cbb7849a888d8faf6258acf",
"score": "0.5622251",
"text": "def serve_guest\n puts \"How can I be of service?\"\n puts \"1. Would you like to order a pizza?\"\n puts \"2. Would you like to leave?\"\n take_order(gets.chomp.to_i)\n end",
"title": ""
},
{
"docid": "33bed9e010a0df4c74ec7c8715ab030b",
"score": "0.56175077",
"text": "def test_check_out_guest_r3_capacity4\n @room3.check_in_guest(@guest_name1)\n @room3.check_in_guest(@guest_name2)\n @room3.check_in_guest(@guest_name3)\n @room3.check_in_guest(@guest_name4)\n @room3.check_out_guest(@guest_name1)\n stepa = @room3.guest\n actual = stepa.count\n assert_equal(3, actual)\n end",
"title": ""
},
{
"docid": "ed619812f078964ecec4c7a95977cda9",
"score": "0.5615838",
"text": "def test_guest_pays()\n @guest3.guest_pays(@room1.room_fee_per_guest)\n assert_equal(90, @guest3.guest_cash)\n end",
"title": ""
},
{
"docid": "ed619812f078964ecec4c7a95977cda9",
"score": "0.5615838",
"text": "def test_guest_pays()\n @guest3.guest_pays(@room1.room_fee_per_guest)\n assert_equal(90, @guest3.guest_cash)\n end",
"title": ""
},
{
"docid": "984a88841ccff28d163568d8ea9287a7",
"score": "0.56136096",
"text": "def test_admin_login_null\n post '/admin_logged_in', :userHandle => 'Dan', :userPassword => ''\n response = get '/cars'\n assert_equal 404, response.status\n end",
"title": ""
},
{
"docid": "08fa94cf6a7dc323dc8c992fbee8ff4e",
"score": "0.5612228",
"text": "def mock_session_test_request(handle = players(:justin).handle, session = players(:justin).session)\n mock_dgs do |dgs|\n dgs.expect(:get, {:handle => handle}.to_json, [session, '/quick_do.php?obj=user&cmd=info'])\n yield\n end\n end",
"title": ""
},
{
"docid": "eeb3d1f3fbb31af9d48019fd6900a17b",
"score": "0.5611446",
"text": "def test_welcome_back\n # Step 1\n params = {\n 'request_host' => 'http://www.xx.com',\n 'user_id' => @user.id\n }\n\n post '/em/welcome_back', params\n assert_response(@response, :client_error)\n end",
"title": ""
},
{
"docid": "c3991da6a773871986c3dceb1a280897",
"score": "0.5605006",
"text": "def test_guest_checking_out_of_room\n @room.guest_checkin_room(@guest1)\n @room.guest_checkin_room(@guest2)\n @room.guest_checkin_room(@guest3)\n @room.guest_checking_out_of_room\n assert_equal(2, @room.guest.length)\n end",
"title": ""
},
{
"docid": "755e9e393aa5104a27ed8226e98b81d1",
"score": "0.56018955",
"text": "def test_basic_auth\n assert_output(//, '') { post '/heartbeat' }\n last_response.status.must_equal 401\n authorize 'user', 'foo'\n assert_output(/Auth Fail/, '') { post '/heartbeat' }\n last_response.status.must_equal 401\n authorize 'user', 'password'\n assert_output(/heartbeat/, //) { post '/heartbeat' }\n last_response.status.must_equal 200\n end",
"title": ""
},
{
"docid": "30954bfea876e35723bf4ed6f91c575f",
"score": "0.55961263",
"text": "def test_send_pings\n end",
"title": ""
},
{
"docid": "2f95ab6eacd2081241fa4202fd8d2254",
"score": "0.55909747",
"text": "def verify_api\n\n # Skip the test if developer settings are activated\n if Setting.first.developermode?\n logger.info \"Developer settings activated, bypassing API check\"\n else\n logger.info \"Testing backend...\"\n host = Setting.first.apiserver\n port = Setting.first.apiport\n\n begin\n Socket.tcp(host, port, connect_timeout: 2) {}\n rescue StandardError\n redirect_to error_api_not_found_path\n end\n\n end #devmode\n\n end",
"title": ""
},
{
"docid": "57d41e3c69ffb7503fffb9659a81cb3c",
"score": "0.5590928",
"text": "def test_list_admin_valid\r\n post :list_administrators, nil, session_for(users(:superadmin))\r\n assert_response :success \r\n end",
"title": ""
},
{
"docid": "dc4044826d618c8e6d4910939e4e6a14",
"score": "0.558338",
"text": "def test_main_route\n # Requesting the root page of the application.\n request = @requester.get('/')\n # The response should be OK (200)\n assert_equal 200, request.status\n # Content type should be HTML\n assert_equal 'text/html', request.content_type\n # Checking if the response contains the expceted text\n assert_contains 'Welcome to RackStep', request.body\n end",
"title": ""
}
] |
a58d3706e61c0ecbe1b5785d226eb698
|
create an unique identifier 'order_number'
|
[
{
"docid": "1051422c3d8e30aa45efbc5c099720d0",
"score": "0.7260888",
"text": "def order_number\n \"66-#{Time.now.strftime('%m%d')}-#{self.id}\"\n end",
"title": ""
}
] |
[
{
"docid": "fecd46a7877c41a2a5bdf647a93e6708",
"score": "0.7992339",
"text": "def generate_order_number\n self.number = generate_unique_number\n end",
"title": ""
},
{
"docid": "f6edf3af0bb16e30ce10c6f447ba94a2",
"score": "0.7933669",
"text": "def unique_order_number\n # \"#{Time.now.to_i}-#{rand(1_000_000)}\"\n ActiveMerchant::Utils::generate_unique_id\n end",
"title": ""
},
{
"docid": "c35f4ac0040140807c70c81131a1f9fa",
"score": "0.7771116",
"text": "def create_order_number\n alpha = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)\n # try a short order number first\n # in case of collision, increase length of order number\n (4..10).each do |length|\n self.order_number = Time.now.strftime(\"%Y%m%d-\")\n length.times {self.order_number += alpha[rand 36]}\n existing_order = Order.find_by(order_number: order_number)\n return if existing_order.nil?\n end\n end",
"title": ""
},
{
"docid": "cb579f21347d6767599f961c1851f3dd",
"score": "0.7609874",
"text": "def order_number\n if (not self.id)\n return \"save to allocate number\"\n end\n base = Time.new().strftime(\"%Y\")\n return base + \"_\" + self.id.to_s\n end",
"title": ""
},
{
"docid": "8e2886fce60e78fa1f8720566629ca04",
"score": "0.7559377",
"text": "def generate_identifier\n if PurchaseOrder.exists?\n identifier = PurchaseOrder.last.identifier\n identifier = (identifier.gsub(\"PO\", \"\").to_i + 1).to_s.prepend(\"PO\")\n else\n identifier = \"PO1\"\n end\n self.identifier = identifier\n end",
"title": ""
},
{
"docid": "026fea655ce8a054b9d3ebffe76fa9e5",
"score": "0.7498131",
"text": "def order_number\n uuid.first(6).upcase\n end",
"title": ""
},
{
"docid": "a3b35b16a9d57030935c5ec7c1992ab4",
"score": "0.7444527",
"text": "def set_order_number\n self.number = (NUMBER_SEED + id).to_s(CHARACTERS_SEED)\n end",
"title": ""
},
{
"docid": "a3b35b16a9d57030935c5ec7c1992ab4",
"score": "0.7444527",
"text": "def set_order_number\n self.number = (NUMBER_SEED + id).to_s(CHARACTERS_SEED)\n end",
"title": ""
},
{
"docid": "a3b35b16a9d57030935c5ec7c1992ab4",
"score": "0.7444527",
"text": "def set_order_number\n self.number = (NUMBER_SEED + id).to_s(CHARACTERS_SEED)\n end",
"title": ""
},
{
"docid": "3b5553c5ec4316869f2a5c747b37df98",
"score": "0.7289789",
"text": "def generate_order_number\n number_array = rand(100..999).to_s.split << self.user_id\n self.order_number = number_array.join.to_i\n end",
"title": ""
},
{
"docid": "21b6d7e3dfe6503749bef09108054b1b",
"score": "0.7234782",
"text": "def generate_unique_number\n begin\n new_number = \"OR#{ Time.now.strftime(\"%Y%d%m\") }#{ Array.new(15){ rand(9) }.join }\"\n end until !order_exists?(new_number)\n new_number\n end",
"title": ""
},
{
"docid": "83042954b067e7757c5e97f7e05a1e68",
"score": "0.72212726",
"text": "def get_orderid(order)\n return order.number\n end",
"title": ""
},
{
"docid": "e35c1ffbbdf7be8cb8cbe37311f1dd0d",
"score": "0.7176988",
"text": "def get_unique_number; @unique_id ||= 0; @unique_id += 1; end",
"title": ""
},
{
"docid": "e35c1ffbbdf7be8cb8cbe37311f1dd0d",
"score": "0.7176988",
"text": "def get_unique_number; @unique_id ||= 0; @unique_id += 1; end",
"title": ""
},
{
"docid": "801d446f692bffe5a899767a437a1de9",
"score": "0.71375185",
"text": "def generate_unique_id\n @serial_id += 1\n end",
"title": ""
},
{
"docid": "b4df985ee6c27fbd78f43276ba954613",
"score": "0.7106108",
"text": "def set_number\n return set_order_number if self.id\n self.number = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator\n end",
"title": ""
},
{
"docid": "b4df985ee6c27fbd78f43276ba954613",
"score": "0.7106108",
"text": "def set_number\n return set_order_number if self.id\n self.number = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator\n end",
"title": ""
},
{
"docid": "42bfc80b458ec3fd5dab9153f3838d73",
"score": "0.7092074",
"text": "def set_number\n return set_order_number if self.id\n self.number = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for validator\n end",
"title": ""
},
{
"docid": "b7261c7f2b06c7b75b4a952164cb84b1",
"score": "0.70878166",
"text": "def set_order_number\n self.order_number = Order.generate_order_number\n end",
"title": ""
},
{
"docid": "2e871cd0950be43713f79e16c0389cea",
"score": "0.7006683",
"text": "def generate_order_number\n if last = Order.first # last, but default order is reversed\n num = last.number[5..9].to_i + 1\n else\n num = 30000\n end\n self.number = \"R#{Time.now.year}#{num}\"\n end",
"title": ""
},
{
"docid": "588c4012d63e3af8ee3b531447fd3d0b",
"score": "0.6960716",
"text": "def transaction_id\n @transaction_id ||= \"#{order.number}-#{SecureRandom.hex(5)}\"\n end",
"title": ""
},
{
"docid": "5f411a9e73ab451a07f1ea612b24b9ba",
"score": "0.6893251",
"text": "def order_id\n \"#{ id || 'NA' }-#{ Time.current.to_i }\"\n end",
"title": ""
},
{
"docid": "552e4d49b36bfbc98313e8328c598014",
"score": "0.6891263",
"text": "def id\n order_number\n end",
"title": ""
},
{
"docid": "6dcdb6e7d22e898a02399c65850ac7de",
"score": "0.6886014",
"text": "def generate_identifier\n if Invoice.exists?\n identifier = Invoice.last.identifier\n identifier = (identifier.gsub(\"INV\", \"\").to_i + 1).to_s.prepend(\"INV\")\n else\n identifier = \"INV1\"\n end\n self.identifier = identifier\n end",
"title": ""
},
{
"docid": "b46ec46506778fc25c780942976e7ddf",
"score": "0.68250734",
"text": "def generate_order_number\n record = true\n while record\n random = \"#{ez.env_to_prefix}#{Array.new(9){rand(9)}.join}\"\n record = self.class.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random if self.number.blank?\n self.number\n end",
"title": ""
},
{
"docid": "ed32691472a94cd14f6d38288bc1b2a6",
"score": "0.68202776",
"text": "def make_order_number(user_id, item_id)\n # 8 bytes\n date_part = Time.now.strftime(\"%Y%m%d\")\n # 4 bytes\n user_part = sprintf \"%04d\", user_id\n user_part = user_part[0, 4]\n # 4 types\n item_part = sprintf \"%04d\", item_id\n item_part = item_part[0, 4]\n # sn\n order_number = date_part + user_part + item_part\n end",
"title": ""
},
{
"docid": "adb3c141a405b49c02c0dba29df9a0c4",
"score": "0.6769622",
"text": "def generate_order_number\n record = true\n while record\n random = \"W#{Array.new(6){rand(9)}.join}\"\n #Make sure number hasn't already been used\n record = self.class.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random if self.number.blank?\n self.number\n end",
"title": ""
},
{
"docid": "87bfe5bd4c33f82b6e4b192590b14b02",
"score": "0.6729869",
"text": "def save_order_number\n set_order_number\n save\n end",
"title": ""
},
{
"docid": "87bfe5bd4c33f82b6e4b192590b14b02",
"score": "0.6729869",
"text": "def save_order_number\n set_order_number\n save\n end",
"title": ""
},
{
"docid": "87bfe5bd4c33f82b6e4b192590b14b02",
"score": "0.6729869",
"text": "def save_order_number\n set_order_number\n save\n end",
"title": ""
},
{
"docid": "41a65123458d1f69c3257ed2eeb9056c",
"score": "0.6718573",
"text": "def generate_trade_no\n order_created_at = Time.now.to_s\n order_created_at.slice(0, order_created_at.index('+')).gsub(/[^\\d]/, '') + SecureRandom.hex(4).upcase\n end",
"title": ""
},
{
"docid": "d5e4fd4904e30a11ac1d45011d6260cc",
"score": "0.67027473",
"text": "def ref_number\n id + ORDER_NUMBER_START\n end",
"title": ""
},
{
"docid": "0d6056ca37ca4d23d390e3e8cda40bfb",
"score": "0.66621226",
"text": "def create_unique_account_number\n number = SecureRandom.alphanumeric\n while Account.find_by_account_number(number)\n number = SecureRandom.alphanumeric\n end\n self.account_number = number\n end",
"title": ""
},
{
"docid": "802e0b728305ff0b1284776cc7295c48",
"score": "0.6647345",
"text": "def set_order_no\n remain_length = 10 - self.id.to_s.length\n self.order_no = self.id\n self.order_no << [*\"0\"..\"9\"].sample(remain_length).join if remain_length > 0\n end",
"title": ""
},
{
"docid": "ede63cf929a876e0a9a3a28095ecb35f",
"score": "0.6646594",
"text": "def storewide_identification_number\n \"KLNT#{self.order.customer.id}\" +\n \"BEST#{self.order.sequence_number}\" +\n \"FACT#{self.sequence_number}\" +\n \"-#{I18n.l self.updated_at, format: :invoice}\"\n end",
"title": ""
},
{
"docid": "3de9593d5f319ce4784a5b231b289f19",
"score": "0.6621639",
"text": "def generate_order_number\n record = Object.new\n while record\n random = rand(999999999)\n record = find(:first, :conditions => [\"order_number = ?\", random])\n end\n return random\n end",
"title": ""
},
{
"docid": "e2aeff684d4233cfd94797beb448670f",
"score": "0.66039973",
"text": "def generate_account_number\n \"FI-%.6d\" % id\n end",
"title": ""
},
{
"docid": "29f56952140c8ce7976987b2d864af75",
"score": "0.6599992",
"text": "def generate_order_number\n record = true\n while record\n random = \"R#{Array.new(9){rand(9)}.join}\"\n record = self.class.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random if self.number.blank?\n self.number\n end",
"title": ""
},
{
"docid": "576ae613652b42806e8ed41effa71226",
"score": "0.6554055",
"text": "def order_number\n if created_at\n # ssm = created_at.seconds_since_midnight.to_i\n # created_at.to_date.to_s + '-' + sprintf( '%05d', (ssm + rand(100000)).modulo(100000) )\n created_at.to_date.to_s + '-' + sprintf('%05d', created_at.seconds_since_midnight.to_i)\n else\n 'XXXX-XX-XX-XXXXX'\n end\n end",
"title": ""
},
{
"docid": "808f93c9c59f5112054e2a76b5917e4c",
"score": "0.6526019",
"text": "def generate_unique_id\n\n lib.tab_genuid(@db)\n end",
"title": ""
},
{
"docid": "f12bebf095b5e0d45666438903e664be",
"score": "0.6523454",
"text": "def generate_random_order_no(options = {})\n size = options.fetch(:size, 6)\n order_no = SecureRandom.hex[0, size].upcase\n \"#{order_no}\"\n end",
"title": ""
},
{
"docid": "f1bf7254202eb712be4bb3f957ca1dff",
"score": "0.65193105",
"text": "def order_number\n \"#{self.created_at.strftime('%Y%m%d')}.#{self.id}\"\n end",
"title": ""
},
{
"docid": "822525fe317af7ad9bc5fd9dab7c9bc7",
"score": "0.65103376",
"text": "def create_identifier!\n @identifier ||= ::ASIR::UUID.counter_uuid\n end",
"title": ""
},
{
"docid": "7614f4f8602c39d6ff0d9da20e95eb80",
"score": "0.6503666",
"text": "def generate_id\n @_last_id ||= 0\n @_last_id += 1\n end",
"title": ""
},
{
"docid": "ac7e6ab3d935715e732893c376470ea1",
"score": "0.64769346",
"text": "def generate_order_number\n record = true\n while record\n random = \"#{Array.new(9) { rand(9) }.join}\"\n record = self.class.where(:number => random).first\n end\n self.number = random if self.number.blank?\n self.number\n end",
"title": ""
},
{
"docid": "36e2766f4158f030e6a1d63f781be0da",
"score": "0.64509416",
"text": "def dibs_order_id\n persisted? ? \"%s%08d\" % [Orders.order_id_prefix, self.id] : nil\n end",
"title": ""
},
{
"docid": "6c224cbd70c501e94309a555599f35c2",
"score": "0.64437246",
"text": "def set_shipment_number\n self.number = (NUMBER_SEED + id).to_s(CHARACTERS_SEED)\n end",
"title": ""
},
{
"docid": "ea0c007e19d82d8e25edb4394868f1d5",
"score": "0.64382607",
"text": "def generate_orderid\n @random_token = \"I\"+current_user.id.to_s+current_user.business_type_id.to_s+Time.now.strftime(\"%d%m%H%M%S\").to_s+current_user.email.slice(0...1)\n @token = TransactionDetail.all.map(&:order_id).include?(@random_token)\n end",
"title": ""
},
{
"docid": "50f47d75b288002d943f72b466db6a93",
"score": "0.6437732",
"text": "def generate_po_number(options = {})\n options[:prefix] = po_prefix_scope\n options[:prefix] += customer.po_order_prefix.nil? ? \"#{DEFAULT_PO_ORDER_PREFIX}\" : \"#{customer.po_order_prefix}\"\n next_number = customer.po_order_next_number.to_s\n loop do\n self.po_number = \"#{options[:prefix].to_s.strip}#{next_number}\"\n # get original number length with padding\n len = next_number.length\n # increase numerical value\n next_number = next_number.to_i + 1\n # get length of numerical value\n len2 = next_number.to_s.length\n # get the number of zeros for padding after the number increases\n # need this for when number length increases Ex. 0009999 + 1 = 0010000\n pad_length = [len - len2, 0].max\n # reassemble next_number\n next_number = \"#{'0' * pad_length}#{next_number}\"\n\n break unless customer.purchase_orders.exists?(po_number: self.po_number)\n end\n\n customer.po_order_next_number = next_number\n customer.update_columns(invoice_settings: customer.invoice_settings)\n po_number\n end",
"title": ""
},
{
"docid": "406b16c3e4130d80aeb9970f1223ac5f",
"score": "0.6426532",
"text": "def generate_unique_id\n @db.genuid\n end",
"title": ""
},
{
"docid": "d6cc718a8c5a72a7641df052a0e533b5",
"score": "0.6421743",
"text": "def purchase_order_identifier=(value)\n @purchase_order_identifier = value\n end",
"title": ""
},
{
"docid": "9139f20076809a537c3fc8a30f6e2e3b",
"score": "0.64177066",
"text": "def set_number\n return set_transaction_id if self.id\n #self.transaction_id = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator\n begin\n self.transaction_id = SecureRandom.random_number(FIXNUM_MAX)\n end while self.class.exists?(transaction_id: transaction_id)\n end",
"title": ""
},
{
"docid": "9139f20076809a537c3fc8a30f6e2e3b",
"score": "0.64177066",
"text": "def set_number\n return set_transaction_id if self.id\n #self.transaction_id = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator\n begin\n self.transaction_id = SecureRandom.random_number(FIXNUM_MAX)\n end while self.class.exists?(transaction_id: transaction_id)\n end",
"title": ""
},
{
"docid": "ba343f898ab7748e000be8f8c0afc6d9",
"score": "0.6411192",
"text": "def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"title": ""
},
{
"docid": "ba343f898ab7748e000be8f8c0afc6d9",
"score": "0.6411192",
"text": "def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"title": ""
},
{
"docid": "6dd01806c33b1585d45f06e18fbc353b",
"score": "0.64079064",
"text": "def create_unique_id\n\t\t\t@previous_safe_id = @previous_safe_id.succ\n\t\t\treturn @previous_safe_id\n\t\tend",
"title": ""
},
{
"docid": "9f702cea99a56d5f5a575c97d3012d57",
"score": "0.64013565",
"text": "def generate_serial_number\n Date.today.to_s.split('-')[1..-1].reverse.to_s << generate_utoken(6).upcase\n end",
"title": ""
},
{
"docid": "752a1a33320b9e78238d9457d4803602",
"score": "0.6383608",
"text": "def order_id\n minimum_order_id + @transaction.order_id.to_i\n end",
"title": ""
},
{
"docid": "9e01801f0f6591a39a8bcac934162edb",
"score": "0.636597",
"text": "def auto_id=(number)\n @auto_id = number\n end",
"title": ""
},
{
"docid": "3b086b2e9d92be504dec5dd4cc41ca2a",
"score": "0.6361788",
"text": "def generate_new_id\n generate_new_sequence_number if intervention_id.nil?\n end",
"title": ""
},
{
"docid": "cd74d92fd2a12202b967e36c875204c9",
"score": "0.63376236",
"text": "def allocate_invoice_number\n if invoice_no_strategy == INVOICE_NUMBERING_STRATEGY[:random_number]\n random_invoice_number\n elsif invoice_no_strategy == INVOICE_NUMBERING_STRATEGY[:prefix_with_sequence]\n inv_no = self.invoice_sequence+1\n \"#{self.invoice_prefix}/#{inv_no.to_s.rjust(3,'0')}\"\n elsif invoice_no_strategy == INVOICE_NUMBERING_STRATEGY[:daily_reset_sequence_with_date]\n inv_no = self.invoice_sequence+1\n 'INV/'+Time.zone.now.to_date.to_s(:number)+\"/\"+inv_no.to_s.rjust(3,'0')\n elsif invoice_no_strategy == INVOICE_NUMBERING_STRATEGY[:custom_format]\n inv_no = self.invoice_sequence+1\n invoice_number = \"\"\n invoice_number += self.invoice_prefix + \"/\" unless self.invoice_prefix.blank?\n invoice_number += inv_no.to_s.rjust(3,'0')\n invoice_number += \"/\" + self.invoice_suffix unless self.invoice_suffix.blank? \n invoice_number #return the custom invoice number\n end \n end",
"title": ""
},
{
"docid": "d04b4f2ff77e38bac3eae4b58e249d12",
"score": "0.6319069",
"text": "def generate_invoice_id \n org_trans = self.organization.transactions\n if org_trans.present? && org_trans.last.invoice_id.present?\n self.invoice_id = org_trans.last.invoice_id.to_i + 1\n #self.update_column(:invoice_id, org_trans.last(2).first.invoice_id.to_i + 1)\n else\n self.invoice_id = 5213\n #self.update_column(:invoice_id, 5213)\n end\n end",
"title": ""
},
{
"docid": "75b8c4ac4f95fcc3626107c04d681ed0",
"score": "0.6304303",
"text": "def gen_id(item)\n id_str = item[:supplier_company].to_s.gsub(\" \", \"_\")+\"_\"+item[:recipient_country].to_s+\"_\"+item[:order_year].to_s\n generated_id = id_str.gsub(\"/\", \"\").gsub(\"(\", \"\").gsub(\")\", \"\").gsub(\",\", \"\").gsub(\".\", \"\")\n\n # Handle duplicate IDs\n if @out_data.map{|d| d[:unique_id]}.include?(generated_id)\n num_so_far = @out_data.select{|d| d[:unique_id].include?(generated_id)}.count\n generated_id += \"_\"+(num_so_far+1).to_s\n end\n return generated_id\n end",
"title": ""
},
{
"docid": "775adf5d473d40fa83ae232d6a516d4a",
"score": "0.6291407",
"text": "def generate_id(value)\n value.to_s.hash.to_s.tr('-', '1')\n end",
"title": ""
},
{
"docid": "88ca889880f6493ed4c13a7c4268a525",
"score": "0.62745726",
"text": "def add_identification_new_order(request, options)\n requires!(options, :order_id)\n request[:orderId] = options[:order_id]\n end",
"title": ""
},
{
"docid": "28cb5f22ad65bd32ff466a62ae715494",
"score": "0.62703115",
"text": "def generate_webpay_trx_id\n Digest::MD5.hexdigest(\"#{self.order.number}#{self.order.payments.count}\")\n end",
"title": ""
},
{
"docid": "fce5169d1df2e9bbd45a7133d04a3656",
"score": "0.626885",
"text": "def generate_purchase_number\n record = true\n while record\n random = \"P#{Array.new(9){rand(9)}.join}\"\n record = self.class.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random if self.number.blank?\n self.number\n end",
"title": ""
},
{
"docid": "fce5169d1df2e9bbd45a7133d04a3656",
"score": "0.626885",
"text": "def generate_purchase_number\n record = true\n while record\n random = \"P#{Array.new(9){rand(9)}.join}\"\n record = self.class.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random if self.number.blank?\n self.number\n end",
"title": ""
},
{
"docid": "5920e67be773d1b8cf48fa2d82e7afc3",
"score": "0.62625766",
"text": "def create\n order = Sap::Order.new\n order.state = Sap::Order::ST_NEW\n # TODO: определять текущего пользователя\n # TODO: вместо хеша к каждой таблице, будет одна таблца с хешами\n order.hash_str = Sap::Tools.get_random_string(6)\n order.save\n\n @id = order.id\n end",
"title": ""
},
{
"docid": "ae24ef4d6fd29316fad49a023d58e9f5",
"score": "0.62561095",
"text": "def serialnum\n self.appgen_order_serial.serial_number\n end",
"title": ""
},
{
"docid": "348177915da0655152e4a3228f37eadd",
"score": "0.6255818",
"text": "def generate_new_id\n generate_new_sequence_number if party_id.nil?\n end",
"title": ""
},
{
"docid": "b33daf7c12dedafa1fb882f62a9767c0",
"score": "0.6252009",
"text": "def generate_reference\n begin\n ref = SecureRandom.hex(5)\n end while Order.exists?(reference: ref)\n\n ref\n end",
"title": ""
},
{
"docid": "067eb9c6a2459d050e713b74e525adf7",
"score": "0.62310857",
"text": "def before_create\n self[:OrderNumber] = record_set.next_order_number\n super\n end",
"title": ""
},
{
"docid": "e4a05388b9391fb4fbca4c532687c03d",
"score": "0.6230587",
"text": "def generate_txn_id\n \tt_id = nil\n \tloop do\t\n \t\tnum = Random.new.rand(0..999999)\n \t\tt_id = \"Anant_\" + self.merchant.merchant_type + \"_\" + num.to_s #self.merchant.location +\n \t\tbreak unless Payment.exists?(txn_id: t_id)\n \tend\n \tPayment.skip_callback(:create, :after, :generate_txn_id)\n \tself.txn_id = t_id.to_s\n \tself.save\n \tPayment.set_callback(:create, :after, :generate_txn_id)\n end",
"title": ""
},
{
"docid": "b32b9a593d6d45adbe68a455b580766b",
"score": "0.6221361",
"text": "def create_primary_key\n @oid ||= UUID.timestamp_create().to_s22\n end",
"title": ""
},
{
"docid": "69de7f42fd0193802f5ea2d8f163a683",
"score": "0.62206894",
"text": "def get_order_no\n return resp_app_f \"找不到对应的服务器\" unless Server.where(id: params[:serverId]).exists?\n order_id = JiyuOrder.generate_order(params[:userId], params[:productId], params[:serverId], params[:platform]).order_id\n Rails.logger.debug \"create order #{order_id}\"\n resp_app_s order_id: order_id\n end",
"title": ""
},
{
"docid": "182a96fb1764da8ab1559093945d4492",
"score": "0.6206451",
"text": "def minimum_order_id\n @minimum_order_id ||= 10000000000\n end",
"title": ""
},
{
"docid": "0105dfcc9bf507b40e7d3e28d6f1d9c8",
"score": "0.6204667",
"text": "def record_order_id(email)\n order_number_message = order_confirmation_number_txt.text\n order_id = ''\n if Data::ENV_CONST == 'PROD'\n idx = order_number_message.index 'lfop'\n else\n idx = order_number_message.index 'lfou'\n end\n\n order_id = order_number_message[idx..-1].delete('.').strip if idx\n\n # Update Order ID to tracking table\n query = \"select * from atg_tracking where email = '#{email}'\"\n rs_select_email = Connection.my_sql_connection query\n\n if rs_select_email.num_rows == 0\n query = \"insert into atg_tracking(firstname, lastname, email, country, order_id, created_at, updated_at) values ('#{Data::FIRSTNAME_CONST}', '#{Data::LASTNAME_CONST}', '#{email}', '#{Data::COUNTRY_CONST}', '#{order_id}', \\'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}\\', \\'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}\\')\"\n else\n rs_select_order_id = Connection.my_sql_connection \"select order_id from atg_tracking where email = '#{email}'\"\n temp = ''\n rs_select_order_id.each_hash do |row|\n if row['order_id'].nil?\n temp = order_id\n else\n temp = row['order_id'] + ', ' + order_id\n end\n\n break\n end\n\n query = \"update atg_tracking set order_id = '#{temp}', updated_at = \\'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}\\' where email = '#{email}'\"\n end\n\n Connection.my_sql_connection query\n end",
"title": ""
},
{
"docid": "2b258d1db269515f9c64c836cdada342",
"score": "0.6203364",
"text": "def build_id\n chain ? chain.serial : '0'\n end",
"title": ""
},
{
"docid": "0d8ccc3b9d8c733ab4e2230a29b5d620",
"score": "0.62000513",
"text": "def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"title": ""
},
{
"docid": "0d8ccc3b9d8c733ab4e2230a29b5d620",
"score": "0.62000513",
"text": "def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"title": ""
},
{
"docid": "0d8ccc3b9d8c733ab4e2230a29b5d620",
"score": "0.62000513",
"text": "def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"title": ""
},
{
"docid": "45334b63860b2f06010f79bb405ac1f8",
"score": "0.61939746",
"text": "def get_id\n @unique_id = (@unique_id || 0) + 1\n end",
"title": ""
},
{
"docid": "9c61814f74c3ddcea99c4c923ea76792",
"score": "0.6174016",
"text": "def generateSequenceNumber\n\n @sequenceNumber = ((@sequenceNumber + 1) & 0xFFFFFFFF)\n end",
"title": ""
},
{
"docid": "e7e7ad1f08136d2972e710906eeb6a37",
"score": "0.6160908",
"text": "def unique_id\n \"#{@table.name}-#{@name}\"\n end",
"title": ""
},
{
"docid": "8f578a3ba39e3227a20bc26649fa444a",
"score": "0.61606085",
"text": "def make_bill_id\n if bill_id.nil? && self.bought?\n start_day = paid_at.beginning_of_day\n digits = start_day.strftime('%Y%m%d')\n num = Order.and(:bill_id.ne => nil).and(:paid_at => { :$gte => start_day }).count + 1\n self.bill_id = \"R#{digits}-#{num}\"\n self.save\n end\n end",
"title": ""
},
{
"docid": "1744aa67195555a3d0643aabfae68d1c",
"score": "0.61481315",
"text": "def generate_account_number\n last_store = Store.order('account_number DESC').where(' client_id = ?', self.client_id).max\n\n if last_store\n store_no = last_store.account_number\n else\n store_no = '0'\n end\n\n # Extract a number\n reggae = /\\d+/\n results = reggae.match(store_no)\n\n # Get difference length\n difference = (results.offset(0).last - results.offset(0).first)\n\n # Add 1 to the number, and add leading zeros\n result_number = (results[0].to_i) + 1\n new_store_account = \"%0#{difference}d\" % result_number\n\n # Add Prefix (PR, A, W, X)\n prefix_string = store_no.slice( 0, results.offset(0).first )\n\n # Join String\n new_string = \"#{prefix_string}#{new_store_account}\"\n\n # Append to store\n new_string\n end",
"title": ""
},
{
"docid": "78abdf616c04f289b5cc57ceada25833",
"score": "0.6146125",
"text": "def generate_shipment_number()\n return self.number unless self.number.blank?\n store = order.store.nil? ? Store.last : order.store\n\n record = true\n while record\n random = \"#{store.code == \"nwb\" ? \"1\" : \"2\"}_#{Array.new(11){rand(9)}.join}\"\n record = Shipment.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random\n end",
"title": ""
},
{
"docid": "0a12ef3baf97ec5c19b4de4b90832128",
"score": "0.61385626",
"text": "def generate_identifier\n old_ident = \"#{self.identifier} #{self.old_identifiers}\" \n ident = \"CC-\" + (Array.new(12) { CHARS[rand(CHARS.length)] }.join).to_s\n self.update_attributes(:identifier => ident, :old_identifiers => old_ident)\n end",
"title": ""
},
{
"docid": "dcc4be4f413b76e7448d66cbb6db3a68",
"score": "0.612726",
"text": "def genUniqueCodeCredit\n time = Time.new\n strtm = time.strftime('%d%L%H%M')\n uniq_id = \"109#{strtm}\"\n uniq_id\n end",
"title": ""
},
{
"docid": "dc7f3885fb110c1b0fa9b751907138dd",
"score": "0.611935",
"text": "def order_id\n text('//purchaseID')\n end",
"title": ""
},
{
"docid": "386810d909895f3a08abec6b5fc1894c",
"score": "0.6115806",
"text": "def generate_account_number\n return if account_number.present?\n self.account_number = generate_account_token\n end",
"title": ""
},
{
"docid": "c44a28b5c811e0c3c47d08477f89173c",
"score": "0.6104186",
"text": "def generate_unique_id\n result = ensure_multi_write { @meta_counter_collection.find_and_modify(:query => { :name => 'primary_key_counter' },\n :update => { '$inc' => { 'counter' => 1 } },\n :new => true\n )\n }\n result[\"counter\"]\n end",
"title": ""
},
{
"docid": "ef6a5a56e3aec9f6576989332ecab481",
"score": "0.60944253",
"text": "def get_order_number(order_number)\n $tracer.trace(\"WebInStoreCommonDSL : #{__method__}, Line : #{__LINE__}\")\n ordernumber=order_number.gsub(/\\s+/, \"\")\n ordernumber=ordernumber.gsub(/[OrderNumber:]/, '')\n return ordernumber\n end",
"title": ""
},
{
"docid": "26b5e031428bef070f7443ba2fab535f",
"score": "0.6088019",
"text": "def identifier\n seed = \"#{@full_name}:#{@number}\"\n Digest::MD5.hexdigest(seed)\n end",
"title": ""
},
{
"docid": "8310a8604055df99e4f063ea6d294d55",
"score": "0.60877115",
"text": "def make_id\n new_id = @id\n @id += 1\n new_id\n end",
"title": ""
},
{
"docid": "a31c1db5a6e611f0321a924943bdeb0c",
"score": "0.6085089",
"text": "def generate_identifier\n rand(99999999) #TODO: Current setup won't necessarily be unique.\n end",
"title": ""
},
{
"docid": "6678cd6378437d44edc352112175fbc6",
"score": "0.6084914",
"text": "def get_new_group_order_id\n\t\t\t\t\"20170319\"\n\t\t\tend",
"title": ""
},
{
"docid": "c360a6b9b998736b3bf86524a0bfac71",
"score": "0.60745513",
"text": "def id_hash_generator(number)\n number = {:id => number}\nend",
"title": ""
},
{
"docid": "d053737608fb1e532993cdb3d2e7f174",
"score": "0.60743445",
"text": "def number\n order_number ? order_number.to_s.rjust(8, '0') : nil\n end",
"title": ""
}
] |
4792a585a5560aa6e165963a29587fd9
|
Convert results to entities
|
[
{
"docid": "25b20ae795267ad27a028f3c1dc23770",
"score": "0.63376874",
"text": "def create_entities\n results = []\n if @attributes.has_key?(:entities)\n @attributes[:entities].each do |result|\n results.push Muddyit::Collections::Collection::Entities::Entity.new(@muddyit, result.merge!(:collection => @attributes[:collection]))\n end\n @attributes[:entities] = results\n end\n end",
"title": ""
}
] |
[
{
"docid": "f2e1baea7c732105d1e15f6fa753f78c",
"score": "0.68390524",
"text": "def to_a\n list = parsed_body['Data']['Entities']['Entity']\n if Hash === list\n list = [list]\n end\n list.map do |data|\n Result.new('Entity', renderer.result(data), self).finalize!\n end\n end",
"title": ""
},
{
"docid": "dcfddc29f56d93f4c0eb19d79cb98355",
"score": "0.66024965",
"text": "def process_result\n if @result.present?\n @result.map do |admin_tag, url_hash|\n url_hash.map do |url, entity_list|\n entity_list.each do |entity|\n entity.symbolize_keys!\n save_and_relate_entity(entity[:name], entity[:url], [admin_tag], \"person\", ADMIN_SOURCE)\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "e78ef14a9ef13b82f4262caca4a34cb3",
"score": "0.6578118",
"text": "def queryAndConvert() \n\t\tres = self.query()\n\t\treturn res.convert()\n end",
"title": ""
},
{
"docid": "6a4e199094fdd36ace4ff7e9ad9cd075",
"score": "0.6165066",
"text": "def reformat_query_results(results)\n return embed_table_in_results results\n end",
"title": ""
},
{
"docid": "5a01263840da37eafe01cfddf3141f80",
"score": "0.6065067",
"text": "def normalize_result(result)\n end",
"title": ""
},
{
"docid": "2b23324053c67b896342657380576816",
"score": "0.6044301",
"text": "def transform_entities(transform, entities)\n end",
"title": ""
},
{
"docid": "82dc7312cc31055f10462941237a6f82",
"score": "0.5997257",
"text": "def entities; end",
"title": ""
},
{
"docid": "6b785a724e3c636870d55a9aa7011a06",
"score": "0.5964908",
"text": "def to_results\n info = request :q => @query, :rsz => @opts[:size], :start => ((@opts[:page] - 1) * @opts[:size])\n results = info[:results]\n query_strings = info[:query_strings]\n coder = HTMLEntities.new\n if(results['responseData']['cursor']['currentPageIndex'].nil?)\n new_one = Chen::Results.new\n new_one.estimated = 0\n return new_one\n end\n \n \n current_page = results['responseData']['cursor']['currentPageIndex']+1\n max_result = query_strings[:start] + query_strings[:rsz]\n estimated_results = results['responseData']['cursor']['resultCount']\n result_array = results['responseData']['results']\n \n datas = Chen::Results.new\n datas.estimated = estimated_results\n result_array.each_with_index do |result, i|\n new_data = Chen::SearchResult.new\n new_data.tap do |d|\n d.title = result[\"titleNoFormatting\"]\n d.url = result[\"url\"]\n d.desc = result[\"content\"].squeeze(\" \")\n d.number = (i + query_strings[:start] + 1)\n end\n datas << new_data\n end\n return datas\n end",
"title": ""
},
{
"docid": "acc96f3ef333d0254e2f8ff7e666476e",
"score": "0.5949245",
"text": "def results_as_objects(results)\n results_as_objects = []\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects \n end",
"title": ""
},
{
"docid": "7c8e14fe190d3cfffeb661c4b88b4255",
"score": "0.5943147",
"text": "def to_xml(entities)\n\t content_type(\"text/xml\")\n\t\txml = Builder::XmlMarkup.new\n\t\txml.instruct!\n\t\tif entities.class.to_s == \"DataMapper::Collection\" # Bad idea!, problem to be solved another day :)\n\t\t xml.results do\n \t\t entities.each do |entity|\n \t\t convert_entity(entity, xml)\n \t\t end\n\t\t end\n\t else\n\t convert_entity(entities, xml)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "8c743b6a48615bb2a83ca697c5587110",
"score": "0.5886616",
"text": "def to_a\n if parsed_body['result']['companies']\n parsed_body['result']['companies'].map do |_,data|\n Result.new('Entity', renderer.result(data), self).finalize!\n end\n else\n []\n end\n end",
"title": ""
},
{
"docid": "22c100e4a8c872d17ddd4cde89fe6027",
"score": "0.5881371",
"text": "def entities(*values)\n values.inject(self) { |res, val| res._entities(val) }\n end",
"title": ""
},
{
"docid": "5b54c3c98ce37cb2d40589b11802e745",
"score": "0.58792037",
"text": "def to_a\n @entities.dup.freeze\n end",
"title": ""
},
{
"docid": "6004a1d7802b92d26d5b6a97c1849865",
"score": "0.5823554",
"text": "def find_entities(results)\n document = ::Nokogiri::XML(results.body)\n document.remove_namespaces!\n document.xpath('//entry')\n end",
"title": ""
},
{
"docid": "243a0a3b131c6fec22e89b130bb1be28",
"score": "0.57940125",
"text": "def entities\n _entities\n end",
"title": ""
},
{
"docid": "243a0a3b131c6fec22e89b130bb1be28",
"score": "0.57940125",
"text": "def entities\n _entities\n end",
"title": ""
},
{
"docid": "2df1c1bc185f342fbcd6f01d28f4c909",
"score": "0.5787777",
"text": "def results\n\t\t\tArray(result)\n\t\tend",
"title": ""
},
{
"docid": "51ace20bcdcfbb4bad8962de0f2321b7",
"score": "0.5782884",
"text": "def result_input\n @employees = Employee.find(:all,:conditions=>[\"company_id=?\",current_user.company_id],:order=>\"team\")\n @results = Result.find(:all,:conditions=>[\"company_id=?\",current_user.company_id],:order=>\"sort\").map {|r| [r.name, r.id]}\n end",
"title": ""
},
{
"docid": "342ba084ee48a1e2b1dcd4060f2f8245",
"score": "0.5751827",
"text": "def entities\n @entities\n end",
"title": ""
},
{
"docid": "477db2ba8fea43916cea5ce88316a9c6",
"score": "0.5736231",
"text": "def parse_entities(ents)\n ents.to_s\n ents.map(&:last).select{|e| e[\"type\"] == \"portal\"}\n #.map{|e|\n\n # {\n # \"title\" => e[\"title\"],\n # \"lat\" => e[\"latE6\"],\n # \"lng\" => e[\"lngE6\"],\n # \"resCount\" => e[\"resCount\"],\n # \"health\" => e[\"resCount\"],\n # \"team\" => e[\"team\"]\n # }\n #}\nend",
"title": ""
},
{
"docid": "b2200352e85d52a961001b71e1df1e5d",
"score": "0.5729304",
"text": "def results_as_objects(results)\n array_of_objects = []\n results.each do |hash|\n array_of_objects << self.new(hash)\n end\n return array_of_objects\n end",
"title": ""
},
{
"docid": "8cbdedd05fac12747d48cc66dee15627",
"score": "0.5675186",
"text": "def normalize_result(ar_res)\n res = []\n ar_res.each do |r|\n c = []\n columns.each do |col| \n if r.attributes[col[:id]] then\n c << r.send(col[:id].intern)\n else\n c << ''\n end\n end\n res << c\n end\n res\n end",
"title": ""
},
{
"docid": "d48e0fd64aab320d8207a3ca016e0904",
"score": "0.566668",
"text": "def search_item_ids_to_objects(item_ids, result_type)\n ServiceCatalographer::Mapper.item_ids_to_model_objects(item_ids, result_type)\n end",
"title": ""
},
{
"docid": "5d14267de52171f91e685a3bec4104c4",
"score": "0.5659658",
"text": "def resultset; end",
"title": ""
},
{
"docid": "07cf70fb4ca1f12da4445dace6100066",
"score": "0.5647726",
"text": "def entities(body, headers, expectation = nil)\n expectation ||= Occi::Core::Entity\n logger.debug \"Parsing #{expectation} from #{body.inspect} and #{headers.inspect}\" if logger_debug?\n\n entity_parser = Text::Entity.new(model: model)\n entity = entity_parser.plain transform(body, headers)\n unless entity.is_a?(expectation)\n raise Occi::Core::Errors::ParsingError, \"Entity is not of type #{expectation}\"\n end\n\n setify(entity)\n end",
"title": ""
},
{
"docid": "ce4df314019a0e23adc3aeea851f36c3",
"score": "0.5612863",
"text": "def to_a\n return @results\n end",
"title": ""
},
{
"docid": "9fdc1321d338cde009271fd36172f703",
"score": "0.559732",
"text": "def parse_results(results)\n results.rows.collect do |row|\n record = {}\n row.each_with_index{|val, i| \n val = val.force_encoding('utf-8') if val\n record[results.fields[i].name] = val\n }\n \n record\n end\n end",
"title": ""
},
{
"docid": "b9e6514091ee44fc3f79fcc7fd599bca",
"score": "0.55895585",
"text": "def entities\n begin\n @first_name = @current_sf_user.first_name\n @last_name = @current_sf_user.last_name\n\n @entity_results = Array.new\n\n limit = QUERY_RESULT_LIMIT || 100\n\n @safe_user_entity_subscriptions = @current_sf_user.entity_subscriptions.find(:all, :limit => limit.to_s)\n chatter_feed_finder = Salesforce::ChatterFeed.new\n\n # This will be an array of entities (Users, Accounts, Asssets, etc) that this user has subscribed.\n @safe_user_entity_subscriptions.each do |an_entity|\n oid = an_entity.parent_id.to_s\n otype = determine_sf_object_type(oid)\n\n begin\n sf_object = salesforce_object_find_by_id(oid)\n entity_row =RForce::MethodHash.new\n entity_row['name'] = sf_object.name\n entity_row['id'] = sf_object.id #should be the same as <an_entity.parent_id.to_s>\n entity_row['type'] = otype\n #entity_row['feeds'] = chatter_feed_finder.get_all_chatter_feeds_with_attachments(entity_row['id'], entity_row['type'], @binding, session.session_id, limit, true)\n\n if current_user[:chatter_load_attachment] == true\n entity_row['feeds'] = chatter_feed_finder.get_all_chatter_feeds_with_attachments(entity_row['id'], entity_row['type'], @binding, session.session_id, limit, true)\n else\n entity_row['feeds'] = chatter_feed_finder.get_all_chatter_feeds_without_attachments(entity_row['id'], entity_row['type'], @binding, session.session_id, limit)\n end\n\n @entity_results << entity_row\n rescue ActiveRecord::RecordNotFound => exception\n logger.info(\"***Record not found: \" + exception.class.name + exception.message + \"<hr/>\" + exception.backtrace.to_s)\n flash[:notice] = \"#{otype} with ID: #{oid} cannot be found. <br/>\"\n return\n end\n end\n\n rescue NoMethodError => nme\n #matching for -> undefined method `entity_subscriptions' for\n #User does not have chatter installed.\n if nme.message.match(/undefined\\s+method\\s+\\Sentity_subscriptions\\S/mi)\n flash[:notice] = \"You do not have Salesforce Chatter application installed.\"\n redirect_to base_url\n else\n return nme\n end \n rescue Exception => exception\n logger.info(\"***Other Exception: \" + exception.class.name + exception.message.to_s + \"<hr/>\" + exception.backtrace.to_s)\n flash[:notice] = exception.class.name + exception.message.to_s + \"<hr/>\" + exception.backtrace\n return\n end\n end",
"title": ""
},
{
"docid": "eeface4ac8f96f328caf71edbb3b4b51",
"score": "0.5584901",
"text": "def to_search_result\n row = self.attributes \n row.delete(\"order_id\") \n row[\"name\"].capitalize! if !row[\"name\"].nil?\n row[\"date_in\"] = OrderEntity.format_pretty_date(self.attributes[\"date_in\"])\n row[\"date_out\"] = OrderEntity.format_pretty_date(self.attributes[\"date_out\"]) \n row\n end",
"title": ""
},
{
"docid": "6ca3eeaf67f0315cd1bda540e926cee8",
"score": "0.5538812",
"text": "def parse_results\n RETS4R::ResponseDocument::Search.parse(self.to_s).to_transaction\n end",
"title": ""
},
{
"docid": "1d561f865c0ac8da0c2889488fa86b33",
"score": "0.54632336",
"text": "def result_to_rows(result)\n result.rows.map do |row|\n typed_row = result.columns.zip(row).map do |column_name, value|\n typed_value = result.column_types[column_name].send(:type_cast, value)\n [column_name.to_sym, typed_value]\n end\n Hash[typed_row]\n end\n end",
"title": ""
},
{
"docid": "f463774ad952466d141ccdae8073443b",
"score": "0.54352117",
"text": "def entities\n return bad_request unless params[:id] and request.format.json? || request.format.js?\n return not_found unless current_document\n @response = {'entities' => current_document.ordered_entity_hash}\n render_cross_origin_json\n end",
"title": ""
},
{
"docid": "c84157c8c94ef0c8e44e8c5860b9d5a8",
"score": "0.5412059",
"text": "def result_set\n klass.requestor.get(nil, { query: to_s })\n end",
"title": ""
},
{
"docid": "27da3ad62bf1c79be4cb30fa5a3f1fed",
"score": "0.5408568",
"text": "def to_record(entity)\n end",
"title": ""
},
{
"docid": "d8a1c11dedabbe4d64c56cfcc86917b3",
"score": "0.540426",
"text": "def get_entities(data)\n\n entities = Array.new\n attributes ||= []\n\n @entity = Entity.new\n\n data.each{|value|\n values = get_values(value)\n\n if values.nil?\n next\n end\n\n # New Entity\n unless values.nil? || values.entity.nil? || values.entity.eql?(\"\")\n # In the first iteration there's no previous entity\n unless @entity.empty?\n entities << @entity\n end\n\n 2.times {\n puts \"\"\n }\n\n puts \"-----------------------\"\n puts \"Entity: #{values.entity}\"\n\n\n # Start the new entity\n @entity = Entity.new\n @entity.name = values.entity.gsub(/[^a-zA-Z0-9]/,'')\n\n # In the same line of new Interface, probably an attribute is defined\n unless values.attribute.eql?(\"\")\n # Add new attribute\n puts \" Attribute #{values.attribute}\"\n @entity.add_attribute values.attribute\n end\n\n else # Same entity\n unless values.attribute.eql?(\"\")\n # Add new attribute\n puts \" Attribute #{values.attribute}\"\n @entity.add_attribute values.attribute\n end\n end\n }\n # Add last entity\n entities << @entity\n entities\n end",
"title": ""
},
{
"docid": "8a8c08b26ec06ee876862b623c8acbe6",
"score": "0.5402941",
"text": "def index\n @entities = Entity.all\n end",
"title": ""
},
{
"docid": "8a8c08b26ec06ee876862b623c8acbe6",
"score": "0.5402941",
"text": "def index\n @entities = Entity.all\n end",
"title": ""
},
{
"docid": "9990c73ef20d26a2a5787f3054904338",
"score": "0.53887653",
"text": "def raw_results\n results\n end",
"title": ""
},
{
"docid": "e0170b6deda5cdaaca46a63a3d47b9e8",
"score": "0.53872615",
"text": "def results\n populate\n @results\n end",
"title": ""
},
{
"docid": "61939b0bf406d0c76a44437be2ede6b4",
"score": "0.5371128",
"text": "def extend_result(result)\n EdgeSet.new(result)\n end",
"title": ""
},
{
"docid": "e817a65bcea3e7a4038ea95d818747bb",
"score": "0.5370386",
"text": "def to_result\n [@index.result_identifier, self.score, self.count, @combinations.to_result, self.ids] if self.count && self.count > 0\n end",
"title": ""
},
{
"docid": "2e04fa250303a130fba78d61194abdf8",
"score": "0.5369773",
"text": "def run(results)\n columns_names = rows.first.inject([]) {|m, kv| m << kv[0]; m}\n row_count = rows.size\n initial_data = results.all.map {|r| columns.map {|c| r[c]}}\n asrecordset = ASRecordset.new(row_count,column_names,initial_data)\n \tresult = asrecordset\n \treturn result\n end",
"title": ""
},
{
"docid": "8e46d71f6d60b97ebdd4ca87628d2590",
"score": "0.5362795",
"text": "def objectify_records(result)\n result[:records] = result[:records].collect do |rec|\n MemoryRecord.new.init(rec[0], rec[1])\n end\n result\n end",
"title": ""
},
{
"docid": "7d74656422184bde3e27b81b397c5f36",
"score": "0.5358791",
"text": "def parse_results(results)\n\t\t\tresults.map { |result| [result[:id], result[:success], result[:seed], result[:message]] }\n\t\tend",
"title": ""
},
{
"docid": "a4f355405db96f491f6a79d8fc11e4dd",
"score": "0.53581",
"text": "def fetch_all\n self.to_a\n end",
"title": ""
},
{
"docid": "1825aa17ea9b8bdc84c8735e89e164b2",
"score": "0.531867",
"text": "def entities\n @entities ||= Entity.from_models(self, @models)\n end",
"title": ""
},
{
"docid": "bc0f22a02132004fecdb477c35d75362",
"score": "0.5317696",
"text": "def entity_search\n @entity_search = Array.new\n entity_search = {}\n @entity = UserEntity.where(:entity_name => /.*#{params[:entity][:char]}*./).all\n @entity.each do |entity|\n @user_entity = User.where(:id => entity.user_id)\n @user_entity.each do |users|\n es = entity_search.merge(:user_entity_id => entity.id ,:user_id => users.id, :profile_picture => users.profile_picture_url, :first_name => users.first_name,:address => entity.address, :comment => entity.comment, :entity_image => entity.entity_image, :entity_name => entity.entity_name, :rating_count => entity.rating_count, :sub_category => entity.sub_category, :lat => entity.lat , :longitude => entity.longitude, :user_category_id => entity.user_category_id)\n @entity_search << es\n end\n end\n respond_to do |format|\n if @entity.present?\n format.json {render :json => @entity_search}\n else\n end\n end\nend",
"title": ""
},
{
"docid": "991e11a38a451c344b2241f8e05907d9",
"score": "0.53075916",
"text": "def entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( control_points )\r\n result\r\n end",
"title": ""
},
{
"docid": "6e068a6f03f6040a4759304534a58977",
"score": "0.53046185",
"text": "def cast\n p @result\n end",
"title": ""
},
{
"docid": "3b9be7ca18b618bff27be4d02a75869d",
"score": "0.52893025",
"text": "def flattened_entities\n results = []\n \n # Add this organization's entities\n entities.where(:type == 'Person').each do |e|\n results << e\n end\n\n # Add all children organization's entities\n child_organizations.all.each do |o|\n o.flattened_entities.each do |e|\n results << e\n end\n end\n\n # Only return a unique list\n results.uniq{ |x| x.id }\n end",
"title": ""
},
{
"docid": "3681a40af1778071bef37ea0e477e11c",
"score": "0.5271412",
"text": "def result_set_to_data(result_set, aggregate: false)\n # use ResultSet#ok method to determine status of a (potentially) aggregate result before serializing\n result_set_status = result_set.ok ? 'success' : 'failure'\n scrubbed_results = result_set.map do |result|\n scrub_stack_trace(result.to_data)\n end\n\n if aggregate\n {\n status: result_set_status,\n result: scrubbed_results\n }\n else\n # If there was only one target, return the first result on its own\n scrubbed_results.first\n end\n end",
"title": ""
},
{
"docid": "90ae9f9f0a4c669ea1f628378b04a30b",
"score": "0.5270933",
"text": "def from_results(graph_result, properties_result, database: Arango.current_database)\n hash = graph_result ? {}.merge(graph_result.to_h) : {}\n hash[:properties] = properties_result\n from_h(hash, database: database)\n end",
"title": ""
},
{
"docid": "6d1d605c885725a20396997b8eb3d48f",
"score": "0.526486",
"text": "def to_a\n @result\n end",
"title": ""
},
{
"docid": "6d1d605c885725a20396997b8eb3d48f",
"score": "0.526486",
"text": "def to_a\n @result\n end",
"title": ""
},
{
"docid": "171ec3747f7ea58bae33f4643fb4f4e8",
"score": "0.5263718",
"text": "def single_result(results)\n result = results.first\n\n result.meta = results.meta\n\n result.linked_data = results.linked_data if results.respond_to? :linked_data\n\n return result\n end",
"title": ""
},
{
"docid": "cb35ac92d4c2dd35a6db9bbd182a2a71",
"score": "0.5258194",
"text": "def index\n @entities_all = Entity.search(params[:q])\n @groups_all = Group.search(params[:q])\n @properties_all = Property.search(params[:q])\n\n @all = @entities_all + @groups_all + @properties_all\n\n respond_to do |format|\n format.html\n format.json { render json: @all.map { |a| a.attributes.merge 'class' => a.class.name } }\n end\n end",
"title": ""
},
{
"docid": "880d02640f44bbedbca453be231dd7c9",
"score": "0.5252688",
"text": "def results_with_rows\n load_from_rows(@dataset.all, true)\n end",
"title": ""
},
{
"docid": "102263a8fecdbca6b5121827a5272ee7",
"score": "0.5246678",
"text": "def merge_movie_search_results(results)\n results.flatten\n end",
"title": ""
},
{
"docid": "ca4ecad62b297a9148893768d7be2416",
"score": "0.5225177",
"text": "def build_entities_list(ontologies = [HAYSTACK, BRICK])\n entities = []\n @mappings_manager.mappings.each do |mapping|\n os_class = mapping.openstudio_class\n if os_class == 'OS:Output:Meter'\n entities += build_meter_entities_list(mapping, ontologies)\n else\n objs = @model.getObjectsByType(os_class)\n objs.each do |obj|\n # rescue objects from the clutches of boost\n conv_meth = 'to_' << os_class.gsub(/^OS/, '').gsub(':', '').gsub('_', '')\n obj = obj.send(conv_meth)\n break if obj.empty?\n obj = obj.get\n\n entity = Mapping::MappingEntity.new(obj, mapping)\n\n resolve_relationships(entity, ontologies)\n node_entities = build_node_entities_list(entity, ontologies)\n entities.push(entity)\n entities += node_entities\n end\n end\n end\n resolve_unitary_and_air_loops_overlap(entities)\n @mappings_manager.process_mapping_entities(entities, ontologies)\n return entities\n end",
"title": ""
},
{
"docid": "701afce955c8188a944d473a6494c9eb",
"score": "0.52236974",
"text": "def entities_list\n raise 'Not implemented'\n end",
"title": ""
},
{
"docid": "e383e361c7ecf4a29588f26904d02fa9",
"score": "0.52236456",
"text": "def array_result\n [@result['results']].flatten\n end",
"title": ""
},
{
"docid": "e6f6e1b91f23533c055b77e7d595effe",
"score": "0.5219175",
"text": "def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end",
"title": ""
},
{
"docid": "1d3954b828438fbf5f2c48663de3229c",
"score": "0.5202793",
"text": "def resultsToXML(result)\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :encoding => \"UTF-8\"\n xml.declare! :DOCTYPE, :Resultado, :SYSTEM, \"Resultados.dtd\"\n xml.tag! 'xml-stylesheet', :type => \"text/xsl\", :href => \"Resultados.xsl\"\n xml.resultado do |r|\n xml.pregunta do |p|\n @question.each{ |q| p.item q }\n end\n result.each { \n |r| xml.documento(:id => r[@INDEX_ID]) do |d| \n d.titulo r[@INDEX_TITLE];\n perc = (r[1]*100).round(2).to_s;\n d.relevancia perc + \"%\"; d.texto r[@INDEX_PATH]\n end \n }\n end\n #UGLY CODE (removing extra <to_s/> from the xml builder)\n f = File.open(\"Results.xml\", 'w')\n f.write(xml)\n f.close\n f = File.open(\"Results.xml\", 'r')\n data = f.read\n data = data.gsub!(\"<to_s/>\", \"\")\n f.close\n f = File.open(\"Results.xml\", 'w')\n f.write(data)\n f.close\n return data\n end",
"title": ""
},
{
"docid": "cea5d42483cad88bfa3621562665a4b3",
"score": "0.5195515",
"text": "def transformed_entries entries\n\t\tentries\n\tend",
"title": ""
},
{
"docid": "470c467697bea4a22547e348ed70e747",
"score": "0.5189343",
"text": "def result_to_product(result)\n {\n id: result[\"Product_Id\"],\n merchant_id: result[\"Merchant_Id\"],\n merchant_name: result[\"Merchant_Name\"],\n data_feed_id: result[\"Datafeed_Id\"],\n external_id: result[\"Product_Id\"],\n subcategory: result[\"Subcategory_Name\"],\n category: result[\"Category_Name\"],\n group: result[\"Department_Name\"],\n sku: result[\"Product_SKU\"],\n name: result[\"Product_Name\"],\n brand_name: result[\"Brand_Name\"],\n retail_price: result[\"Retail_Price\"],\n sale_price: result[\"Sale_Price\"],\n price: result[\"Sale_Price\"],\n summary: result[\"Abbreviated_Description\"] || result[\"Short_Description\"],\n description: result[\"Description\"],\n thumb_url: result[\"Thumbnail_Image\"],\n image_url: result[\"Large_Image\"] || result[\"Medium_Image\"],\n buy_link: result[\"Buy_URL\"],\n commission: result[\"Commission\"]\n }\n end",
"title": ""
},
{
"docid": "121ca8cfefd50cb98646fa0cf89473aa",
"score": "0.51825774",
"text": "def prepare_data(results_hash)\n\n @entities_store = {}\n @generic_relations_store = {}\n @events_store = {}\n # find all Entities in response\n @entities_store = results_hash.select{|key, hash| hash[\"_typeGroup\"] == \"entities\"}\n # find all GenericRelations in response\n @generic_relations_store = results_hash.select{|key, hash| hash[\"_typeGroup\"] == \"relations\" &&\n hash[\"_type\"] == \"GenericRelations\"}\n # find all Events in response\n @events_store = results_hash.select{|key, hash| hash[\"_typeGroup\"] == \"relations\" &&\n hash[\"_type\"] != \"GenericRelations\"}\n\n Ohm.redis = Redic.new(REDIS)\n\n\n #for each Entity find all related Relations and Events and store them to Ohm/Redis\n @entities_store.each_pair do |k, v|\n\n entity_set = EntityModel.find(calais_id: k)\n\n if entity_set.size > 0 #entity already exists in store\n entity = entity_set.first\n k = entity.calais_id\n else #entity doesn't exist in store\n entity = EntityModel.create(:name => v['name'], :type => v['_type'], :calais_id => k)\n entity.save\n end #if\n\n\n #get all referenced relations\n find_in_relations(k).each do |obj|\n\n found_rel = get_relation(obj[0])\n if found_rel\n\n found_rel.subject = convert_to_hash(found_rel.subject)\n found_rel.object = convert_to_hash(found_rel.object)\n\n relation = EntityModel::RelationModel.create(:subject => found_rel.subject,\n :object => found_rel.object,\n :verb => found_rel.verb,\n :detection => found_rel.detection,\n :calais_id => obj[0])\n entity.relations.add(relation)\n end #if\n end #each\n #get all referenced events\n find_in_events(k).each do |obj|\n found_event = get_event(obj[0])\n attribs = {}\n if found_event\n\n found_event.each_pair do |key, val|\n\n key = key.to_s.slice(1, key.length-1)\n attribs[key] = val\n\n end #block\n\n event = EntityModel::EventModel.create(:calais_id => obj[0], :info_hash => attribs)\n entity.events.add(event)\n\n end #if\n\n end #each\n end #each_pair\n end",
"title": ""
},
{
"docid": "c0b39325cee3552815aa56a91007a512",
"score": "0.5182362",
"text": "def reify_results(ids)\n results = []\n \n ids_hash = {}\n ids.each do |class_name, id|\n (ids_hash[class_name] ||= []) << id\n end\n \n ids.map {|ary| ary.first}.uniq.each do |class_name|\n klass = class_name.constantize\n \n finder = (\n Ultrasphinx::Search.client_options['finder_methods'].detect do |method_name| \n klass.respond_to? method_name\n end or\n # XXX This default is kind of buried, but I'm not sure why you would need it to be \n # configurable, since you can use ['finder_methods'].\n \"find_all_by_#{klass.primary_key}\"\n )\n\n records = klass.send(finder, ids_hash[class_name])\n \n unless Ultrasphinx::Search.client_options['ignore_missing_records']\n if records.size != ids_hash[class_name].size\n missed_ids = ids_hash[class_name] - records.map(&:id)\n msg = if missed_ids.size == 1\n \"Couldn't find #{class_name} with ID=#{missed_ids.first}\"\n else\n \"Couldn't find #{class_name.pluralize} with IDs: #{missed_ids.join(',')} (found #{records.size} results, but was looking for #{ids_hash[class_name].size})\"\n end\n raise ActiveRecord::RecordNotFound, msg\n end\n end\n \n records.each do |record|\n results[ids.index([class_name, record.id])] = record\n end\n end\n \n # Add an accessor for global search rank for each record, if requested\n if self.class.client_options['with_global_rank']\n # XXX Nobody uses this\n results.each_with_index do |result, index|\n if result\n global_index = per_page * (current_page - 1) + index\n result.instance_variable_get('@attributes')['result_index'] = global_index\n end\n end\n end\n\n # Add an accessor for distance, if requested\n if self.options['location']['lat'] and self.options['location']['long']\n results.each_with_index do |result, index|\n if result\n distance = (response[:matches][index][:attributes]['@geodist'] or INFINITY)\n result.instance_variable_get('@attributes')['distance'] = distance\n end\n end\n end\n \n results.compact!\n \n if ids.size - results.size > Ultrasphinx::Search.client_options['max_missing_records']\n # Never reached if Ultrasphinx::Search.client_options['ignore_missing_records'] is false due to raise\n raise ConfigurationError, \"Too many results for this query returned ActiveRecord::RecordNotFound. The index is probably out of date\" \n end\n \n results \n end",
"title": ""
},
{
"docid": "41e99ab02c51581e6490b17f3263a84c",
"score": "0.51756763",
"text": "def merged_result; end",
"title": ""
},
{
"docid": "e85035e0d59e5386c8fa78044019efbb",
"score": "0.51733196",
"text": "def conv_results_to_a_of_h( search_results )\n result_objects = []\n\n search_results[:data].each do |row|\n tmp = {}\n row.each_index do |index|\n tmp[ search_results[:headers][index] ] = row[index]\n end\n result_objects.push(tmp)\n end\n\n return result_objects\n end",
"title": ""
},
{
"docid": "857cf665b3e0cd7ea955c5f9e57c22bb",
"score": "0.51696527",
"text": "def query_entities(table_name, options={})\n query ={}\n query[\"$select\"] = options[:select].join ',' if options[:select]\n query[\"$filter\"] = options[:filter] if options[:filter]\n query[\"$top\"] = options[:top].to_s if options[:top] unless options[:partition_key] and options[:row_key]\n query[\"NextPartitionKey\"] = options[:continuation_token][:next_partition_key] if options[:continuation_token] and options[:continuation_token][:next_partition_key]\n query[\"NextRowKey\"] = options[:continuation_token][:next_row_key] if options[:continuation_token] and options[:continuation_token][:next_row_key]\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n uri = entities_uri(table_name, options[:partition_key], options[:row_key], query)\n response = call(:get, uri, nil, {\"DataServiceVersion\" => \"2.0;NetFx\"}, options)\n\n entities = Azure::Service::EnumerationResults.new\n\n results = (options[:partition_key] and options[:row_key]) ? [Table::Serialization.hash_from_entry_xml(response.body)] : Table::Serialization.entries_from_feed_xml(response.body)\n \n results.each do |result|\n entity = Entity.new do |e|\n e.table = table_name\n e.updated = result[:updated]\n e.etag = response.headers[\"etag\"] || result[:etag]\n e.properties = result[:properties]\n end\n entities.push entity\n end if results\n\n entities.continuation_token = nil\n entities.continuation_token = { \n :next_partition_key=> response.headers[\"x-ms-continuation-NextPartitionKey\"], \n :next_row_key => response.headers[\"x-ms-continuation-NextRowKey\"]\n } if response.headers[\"x-ms-continuation-NextPartitionKey\"]\n\n entities\n rescue => e\n raise_with_response(e, response)\n end",
"title": ""
},
{
"docid": "015da6c0d0574aa7890fe2bcd9b1a743",
"score": "0.5169407",
"text": "def entities\n ordering.map(&:entity).compact\n end",
"title": ""
},
{
"docid": "d2ca7135fb735641b96641a5862f664b",
"score": "0.5165376",
"text": "def raw\n results\n end",
"title": ""
},
{
"docid": "b3d6667f964cf972dafcaf4481fc7bb6",
"score": "0.5164019",
"text": "def entities\n @entities ||= Entities.from_grpc @grpc\n end",
"title": ""
},
{
"docid": "2e56e14e931435560d83e535fad1ceab",
"score": "0.5161253",
"text": "def process_results (results)\n\t\t\tresults.each do |result|\n\t\t\t\tresult = process_result(result)\n\t\t\tend\n\t\t\treturn results\n\t\tend",
"title": ""
},
{
"docid": "d15dc346e00ec882df0e7894d20bd80c",
"score": "0.5159935",
"text": "def build_result(columns:, rows:, column_types: {})\n ActiveRecord::Result.new(columns, rows, column_types)\n end",
"title": ""
},
{
"docid": "1b2a641df0459cd61e93cb17e677b658",
"score": "0.5157581",
"text": "def fetch\n @result = Result.new(data, :query => self)\n end",
"title": ""
},
{
"docid": "7a303b0b59e1cdffa4bb9a5d3572fc64",
"score": "0.51559573",
"text": "def to_entity\n \tentity = Google::Cloud::Datastore::Entity.new\n \tentity.key = Google::Cloud::Datastore::Key.new \"Feedback\", id\n \tentity[\"comment\"] = comment\n \tentity[\"overall\"] = overall \n \tentity[\"cleanliness\"] = cleanliness\n \tentity[\"odour\"] = odour\n \tentity[\"safety\"] = safety\n \tentity[\"user_id\"] = user_id\n \tentity[\"toilet_id\"] = toilet_id\n \tentity\n end",
"title": ""
},
{
"docid": "db44b8b43d949264f01b56d161fb883c",
"score": "0.5152658",
"text": "def find_entities\n []\n end",
"title": ""
},
{
"docid": "d0918ce1137218c70f175356b840875c",
"score": "0.5148292",
"text": "def entities\n @entities ||= []\n end",
"title": ""
},
{
"docid": "dd8cad6357ab7063cc4fa2adc4c77030",
"score": "0.5128144",
"text": "def to_a\n deserialize(find)\n end",
"title": ""
},
{
"docid": "085a02069350ce41efb1b0dcf6fb1803",
"score": "0.5121475",
"text": "def entity_objects\n ProjectMedia.where(id: self.entities).to_a\n end",
"title": ""
},
{
"docid": "1fc7ad1e289d4e7885b8c495df180481",
"score": "0.51156574",
"text": "def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "7545fb292107ac2e74b9329a8a02ccde",
"score": "0.51151335",
"text": "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_id\n ))\n end",
"title": ""
},
{
"docid": "7545fb292107ac2e74b9329a8a02ccde",
"score": "0.51151335",
"text": "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_id\n ))\n end",
"title": ""
},
{
"docid": "c7f1f2809efeb9920939bb11f57e99fb",
"score": "0.5112392",
"text": "def to_a\n fetch(ids)\n end",
"title": ""
},
{
"docid": "c7f1f2809efeb9920939bb11f57e99fb",
"score": "0.5112392",
"text": "def to_a\n fetch(ids)\n end",
"title": ""
},
{
"docid": "faf47c4a736c2081a9280f0abeb089de",
"score": "0.5111738",
"text": "def entity\n @response_impl.entity\n end",
"title": ""
},
{
"docid": "16c4ac23e7cbe4de7f049e47e069304b",
"score": "0.5110929",
"text": "def retrieve_all_entities\n response = self.execute(\"RetrieveAllEntities\", {\n EntityFilters: \"Entity\",\n RetrieveAsIfPublished: true\n },\n Metadata::RetrieveAllEntitiesResponse)\n end",
"title": ""
},
{
"docid": "6ba64e9a14f6ae7583144afc86be1ec3",
"score": "0.5100899",
"text": "def to_a\n [\"#{status_code} #{reason_phrase}\", headers, entity_body]\n end",
"title": ""
},
{
"docid": "70d021097ab31e0332e8b4cda5995b4c",
"score": "0.5091892",
"text": "def to_array(dataset)\n dataset.map do |row|\n entity_class.new row\n end\n end",
"title": ""
},
{
"docid": "346a86c44634d7e8a2ddc6d7e3098125",
"score": "0.5084964",
"text": "def to_result\n Result.new(url, docid, score_value, term_count_hash)\n end",
"title": ""
},
{
"docid": "5b1667020ca8845d9f6ad4a3608942a4",
"score": "0.50841373",
"text": "def map_entity_relations\n assignments = @db_base.query_assignments\n results = Hash.new()\n assignments.each { |result|\n results[result[\"P_Id\"]] = result[\"T_Id\"]\n }\n return results\n end",
"title": ""
},
{
"docid": "88ef0020ba63af2c948f23455f673925",
"score": "0.5083697",
"text": "def embiggen_grouped_results(values)\n embiggened_results = []\n values.each do |resultset|\n container = {} \n resultset.each do |set|\n data = {}\n set.data.each do |key, value|\n if value.kind_of? Hash\n if value.empty?\n value = []\n else \n value = [value] if value.kind_of? Hash\n end\n end\n data[key] = value\n end\n container.merge!(data) do |key, old, nue|\n if old.kind_of? Array\n old.push nue.first\n else\n nue\n end \n end\n end\n embiggened_results.push container\n end\n\n embiggened_results\n end",
"title": ""
},
{
"docid": "8c32865cabe4c4745131cdc90e546901",
"score": "0.5082725",
"text": "def entities(query={})\n if query.key?(:partition_key) && query.key?(:row_key)\n @service.query_entity(self, query.delete(:partition_key), query.delete(:row_key), query)\n else\n @service.query_entities(self, query)\n end\n end",
"title": ""
},
{
"docid": "4e4784f38ed494275f030f637ef4bb02",
"score": "0.5082234",
"text": "def process_result_set(result, opts=OPTS)\n meta = result.getMetaData\n if fetch_size = opts[:fetch_size]\n result.setFetchSize(fetch_size)\n end\n\n converters = []\n self.columns = meta.getColumnCount.times.map do |i|\n col = i + 1\n converters << TypeConverter::MAP[meta.getColumnType(col)]\n meta.getColumnLabel(col)\n end\n\n fetch_as_array = opts[:as] == :array\n while result.next\n row = fetch_as_array ? [] : {}\n _columns.each_with_index do |column, i|\n k = fetch_as_array ? i : column\n col = i+1\n row[k] = converters[i].call(result, col, opts)\n end\n yield row\n end\n ensure\n result.close\n end",
"title": ""
},
{
"docid": "42d034e9cbf06592ac978080b838cc61",
"score": "0.5080263",
"text": "def to_xml\n\t\t\tresult_string = String.new\n\t\t\tresult_string << \"<results>\\n\"\n\t\t\t@results.each do |result|\n\t\t\t\tresult_string << \"\\t<vtresult>\\n\"\n\t\t\t\tRESULT_FIELDS.each{|field|\n\t\t\t\t\tresult_string << \"\\t\\t<#{field.to_s}>#{result[field]}</#{field.to_s}>\\n\" unless field == :permalink and result['permalink'].nil?\n\t\t\t\t}\n\t\t\t\tresult_string << \"\\t</vtresult>\\n\"\n\t\t\tend if @results != nil\n\t\t\tresult_string << \"</results>\\n\"\n\n\t\t\tresult_string\n\t\tend",
"title": ""
},
{
"docid": "9de676934ff5ed468077b399e3ad47db",
"score": "0.50756174",
"text": "def make_entity_array x\n retval = Array.new\n case x.class.to_s\n when 'Entity'\n retval.push x\n when 'EntityStruct'\n retval.push x.entity\n when 'Array'\n x.each{|elem|\n if elem.class.to_s == 'Entity'\n retval.push elem\n elsif elem.class.to_s == 'EntityStruct'\n retval.push elem.entity\n else\n puts \"ERROR elem.class invalid, is #{elem.class}\"\n end # if\n } # x.each\n else\n puts \"ERROR: input class invalid, is #{x.class}\"\n exit\n end # case\n return retval\n end",
"title": ""
},
{
"docid": "99e0fc6f09bf904ffe82e3cdea3be1b9",
"score": "0.50755614",
"text": "def entities(text)\n return Typogruby.entities(text.to_s)\n end",
"title": ""
},
{
"docid": "d56ddb6f8d2dc08e8e5d23b0b6d2c076",
"score": "0.5066911",
"text": "def parse_results(results)\n out = []\n results = [results] if results.is_a?(Hash) # no array if only one result\n results.each do |r|\n out << Result.new(r)\n end\n out\n end",
"title": ""
},
{
"docid": "a68bf17d44e88f91f2fdf1bba43e717d",
"score": "0.5054961",
"text": "def assemble(results, map)\n list = []\n results.each do |result|\n if map[result.id.to_s]\n list << result\n list += assemble(map[result.id.to_s], map)\n else\n list << result\n end\n end\n list\n end",
"title": ""
}
] |
9146985ae802fbd807130d218a3607fd
|
validates if a user is logged_in, reroutes to root_path if not
|
[
{
"docid": "bde45fdf68116391cb4f2bbd77f3d0b5",
"score": "0.72439444",
"text": "def logged_in?\n if session[:user_id].nil?\n redirect_to root_path\n else\n true\n end\n end",
"title": ""
}
] |
[
{
"docid": "c0d4af5398d098f9c0de8adf5e577751",
"score": "0.77892125",
"text": "def verify_logged_in\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "a50f556fc6f436c446e8849e8d795ea2",
"score": "0.76900214",
"text": "def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "8b8827488281fa13c607f718c9543540",
"score": "0.76605904",
"text": "def must_be_logged_in\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "d13a0feef5c2db1b840ed684f0c4616d",
"score": "0.7586071",
"text": "def validate_logged_in\n unless signed_in?\n flash[:error] = 'You need to sign in' unless request.path == root_path\n redirect_to signin_path\n end\n end",
"title": ""
},
{
"docid": "8364d3e4cb1e5081e9b114ac1637d2d4",
"score": "0.7566787",
"text": "def user_root\r\n if logged_in?\r\n redirect_to current_user\r\n else\r\n redirect_to login_path\r\n end\r\n end",
"title": ""
},
{
"docid": "64a48c240c3548327fb60fe610ae21fb",
"score": "0.7558613",
"text": "def require_logged_in\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "535476d7662cf6a151d6cf1779447a50",
"score": "0.752549",
"text": "def check_logged_in?\n if !logged_in?\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "9c0ad745c0303a453b68e3785201df3b",
"score": "0.7512987",
"text": "def logged_in_user\n unless current_user \n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "9f9250d7d51e5eb213fa76a8a37a8ffd",
"score": "0.74955326",
"text": "def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end",
"title": ""
},
{
"docid": "2acbe4e841013a4fc3b9f84de1448790",
"score": "0.7437501",
"text": "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end",
"title": ""
},
{
"docid": "2acbe4e841013a4fc3b9f84de1448790",
"score": "0.7437501",
"text": "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end",
"title": ""
},
{
"docid": "81cd64f48a7bb79cee38f67ef5efc386",
"score": "0.7431279",
"text": "def logged_in_user\n unless logged_in?\n store_location\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "81cd64f48a7bb79cee38f67ef5efc386",
"score": "0.74309075",
"text": "def logged_in_user\n unless logged_in?\n store_location\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "81cd64f48a7bb79cee38f67ef5efc386",
"score": "0.74309075",
"text": "def logged_in_user\n unless logged_in?\n store_location\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "0e410e501eecbb3fdf3cdb8d8aea8219",
"score": "0.74221545",
"text": "def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end",
"title": ""
},
{
"docid": "ef462fab803ec4851a6d70eecb5881ea",
"score": "0.7367242",
"text": "def logged_in?\n redirect_to(root_path, notice: 'Unauthorized access!') unless current_user\n end",
"title": ""
},
{
"docid": "367b8f96e6fcdae720705a6149a7d6e7",
"score": "0.7359465",
"text": "def require_login\n if !current_user\n redirect_to \"/\"\n end\n end",
"title": ""
},
{
"docid": "7d1ce4e0635c4b37ad20d00a7174ffd1",
"score": "0.73587054",
"text": "def redirect_if_logged_in\n redirect_to root_path if logged_in?\n end",
"title": ""
},
{
"docid": "0f16f4e26d65c85ad9bc910c1d50afd3",
"score": "0.7329918",
"text": "def logged_in?\n if current_user == nil\n redirect_to \"/sign_in\"\n end\n end",
"title": ""
},
{
"docid": "78368f8b1d01d41ee19afb0684cbae19",
"score": "0.7314356",
"text": "def user_logged\n \tif !current_user\n \t\treturn redirect_to '/'\n \tend\n end",
"title": ""
},
{
"docid": "792784bd6a1083f0315dcbf360168dfd",
"score": "0.72983503",
"text": "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"title": ""
},
{
"docid": "d6cd17ab6da66f3b38bbe3057d7e84de",
"score": "0.7293684",
"text": "def already_logged_in\n\t\t\t#current user is not nil\n\t\t\tif !current_user.nil?\n\t\t\t\tredirect_to root_url\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "f51b1118e4be327f2f9b5ea68c715802",
"score": "0.72919714",
"text": "def redirect_if_not_logged_in\n\t\tredirect_to '/' if !logged_in?\n\tend",
"title": ""
},
{
"docid": "976cb7c0ae229fbb830ceb59187cf2ef",
"score": "0.7290959",
"text": "def logged_in_user\n unless logged_in?\n flash[:warning] = \"Please log in\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "47d7123542bd3cf16ac6e55b02952f56",
"score": "0.7276919",
"text": "def logged_in_user\n if user_signed_in? then\n \n else\n redirect_to root_path\n end \n \n end",
"title": ""
},
{
"docid": "95521c9c2d2a0641e6e471e96b7d286b",
"score": "0.726662",
"text": "def require_login\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "95521c9c2d2a0641e6e471e96b7d286b",
"score": "0.726662",
"text": "def require_login\n redirect_to root_path unless logged_in?\n end",
"title": ""
},
{
"docid": "f09b458b28fcc28669b5c7ec242273ee",
"score": "0.72366226",
"text": "def user_signin_status\n unless user_signed_in?\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "a9b8783bf00bf30542319394568db95a",
"score": "0.7231385",
"text": "def logged_in_user\n \t\tunless logged_in?\n \t\t\tflash[:error] = \"You must be logged in\"\n \t\tredirect_to login_path\n \t\tend\n \tend",
"title": ""
},
{
"docid": "b143eb4d822f5f930d8af50bfa34c963",
"score": "0.7229449",
"text": "def logged_in_user\n unless logged_in?\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "a367a73a13afcebdbbc2b33beb34325f",
"score": "0.72126514",
"text": "def logged_in_user?\n if logged_in?\n redirect_to user_path(current_user)\n end\n end",
"title": ""
},
{
"docid": "80dee6c96e5cb333cb69e55508afc010",
"score": "0.7209914",
"text": "def check_logged_in\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n\n return\n end",
"title": ""
},
{
"docid": "c2c1c1e3132823bf8305dc279d4458a5",
"score": "0.7207646",
"text": "def is_logged_in\n redirect_to login_path unless logged_in?\n end",
"title": ""
},
{
"docid": "4fddf8e3bf5f53fec5e1fa053ac60911",
"score": "0.7196828",
"text": "def log_in?\n if current_user\n redirect_to user_path\n end\n end",
"title": ""
},
{
"docid": "2e73ed831c9154ee82594ed41c8dc65e",
"score": "0.71891123",
"text": "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "ab5c8195c5b1fd529e2c760f5c6b0fd9",
"score": "0.71877706",
"text": "def login_required\n if !logged_in?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end",
"title": ""
},
{
"docid": "ca836afe96155ec5bfaefe19a7741980",
"score": "0.7186592",
"text": "def redirect_if_logged_in\n if logged_in?\n redirect \"/users/#{current_user.id}\"\n end\n end",
"title": ""
},
{
"docid": "0b39c90a87cf8a71acec556af4d8c022",
"score": "0.718326",
"text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "5b084c415fcae9616a8fedd812e25914",
"score": "0.7182117",
"text": "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"title": ""
},
{
"docid": "ceba951bfcc3d2c5905fc8bf03a95c65",
"score": "0.71733606",
"text": "def check_user\n if current_user.blank?\n puts\"false\"\n new_user_session_path\n else\n puts\"true\"\n end\n end",
"title": ""
},
{
"docid": "080ddd6f5695c3d33da939a9091c3a38",
"score": "0.7170751",
"text": "def redirect_if_not_logged_in\n if !logged_in?\n flash[:errors] = \"You must be logged in to view the page \"\n redirect '/'\n end\n end",
"title": ""
},
{
"docid": "81f73042570781ad23cecfb498a119f3",
"score": "0.7169642",
"text": "def require_logged_in\n \treturn true if current_user\n\n \treturn redirect_to root_path\n\n end",
"title": ""
},
{
"docid": "b5fcdf8c94e3201cff9f7a430c96b3c8",
"score": "0.7162946",
"text": "def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "579b6818ac98c6b8798878feb72b643b",
"score": "0.7161674",
"text": "def redirect_home_if_not_logged_in\n unless logged_in?\n session[:error] = \"You must be signed in to do that.\"\n redirect \"/\"\n end\nend",
"title": ""
},
{
"docid": "1eb19cf62a511ea5369de45de659c9a5",
"score": "0.71613276",
"text": "def redirect_if_not_logged_in\n redirect_to login_path unless logged_in?\n end",
"title": ""
},
{
"docid": "670aab801fb06fe232ab7736b167618f",
"score": "0.71559364",
"text": "def must_be_logged_in\n unless current_user\n redirect_to new_user_session_path\n end\n end",
"title": ""
},
{
"docid": "2b3a1adae0b4653b84d2cd918c7a1d23",
"score": "0.71542907",
"text": "def login_required\n redirect_to login_path unless logged_in?\n end",
"title": ""
},
{
"docid": "b700fa8e2928de229aa4ef9f27c44edb",
"score": "0.715276",
"text": "def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "b700fa8e2928de229aa4ef9f27c44edb",
"score": "0.715276",
"text": "def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "b700fa8e2928de229aa4ef9f27c44edb",
"score": "0.715276",
"text": "def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "c45ef52b541d3a4012a0843c59a12655",
"score": "0.71521837",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in first.\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "c2fc38e6d8dcf7b302c9ee24d24c5967",
"score": "0.7116574",
"text": "def logged_in_user?\n unless logged_in?\n store_URL\n flash[:alert] = 'Please log in.'\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "25cb65218625c4d9b30e06dbaed65155",
"score": "0.7111818",
"text": "def redirect_if_logged_in\n if logged_in?\n redirect \"/users/#{current_user.id}\"\n end\n #def redirect_if_logged_in_as_someone_else\n #end\n end",
"title": ""
},
{
"docid": "8ab29dcf0354cc110776ec1f64cc7b1d",
"score": "0.71103173",
"text": "def logged_in_user?\n unless logged_in?\n # store location for logged out user (friendly redirect)\n store_location\n flash[:danger] = \"Please login\"\n redirect_to login_path\n end\n end",
"title": ""
},
{
"docid": "a4f5d5976635373120ff792fddff4362",
"score": "0.7094571",
"text": "def check_for_login\n #if not, back home with you!\n redirect_to root_path unless @current_user.present?\n end",
"title": ""
},
{
"docid": "ff1c5ff6cf2395445fa132f41010c2e1",
"score": "0.7086326",
"text": "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: \"Please log in.\" }\n end\n end",
"title": ""
},
{
"docid": "8896018d7884812c387e52f6880f1921",
"score": "0.70835054",
"text": "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\t end\n end",
"title": ""
},
{
"docid": "6ddea9d927c8830d81dbef2c9357f068",
"score": "0.7080229",
"text": "def login_required\n if logged_in?\n return true\n else\n redirect_to(:controller => '/user', :action => 'index')\n return false\n end\n end",
"title": ""
},
{
"docid": "eedf0230b9cc649cf83b809371f52e5b",
"score": "0.7079275",
"text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "af698d0fc7d5b90324b97c2d8f265331",
"score": "0.70553005",
"text": "def logged_in_user\n unless logged_in?\n # store intended location to be used for friendly forwarding after\n # the user properly logs in\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "edd0e6aac7c3d26bb8825d49a05909e5",
"score": "0.70528734",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "f499126127b9b07dd7a67e67ca76841a",
"score": "0.7052462",
"text": "def redirect_unless_signed_in\n unless signed_in?\n flash[:notice] = \"You must be logged in to access #{request.fullpath}\"\n redirect_to users_path\n end\n end",
"title": ""
},
{
"docid": "fcbb7d3699ffaaebbd0d9222985a48b2",
"score": "0.70451945",
"text": "def logged_in_user\n\t unless logged_in?\n\t store_location # store where the user was going to go (redirects them to it after they log in)\n\t flash[:danger] = \"Please log in.\"\n\t redirect_to login_url\n\t end\n\t end",
"title": ""
},
{
"docid": "0d6e9594dcfab3a2d0a8c66350beb0b4",
"score": "0.70365113",
"text": "def require_login\n if current_user.nil? then\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "505f3bcd0ad96bbc722bdb4dd828e408",
"score": "0.70355695",
"text": "def logged_in_user\n if logged_in?\n redirect_to(user_path(@current_user)) if params[:id] != @current_user.id.to_s\n else\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "221fd58440cac10f77e12e385ad693fd",
"score": "0.70328003",
"text": "def signed_in_root\n path = case session[:user_type]\n when 'admin'\n users_path\n\n when 'provider'\n provider_home_path\n\n when 'patient'\n patient_home_path\n\n else\n root_path\n end\n\n path\n end",
"title": ""
},
{
"docid": "30115e52716b004b611eaef1bc53763f",
"score": "0.7029603",
"text": "def require_login\n redirect_to login_path if !user_logged?\n end",
"title": ""
},
{
"docid": "c2f189e18213c944fcaa4dc375a539db",
"score": "0.7028947",
"text": "def already_signed_in\n if current_user != nil\n redirect_to(root_path)\n end\n end",
"title": ""
},
{
"docid": "23d8c2dea8e64d0dceaec5893169940d",
"score": "0.70269734",
"text": "def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end",
"title": ""
},
{
"docid": "646e46ac55b394dafa1c7df2e77b221b",
"score": "0.7022648",
"text": "def if_logged_in_redirect\n if logged_in?\n redirect_to current_user\n end\n end",
"title": ""
},
{
"docid": "646e46ac55b394dafa1c7df2e77b221b",
"score": "0.7022648",
"text": "def if_logged_in_redirect\n if logged_in?\n redirect_to current_user\n end\n end",
"title": ""
},
{
"docid": "89827e03b3fca47b4f13f29a36d1d710",
"score": "0.7022045",
"text": "def logged_in_user\n unless logged_in? #this is equivalent to if !logged_in? or user is not logged in\n store_location #session help method that stores the accessed url\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "207939eff76e5b301b4efe1b2fc2e352",
"score": "0.70215183",
"text": "def check_logged_in_home\n if current_user != nil\n redirect_to user_path(current_user)\n end\n end",
"title": ""
},
{
"docid": "a228a5254c1645937b6bdbcd3629226d",
"score": "0.7019638",
"text": "def login_required\n \t\t redirect_to(root_url, notice: 'You have to be signed in to do that! Top right ~') unless current_user\n \tend",
"title": ""
},
{
"docid": "57b956e951c1d733c57d0abcccc05273",
"score": "0.70180744",
"text": "def logged_in_user\n unless logged_in?\n #We store the location where the users want to go\n #and then ask them to log in, once they log in, we will\n #redirect them to that location.\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "eacab6fe5fd9559d2a8761f66e8b18cb",
"score": "0.70079184",
"text": "def require_login\n redirect_to root_path unless session.include?(:user_id)\n end",
"title": ""
},
{
"docid": "619123c877d0a70b4158ca334e25712d",
"score": "0.7005235",
"text": "def redirect_if_not_logged_in\n #redirect the user if the user is not logged in\n end",
"title": ""
},
{
"docid": "f4ae05f255a010a3c0176fed1577191d",
"score": "0.70031404",
"text": "def Usuario_noLogueado\n redirect_to(root_url) unless logged_in?\n end",
"title": ""
},
{
"docid": "ca9a962e9c6dae1dfea3ca5d68dc398b",
"score": "0.69997907",
"text": "def logged_in_user\n #this only runs if the user is NOT logged in\n #logged_in method comes from the sessions helper file, and returns a boolean\n unless logged_in?\n #this method comes from the sessions_helper file. it stores where you were trying to go, so that after you log in, it will get you there. reference comments in the helper file.\n store_location\n #adds a flash - it is not flash.now because it is redirected to the login page, so that login page counts as a new request which is what we want.\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "6549249c0f8df6a8bf3240afbdd96114",
"score": "0.6996471",
"text": "def logged_in_user\n \n unless logged_in?\n\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"title": ""
},
{
"docid": "4064547a09c88238716b468ea213c12e",
"score": "0.6993112",
"text": "def authenticate_user\n redirect_to root_path unless signed_in?\n end",
"title": ""
},
{
"docid": "789426a43ef4db4024911461964dae56",
"score": "0.6991224",
"text": "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\tend\n end",
"title": ""
},
{
"docid": "b1df2d08de7d948cd1c229752e18a011",
"score": "0.69818425",
"text": "def require_login\n redirect_to '/' if session[:user_id] == nil\n end",
"title": ""
},
{
"docid": "746d08e98dbcc25e0dbcd55b85bd5deb",
"score": "0.6979993",
"text": "def check_logged_in\n return if current_user.present?\n\n redirect_to new_session_path and return\n end",
"title": ""
},
{
"docid": "68a49bd8c627d6cc908575fb3ab34c65",
"score": "0.69793904",
"text": "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",
"title": ""
},
{
"docid": "fd01a9d3f37951490a1a5f8b195f1162",
"score": "0.6976907",
"text": "def check_if_already_logged_in\n redirect_to(user_url(current_user)) if logged_in?\n end",
"title": ""
},
{
"docid": "1fd7c86160a97ba6ec6abd0ac0a7efc5",
"score": "0.69720674",
"text": "def logged_in_user\n unless logged_in?\n respond_with_error \"This action requires that you be logged in.\", \n login_path\n end\n end",
"title": ""
},
{
"docid": "d5cb55a9314bef9d375868181f75a706",
"score": "0.6969916",
"text": "def login_required\n redirect_to login_path unless logged_in?\n end",
"title": ""
},
{
"docid": "9361bf2c45c97f3967fbb14234d14536",
"score": "0.69682205",
"text": "def logged_in?\n unless current_user\n redirect_to login_path, notice: 'You must be logged in to do that.'\n end\n end",
"title": ""
},
{
"docid": "ad2ba45307b7d637d814e2f85e6ba22c",
"score": "0.6965926",
"text": "def redirect_if_logged_in\n if session[:user_id].present? && !session[:user_is_admin?]\n flash[:notice] = 'Already Logged in!'\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "d64897f963e6b7f8afb1e10160e1f91d",
"score": "0.69658566",
"text": "def check_current_user\n redirect_to '/' unless @user.id == current_user.id\n end",
"title": ""
},
{
"docid": "c63eb2c34dd4ebc9950ee4436bbf9735",
"score": "0.69639355",
"text": "def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"title": ""
},
{
"docid": "579bd26c52027a2a0801df8b83d1eb35",
"score": "0.69622374",
"text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to user_login_url\n end\n end",
"title": ""
},
{
"docid": "a3250b97f10c7f41cbe6cb1dd5e9ff26",
"score": "0.69572765",
"text": "def check_user\n if (!user_signed_in?)\n redirect_to root_path, notice: 'You must log in to do that'\n end\n # if (!current_user.superadmin_role)\n # redirect_to root_path, notice: 'You do not have permissions to do that'\n # end\n end",
"title": ""
},
{
"docid": "2b4b5b8ec131c55c5ecb538f40683746",
"score": "0.69539267",
"text": "def redirect_if_not_logged_in\n if !logged_in?\n flash[:notice] = \"You must be logged in to view the page you tried to view.\"\n redirect '/'\n end\n end",
"title": ""
},
{
"docid": "6e5adf9b037d32dc5a186c5f1c033bc7",
"score": "0.69526905",
"text": "def logged_in_user\n\tunless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in.\"\n\t redirect_to login_url\n\tend\n end",
"title": ""
},
{
"docid": "2055c90579efb5c8d06901077dda71a6",
"score": "0.69515324",
"text": "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: 'Por favor, faça login' }\n end\n end",
"title": ""
},
{
"docid": "b9ffab3a5d2d56eeed619379e55a4551",
"score": "0.694862",
"text": "def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end",
"title": ""
},
{
"docid": "2b752e662e7d0e90fea42a26e53cf715",
"score": "0.69485193",
"text": "def user_must_be_logged_in\n\n unless logged_in?\n flash[:danger] = \"Please log in\"\n redirect_to login_path\n end\n\n end",
"title": ""
},
{
"docid": "ca80d21f77868989c9f717a0d5d96c28",
"score": "0.6947551",
"text": "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end",
"title": ""
}
] |
1a1cc8588d73a6cdc9f78603f8e84b2f
|
DELETE /poas/1 DELETE /poas/1.json
|
[
{
"docid": "cb9a35717712194ef3cda024a4d3d4e8",
"score": "0.71604455",
"text": "def destroy\n @poa.destroy\n respond_to do |format|\n format.html { redirect_to poas_url, notice: 'Poa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.72508603",
"text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end",
"title": ""
},
{
"docid": "b445c184893647d3482f8fbc6a507a52",
"score": "0.7125183",
"text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end",
"title": ""
},
{
"docid": "3fe54c3cd295c6151785b7802e16fcd9",
"score": "0.7026654",
"text": "def destroy\n @apodo = Apodo.find(params[:id])\n @apodo.destroy\n\n respond_to do |format|\n format.html { redirect_to apodos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b6ac44edd621f4d220e665e0704a3ecc",
"score": "0.70255744",
"text": "def destroy\n @pessoa.destroy\n render json: @pessoa\n end",
"title": ""
},
{
"docid": "28b5b8b0a6881509ac5d2dda82e3c021",
"score": "0.7012468",
"text": "def destroy\n @ato.destroy\n respond_to do |format|\n format.html { redirect_to atos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9106867cee9e8775ba817195d3bc2020",
"score": "0.70019764",
"text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end",
"title": ""
},
{
"docid": "ab5b24793fee9177d572efb7a567b6ab",
"score": "0.6988664",
"text": "def destroy\n @pola.destroy\n respond_to do |format|\n format.html { redirect_to polas_url, notice: 'Pola was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "773e5d611adeb09776f9c841e1b876cc",
"score": "0.6956753",
"text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end",
"title": ""
},
{
"docid": "353213b42c4e781bb462ea2f73703ba5",
"score": "0.69529164",
"text": "def destroy\n @pessoa.destroy\n \n respond_to do |format|\n format.html { redirect_to pessoas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "75a785bddc2252b3dfe08070dcb44399",
"score": "0.6951058",
"text": "def delete(args)\n if args[:json]\n post(args.merge(method: :delete))\n else\n get(args.merge(method: :delete))\n end\n end",
"title": ""
},
{
"docid": "179ff0053e8f4f967cb3d92206094cf0",
"score": "0.69277936",
"text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"title": ""
},
{
"docid": "4eadb61943fa9a636cad510bf21db1aa",
"score": "0.6915405",
"text": "def destroy\n @agronomiadecanato = Agronomiadecanato.find(params[:id])\n @agronomiadecanato.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiadecanatos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47a3c9c28e1fcd0fcae5ea58416b42bd",
"score": "0.6908736",
"text": "def delete(path)\n api :delete, path\n end",
"title": ""
},
{
"docid": "0879ade66bdab83e51e8da609fb6b45b",
"score": "0.68694085",
"text": "def destroy\n @resposta = Resposta.find(params[:id])\n @resposta.destroy\n\n respond_to do |format|\n format.html { redirect_to respostas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a1d498c4de7fd26551456198f22e8373",
"score": "0.68639195",
"text": "def destroy\n @aprova = Aprova.find(params[:id])\n @aprova.destroy\n\n respond_to do |format|\n format.html { redirect_to aprovas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "155bb0129cc113c2fc5c6f6b1336dfd1",
"score": "0.6861875",
"text": "def destroy\n @anexo = Anexo.find(params[:id])\n @anexo.destroy\n\n respond_to do |format|\n format.html { redirect_to anexos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dba16b2327539a3629ad19ee7d16009e",
"score": "0.68464965",
"text": "def destroy\n @sangano = Sangano.find(params[:id])\n @sangano.destroy\n\n respond_to do |format|\n format.html { redirect_to sanganos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a3fa29ff48655418a901a56b030d072c",
"score": "0.68442935",
"text": "def destroy\n @pago = Pago.find(params[:id])\n @pago.destroy\n\n respond_to do |format|\n format.html { redirect_to pagos_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "57c66c44a1a8bb6e651478111a596343",
"score": "0.6838475",
"text": "def destroy\n @polaczeny = Polaczenie.find(params[:id])\n @polaczeny.destroy\n\n respond_to do |format|\n format.html { redirect_to polaczenies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.6836898",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "dce2f7595dd93b9578936c70843ef1fb",
"score": "0.68343663",
"text": "def destroy\n @pruebaloca = Pruebaloca.find(params[:id])\n @pruebaloca.destroy\n\n respond_to do |format|\n format.html { redirect_to pruebalocas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "68a9fe9d98cb91050271b609da7d3664",
"score": "0.68324083",
"text": "def destroy\n @pessoa.destroy\n respond_to do |format|\n format.html { redirect_to pessoas_url, notice: @@msgs }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "00c90bc63b0302afbbc4b2979ae20b57",
"score": "0.6832268",
"text": "def api_delete(path, data = {})\n api_request(:delete, path, :data => data).parsed\n end",
"title": ""
},
{
"docid": "ca2ce8f23b4ea50249ad50bb30d52499",
"score": "0.6828871",
"text": "def destroy\n @pesaje = Pesaje.find(params[:id])\n @pesaje.destroy\n\n respond_to do |format|\n format.html { redirect_to pesajes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c062641bed95297a1f5e06f6a7986101",
"score": "0.68258965",
"text": "def destroy\n @prueba1 = Prueba1.find(params[:id])\n @prueba1.destroy\n\n respond_to do |format|\n format.html { redirect_to prueba1s_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "887432e4b57a71666f432ad34958877c",
"score": "0.68178356",
"text": "def destroy\n @solicitud = Solicitud.find(params[:id])\n @solicitud.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a551bb6d8f17cd35dca87b4776550e14",
"score": "0.6817524",
"text": "def destroy\n @pago = Pago.find(params[:id])\n @pago.destroy\n\n respond_to do |format|\n format.html { redirect_to pagos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a551bb6d8f17cd35dca87b4776550e14",
"score": "0.6817524",
"text": "def destroy\n @pago = Pago.find(params[:id])\n @pago.destroy\n\n respond_to do |format|\n format.html { redirect_to pagos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "034d813387647ba367ef44dab8899fe3",
"score": "0.68116647",
"text": "def destroy\n @anotacion = Anotacion.find(params[:id])\n @anotacion.destroy\n\n respond_to do |format|\n format.html { redirect_to anotacions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8018e400c9c6129294aa08214895a132",
"score": "0.6811086",
"text": "def destroy\n @poema.destroy\n respond_to do |format|\n format.html { redirect_to poemas_url, notice: 'Poema apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7d7b7dadba9ceef0afd974baf9438a97",
"score": "0.6799738",
"text": "def destroy\n @adocao.destroy\n respond_to do |format|\n format.html { redirect_to adocaos_url, notice: 'Adocao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ba67ebd85114998e01be10599c8943ca",
"score": "0.67987865",
"text": "def delete(path)\n RestClient.delete request_base+path\n end",
"title": ""
},
{
"docid": "822ddea2e45bf78350003645efcbdb54",
"score": "0.67984015",
"text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end",
"title": ""
},
{
"docid": "9dd1623806ce1059ff6318fcb9a27c7a",
"score": "0.67959034",
"text": "def destroy\n @ata = @reuniao.atas.find params[:id]\n @ata.destroy\n respond_to do |format|\n format.html { redirect_to @reuniao}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "57b799133d29316426c358002043baa2",
"score": "0.67898005",
"text": "def delete_rest(path, headers={}) \n run_request(:DELETE, create_url(path), headers) \n end",
"title": ""
},
{
"docid": "0674f1b6f8e6fd33271b36be2baf448b",
"score": "0.6787016",
"text": "def destroy\n @tipo_apuestum = TipoApuestum.find(params[:id])\n @tipo_apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_apuesta_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8367c4e543d9e1cad76ea005a57eac68",
"score": "0.67860055",
"text": "def destroy\n @asesoria = Asesoria.find(params[:id])\n @asesoria.destroy\n\n respond_to do |format|\n format.html { redirect_to asesoria_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bd01164c6edd3314ec13ec01f586fae8",
"score": "0.677982",
"text": "def destroy\n @pelicula = Pelicula.find(params[:id])\n @pelicula.destroy\n render json: {message: 'Eliminated'}, status: :ok\n\n end",
"title": ""
},
{
"docid": "9dd790c02a5ce3b1a66861c3f9e23778",
"score": "0.6772674",
"text": "def destroy\n @prazo = Prazo.find(params[:id])\n @prazo.destroy\n\n respond_to do |format|\n format.html { redirect_to prazos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b069af6ed882aa3d1229f80526b92fa0",
"score": "0.677032",
"text": "def destroy\n @presencia = Presencia.find(params[:id])\n @presencia.destroy\n\n respond_to do |format|\n format.html { redirect_to presencia_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a919a26087e80e5b68cbb5f1f9cd0ed9",
"score": "0.6770004",
"text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to questaos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "39ab41ec0f91fcc10ad25e05a2d9184f",
"score": "0.6768567",
"text": "def destroy\n @aluga_jogo.destroy\n respond_to do |format|\n format.html { redirect_to aluga_jogos_url, notice: 'Aluguel foi excluido' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c1c164b581dbae14285797e584e8fb7",
"score": "0.6765023",
"text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"title": ""
},
{
"docid": "3b6e71435585e0fe445bb86f65f16a30",
"score": "0.67618835",
"text": "def destroy\n @v2_pessoa.destroy\n respond_to do |format|\n format.html { redirect_to v2_pessoas_url, notice: \"Pessoa was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b6db2bfd7e105be65ed231e3d8849af0",
"score": "0.6760867",
"text": "def destroy\n @tiposuario.destroy\n respond_to do |format|\n format.html { redirect_to tiposuarios_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c1cde2518cb592b6add14fe05ae1b37d",
"score": "0.6756368",
"text": "def delete\n options = self.to_h \n uri = self.class.path_builder(:delete, self.id)\n data = {}\n data['id'] = self.id \n data = data.to_json\n VivialConnect::Client.instance.make_request('DELETE', uri, data)\n end",
"title": ""
},
{
"docid": "17e68bdf2bc06dd61627ffbdb9eb9d53",
"score": "0.6751958",
"text": "def destroy\n @taco.destroy\n render json: @taco, status: :ok\n end",
"title": ""
},
{
"docid": "2400656f002ce9ec8a4216619c160e53",
"score": "0.6749245",
"text": "def destroy\n @polo.destroy\n respond_to do |format|\n format.html { redirect_to polos_url, notice: 'Polo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "851bfc10f468b300b20eac084b49a20f",
"score": "0.674893",
"text": "def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n addlog(\"Apagou um aviso\")\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "09f6303f18ce5612216026bdd448d644",
"score": "0.67417204",
"text": "def api_delete(path)\n api_request(Net::HTTP::Delete.new(path))\n end",
"title": ""
},
{
"docid": "28bd18c4fd8609e62f97769a53448785",
"score": "0.67411494",
"text": "def destroy\n @puesto = Puesto.find(params[:id])\n @puesto.destroy\n\n respond_to do |format|\n format.html { redirect_to puestos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cef857471089b938c912e72f49ec42fc",
"score": "0.6736108",
"text": "def destroy\n @obrasproyecto = Obrasproyecto.find(params[:id])\n @obrasproyecto.destroy\n\n respond_to do |format|\n format.html { redirect_to(obrasproyectos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e38f074cfee25d7705ef59a685e892bb",
"score": "0.6734356",
"text": "def destroy\n @doenca_pessoa.destroy\n respond_to do |format|\n format.html { redirect_to doenca_pessoas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "74d2016c24c7eb760bcf451d5893cc0e",
"score": "0.6727443",
"text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to questoes_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "14ac045e510ad481a07e5c7a56b8f41f",
"score": "0.6725328",
"text": "def destroy\n @adres_osoba.destroy\n respond_to do |format|\n format.html { redirect_to adres_osoba_index_url, notice: 'Adres osoba was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1c916fcf0deb08a107e48e9a18c128b8",
"score": "0.67214036",
"text": "def destroy\n @posao = Posao.find(params[:id])\n @prijava = @posao.prijavas.where(posao_id: @posao.id) \n @prijava.each do |prijava|\n prijava.destroy\n end\n \n @posao.destroy\n respond_to do |format|\n format.html { redirect_to posaos_url, notice: \"Posao was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c53a7ddfb5f66bdab62b1fc4305a0473",
"score": "0.67208195",
"text": "def delete *args\n make_request :delete, *args\n end",
"title": ""
},
{
"docid": "815fee21d924284c1bc5b4516ae4262c",
"score": "0.67193055",
"text": "def destroy\n @aporte = Aporte.find(params[:id])\n @aporte.destroy\n\n respond_to do |format|\n format.html { redirect_to aportes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "815fee21d924284c1bc5b4516ae4262c",
"score": "0.67193055",
"text": "def destroy\n @aporte = Aporte.find(params[:id])\n @aporte.destroy\n\n respond_to do |format|\n format.html { redirect_to aportes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "325e3df61887ae18cacda37bbb1b90e3",
"score": "0.6718946",
"text": "def destroy\n @testudo = Testudo.find(params[:id])\n @testudo.destroy\n\n respond_to do |format|\n format.html { redirect_to testudos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c6900ce67a9d61dffc209965544d7d57",
"score": "0.67187554",
"text": "def destroy\n @pais.destroy\n\n respond_to do |format|\n format.html { redirect_to paises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "19efc6b90ad5a49de7d22c5608a300e6",
"score": "0.671787",
"text": "def destroy\n @viaaplic.destroy\n respond_to do |format|\n format.html { redirect_to viaaplics_url, notice: 'Viaaplic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0bc82117711e3930c36af2754cff1902",
"score": "0.67173326",
"text": "def destroy\n @boleto.destroy\n respond_to do |format|\n format.html { redirect_to boletos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dc98a0e799039c98bf7220d721ede00d",
"score": "0.67160255",
"text": "def destroy\n @plantao = Plantao.find(params[:id])\n @plantao.destroy\n\n respond_to do |format|\n format.html { redirect_to plantoes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "387800b54c297728ea1a84e16fce8936",
"score": "0.6709968",
"text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to questoes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "20cb2fee2e91d0b7fae286e3af101efb",
"score": "0.67082536",
"text": "def destroy\n @punto = Punto.find(params[:id])\n @punto.destroy\n\n respond_to do |format|\n format.html { redirect_to puntos_url(:proyecto_id=>@punto.proyecto_id) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2fa0a3656e86962ca1a10fa31aede189",
"score": "0.67040735",
"text": "def destroy\n @productos_json.destroy\n respond_to do |format|\n format.html { redirect_to productos_jsons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "83824714428182d740d3c2e5a6691f7d",
"score": "0.67015165",
"text": "def destroy\n @policial = Policial.find(params[:id])\n @policial.destroy\n\n respond_to do |format|\n format.html { redirect_to policials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b7aa5afb0632d570794ea7a026498672",
"score": "0.670015",
"text": "def destroy\n @clientetipo = Clientetipo.find(params[:id])\n @clientetipo.destroy\n\n respond_to do |format|\n format.html { redirect_to clientetipos_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6aacef0a41b0cab169d450bf06d67c78",
"score": "0.6698998",
"text": "def destroy\n @apuestum = Apuestum.find(params[:id])\n @apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c436097000bc257fe8eed8fcde601811",
"score": "0.6698343",
"text": "def destroy\n @aluno.destroy\n respond_to do |format|\n format.html { redirect_to alunos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6a19ba99f0d1f7225b5ed73fe068136d",
"score": "0.6697113",
"text": "def delete(path, params: {}, headers: {})\n request_json :delete, path, params, headers\n end",
"title": ""
},
{
"docid": "c66c181f0873315d34247e556e098e09",
"score": "0.6696777",
"text": "def destroy\n @taco = Taco.find(params[:id])\n @taco.destroy\n\n respond_to do |format|\n format.html { redirect_to tacos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7290eef63bb79038d174d61c8fc9d4ee",
"score": "0.6696669",
"text": "def destroy\n @jogo = Jogo.find(params[:id])\n @jogo.destroy\n\n respond_to do |format|\n format.html { redirect_to jogos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f245bcabc83c5d69181fc839e9c33b4f",
"score": "0.6695751",
"text": "def destroy\n @ocupacion = Ocupacion.find(params[:id])\n @ocupacion.destroy\n\n respond_to do |format|\n format.html { redirect_to ocupacions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6203ec7eb19328c6fe88c531313f6fe7",
"score": "0.6694742",
"text": "def destroy\n @po = Po.find(params[:id])\n @po.destroy\n respond_with @po\n end",
"title": ""
},
{
"docid": "268cd9c728145a01764e9573495fb030",
"score": "0.66945916",
"text": "def destroy\n @tipo_egreso = TipoEgreso.find(params[:id])\n @tipo_egreso.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_egresos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c8c244ce4b239ab12e6361d6bb632c74",
"score": "0.66942704",
"text": "def destroy\n @aposta.destroy\n respond_to do |format|\n format.html { redirect_to apostas_url, notice: 'Aposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ca65a24c086e11050e27c56cda9b8270",
"score": "0.6693984",
"text": "def destroy\n @gonogo.destroy\n respond_to do |format|\n format.html { redirect_to $current_task, notice: 'آزمون GoNoGo با موفقیت انجام شد.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4bccb7ee1ddb98667fc5e70cdd42e292",
"score": "0.6688535",
"text": "def destroy\n @objeto = Objeto.find(params[:id])\n @objeto.destroy\n\n respond_to do |format|\n format.html { redirect_to objetos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bc16d411b0eac2ad7580fe114fe95d84",
"score": "0.66884995",
"text": "def destroy\n @tipo = Tipo.find(params[:id])\n @tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "befbbfee69356e2e8d74e3feb5d8ec0a",
"score": "0.6687926",
"text": "def destroy\n @puntaje = Puntaje.find(params[:id])\n @puntaje.destroy\n\n respond_to do |format|\n format.html { redirect_to puntajes_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c3b4205acbad2f959f1f6ae2823aab82",
"score": "0.66865706",
"text": "def destroy\n @hola = Hola.find(params[:id])\n @hola.destroy\n\n respond_to do |format|\n format.html { redirect_to holas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f80ec72480d7aee53286545b6909b105",
"score": "0.66861045",
"text": "def destroy\n @pelada.destroy\n respond_to do |format|\n format.html { redirect_to peladas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.66833484",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.66833484",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.66833484",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "0387aa3c568d857184e97a214e580a14",
"score": "0.6683124",
"text": "def delete(path, params = {}, payload = {})\n JSON.parse Generic.delete(@base_url, @headers, path, params, payload)\n end",
"title": ""
},
{
"docid": "6e0f3ed4145a67e3b88c44c5d5d4f7f0",
"score": "0.6681877",
"text": "def destroy\n @aluno = Aluno.find(params[:id])\n @aluno.destroy\n\n respond_to do |format|\n format.html { redirect_to alunos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6e0f3ed4145a67e3b88c44c5d5d4f7f0",
"score": "0.6681877",
"text": "def destroy\n @aluno = Aluno.find(params[:id])\n @aluno.destroy\n\n respond_to do |format|\n format.html { redirect_to alunos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6e0f3ed4145a67e3b88c44c5d5d4f7f0",
"score": "0.6681877",
"text": "def destroy\n @aluno = Aluno.find(params[:id])\n @aluno.destroy\n\n respond_to do |format|\n format.html { redirect_to alunos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fdfa5f023a5b91de7150a7231284ceb6",
"score": "0.6680787",
"text": "def delete(name)\n validate_path_elements(name)\n\n client.request(\n method: :delete,\n path: name,\n expected: 204\n )\n end",
"title": ""
},
{
"docid": "4eb950146d32019c2408ced29ca1c341",
"score": "0.6679773",
"text": "def destroy\n @asunto = Asunto.find(params[:id])\n @asunto.destroy\n\n respond_to do |format|\n format.html { redirect_to asuntos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0d0d63b63f92b8e0e28cc88ea5d7a880",
"score": "0.6679123",
"text": "def destroy\n @cota = Cota.find(params[:id])\n @cota.destroy\n\n respond_to do |format|\n format.html { redirect_to cotas_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "28cb9976a0f8da06dd9be8a534fb5edc",
"score": "0.6678491",
"text": "def destroy\n @pessoa.destroy\n respond_to do |format|\n format.html { redirect_to pessoas_url, notice: 'Dados deletados com Sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "35fd1b55cd24fd637648b2cb2d35bde1",
"score": "0.6678337",
"text": "def destroy\n @pto.destroy\n respond_to do |format|\n format.html { redirect_to ptos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "33331b781082764da4969295fef87ef2",
"score": "0.6677325",
"text": "def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to(pessoas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "33331b781082764da4969295fef87ef2",
"score": "0.6677325",
"text": "def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to(pessoas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6fc44087a169097b98d6d8450b13d49b",
"score": "0.6672891",
"text": "def destroy\n @aula = Aula.find(params[:id])\n @aula.destroy\n\n respond_to do |format|\n format.html { redirect_to aulas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1abb26bf31f5093c3848b2927ff648be",
"score": "0.6672802",
"text": "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to aplicaciones_url }\n format.json { head :ok }\n end\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "3b5a87acaef0470cb174588fae6685bf",
"score": "0.0",
"text": "def set_search\n @search = Search.friendly.includes(:origin,:destination, :locations).find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
b1b8ded159747250873689b3bf1ee585
|
SURF_FEE = 0.15 YANDEX_PROCESSOR_FEE = 0.035 SURF_GROSS_FEE = SURF_FEEYANDEX_PROCESSOR_FEE
|
[
{
"docid": "646108abfb8f146460310f6ac7917def",
"score": "0.0",
"text": "def sample_product?\n self.kind == \"sample_product\"\n end",
"title": ""
}
] |
[
{
"docid": "d4aef2b56f6746b32786d0e1943c953f",
"score": "0.70245206",
"text": "def ship_fedex\n 0.0\n end",
"title": ""
},
{
"docid": "309e6fb58a08ca0a6cbee41fcb1d5d11",
"score": "0.6656666",
"text": "def trainer_fee_gst\n (trainer_fee_amount * Settings.fees.gst_percent).round\n end",
"title": ""
},
{
"docid": "15aaba2d837810b74da46ac607cecb50",
"score": "0.65483475",
"text": "def trainer_fee\n trainer_fee_amount + trainer_fee_gst\n end",
"title": ""
},
{
"docid": "f4279ed399f1677eac3f0797d2094ba2",
"score": "0.6519186",
"text": "def fee_percentage\n 0.10\n end",
"title": ""
},
{
"docid": "f1004f31edf70d42a4c617d1c75e535b",
"score": "0.6462954",
"text": "def commission_fee\n 0.1\n end",
"title": ""
},
{
"docid": "7b6f6a2a2f6f19fc5b89000094d1d9e3",
"score": "0.6441004",
"text": "def seller_fee\n amount = transaction_fee\n amount += marketplace_fee if seller_pays_marketplace_fee?\n amount += prepaid_shipping if prepaid_shipping?\n amount.to_d.round(2)\n end",
"title": ""
},
{
"docid": "1651c7e9f841caddf9ba623767b87167",
"score": "0.6424699",
"text": "def passive_factor\n (0.95 ** (self.cost / 125.0))\n end",
"title": ""
},
{
"docid": "c5862f6db9440078ba69e98c8c7272bc",
"score": "0.64142907",
"text": "def main_delivery_fees_cents\n DELIVERY_FEES.select { |weight| weight.member?(total_weight) }.values.dig(0, symbol_region) || 0\n end",
"title": ""
},
{
"docid": "328bd8ece70d6a733913f4fddd29f8e0",
"score": "0.6353605",
"text": "def handling_fee_percent\n 0\n end",
"title": ""
},
{
"docid": "51c173be4405c318cd2b3e64ee1cf8ee",
"score": "0.63417673",
"text": "def fees\n sell_price = self.sold_for || self.priced_for\n (sell_price * self.store.commission) + (sell_price * self.store.credit_card_fee)\n end",
"title": ""
},
{
"docid": "baf60d00d1bb8ab57f97bc04292c19ac",
"score": "0.6320234",
"text": "def fees\n raise Sibit::NotSupportedError, 'Cryptoapis doesn\\'t provide recommended fees'\n end",
"title": ""
},
{
"docid": "cfe2ea5d4d439bb3db1d4c61f69600e5",
"score": "0.6271837",
"text": "def setup_fee\n b = read_attribute(:setup_fee)\n if User.current and User.current.currency\n b.to_d * User.current.currency.exchange_rate.to_d\n else\n b\n end\n end",
"title": ""
},
{
"docid": "e26639a0e59d1b446c9eff0f0c5b9684",
"score": "0.6264851",
"text": "def get_fees\n 0\n end",
"title": ""
},
{
"docid": "76bbd876b24ab260fd55a271c484df8f",
"score": "0.62648183",
"text": "def send_mtf_values_cost; end",
"title": ""
},
{
"docid": "6630f425efa9a33c47d2c7590736ea24",
"score": "0.62373185",
"text": "def marketplace_fee\n ((subtotal * buyer_fee_variable) + buyer_fee_fixed).round(2)\n end",
"title": ""
},
{
"docid": "5b524c64cb6e58c885c5f9afeaf08a45",
"score": "0.6236364",
"text": "def fees\n raise Sibit::Error, 'Not implemented yet'\n end",
"title": ""
},
{
"docid": "de73238ec15e5f47e67e7c61324573db",
"score": "0.6217338",
"text": "def fees\n @fees ||= {\n \"insurance_fee\" => (commission * ASSURANCE_SHARE).round(0),\n \"assistance_fee\" => (ASSISTANCE_COST * rental.duration).round(0)\n }.tap { |fees| fees[\"drivy_fee\"] = commission - fees.values.inject(:+) }\n end",
"title": ""
},
{
"docid": "f84a5ac61f223d727488e369fe8c0e3a",
"score": "0.6207869",
"text": "def influencer_tweet_fee\n tweet_fee - (tweet_fee * borwin_fee)\n end",
"title": ""
},
{
"docid": "a859855eef3c92981796c8ba12f2a972",
"score": "0.6185536",
"text": "def client_fee\n client_fee_amount # + client_fee_gst\n end",
"title": ""
},
{
"docid": "66d28965e296baa730d3a5a96e6badcc",
"score": "0.6179644",
"text": "def shipping_amount_gross\n shipping_amount + shipping_tax_amount\n end",
"title": ""
},
{
"docid": "7f36c86d1a25e7dc033ef19a497b958a",
"score": "0.61756605",
"text": "def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end",
"title": ""
},
{
"docid": "5ae956af007928db29cec880e837924b",
"score": "0.6169888",
"text": "def client_fee_gst\n (client_fee_amount * Settings.fees.gst_percent).round\n end",
"title": ""
},
{
"docid": "aada78b8831c5ef64eb6060c78b0adef",
"score": "0.6165161",
"text": "def shipping_cost\n 10.0\n end",
"title": ""
},
{
"docid": "9b46b36cc2c9ced5fe3b5a37922c2bdd",
"score": "0.6125358",
"text": "def loveland_cut\n AppConfig.loveland_fee * amount\n end",
"title": ""
},
{
"docid": "389c9a10f3113b9350429e141a10244b",
"score": "0.61249727",
"text": "def calculate_fee\n self.fee = 0\n\n if unit_price_quantity > 0\n first_unit_price = (1.0 / unit_price_quantity) * price\n\n remainder_fee_factor = PayConf.deskspotting_fee.to_f\n if %w(month month_to_month).include? b_type\n m2mmu = self.space.month_to_month_minimum_unity\n next_payout_at = self.payment.try(:next_payout_at) || Date.today\n\n remainder_fee_factor = if next_payout_at <= from.advance(months: m2mmu)\n PayConf.deskspotting_fee2\n else\n PayConf.deskspotting_fee3\n end\n end\n\n remainder_price = price - first_unit_price\n\n self.fee = PayConf.deskspotting_fee * first_unit_price\n self.fee += remainder_price * remainder_fee_factor\n end\n end",
"title": ""
},
{
"docid": "4d109b9dfbaef50968c0aca28c020a82",
"score": "0.6059932",
"text": "def credit_card_payment_fee_payer\n credit_card_market_fee != 0 ? 'market' : 'seller'\n end",
"title": ""
},
{
"docid": "ea3dbf3c0aa3e61d4414828a62cf3ee0",
"score": "0.60550183",
"text": "def sinergic_defense; 0.0; end",
"title": ""
},
{
"docid": "8871a5d8cd3ad4820b07450833735fe2",
"score": "0.6029514",
"text": "def calculate_amount\n processing_fee = 0\n amount = price - used_credits\n\n if TYPE_FEE_EQUATIONS[type.to_sym].present?\n n = amount\n self.processing_fee = eval(TYPE_FEE_EQUATIONS[type.to_sym]) - amount\n end\n\n amount += self.processing_fee\n self.amount = amount\n end",
"title": ""
},
{
"docid": "bf3d6a2d3250d5764d865ca4c9585f17",
"score": "0.60246474",
"text": "def fee\n @fee || DEFAULT_FEE\n end",
"title": ""
},
{
"docid": "ffb3d828fa847c9af0c1c43e28cca565",
"score": "0.60083765",
"text": "def fee\n 1\n end",
"title": ""
},
{
"docid": "eabd8504b6adc018347fc633669bffac",
"score": "0.59994745",
"text": "def influencer_campaign_fee\n self.influencer_tweet_fee * 3\n end",
"title": ""
},
{
"docid": "22cd49c471e40a4d658128ff58669738",
"score": "0.5994836",
"text": "def set_fee_amount\n self.fee_amount_in_cents = (self.actual_amount_in_cents * self.fee_percentage.to_f).floor \n end",
"title": ""
},
{
"docid": "fed596e9b7b28b6225cf3a3e337181ce",
"score": "0.5994075",
"text": "def calculate_fee\n if stripe?\n # Stripe::Charge.retrieve(id: stripe_charge_id, expand: ['balance_transaction'])\n ((calculate_total * STRIPE_FEE_PERCENT) + STRIPE_FEE_FIXED).round(2)\n else\n # NetworkForGood::CreditCard.get_fee(Nonprofit.last)[:total_add_fee].to_d\n (amount * NFG_FEE_PERCENT).round(2)\n end\n end",
"title": ""
},
{
"docid": "3d1da314c54aa30f40d51cccba6ee0ce",
"score": "0.5990412",
"text": "def tax_rate\n 0.10\n end",
"title": ""
},
{
"docid": "24b6510b80422ede017352fa11345862",
"score": "0.5972501",
"text": "def taxrate\n 0.10\n end",
"title": ""
},
{
"docid": "4c29e1c51086a6c2b7800469934688b9",
"score": "0.5957532",
"text": "def platform_fee_cents\n fee = price_cents * 0.05\n fee = 20000 if fee > 20000\n fee.to_i\n end",
"title": ""
},
{
"docid": "37010a8039d6f4a2d8cd25ca4a622114",
"score": "0.5954406",
"text": "def fedex_rate(address, options={})\n Rails.logger.info \"Getting Fedex rate for #{address.inspect}\"\n @fedex = Shippinglogic::FedEx.new(FEDEX_AUTH_KEY, FEDEX_SECURITY_CODE, FEDEX_ACCOUNT_NUMBER, FEDEX_METER_NUMBER, :test => false)\n @rates = @fedex.rate(:service_type => options[:service_type], :shipper_company_name => \"Ellison\", :shipper_streets => '25862 Commercentre Drive', :shipper_city => 'Lake Forest', :shipper_state => 'CA', :shipper_postal_code => \"92630\", :shipper_country => \"US\",\n :recipient_name => \"#{address.first_name} #{address.last_name}\", :recipient_company_name => address.company, :recipient_streets => \"#{address.address1} #{address.address2}\", :recipient_city => address.city, :recipient_postal_code => address.zip_code, :recipient_state => address.with_state? ? address.state : nil, :recipient_country => country_2_code(address.country), :recipient_residential => options[:residential],\n :package_weight => options[:weight], :rate_request_types => options[:request_type] || \"ACCOUNT\", :packaging_type => options[:packaging_type] || \"FEDEX_BOX\", :package_length => options[:package_length] || 12, :package_width => options[:package_width] || 12, :package_height => options[:package_height] || 12, :ship_time => options[:ship_time] || skip_weekends(Time.now, 3.days), :package_count => options[:package_count] || 1)\n raise \"unable to calculate shipping rates. please check your shipping address or call customer service to place an order.\" if @rates.blank?\n @rates\n end",
"title": ""
},
{
"docid": "6d94479af513dcb6c747848aca7085e7",
"score": "0.5941442",
"text": "def fee_in_pounds\n fee_pence / 100\n end",
"title": ""
},
{
"docid": "0d4f8a2a2c5f91c9372a9bc92e105fee",
"score": "0.59200877",
"text": "def stripe_fee\n ((to_charge * stripe_percent) + (Settings.fees.stripe).round)\n end",
"title": ""
},
{
"docid": "528cd793b7e02fd885b1bdf1fc500460",
"score": "0.59094876",
"text": "def trainer_fee_amount\n s = \"\"\n self.is_a?(Purchase) ? s = Settings.fees.trainer.to_s : s = (amount * Settings.fees.trainer_percent).round.to_s \n # self.is_a?(Purchase) ? Settings.fees.trainer :\n (amount * Settings.fees.trainer_percent).round \n end",
"title": ""
},
{
"docid": "894e6ca02f243ea18173cedd2d1f02fb",
"score": "0.5892856",
"text": "def assistance_fee\n ROADSIDE_ASSISSTANCE_FEE_PER_DAY * duration\n end",
"title": ""
},
{
"docid": "376266688272b4b0dd38660ca8b69b6c",
"score": "0.58909625",
"text": "def calculate_drivy_fee(commission_price, insurance_fee, assistance_fee)\n\t\tdrivy_fee = commission_price - insurance_fee - assistance_fee\n\t\treturn drivy_fee\n\tend",
"title": ""
},
{
"docid": "376266688272b4b0dd38660ca8b69b6c",
"score": "0.58909625",
"text": "def calculate_drivy_fee(commission_price, insurance_fee, assistance_fee)\n\t\tdrivy_fee = commission_price - insurance_fee - assistance_fee\n\t\treturn drivy_fee\n\tend",
"title": ""
},
{
"docid": "381d02dbdc031219db1d36f2f257bf3b",
"score": "0.5884751",
"text": "def chargeable_rate\n if @supplier_type == \"E\"\n @total_price\n else\n @max_nightly_rate\n end\n end",
"title": ""
},
{
"docid": "754a7489e6c7c881ebb4331431d429d1",
"score": "0.58630854",
"text": "def buyer_fee\n (seller_pays_marketplace_fee? ? 0 : marketplace_fee).to_d\n end",
"title": ""
},
{
"docid": "c34574e14320c664c55ec0d26896df3c",
"score": "0.58612096",
"text": "def fed_tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 11038\n ((update_taxable-11038) * 0.15)\n elsif update_taxable >= 43953.01 && update_taxable <=87907\n ((update_taxable-43953)*0.22+(4937.25))\n elsif update_taxable >= 87907.01 && update_taxable <=136270\n ((update_taxable-87907)*0.26+(14607.13))\n elsif update_taxable >= 136270.01\n ((update_taxable-136270)*0.29+(27181.51))\n elsif update_taxable <= 11038 && update_taxable > 0\n 0\n else update_taxable < 0\n update_taxable\n end\n end",
"title": ""
},
{
"docid": "6bf77b352a88cdaea754cc6e1a048fcb",
"score": "0.58569545",
"text": "def spi;party_bonus(ex_attr_spi, :spi) + party_gift(:spi);end",
"title": ""
},
{
"docid": "965427cf7338e39c3a65b3af91c0c1d5",
"score": "0.58545166",
"text": "def total_storing_balance # storing fee\n end",
"title": ""
},
{
"docid": "f7bcebda932650a9dfa28ed1a8c799ad",
"score": "0.58483166",
"text": "def update_amount_payable\n base_amount = BigDecimal('0') \n tax_amount = BigDecimal('0')\n \n delivery.delivery_entries.each do |de|\n if de.sales_item.is_pending_pricing \n self.amount_payable = BigDecimal('0')\n self.base_amount_payable = BigDecimal('0')\n self.tax_amount_payable = BigDecimal('0')\n self.save \n return \n end\n \n \n base_amount += de.total_delivery_entry_price\n tax_amount += de.tax_amount\n end\n \n # with the tax \n self.base_amount_payable = base_amount\n self.tax_amount_payable = tax_amount \n self.amount_payable = self.base_amount_payable + self.tax_amount_payable\n self.save \n end",
"title": ""
},
{
"docid": "848e7ce0a459ebcfdb72b746883d11e5",
"score": "0.5830539",
"text": "def fees\n unpaid_fees\n end",
"title": ""
},
{
"docid": "ea9796c5cac54fe8dec022917a113994",
"score": "0.58291876",
"text": "def profit\n # base_profit - outrage + marketing.\n end",
"title": ""
},
{
"docid": "98bc636d8b762bfda6c913212fee49b3",
"score": "0.5824836",
"text": "def sinergic_defense\n 0.0\n end",
"title": ""
},
{
"docid": "b3743ea247014138fe380486eb05356d",
"score": "0.5808478",
"text": "def crypto_gross\n BigDecimal.new(params['payload']['price'], 8)\n end",
"title": ""
},
{
"docid": "608d297b31a9b71c843529e80264a53e",
"score": "0.5803348",
"text": "def get_fees(price, rental)\n commission = (price * COMMISSION).round(0)\n {\n \"insurance_fee\" => (commission * ASSURANCE_SHARE).round(0),\n \"assistance_fee\" => (ASSISTANCE_COST * rental.duration).round(0)\n }.tap do |fees|\n fees[\"drivy_fee\"] = commission - (fees[\"insurance_fee\"] + fees[\"assistance_fee\"])\n end\n end",
"title": ""
},
{
"docid": "8d9291bfe97e13c0fddcf7f7191159f6",
"score": "0.58028495",
"text": "def spoil_bonus\n 1.0\n end",
"title": ""
},
{
"docid": "487ada2d60b7df3576037fbe3e97accd",
"score": "0.5800168",
"text": "def minimum_downpayment\n return 0.1\n end",
"title": ""
},
{
"docid": "220495267406becfa53896e25b94f758",
"score": "0.5793362",
"text": "def calculate_entry_fee(price_per_person)\n @max_capacity * price_per_person\n end",
"title": ""
},
{
"docid": "776340206c138fec9782ca5e7fe27d65",
"score": "0.57921785",
"text": "def duty_free(price, discount, holiday_cost)\r\n (holiday_cost/(price*discount/100.0)).to_i\r\nend",
"title": ""
},
{
"docid": "fac4babb2326467386a0fde3425db324",
"score": "0.579178",
"text": "def employee_cost_factor\n 1 + employer_benefits_premium\n end",
"title": ""
},
{
"docid": "cdca6f989bb94fbead20c9e3211a4313",
"score": "0.578522",
"text": "def our_price_target\n Format.currency_dec(security.our_price_target)\n end",
"title": ""
},
{
"docid": "5df6614a53ced7b71ddc8438235ffce4",
"score": "0.5785108",
"text": "def discount_amount\n agreed_price * discount_factor\n end",
"title": ""
},
{
"docid": "e6de7aa7e3c99a3d4223353ddee13180",
"score": "0.5769467",
"text": "def calculate_fees(data)\n\t# compute the enrolment fee\n\tenrollment_fee = data[0] * (data[1] == 1 ? $ENROLLMENT_FEE_NONCA_RESIDENTS\n\t : $ENROLLMENT_FEE_CA_RESIDENTS)\n \n # compute the student service fee\n\tstudent_service_fee = (data[2] % 2 == 1 ? $STUDENT_SERVICES_FEE_WINTER_SUMMER\n : $STUDENT_SERVICES_FEE_FALL_SPRING) +\n\t\t (data[3] == \"y\" ? $STUDENT_SERVICES_FEE_STICKER : 0) +\n\t\t (data[4] == \"y\" ? $STUDENT_SERVICES_ID_CARD : 0)\n\t\t\t\t\t\t\n # compute the cost of the parking decal\n\tparking_decal_fee = (data[2] % 2 == 1 ? $PARKING_DECAL_WINTER_SUMMER\n : $PARKING_DECAL_FALL_SPRING)\n\tparking_decal_fee = (data[5] == \"y\" ? parking_decal_fee : 0)\n\t\n\ttotal_fees = enrollment_fee + student_service_fee + parking_decal_fee\nend",
"title": ""
},
{
"docid": "adb8505248572c2252048f42ed41284d",
"score": "0.57691675",
"text": "def srv_disc_amt\n srv_list_price * discount_pref_srv\n end",
"title": ""
},
{
"docid": "aa2d50b659fdc49817fe9eabdd75f5b9",
"score": "0.57630587",
"text": "def _fee_rate(pair)\n\t\t\traise \"Should not come here any more #{market_name()}\"\n\t\t\tpair = get_active_pair(pair)\n\t\t\tfee_rate(pair)\n\t\tend",
"title": ""
},
{
"docid": "6ba3d3353c429b02fbd72e78cdbe16d9",
"score": "0.5760508",
"text": "def process_discount_fees #should_validate = false\n precision_count = FedenaPrecision.get_precision_count\n precision_count = 2 if precision_count.to_i < 2\n sql_ft_tax_amount = \"SELECT SUM(tax_amount) \n FROM finance_transactions ft \n WHERE ft.finance_id=ff.id AND ft.finance_type='FinanceFee'\"\n # sql_ft_fine_amount\n sql_ft_amount = \"SELECT SUM(IF(ft.fine_included,ft.amount - ft.fine_amount,ft.amount)) \n FROM finance_transactions ft \n WHERE ft.finance_id=ff.id AND ft.finance_type='FinanceFee'\"\n sql_ff_discount = \"SELECT SUM(ffd.discount_amount) \n FROM finance_fee_discounts ffd \n WHERE ffd.finance_fee_id=ff.id\"\n \n if self.fee_type == \"FinanceFee\"\n if self.particulars == 'Overall'\n sql_select = self.is_amount ? \n \"(ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) - #{self.discount}\" : \n \"((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - \n (((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL(ff.tax_amount, 0))\n + IFNULL((#{sql_ff_discount}),0)) * #{self.discount.to_f} * 0.01))\"\n sql_from = \"FROM finance_fees ff\"\n sql_con = \"WHERE ff.id = #{self.collections.to_i}\"\n # check discount applied should not be more than fee balance\n sql = \"SELECT #{sql_select} AS discount_check #{sql_from} #{sql_con}\"\n # puts sql\n discount_check = FinanceFee.find_by_sql(sql).try(:last).try(:discount_check).to_f\n if self.waiver_check == \"1\"\n discount_check == 0 \n else\n discount_check > 0\n end\n elsif self.particulars.present?\n # self.particulars.to_i \n # fee = FinanceFee.find(self.collections, :include => :finance_fee_collection) \n sql_join = \"INNER JOIN finance_fee_particulars ffp ON ffp.id = #{self.particulars.to_i}\n LEFT JOIN finance_fee_discounts ffd \n ON ffd.finance_fee_id = ff.id AND ffd.finance_fee_particular_id = ffp.id\n LEFT JOIN particular_payments pp\n ON pp.finance_fee_id = ff.id AND pp.finance_fee_particular_id = ffp.id AND pp.is_active = true\"\n sql_ff_discount = \"SELECT SUM(ffd.discount_amount) \n FROM finance_fee_discounts ffd\n WHERE ffd.finance_fee_id=ff.id AND ffd.finance_fee_particular_id = #{self.particulars.to_i}\"\n sql_p_tax = \"SELECT tax_amount FROM tax_collections tc\n WHERE tc.taxable_entity_type = 'FinanceFeeParticular' AND\n tc.taxable_entity_id = #{self.particulars.to_i} AND\n tc.taxable_fee_type = 'FinanceFee' AND\n tc.taxable_fee_id = #{self.collections.to_i}\"\n sql_ff_discount = \"SELECT SUM(discount_amount) FROM finance_fee_discounts ffd \n WHERE ffd.finance_fee_id = ff.id AND ffd.finance_fee_particular_id = ffp.id \"\n sql_pp_amount = \"SELECT SUM(amount) FROM particular_payments pp\n WHERE pp.finance_fee_id = ff.id AND pp.finance_fee_particular_id = ffp.id AND pp.is_active = true\"\n sql_select = self.is_amount ? \n \"(ffp.amount - IFNULL((#{sql_ff_discount}),0)\n - IFNULL((#{sql_pp_amount}), 0)) - #{self.discount}\" : \n \"((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL((#{sql_p_tax}), 0)) \n - \n (((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL((#{sql_p_tax}), 0))\n + IFNULL((#{sql_ff_discount}),0)) * #{self.discount.to_f} * 0.01))\"\n sql_from = \"FROM finance_fees ff\"\n sql_con = \"WHERE ff.id = #{self.collections.to_i}\"\n # check discount applied should not be more than fee balance\n sql = \"SELECT #{sql_select} AS discount_check #{sql_from} #{sql_join} #{sql_con}\"\n # puts sql\n discount_check = FinanceFee.find_by_sql(sql).try(:last).try(:discount_check).to_f\n if self.waiver_check == \"1\"\n discount_check == 0 \n else\n discount_check > 0\n end\n end\n elsif self.collections == 'Overall'\n finance_fees = FinanceFee.all(:select => \"finance_fees.*\", \n :include => [:finance_fee_collection, :finance_transactions],\n :conditions => [\"finance_fees.id in (?) AND finance_fees.is_paid = false\", self.finance_fee_ids]).reject do |ff|\n ff.finance_fee_collection.discount_mode != \"OLD_DISCOUNT\" and \n ff.finance_transactions.select {|ft| ft.trans_type == 'particular_wise'}.present?\n end\n @particular_total = finance_fees.map {|x| x.finance_fee_particulars.\n map {|x| x.amount }}.flatten.sum\n \n @particular_balance = finance_fees.map{|x| x.tax_enabled ? (x.balance.to_f - x.tax_amount.to_f ) : x.balance }.sum.to_f\n \n \n \n transport_fees = []\n transport_fees = TransportFee.all(:conditions => {:id => self.transport_fee_ids}, \n :include => :transport_fee_collection) if FedenaPlugin.can_access_plugin?('fedena_transport')\n \n @particular_total += transport_fees.map {|x| x.bus_fare }.sum \n @particular_balance += transport_fees.map{|x| x.tax_enabled ? (x.balance.to_f - x.tax_amount.to_f ) : x.balance }.sum.to_f \n \n \n \n sql_select = self.is_amount ? self.waiver_check == \"1\"? \n \"ROUND(ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0) - IFNULL(ff.tax_amount, 0)) \n * (1 - ((#{self.discount}) / (#{@particular_balance.to_f}))), #{precision_count}), #{precision_count})\" : \n \"ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - ROUND(((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL(ff.tax_amount, 0))\n + IFNULL((#{sql_ff_discount}),0))\n * (#{self.discount}/#{@particular_balance.to_f}) \n , #{precision_count}), #{precision_count})\" :\n # * ( 1 - (#{self.discount}/#{@particular_total.to_f})), #{precision_count})\" : \n #- (#{self.discount}/#{@particular_total}),#{precision_count})\" : \n \"ROUND(ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - \n (((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL(ff.tax_amount, 0))\n + IFNULL((#{sql_ff_discount}),0)) * #{self.discount.to_f} * 0.01),#{precision_count}),\n #{precision_count})\"\n sql_from = \"FROM finance_fees ff\"\n sql_con = self.finance_fee_ids ? \"WHERE ff.id IN (#{self.finance_fee_ids.join(',')})\" : \"\"\n \n sql = self.finance_fee_ids.present? ? \"SELECT #{sql_select} AS discount_check #{sql_from} #{sql_con}\" : \"\"\n discount_checks = sql.present? ? FinanceFee.find_by_sql(sql) : []\n \n # puts discount_checks.map {|x| x.discount_check.to_f }.inspect\n ## add <= if want to avoid exact amount as discount, else make < ( but add same condition for all cases)\n \n if self.waiver_check == \"1\"\n discount_checks_present = discount_checks.present? ? discount_checks.select{|x| x.discount_check.to_f < 0} : [] \n else\n discount_checks_present = discount_checks.present? ? discount_checks.select{|x| x.discount_check.to_f <= 0} : []\n end\n \n if FedenaPlugin.can_access_plugin?('fedena_transport') and self.transport_fee_ids.present?\n sql_ft_amount = \"SELECT SUM(IF(ft.fine_included,ft.amount - ft.fine_amount,ft.amount)) \n FROM finance_transactions ft \n WHERE ft.finance_id=ff.id AND ft.finance_type='TransportFee'\"\n sql_ft_tax_amount = \"SELECT SUM(tax_amount) \n FROM finance_transactions ft \n WHERE ft.finance_id=ff.id AND ft.finance_type='TransportFee'\"\n sql_ff_discount = \"SELECT SUM(IF(tfd.is_amount,tfd.discount,\n ROUND(ff.bus_fare * tfd.discount * 0.01,#{precision_count}))) \n FROM transport_fee_discounts tfd\n WHERE tfd.transport_fee_id=ff.id\" \n sql_from = \"FROM transport_fees ff\"\n sql_con = \"WHERE ff.id IN (#{self.transport_fee_ids.join(',')})\"\n \n sql_select = self.is_amount ? self.waiver_check == \"1\"? \n \n \"ROUND(ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0) - IFNULL(ff.tax_amount, 0)) \n * (1 - ((#{self.discount}) / (#{@particular_balance.to_f}))), #{precision_count}), #{precision_count})\" :\n \n \"ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - ROUND(((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL(ff.tax_amount, 0))\n + IFNULL((#{sql_ff_discount}),0))\n * (#{self.discount}/#{@particular_balance.to_f}) \n , #{precision_count}))\" :\n # * ( 1 - (#{self.discount}/#{@particular_total.to_f})), #{precision_count})\" : \n #- #{self.discount},#{precision_count})\" : \n \"ROUND(ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - \n (((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL(ff.tax_amount, 0))\n + IFNULL((#{sql_ff_discount}),0)) * #{self.discount.to_f} * 0.01),#{precision_count}),\n #{precision_count})\"\n \n sql = \"SELECT #{sql_select} AS discount_check #{sql_from} #{sql_con}\" \n \n discount_checks = TransportFee.find_by_sql(sql)\n \n # puts discount_checks.map {|x| x.discount_check.to_f }.inspect\n if self.waiver_check == \"1\"\n discount_checks_present += discount_checks.select{|x| x.discount_check.to_f < 0}\n else\n discount_checks_present += discount_checks.select{|x| x.discount_check.to_f <= 0}\n end\n \n end\n # discount_checks.present?\n !(discount_checks_present.present?)\n \n elsif self.fee_type == \"TransportFee\" # write case for transport fee alone\n sql_ft_amount = \"SELECT SUM(IF(ft.fine_included,ft.amount - ft.fine_amount,ft.amount)) \n FROM finance_transactions ft \n WHERE ft.finance_id=ff.id AND ft.finance_type='TransportFee'\"\n sql_ft_tax_amount = \"SELECT SUM(tax_amount) \n FROM finance_transactions ft \n WHERE ft.finance_id=ff.id AND ft.finance_type='TransportFee'\"\n sql_ff_discount = \"SELECT SUM(IF(tfd.is_amount,tfd.discount,\n ROUND(ff.bus_fare * tfd.discount * 0.01,#{precision_count}))) \n FROM transport_fee_discounts tfd\n WHERE tfd.transport_fee_id=ff.id\" \n sql_from = \"FROM transport_fees ff\"\n sql_con = \"WHERE ff.id = #{self.collections.to_i}\"\n \n sql_select = self.is_amount ? \n \"ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - #{self.discount}, #{precision_count})\" :\n \"ROUND(ROUND((ff.balance + IF(ff.tax_enabled,IFNULL((#{sql_ft_tax_amount}),0),0)\n - IFNULL(ff.tax_amount, 0)) \n - \n (((ff.balance + IFNULL((#{sql_ft_amount}),0) \n - IFNULL(ff.tax_amount, 0))\n + IFNULL((#{sql_ff_discount}),0)) * #{self.discount.to_f} * 0.01),#{precision_count}),\n #{precision_count})\"\n \n sql = \"SELECT #{sql_select} AS discount_check #{sql_from} #{sql_con}\" \n \n discount_check = TransportFee.find_by_sql(sql).try(:last).try(:discount_check).to_f\n if self.waiver_check == \"1\"\n discount_check == 0 \n else\n discount_check > 0\n end\n end\n end",
"title": ""
},
{
"docid": "5e94c53a6554885958fa21c03e4d4b1f",
"score": "0.57522386",
"text": "def calculate_seller_shipping_fee\n cost = 0.00\n\n items.each do |i|\n sr = ProductShippingRate.find_by!(product_id: i.order_item.product_id, destination_country_code: recipient_country, ship_method: :standard)\n cost += sr.get_cost(i.quantity)\n end\n\n cost\n end",
"title": ""
},
{
"docid": "36402c08da14943c3067d413eefaa54f",
"score": "0.5752116",
"text": "def license_fee_percentage\n license_fee_calculator.percentage_rate(annual_booking_number)\n end",
"title": ""
},
{
"docid": "79f2415cc24fbd3256fbc9199439e59f",
"score": "0.5751933",
"text": "def claim_calculations(expenditure, loss_or_profit, rate_of_enhancement, rate_of_surrender)\n\t\n\tclaim_amount = (expenditure * rate_of_enhancement) + expenditure\n\tunrelieved_loss = loss_or_profit - claim_amount\n\t\n\tcredit = 0\n\t\t\n\tif unrelieved_loss < 0\n\t\tif claim_amount < unrelieved_loss\n\t\t\tcredit = claim_amount * rate_of_surrender\n\t\telse claim_amount > unrelieved_loss\n\t\t\tcredit = unrelieved_loss * rate_of_surrender\n\t\tend\n\tend\n\t\n\tputs \"The tax credit amount is £#{credit}\"\n\t\nend",
"title": ""
},
{
"docid": "54a2a5a1a3eab8d85d805b7d7e12872c",
"score": "0.574558",
"text": "def state_fulfillment_fee\n adjustments.eligible.where(:label => 'Additional State Fulfillment Fee').first.amount rescue 0.0\n end",
"title": ""
},
{
"docid": "14719b79895963f43aca0bc134da0899",
"score": "0.57403105",
"text": "def fee\n end",
"title": ""
},
{
"docid": "f93b2c60fdc67d6dc7e286a016fbc672",
"score": "0.5737176",
"text": "def vampire_rate; 0; end",
"title": ""
},
{
"docid": "e9d710b7fdb7cd3330a21d9906890dc8",
"score": "0.5735739",
"text": "def sin_evade_bonus; 0; end",
"title": ""
},
{
"docid": "c5e1b8952f30dbb16de00b05c32c6ac1",
"score": "0.5734179",
"text": "def sin_attack_bonus; 1.0; end",
"title": ""
},
{
"docid": "3ae540d3b490513600de68ede11e982c",
"score": "0.5731673",
"text": "def local_orbit_seller_and_market_fee_fraction\n (local_orbit_seller_fee + local_orbit_market_fee) / 100\n end",
"title": ""
},
{
"docid": "dbd9ada7f4f42873748d1c9d855286db",
"score": "0.57286",
"text": "def fee\n params['amount_fee']\n end",
"title": ""
},
{
"docid": "eb0c711b9e1cde7841c6fefa1ebf5938",
"score": "0.5724478",
"text": "def cost\n super + affiliate_fee\n end",
"title": ""
},
{
"docid": "c1a78e7386cf29fbf81b0adc33949347",
"score": "0.57232904",
"text": "def envisage_price\n 0\n end",
"title": ""
},
{
"docid": "1bcbc080a861a934ae49c13f7921b8e2",
"score": "0.571219",
"text": "def calculate_shipping(limberjacks, others)\n return 0 if limberjacks + others == 0\n if limberjacks > 0\n fee = 4\n else\n fee = 2\n end\n\n fee += (limberjacks * 2)\n fee += others\n return fee * 100 # shipping fee in pennies\n end",
"title": ""
},
{
"docid": "f6c1e4dd348c9c0febaea22796a011f1",
"score": "0.5705996",
"text": "def sin_weak_bonus; 1.0; end",
"title": ""
},
{
"docid": "eb353eaafd8bd65faf0d7940718576ce",
"score": "0.57050157",
"text": "def application_fee\n (price_cents.to_f * 0.10).to_i\n end",
"title": ""
},
{
"docid": "9666d7d002203cce97861dfc7a965b28",
"score": "0.57013637",
"text": "def required_mortgage\n selling_price - down_payment\n end",
"title": ""
},
{
"docid": "854c333d9cc3b7d56656075085964562",
"score": "0.5693649",
"text": "def federal_tax_rate\n FEDERAL_TAX_RATE\n end",
"title": ""
},
{
"docid": "9cdf5a5a7da8c32d8404df7d271c800e",
"score": "0.5689691",
"text": "def fee\n @fee ||= (payments.length > 0 ? payments.inject(0){|sum, p| sum + p.fee_cents} / 100.0 : 0)\n end",
"title": ""
},
{
"docid": "8450994a79b786086e64cfdbb79a8ccc",
"score": "0.5681072",
"text": "def calculate_fee\n (FEE * day_range * volume_in_m).to_f\n end",
"title": ""
},
{
"docid": "1e57946fe8c84b06d79e272199862f0f",
"score": "0.56802666",
"text": "def calculate_cost(shipment)\n if can_be_free && shipment.order.line_items.total > Spree::Config.get(\"#{shipment.order.store.code}_free_shipping_at\").to_f\n 0.0 #aka FREE!\n else\n core_calculate_cost(shipment) + handling_fee.to_f\n end\n\n end",
"title": ""
},
{
"docid": "33ec86d02dabd9f3f6cbc817214d229d",
"score": "0.5679045",
"text": "def find_fedex_retail_price(fedex_zone, shipping_mode, shipping_point)\n price = FEDEX_SHIPPING_RATES.find {|rate| rate['shipping_zone'] == fedex_zone && rate['code'] == shipping_mode && rate['min_points'] <= shipping_point && rate['max_points'] >= shipping_point }\n price.nil? ? 0.0 : price['retail_price']\n end",
"title": ""
},
{
"docid": "c4a68c63c4a4033452edc5f6d6b6b174",
"score": "0.5671504",
"text": "def extra_costs\n shipping_cost + taxes_cost\n end",
"title": ""
},
{
"docid": "900be1de01bd0a327f7110413cf7a971",
"score": "0.5670907",
"text": "def set_prices\n if self.influencer\n self.tweet_fee = influencer.tweet_fee\n self.cpc_fee = influencer.cpc_fee\n self.influencer_tweet_fee = influencer.influencer_tweet_fee\n self.influencer_cpc_fee = influencer.influencer_cpc_fee\n end\n end",
"title": ""
},
{
"docid": "77ab3ef8373108d800186cbecb375a15",
"score": "0.56686556",
"text": "def taxable_amount\n taxable_amount = 0 \n taxable_amount = taxable_amount + self.amount if self.amount\n taxable_amount = taxable_amount + self.smog_fee if self.smog_fee\n taxable_amount = taxable_amount + self.doc_fee if self.doc_fee\n taxable_amount = taxable_amount + self.reg_fee if self.reg_fee\n taxable_amount = taxable_amount + self.other_fee if self.other_fee\n taxable_amount = taxable_amount + self.gap_price if self.gap_price\n taxable_amount = taxable_amount + self.warranty_price if self.warranty_price\n taxable_amount = taxable_amount - self.trade_in_value if self.trade_in_value\n taxable_amount = taxable_amount + self.less_payoff if self.less_payoff\n return taxable_amount\n return taxable_amount\n end",
"title": ""
},
{
"docid": "03dd6a7c6b81c9ad29ad7792230b8ed3",
"score": "0.5667921",
"text": "def sw_disc_amt\n sw_list_price * discount_pref_sw\n end",
"title": ""
},
{
"docid": "fd052c9fb2e15538ca30e72f9d3c6982",
"score": "0.5661302",
"text": "def fee\n # calculate the monthly fee of the guest\n case(self.type)\n when('monthly')\n start_time = Time.parse(@guest['first_seen'])\n\n end_time = Time.now\n\n unless(@guest['lease_signed'].nil?)\n end_time = Time.parse(@guest['lease_signed'])\n end\n\n month_diff = TimeDifference.between(start_time, end_time).in_months\n\n month_diff_round_up = month_diff.ceil\n\n return month_diff_round_up * market_info['price']\n # if per_lease, give price is signed else $0\n when('per_lease')\n return @guest['lease_signed'].nil? ? 0 : market_info['price']\n when('per_lease_or_percentage')\n lease_price = market_info['price']\n rent_percentage = market_info['price_percentage'] * @guest['resident_rent']\n\n highest_price = lease_price > rent_percentage ? lease_price : rent_percentage\n\n return highest_price\n end\n end",
"title": ""
},
{
"docid": "53b65691bc0f0ee0b4c339d9b2d2f489",
"score": "0.5660631",
"text": "def fixed_shipping\n Money.new(0)\n end",
"title": ""
},
{
"docid": "6bc1c0ab4e2c6f54147947addf441498",
"score": "0.5658864",
"text": "def funding\n 0\n end",
"title": ""
},
{
"docid": "44a8c13ee5c2b6cc5c08468ee7d5d5f9",
"score": "0.5657079",
"text": "def cost_per_unit;end",
"title": ""
},
{
"docid": "40531f29b58d1d43804eba3c05499158",
"score": "0.5655185",
"text": "def tax_pct\n 20\n end",
"title": ""
},
{
"docid": "40531f29b58d1d43804eba3c05499158",
"score": "0.5655185",
"text": "def tax_pct\n 20\n end",
"title": ""
},
{
"docid": "5fbda5f1c686fdbdbc3e3aacaab67b54",
"score": "0.56518614",
"text": "def cost; end",
"title": ""
},
{
"docid": "5fbda5f1c686fdbdbc3e3aacaab67b54",
"score": "0.56518614",
"text": "def cost; end",
"title": ""
},
{
"docid": "d279cd7364cd439602e1ec261ead7ca4",
"score": "0.56511045",
"text": "def capital_gain_tax\n end",
"title": ""
},
{
"docid": "83399f871e42676426c14152fa36282c",
"score": "0.56381774",
"text": "def valuation_fee_params\n #params[:valuation_fee]\n params.require(:valuation_fee).permit(:valuer, :fees_amount, :fees_percentage, :remarks)\n end",
"title": ""
},
{
"docid": "e964b7de1c4d552862a8b8e970a13100",
"score": "0.563804",
"text": "def net_price\n price_actual - total_tax_ticket\n end",
"title": ""
}
] |
3581e696ca6b462175769f7e2820c3df
|
Get whether the task list is completed or not. ==== Returns true, if the task list is completed else returns false.
|
[
{
"docid": "ae7d1b060d198cf4fdc9cd92da877b38",
"score": "0.7386688",
"text": "def isCompleted\r\n\t\t\t\t\treturn @completed\r\n\t\t\t\tend",
"title": ""
}
] |
[
{
"docid": "65516927542e2b0f7474464c09c7799b",
"score": "0.80854744",
"text": "def to_do_list_completed?\n return @to_do_list.all? {|item| item.completion_status == true}\n end",
"title": ""
},
{
"docid": "017894f3280580d2f2fdfe3cabaa3c81",
"score": "0.8046172",
"text": "def completed?\n @__status == TaskStatus::COMPLETED\n end",
"title": ""
},
{
"docid": "c04b7d3d91b421e6d2f19fd1d68671cb",
"score": "0.7631987",
"text": "def tasks_are_finished?\n return true if @tasks_are_finished\n finished = all? do |task|\n task.finished?\n end\n if finished\n debug 'All tasks are finished'\n @tasks_are_finished = true\n end\n finished\n end",
"title": ""
},
{
"docid": "4b3d5ec8b4465d052780f00ace7f2ad6",
"score": "0.7621467",
"text": "def completed?\n @completed\n end",
"title": ""
},
{
"docid": "c0b76ae09589a62ee71acaa202e66b05",
"score": "0.7592313",
"text": "def tasks_remain?\n\t\ttasks.any?{ |t| t.completed.nil? }\n\tend",
"title": ""
},
{
"docid": "5d6cdd2f9239f47e728d0b99ec93ea81",
"score": "0.7579868",
"text": "def completed? # Is task completed? method\n completed_status # True or false\n end",
"title": ""
},
{
"docid": "0de06166e6fa2cf29db67690b58786bc",
"score": "0.7578974",
"text": "def completed?\n @completed\n end",
"title": ""
},
{
"docid": "71f3cfe2477d54fc72bf956229071abb",
"score": "0.7566685",
"text": "def completed?\n return @complete\n end",
"title": ""
},
{
"docid": "71f3cfe2477d54fc72bf956229071abb",
"score": "0.7566685",
"text": "def completed?\n return @complete\n end",
"title": ""
},
{
"docid": "9eb6c5febee72ca4216bc412a4c069d0",
"score": "0.7549755",
"text": "def completed?\n return @completed\n end",
"title": ""
},
{
"docid": "9718e05d140ad9497350c6e0ba7588cc",
"score": "0.7547949",
"text": "def list_complete?(list)\n list[:todos].all? { |todo| todo[:completed] } && list[:todos].length > 0\n end",
"title": ""
},
{
"docid": "671ed8f283b15cd49789e6ee79bdb96b",
"score": "0.75294036",
"text": "def finished?\n FINISHED_STATUSES.include? status or tasks_are_finished?\n end",
"title": ""
},
{
"docid": "7217e800fae7e642116666d58b689798",
"score": "0.7518426",
"text": "def completed?\n status.completed?\n end",
"title": ""
},
{
"docid": "427b72fff6b5b01579ed8f7d837d060b",
"score": "0.7457625",
"text": "def completed?\n !!completed\n end",
"title": ""
},
{
"docid": "886ef4bd81c9f87de36766d045db77d4",
"score": "0.7433151",
"text": "def finished?\n @__status == TaskStatus::COMPLETED ||\n @__status == TaskStatus::FAULTED ||\n @__status == TaskStatus::CANCELED\n end",
"title": ""
},
{
"docid": "e0cc61f7cf751177cd5a86348b57d4d7",
"score": "0.73590493",
"text": "def completed?\n @completed\n end",
"title": ""
},
{
"docid": "e0cc61f7cf751177cd5a86348b57d4d7",
"score": "0.73590493",
"text": "def completed?\n @completed\n end",
"title": ""
},
{
"docid": "36e831845e4775c2a486a7e3ccd0d85d",
"score": "0.7352464",
"text": "def completed?\n self.status == STATUS_COMPLETED\n end",
"title": ""
},
{
"docid": "0ed823b180d8a475471acc6ce52bb398",
"score": "0.7346126",
"text": "def is_ready\n if self.tasks.empty? and not self.is_done # no tasks assigned for this\n false\n elsif (self.tasks.find_by is_done: false).nil? # can't find any false => all tasks are done\n self.update_attribute(:is_done, true)\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "71f49b7492854abbe51d86a005bed3b3",
"score": "0.7309157",
"text": "def tasks_complete(list)\n completed = list[:todos].select do |item|\n item[:completed] == true\n end.size\n end",
"title": ""
},
{
"docid": "1c6b8b4b4f37bed2de92c1ddfdce99e0",
"score": "0.73058033",
"text": "def completed?\n\t\t@completed\n\tend",
"title": ""
},
{
"docid": "0fda9df0cb42113ed397bd2b7c5be63a",
"score": "0.72961736",
"text": "def completed?\n job_completed?\n end",
"title": ""
},
{
"docid": "6da60de4d3d01e727cf5672e5dbcc8bf",
"score": "0.7292156",
"text": "def all_complete\n self.tasks.count == self.tasks.done.count\n end",
"title": ""
},
{
"docid": "2a9c190e02aff5d453d2a066cd201cad",
"score": "0.72817135",
"text": "def completed?\n completed\n end",
"title": ""
},
{
"docid": "f0426c834e65ba3bf4787e90852ce380",
"score": "0.7253192",
"text": "def completed?\n COMPLETED_STATES.include?(status)\n end",
"title": ""
},
{
"docid": "6bb2ffdaabf7e353482d2d38eaa6a994",
"score": "0.7240689",
"text": "def get_finished\n @task_list.select { |task| task.status == \"finished\" }\n end",
"title": ""
},
{
"docid": "9daa2973fbdfda93ac5c2d6d800bf413",
"score": "0.7188594",
"text": "def completed?\n completed == '1'\n end",
"title": ""
},
{
"docid": "61f9785a973a6c30078b14fd4d97c576",
"score": "0.71813285",
"text": "def completed?\n\t\t\treturn request_status == REQUEST_STATUS['completed']\n\t\tend",
"title": ""
},
{
"docid": "2f2fc823e6e9680efb12c402d66f4a35",
"score": "0.7168666",
"text": "def completed?\n \t\tlatest_transaction.completed? unless transactions.empty?\n \tend",
"title": ""
},
{
"docid": "26071ca91b7312c452e6ee60c4502ccb",
"score": "0.7147476",
"text": "def complete?\n status == \"Completed\"\n end",
"title": ""
},
{
"docid": "0d3c8b4e49512079a46dd8bb9e9dbc0e",
"score": "0.7142216",
"text": "def not_completed?\n tasks.any? { |task| task.done != 100 }\n end",
"title": ""
},
{
"docid": "b8d05a7828b9aeb32601c05cbede3d6c",
"score": "0.71132195",
"text": "def completed_task_id?(task_id)\n completed_task_ids.include? task_id\n end",
"title": ""
},
{
"docid": "c317807af3d56b2014c1f03b0b770dd4",
"score": "0.7106755",
"text": "def completed?(item)\n state_group(item) == :done\n end",
"title": ""
},
{
"docid": "3a77c574e6816933f76842b67c342752",
"score": "0.70943046",
"text": "def completed_tasks\n self.tasks.where('is_completed =?', is_completed = true)\n end",
"title": ""
},
{
"docid": "6668cb1522ba395f5f511a301107127c",
"score": "0.7092476",
"text": "def completed?\n attributes['percentDone'] >= 1\n end",
"title": ""
},
{
"docid": "a45714d60e9a3fe89090fe3cab88426d",
"score": "0.7084577",
"text": "def completed?\n self.is_completed\n end",
"title": ""
},
{
"docid": "e07c8abe131220fdc47ab487d9fbf86b",
"score": "0.705205",
"text": "def complete?\r\n @is_complete\r\n end",
"title": ""
},
{
"docid": "9e39e9191f648e7dd28407b32319fe96",
"score": "0.7047873",
"text": "def tasks?\n tasks.summary.items?\n end",
"title": ""
},
{
"docid": "fbefb18be06a6db09d4a1a75b8ff730c",
"score": "0.7043884",
"text": "def completed?\n @state.to_s =~ /finished|aborted|failed/\n end",
"title": ""
},
{
"docid": "95f03102707474faa9d45073844f2216",
"score": "0.70184886",
"text": "def complete?\n @complete\n end",
"title": ""
},
{
"docid": "2d43cd650c0e30967be34710454e99a5",
"score": "0.70171994",
"text": "def completed?\n return true unless @state == PENDING_STATE\n @lock.lock\n begin\n @state != PENDING_STATE\n ensure\n @lock.unlock\n end\n end",
"title": ""
},
{
"docid": "11f19c9a40fad6884f2783a810365a86",
"score": "0.6999569",
"text": "def complete?\n @complete\n end",
"title": ""
},
{
"docid": "494fecab663ee106c08ccd7b03ddc154",
"score": "0.6962058",
"text": "def is_done?\n ssh_url, path = @item_url.split(':')\n `ssh #{ssh_url} ls #{path}/Run.completed 2>/dev/null`.split(\"\\n\").size == 1\n end",
"title": ""
},
{
"docid": "ccd8ec8eca83164d62b6ebe19fbdc0b3",
"score": "0.69614065",
"text": "def completed?\n @progress != 'PENDING'\n end",
"title": ""
},
{
"docid": "55d5327ebf9f75c8cc6d73aacc0de7e3",
"score": "0.69421846",
"text": "def completed?\n self.state == :completed\n end",
"title": ""
},
{
"docid": "82b7ee3cb7a268fb70ccbb354f52ec63",
"score": "0.69295335",
"text": "def is_done?\n return @is_done\n end",
"title": ""
},
{
"docid": "cf0513c92468a9e9034b35683c138f23",
"score": "0.69213414",
"text": "def complete_task(list_id, task_id, is_completed)\n path = \"lists/#{list_id}/tasks/#{task_id}\"\n if is_completed\n completed = 1\n else\n completed = 0\n end\n params = {task: {is_completed: completed}}\n request(path, params, :put)\n\n # output full list again\n show_list(list_id)\n end",
"title": ""
},
{
"docid": "ac1bb83151ce25992677f4a5e88cd79e",
"score": "0.6897851",
"text": "def tasks_are_successful?\n return true if @tasks_are_successful\n return false if @tasks_have_failed\n successful = all? do |task|\n task.successful?\n end\n if successful\n debug 'All tasks are successful'\n @tasks_are_successful = true\n end\n successful\n end",
"title": ""
},
{
"docid": "5f9b1bd022826f2cb9cf8970852edcc2",
"score": "0.6889959",
"text": "def pending_tasks?\n hash = pending_tasks\n return nil unless hash.key? \"tasks\"\n hash[\"tasks\"].length > 0\n end",
"title": ""
},
{
"docid": "d2987f6f8489cf8658a3bb7eb2ef5490",
"score": "0.6885818",
"text": "def is_finished\n\t\tif self.completed_at \n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3e16990b8a53ad4e8b0e68e7c639a4b3",
"score": "0.6879576",
"text": "def validate_tasks\n validated = false\n if tasks_completed?\n validated = tasks_completed!\n end\n\n validated\n end",
"title": ""
},
{
"docid": "9ac1e5cdec2a05f446ea9c3d911c6ad8",
"score": "0.6852556",
"text": "def success?\n @success ||= @tasks_results.all?(&:success?)\n end",
"title": ""
},
{
"docid": "40e3bdc47443b0a99eedd1b362a77584",
"score": "0.68267745",
"text": "def job_ended?\n FINAL_JOB_TASK_STATUSES.include?(@task_status)\n end",
"title": ""
},
{
"docid": "1fa84d722af9265884094858440f589e",
"score": "0.68176126",
"text": "def complete?\n\tstatus == \"Completed\"\n end",
"title": ""
},
{
"docid": "0a8ba3cc6e10975b6a1b087b932bb205",
"score": "0.6806661",
"text": "def completed?\n !self.finished_at.nil?\n end",
"title": ""
},
{
"docid": "ff97565e1186663ca0a76a88fe995235",
"score": "0.6805057",
"text": "def became_completed?\n completed_changed? && completed\n end",
"title": ""
},
{
"docid": "cc23f96b0f37895af5bbe00bf12d49f2",
"score": "0.6771028",
"text": "def done?\n return status if [true, false].include? status\n\n status == :DONE\n end",
"title": ""
},
{
"docid": "c63facbc3a31e81eecd5183fe0894012",
"score": "0.67708063",
"text": "def completed?\n self.status_sym == :completed\n end",
"title": ""
},
{
"docid": "4c1bb23488eb990e20489cb5f2d82f7e",
"score": "0.676986",
"text": "def complete?\n return state == \"complete\"\n end",
"title": ""
},
{
"docid": "5010e9ba9d8192ad5f76abe35556b999",
"score": "0.6758902",
"text": "def iscompleted?\n status == \"completed\"\n end",
"title": ""
},
{
"docid": "492b18a1a11b4351e2d3013c8caa0de2",
"score": "0.67448384",
"text": "def completed?\n !completed_at.blank?\n end",
"title": ""
},
{
"docid": "4996a0bc4ed124a65073654663a2fc96",
"score": "0.6735598",
"text": "def done?\n\t\tstatus == DONE\n\tend",
"title": ""
},
{
"docid": "045a78093ba3e0bf3ff5b1bca54748ca",
"score": "0.67344654",
"text": "def finished?\n self.completed? || self.failed?\n end",
"title": ""
},
{
"docid": "9e624648ff375226530b1d0ecf101567",
"score": "0.67312235",
"text": "def finished?\n\t\tfinished_on.present?\n\tend",
"title": ""
},
{
"docid": "9e624648ff375226530b1d0ecf101567",
"score": "0.67312235",
"text": "def finished?\n\t\tfinished_on.present?\n\tend",
"title": ""
},
{
"docid": "cef2dc392f28ea53d8d369e97b31d8d0",
"score": "0.67238295",
"text": "def crawling_complete?\n @completed\n end",
"title": ""
},
{
"docid": "254b5c8dd4af24a28cb70fd93a232132",
"score": "0.6719253",
"text": "def completed?\n !self.shift_jobs.empty?\n end",
"title": ""
},
{
"docid": "cc3e663cf314d445619aa53affe9d0ea",
"score": "0.6713682",
"text": "def done?\n @todos.all? {|todo| todo.done? }\n end",
"title": ""
},
{
"docid": "0de89fde363703e023de7dee41d25a2b",
"score": "0.6704774",
"text": "def finished?\n @status[:description] == :finished\n end",
"title": ""
},
{
"docid": "3538267eb98141a28653790247c137d5",
"score": "0.6692306",
"text": "def done?\n return @done\n end",
"title": ""
},
{
"docid": "63efc25b0c210d0e43fa7beb90aeceef",
"score": "0.6684077",
"text": "def done?\n @pb_list.empty? or @nb_iter >= MAX_ITER or @pb_list[0].complete?\n end",
"title": ""
},
{
"docid": "04bd8ee2b6f013c4044a64201fe3b9dc",
"score": "0.66825664",
"text": "def done?\n return false if status.nil?\n \"done\".casecmp(status).zero?\n end",
"title": ""
},
{
"docid": "2d38b0dcb5f5df510d14faf57b6aaa31",
"score": "0.66715324",
"text": "def complete?\n true\n end",
"title": ""
},
{
"docid": "bae78b6ed0f49585d789b6d48cd478fc",
"score": "0.66674644",
"text": "def is_complete?\n if self.state == COMPLETE\n self.children.each do |child|\n if !child.is_complete?\n return false\n end\n end\n return true\n\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "19a16250aae644b7f877ceaf20317fb2",
"score": "0.66669226",
"text": "def finished?\n if self.status == self.statuses[\"Finished\"]\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "79c512494dc2bf5ec204ab79f2d13831",
"score": "0.66573566",
"text": "def done?\n @done\n end",
"title": ""
},
{
"docid": "79c512494dc2bf5ec204ab79f2d13831",
"score": "0.66573566",
"text": "def done?\n @done\n end",
"title": ""
},
{
"docid": "0766b78b3bfcfbb6206c17c436a0789e",
"score": "0.66504264",
"text": "def is_done?\n return self.status == Erp::QuickOrders::Order::STATUS_DONE\n end",
"title": ""
},
{
"docid": "e32dea74a1b9e47aeb3e30cb21671e72",
"score": "0.66456914",
"text": "def has_tasks?\n return true unless session_tasks.empty?\n false\n end",
"title": ""
},
{
"docid": "5a2f132ac8cc1bda9d1f578748d89f5a",
"score": "0.6644193",
"text": "def task_complete?(id)\n task = @xml.search(\"object[@id='#{id}']\")\n task.search(\"attribute[@name='datecompleted']\").any?\n end",
"title": ""
},
{
"docid": "daf04a3beba29b7e3d2b1bc1a391a163",
"score": "0.6642729",
"text": "def completed?(step_name)\n status_flag = published? || false\n unless published?\n step_index = HYDRANT_STEPS.index(step_name)\n current_index = HYDRANT_STEPS.index(step_name)\n last_index = HYDRANT_STEPS.index(last_completed_step.first)\n unless (current_index.nil? or last_index.nil?)\n status_flag = (last_index >= current_index)\n end\n end\n status_flag\n end",
"title": ""
},
{
"docid": "471407ef3ec16546f879cd5fc49e1aef",
"score": "0.662941",
"text": "def complete?\n true\n end",
"title": ""
},
{
"docid": "ea124d56cb4e22a875cf6a7de8b4dbd2",
"score": "0.6625812",
"text": "def complete?\n pending == failures && (child_count == 0 || child_count == @completed)\n end",
"title": ""
},
{
"docid": "cc31c4baf8aa03d7b066a938278fa590",
"score": "0.6616837",
"text": "def complete?\n !incomplete?\n end",
"title": ""
},
{
"docid": "cc31c4baf8aa03d7b066a938278fa590",
"score": "0.6616837",
"text": "def complete?\n !incomplete?\n end",
"title": ""
},
{
"docid": "ac8f292568b8f1d27fed3c7a5c808b86",
"score": "0.6590769",
"text": "def complete?\n completed_at && response\n end",
"title": ""
},
{
"docid": "b07a01895e1589bb325b66415072b5be",
"score": "0.6583828",
"text": "def finished?\n attributes['isFinished']\n end",
"title": ""
},
{
"docid": "0d2a08cc367fc21c0250e2f07c1bee51",
"score": "0.65825206",
"text": "def tasks_have_failed?\n return true if @tasks_have_failed\n failed = select do |task|\n task.failed?\n end\n if failed.any?\n debug \"Found failed tasks: #{failed.map { |t| t.name }.join ', '}\"\n @tasks_have_failed = true\n end\n failed.any?\n end",
"title": ""
},
{
"docid": "40608b36cc2bf2077324b51333d33178",
"score": "0.6580987",
"text": "def completed_by_user?(user)\n @tasks_completed = CompletedTask.all\n @tasks_completed.each do |completed|\n if (user.id == completed.user_id && self.id == completed.task_id)\n return true\n end\n end\n end",
"title": ""
},
{
"docid": "2ac1b7f6a8dae171d9de5b4250d3daf4",
"score": "0.65747315",
"text": "def finished?\n FINAL_STATUSES.include?(transaction_status) || status == COMPLETED\n end",
"title": ""
},
{
"docid": "7d077ab36368d1c1167822c1f7473d6d",
"score": "0.6568037",
"text": "def complete?\n complete == true\n end",
"title": ""
},
{
"docid": "1513eefab46fb8cd34af4cafbd96ae6b",
"score": "0.6554005",
"text": "def completed?\n !@time_started.nil? && !@time_completed.nil?\n end",
"title": ""
},
{
"docid": "6da8667b097b5bfc756e148e8c88793c",
"score": "0.65509206",
"text": "def is_done?\n return self.status == Erp::Reservations::Reservation::STATUS_DONE\n end",
"title": ""
},
{
"docid": "d29fd55da90f5b0fd455f6c397266dbb",
"score": "0.6549129",
"text": "def complete?\n if threaded?\n !running?\n else\n true\n end\n end",
"title": ""
},
{
"docid": "2512d7e98a4f061cd4d82b2b083a1310",
"score": "0.65478987",
"text": "def done?\n if @complete == \"Item complete\"\n return \"Item complete\"\n else\n return \"Item incomplete\"\n end\n end",
"title": ""
},
{
"docid": "65198a62071d93f6fad1b60a07d2c97f",
"score": "0.6544592",
"text": "def complete?\n @gapi.job_complete\n end",
"title": ""
},
{
"docid": "28f3c2a97583a43b5c6600b9c091d0a4",
"score": "0.6544588",
"text": "def completed?\n completed_at ? true : false\n end",
"title": ""
},
{
"docid": "28f3c2a97583a43b5c6600b9c091d0a4",
"score": "0.6544588",
"text": "def completed?\n completed_at ? true : false\n end",
"title": ""
},
{
"docid": "569b3b20d75e2e745893b53165e7a990",
"score": "0.65404147",
"text": "def marked_as_complete?\n get[state.to_s] and get[state.to_s].to_sym == :complete\n end",
"title": ""
}
] |
ea505f5ce73c684ff95aa3c9a9cb5f68
|
GET /regexes/1 GET /regexes/1.json
|
[
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] |
[
{
"docid": "66a58fbdeb5e7b5329337d02db778567",
"score": "0.69273245",
"text": "def show\n @regex = Regex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @regex }\n end\n end",
"title": ""
},
{
"docid": "3156ead821f6c8eac7156058742e167e",
"score": "0.66301024",
"text": "def get_json_regex\n JSON.pretty_generate(get_object[\"regex\"], @json_option)\n end",
"title": ""
},
{
"docid": "cac5694117b20d25197e30376504f860",
"score": "0.6598676",
"text": "def new\n @regex = Regex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @regex }\n end\n end",
"title": ""
},
{
"docid": "03f7075bb73908b5b382d479a9720e35",
"score": "0.6536249",
"text": "def show\n @regular_expression = RegularExpression.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @regular_expression }\n end\n end",
"title": ""
},
{
"docid": "b54593c421893d4ad9de990ef63f8d24",
"score": "0.64788485",
"text": "def regexes\n server.regexes rescue {}\n end",
"title": ""
},
{
"docid": "f37049b6d4927d34add6c754fcfc7b8b",
"score": "0.6268233",
"text": "def create\n @regex = Regex.new(regex_params)\n\n respond_to do |format|\n if @regex.save\n format.html { redirect_to @regex, notice: 'Regex was successfully created.' }\n format.json { render :show, status: :created, location: @regex }\n else\n format.html { render :new }\n format.json { render json: @regex.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "35bd395ce559f7676868dc1b550b669d",
"score": "0.6261167",
"text": "def create\n @regex = Regex.new(params[:regex])\n\n respond_to do |format|\n if @regex.save\n format.html { redirect_to @regex, notice: 'Regex was successfully created.' }\n format.json { render json: @regex, status: :created, location: @regex }\n else\n format.html { render action: \"new\" }\n format.json { render json: @regex.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51d3b0ef4739b6facd5093e93fa845cb",
"score": "0.62361526",
"text": "def index\n @regular_expressions = RegularExpression.all\n @regular_expressions = RegularExpression.paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @regular_expressions }\n end\n end",
"title": ""
},
{
"docid": "62b87784402887d8a19def4efce8c502",
"score": "0.6151295",
"text": "def regexps; end",
"title": ""
},
{
"docid": "e27cfca6ed988d09f090591a83bb9c5f",
"score": "0.607735",
"text": "def regexps\n @regexps\n end",
"title": ""
},
{
"docid": "a718d113c39f7b884fbe7fae7a69a8af",
"score": "0.60501134",
"text": "def index\n @regexes = Regex.where(user: current_user)\n end",
"title": ""
},
{
"docid": "c05659a6e995a987e1c193ff857c1e61",
"score": "0.5944322",
"text": "def scan_for_match(regex)\n regex = Regexp.new regex\n self.body.scan(regex)\n end",
"title": ""
},
{
"docid": "56a0cca7635b806857e7d09181382be7",
"score": "0.5863375",
"text": "def regex; end",
"title": ""
},
{
"docid": "c66a30539dd1ed886cf6f21cf697a436",
"score": "0.58564866",
"text": "def deep_regexps; end",
"title": ""
},
{
"docid": "e6a0e49877bd1c6c2db8ba092a03f4a2",
"score": "0.58536977",
"text": "def set_regex\n @regex = Regex.find(params[:id])\n end",
"title": ""
},
{
"docid": "92c0d58178478ea18590fcc9b51ad4d0",
"score": "0.58299196",
"text": "def create\n @regex = Regex.new(regex_params)\n #current_user.regexes << @regex\n\n respond_to do |format|\n if @regex.save\n format.html { redirect_to @regex, notice: 'Regex was successfully created.' }\n format.json { render :show, status: :created, location: @regex }\n else\n format.html { render :new }\n format.json { render json: @regex.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "47c14595291b29dbe9b85579577e1aed",
"score": "0.5748669",
"text": "def getResourceList(nodename, regex)\n nodename = nodename.downcase\n\n resources=JSON.parse(RestClient.get(\"http://localhost:8080/v2/nodes/#{nodename}/resources\", {:accept => :json}))\n \n retVal = Array.new\n\n resources.each do |resource|\n if resource[\"title\"] =~ /#{regex}/\n retVal.push(resource[\"title\"])\n end\n end\n\n return retVal\nend",
"title": ""
},
{
"docid": "61513182c0d19de61ce754c784ccd211",
"score": "0.5719193",
"text": "def get\n @data = Utils::Request.get(\"patterns/#{@id}.json\", :pattern)\n end",
"title": ""
},
{
"docid": "5b50c4327fabca037e14ed25039f281c",
"score": "0.5710273",
"text": "def set_regex\n @regex = Regex.find(params[:id])\n end",
"title": ""
},
{
"docid": "18d81512681db8ed4fea01fe62ef233b",
"score": "0.5706193",
"text": "def to_json\n regextest = Regextest.new(self, {})\n regextest.to_json\n end",
"title": ""
},
{
"docid": "21541ed6965ad5a95efe10a6d339260d",
"score": "0.5650105",
"text": "def match_all(regex, data, options = '')\n raise Errors::MatchException, \"Regex can't be empty\" if\n regex.nil? || regex.empty?\n return @ruby.match_all(regex, data, options) if @language == 'ruby'\n\n cmd = self.run_command('match_all', {:regex => regex, :data => data,\n :options => options})\n self.parse_response(cmd)\n end",
"title": ""
},
{
"docid": "1a1b3c4b949ec99da514a1e554ca3e5e",
"score": "0.5646877",
"text": "def index\n @matches = Match.all\n\n respond_to do |format|\n format.html\n format.json { render json: @matches }\n end\n end",
"title": ""
},
{
"docid": "d1517e8f27c4b62ad1dd6ee3465a27ca",
"score": "0.56025666",
"text": "def regular_expressions; end",
"title": ""
},
{
"docid": "af50bd720f1f0fdeb25e8f504db4ba99",
"score": "0.5570686",
"text": "def get_with_regex(regex=nil)\n if regex.class == String && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getWithRegex, [Java::java.lang.String.java_class]).call(regex),::VertxWeb::Route)\n end\n raise ArgumentError, \"Invalid arguments when calling get_with_regex(regex)\"\n end",
"title": ""
},
{
"docid": "ab8053494c10e6c695e337abcfeb3e96",
"score": "0.5544056",
"text": "def get\n @data = Utils::Request.get(\"patterns/#{@id}.json\", :pattern)\n self\n end",
"title": ""
},
{
"docid": "78cc858f2977261771d6e8af507b7e11",
"score": "0.55391645",
"text": "def regex\n @regex ||= Regexp.new(value)\n end",
"title": ""
},
{
"docid": "477384a1b6eaa8d01c6664073e7e5028",
"score": "0.55253446",
"text": "def index\n @titlematches = Titlematch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @titlematches }\n end\n end",
"title": ""
},
{
"docid": "f5bc6a8e8f7a44f084559937f0f2c4fb",
"score": "0.54798573",
"text": "def update\n @regex = Regex.find(params[:id])\n\n respond_to do |format|\n if @regex.update_attributes(params[:regex])\n format.html { redirect_to @regex, notice: 'Regex was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @regex.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cfc19ca3848dd73ca0c6f751f54fcaa0",
"score": "0.54739517",
"text": "def index\n @matches = Match.all\n render json: @matches\n end",
"title": ""
},
{
"docid": "2f736daa7101f5954b129f1f688fa34c",
"score": "0.5447678",
"text": "def new\n @regular_expression = RegularExpression.new\n\n @available_releases = Release.all\n @available_rules = Rule.all\n @available_results = Result.all\n\n @add_releases = Array.new\n @add_rules = Array.new\n @add_results = Array.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @regular_expression }\n end\n end",
"title": ""
},
{
"docid": "13cfa87a8b8e6b42e7b0d09b8dc09dc9",
"score": "0.5429527",
"text": "def update\n respond_to do |format|\n if @regex.update(regex_params)\n format.html { redirect_to @regex, notice: 'Regex was successfully updated.' }\n format.json { render :show, status: :ok, location: @regex }\n else\n format.html { render :edit }\n format.json { render json: @regex.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "13cfa87a8b8e6b42e7b0d09b8dc09dc9",
"score": "0.5429527",
"text": "def update\n respond_to do |format|\n if @regex.update(regex_params)\n format.html { redirect_to @regex, notice: 'Regex was successfully updated.' }\n format.json { render :show, status: :ok, location: @regex }\n else\n format.html { render :edit }\n format.json { render json: @regex.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a596bb805d0d371b755146df54bb9f4f",
"score": "0.5419269",
"text": "def read_regexp\n string = read_string(cache: false)\n options = read_byte\n\n result = ::Regexp.new(string, options)\n @object_cache << result\n result\n end",
"title": ""
},
{
"docid": "93916834f4924050eeb4cfb9d1c61d5f",
"score": "0.5416685",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @patterns }\n end\n end",
"title": ""
},
{
"docid": "a8b4a11c22386b34a18bac28b3ed2127",
"score": "0.5351449",
"text": "def index\n @recipes = Recipe.search(params[:search_re])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"title": ""
},
{
"docid": "fb104d826a081330faf39988c78d19a4",
"score": "0.53499734",
"text": "def regexp\n @regexp\n end",
"title": ""
},
{
"docid": "3db71a0970f2e9a35ffdf62a91ec990b",
"score": "0.5342484",
"text": "def match(regex, data, options = '')\n raise Errors::MatchException, \"Regex can't be empty\" if regex.empty?\n return @ruby.match(regex, data, options) if @language == 'ruby'\n\n cmd = self.run_command('match', {:regex => regex, :data => data,\n :options => options})\n self.parse_response(cmd)\n end",
"title": ""
},
{
"docid": "f10b4c5e2e571221116f216fcf17b6c9",
"score": "0.5337962",
"text": "def destroy\n @regex.destroy\n respond_to do |format|\n format.html { redirect_to regexes_url, notice: 'Regex was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f10b4c5e2e571221116f216fcf17b6c9",
"score": "0.5337962",
"text": "def destroy\n @regex.destroy\n respond_to do |format|\n format.html { redirect_to regexes_url, notice: 'Regex was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d37d1d26a5e5936a69e5f3d04eddcea0",
"score": "0.53257847",
"text": "def extract(regex)\n self[regex, 1]\n end",
"title": ""
},
{
"docid": "41350abb1deb8fb9d629dea4d6912b82",
"score": "0.53140104",
"text": "def regexp; end",
"title": ""
},
{
"docid": "41350abb1deb8fb9d629dea4d6912b82",
"score": "0.53140104",
"text": "def regexp; end",
"title": ""
},
{
"docid": "a7511de64d331d7af895537d4d375eac",
"score": "0.5310239",
"text": "def regex_params\n params.require(:regex).permit(:expression, :title, :user_id, :text_id)\n end",
"title": ""
},
{
"docid": "3e15c2df23dcd8dcdb61ec537aac9dc4",
"score": "0.52895045",
"text": "def regex(pattern)\n end",
"title": ""
},
{
"docid": "18c76d91134bc2c066f3e61ece6eb27b",
"score": "0.52878785",
"text": "def get_re(pattern, proc = nil, &hndlr)\n hndlr = proc if proc\n @j_del.getWithRegEx(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end",
"title": ""
},
{
"docid": "3d0720d3fe37c2e99132d0bde151e936",
"score": "0.52775073",
"text": "def destroy\n @regex = Regex.find(params[:id])\n @regex.destroy\n\n respond_to do |format|\n format.html { redirect_to regexes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "63a2078b2123a7afe7beb079bd042290",
"score": "0.52728033",
"text": "def iregex(pattern)\n end",
"title": ""
},
{
"docid": "6c970eda049209945ede3f9db304566b",
"score": "0.5266108",
"text": "def regexp_source; end",
"title": ""
},
{
"docid": "1bc1e5d3d14fac0b97697e7ef8122cc3",
"score": "0.5255932",
"text": "def re; end",
"title": ""
},
{
"docid": "af5bae5fce48fc1d338186ef55158bb6",
"score": "0.52432793",
"text": "def index\n # TODO THIS IS NOT WORKING ATM\n # @matches = Match.all\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @matches }\n # end\n\n render :nothing => true\n end",
"title": ""
},
{
"docid": "9c57d25cf9e573d53b8442976632c654",
"score": "0.5242667",
"text": "def matching_lines(regex); end",
"title": ""
},
{
"docid": "b58e778e65be500af308efe5c2c792f4",
"score": "0.52226514",
"text": "def test_accepts_regexp\n blacklist = [/a+lien/i]\n app = TestApp.new(Censored, blacklist) do |env|\n body = '<p>We have recovered AAAAAALIEN artifacts.</p>'\n [200, {}, [body]]\n end\n\n response = app.get('/')\n\n expected_body = '<p>We have recovered ########## artifacts.</p>'\n assert_equal expected_body, response.body\n end",
"title": ""
},
{
"docid": "61eb5fe3da85b4c46e5242c002fb8a64",
"score": "0.520727",
"text": "def data\n regex.match(@query)\n end",
"title": ""
},
{
"docid": "a95eaf96632fc85cc3d29d42a1f45ce4",
"score": "0.52028954",
"text": "def initialize(regex = nil)\n raise(TypeError, 'regex must be a kind of Regexp!') if regex and !regex.kind_of?(Regexp)\n\n @urls, @json, @text = [], [], ''\n\n open(URLS_JSON, OPEN_URI_OPTS) do |x|\n if x.content_type.include?('/json') and x.status.first.to_i.eql?(200)\n x.each_line do |l|\n @text << l\n end\n end\n end\n\n @json = JSON.parse(@text)\n\n return [] if !@json.key?('urls')\n\n @urls = @json['urls']\n\n if block_given?\n if regex\n @urls.each do |u|\n if u =~ regex\n yield u\n\n self << u\n end\n end\n else\n @urls.each do |u|\n yield u\n\n self << u\n end\n end\n end\n\n if regex\n @urls.each do |u|\n self << u if u =~ regex\n end\n else\n self.concat(@urls)\n end\n\n self\n end",
"title": ""
},
{
"docid": "e690ad319da45372e5ecbddc5da48cc7",
"score": "0.51792276",
"text": "def regexp\n @regexp ||= Regexp.new( tree_flatten( char_tree( hash.keys ) ) )\n end",
"title": ""
},
{
"docid": "14d2b50f184212130e3f9a0f7253fc91",
"score": "0.5176396",
"text": "def get_niaapi_version_regex_list(opts = {})\n data, _status_code, _headers = get_niaapi_version_regex_list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "f55406790580c169c7523c4ba16a6dee",
"score": "0.5166838",
"text": "def search(regex)\n puts _search(regex).join(\"\\n\")\n end",
"title": ""
},
{
"docid": "7935e1ea9bc40db708e292e1e4056399",
"score": "0.51581705",
"text": "def regex! query, re, operations = [], &block\n end",
"title": ""
},
{
"docid": "0c6e0019992132fd2a262713d716b5cd",
"score": "0.51566947",
"text": "def regexp(); REGEXP; end",
"title": ""
},
{
"docid": "8ae92c6c258e234976ed3806d8613135",
"score": "0.51268226",
"text": "def regexp(regex)\n # We have to match from the beginning\n real_regex = /^#{regex}/\n\n Parser.new do |input, index|\n match_data = real_regex.match(input)\n\n if match_data.nil?\n # We did not even match one letter\n Failure.new(index, [regex], input)\n else\n Success.new(index, match_data[0], input)\n end\n end\n end",
"title": ""
},
{
"docid": "36b78b368f09cf313708c5f78f0ceca5",
"score": "0.50851434",
"text": "def match\n descriptors = body_params\n matched = CloudController.resource_pool.match_resources(descriptors)\n render :json => matched\n end",
"title": ""
},
{
"docid": "f0fd9ae5ef24356995b7a979412af17f",
"score": "0.50845593",
"text": "def scan(regex)\n @scanner.scan(regex)\n end",
"title": ""
},
{
"docid": "3f32625d03e88c170a3d7ccea91e9424",
"score": "0.507508",
"text": "def regexes\n [\n [\"year\", '(?<start_year>\\d{4})-(?<end_year>\\d{4})'], # year:2003-2015\n [\"year\", '(\\d{4})'], # year:2003\n [\"type\", '(?<reference_type>nested)'], # type:nested\n [\"title\", '\"(.*?)\"'], # title:\"Iceland\"\n [\"title\", '\\'(.*?)\\''], # title:'Iceland'\n [\"title\", '([^ ]+)'], # title:Iceland\n [\"author\", '\"(.*?)\"'], # author:\"Barry Bolton\"\n [\"author\", '\\'(.*?)\\''], # author:'Barry Bolton'\n [\"author\", '([^ ]+)'], # author:Bolton\n [\"doi\", '([^ ]+)'] # doi:10.11865/zs.201806\n ]\n end",
"title": ""
},
{
"docid": "0e9dbbb8a93711f0ec4585f95f4a4424",
"score": "0.50698304",
"text": "def app_request_regex\n @app_request_regex.each_with_object({}) { |(k, v), h| h[k] = ::Regexp.new v }\n end",
"title": ""
},
{
"docid": "9c23642f29f861ec47bd6728485cc932",
"score": "0.50554687",
"text": "def match(regex, data, options)\n regex = self.compile_regex(regex, options)\n {:matches => data.match(regex).to_a}\n end",
"title": ""
},
{
"docid": "574fcc97777825b369d760cb122d8660",
"score": "0.50526714",
"text": "def index\n @patterns = Pattern.all\n end",
"title": ""
},
{
"docid": "574fcc97777825b369d760cb122d8660",
"score": "0.50526714",
"text": "def index\n @patterns = Pattern.all\n end",
"title": ""
},
{
"docid": "574fcc97777825b369d760cb122d8660",
"score": "0.50526714",
"text": "def index\n @patterns = Pattern.all\n end",
"title": ""
},
{
"docid": "d51b4d47ffbb4abe28ab1509fe42a18d",
"score": "0.50490993",
"text": "def regex\n /\\[([^\\]]+)\\]\\((#{Regexp.quote(@url)})\\)/\n end",
"title": ""
},
{
"docid": "5decd0f232cdb34fc93bcab017d5c01e",
"score": "0.5037268",
"text": "def match_regexps(key, regexps)\n string = @context.dictionary[key]\n\n array(regexps).each_with_object({}) do |regexp, matches|\n matchdata = ::Regexp.new(regexp).match(string)\n next if matchdata.nil?\n\n matches.merge!(matchdata.named_captures.transform_keys(&:to_sym))\n end\n end",
"title": ""
},
{
"docid": "a292b0f0465efd695c30781d1e39f15a",
"score": "0.50212467",
"text": "def index\n @greps = Grep.all\n end",
"title": ""
},
{
"docid": "a627191cd6f99138adeb681cdcb81155",
"score": "0.5014358",
"text": "def emit_match_pattern; end",
"title": ""
},
{
"docid": "8e3bab17d338ec5f1fb20320ed200bdd",
"score": "0.5007002",
"text": "def files_regex_search\n page = params[:page].to_i.positive? ? params[:page] : 1\n files = user_real_files(params, @context).files_conditions\n\n begin\n regexp = Regexp.new(params[:search_string], params[:flag])\n search_result = files.eager_load(:license, user: :org).order(id: :desc).map do |file|\n describe_for_api(file) if file.name.scan(regexp).present?\n end\n result = search_result.compact.\n map do |file|\n {\n id: file[:id],\n uid: file[:uid],\n title: file[\"title\"],\n path: file[:file_path],\n }\n end\n paginated_result = Kaminari.paginate_array(result).page(page).per(20)\n uids = params[:uids].present? && to_bool(params[:uids]) ? result.compact.pluck(:uid) : []\n\n render json: { search_result: paginated_result, uids: uids }\n rescue RegexpError => e\n fail \"RegEx Invalid: #{e}\"\n end\n # rubocop:enable Style/SignalException\n end",
"title": ""
},
{
"docid": "8604bfba134c97be1556bb24835c413b",
"score": "0.5005605",
"text": "def match_all(regex, data, options)\n regex = self.compile_regex(regex, options)\n {:matches => data.scan(regex).to_a}\n end",
"title": ""
},
{
"docid": "27ead5ca5d6df4b8fd1a4d23b737a332",
"score": "0.49832156",
"text": "def regex_pattern\n return @regex_pattern\n end",
"title": ""
},
{
"docid": "85a02e8de281b8b7cb90c02e631c831f",
"score": "0.49665472",
"text": "def regexp\n @regexp ||= Regexp.new(encoding)\n end",
"title": ""
},
{
"docid": "0e6743f652246037dd8063a69be49a63",
"score": "0.4963248",
"text": "def new\n @match1 = Match1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match1 }\n end\n end",
"title": ""
},
{
"docid": "46d63aa36e273f6409fc13be4ab62731",
"score": "0.49462545",
"text": "def valid_regex; end",
"title": ""
},
{
"docid": "2e632765aa0d1f639d7ec5fad2c50be6",
"score": "0.49451774",
"text": "def handle_regex string\n\t\t\treturn string_to_regex string, false\n\t\tend",
"title": ""
},
{
"docid": "7f8b32beb2c037b81ed617c97e17a2f7",
"score": "0.49436083",
"text": "def matches(regex)\n @subject.validations[:matches] ||= []\n @subject.validations[:matches] << regex\n end",
"title": ""
},
{
"docid": "53917a4b884313ead13f2ebf790b8e79",
"score": "0.4938707",
"text": "def regex_match_func(*args)\n regex_match(args[0], args[1])\n end",
"title": ""
},
{
"docid": "6af4ec396d90e8d90993c93d6a78b471",
"score": "0.49384418",
"text": "def simplify\n out = {}.to_json\n if params[:url]\n # is it a url?\n return unless params[:url] =~ /^#{URI::regexp}$/\n # query stuff\n endpoint = \"http://www.readability.com/api/content/v1/parser\"\n q = \"#{endpoint}?url=#{params[:url]}&token=#{ENV[\"RD_PARSER_KEY\"]}\"\n out = RestClient.get(q)\n end\n # RSVP\n respond_to do |format|\n format.html\n format.json { render :json => out.body }\n end\n end",
"title": ""
},
{
"docid": "f4324e8944a72b6cfe38d0c2ce330344",
"score": "0.4933588",
"text": "def match(regexp); end",
"title": ""
},
{
"docid": "c988ab319bd3724cde0624c2cf478ba8",
"score": "0.4932904",
"text": "def select(mode=:regex)\n source = mode.eql?(:regex) ? self.path_regex_map : self.path_string_map\n interim = source.select { |regex,endpoint|\n match = yield(regex, endpoint)\n }\n #\n # We now have an array or arrays. Yuck. Turn it back into an\n # array of hashes.\n #\n result = []\n while (tuple = interim.shift)\n result << { tuple[0] => tuple[1] }\n end\n return result\n end",
"title": ""
},
{
"docid": "ab0f476ffb6fa0764f619b35a8ad3fae",
"score": "0.49321246",
"text": "def index\n @http_path_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_path_rules }\n end\n end",
"title": ""
},
{
"docid": "3366b78d5cefff51139e477bed644277",
"score": "0.49290663",
"text": "def to_reb\n escaped_string = self.inspect[1,self.inspect.length-2]\n return rebexToRegex(escaped_string)\n end",
"title": ""
},
{
"docid": "d83ecd1822d64bf7ad91031b07bb39a6",
"score": "0.49273112",
"text": "def match_data(option = {})\n regextest = Regextest.new(self, option)\n result = regextest.generate\n end",
"title": ""
},
{
"docid": "68c49f9e7e0dc9bdeaa8df4f5d26310a",
"score": "0.49260643",
"text": "def get_niaapi_version_regex_by_moid(moid, opts = {})\n data, _status_code, _headers = get_niaapi_version_regex_by_moid_with_http_info(moid, opts)\n data\n end",
"title": ""
},
{
"docid": "ec6f65e686626fc19e2496102146f75b",
"score": "0.49228582",
"text": "def index\n @matches = Match.order(:datum)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end",
"title": ""
},
{
"docid": "df072a7499a2dab7a38dd923ba44aca8",
"score": "0.49061206",
"text": "def regex\n Regexp.new(r_place(scan))\n end",
"title": ""
},
{
"docid": "6ba8857e5ee243e77c55e485e435fd69",
"score": "0.49026704",
"text": "def regex_params\n params.require(:regex).permit(:name, :code, :prefix_length, :prefix_string, :type, :suffix_length, :suffix_string, :regex_string, :localtion_id)\n end",
"title": ""
},
{
"docid": "ed4135e59144978fdb8b2fbb6db4fe81",
"score": "0.49012432",
"text": "def regex1\n\nfname = \"regex_exe2_1.txt\"\nsomefile = File.open(fname, \"w\")\nARGF.each do |line|\n if line =~ /match/\n matches = line.match(/match/)\n somefile.puts line\n somefile.puts matches.pre_match\n somefile.puts matches[0]\n somefile.puts matches.post_match\n end\nend\nsomefile.close\nend",
"title": ""
},
{
"docid": "27d4d690e69b333666ffe1d3c4365846",
"score": "0.48948646",
"text": "def index\n @user=User.find(params[:user_id])\n @matches=@user.matches\n render json: @matches\n end",
"title": ""
},
{
"docid": "8d8de56cf926b3f2626c3be083c46449",
"score": "0.48873767",
"text": "def to_regexp; end",
"title": ""
},
{
"docid": "4f260b628c14782e15bdb06d1304d41b",
"score": "0.4884038",
"text": "def index\n @reg_lines = RegLine.all\n\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reg_lines }\n end\n end",
"title": ""
},
{
"docid": "adc5618715f0916d6edb9ad83dc4bb4e",
"score": "0.48830092",
"text": "def regex\n @regex ||= /#{strip_regex_from(value)}/\n end",
"title": ""
},
{
"docid": "adc5618715f0916d6edb9ad83dc4bb4e",
"score": "0.48830092",
"text": "def regex\n @regex ||= /#{strip_regex_from(value)}/\n end",
"title": ""
},
{
"docid": "46728e39bde3d3cb6064d807af88b4ed",
"score": "0.48748946",
"text": "def fix_regexp regexp\n {:json_class => 'Regexp', \"o\" => regexp.options, \"s\" => regexp.source }\n end",
"title": ""
},
{
"docid": "08271e77051f1d8bc93485aa85fa4a33",
"score": "0.4873853",
"text": "def index\n render json: Captcha.all\n end",
"title": ""
},
{
"docid": "ad0d5af4540e2c64a651804dddabb159",
"score": "0.48726824",
"text": "def index\n # byebug\n @matches = Match.all\n end",
"title": ""
},
{
"docid": "2df387ee4979846481269583754f3256",
"score": "0.48718694",
"text": "def index\n @matches = Match.all\n respond_with @matches;\n end",
"title": ""
}
] |
7dc42c8df562c812e0c1c1e1f0a39779
|
PATCH/PUT /generated_feedbacks/1 PATCH/PUT /generated_feedbacks/1.json
|
[
{
"docid": "cba5cdac8aac8ee13efc66fb8234c020",
"score": "0.6766348",
"text": "def update\n\n if @generated_feedback.update(generated_feedback_params)\n redirect_to(edit_auto_gens_path, :notice => \"Generated feedback was successfully edited.\")\n else\n redirect_to(edit_auto_gens_path, :notice => \"Generated feedback was not successfully edited.\")\n end\n end",
"title": ""
}
] |
[
{
"docid": "d7e3523b3cfdad8e224ae64bf8cbd5a9",
"score": "0.7192793",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.json { head :no_content }\n else\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a952b47c4193be53694fdb310562d0f9",
"score": "0.6822524",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: t('feedback_update_success') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "73ca8fe1abc2cd10d8133837db1c048c",
"score": "0.6776679",
"text": "def update\n @feedback = Feedback.find(params[:id])\n \n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17f2c096798e7ddae85cd04876bf020d",
"score": "0.67639065",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n Events.delay.assign_feedback(@feedback.id) if @feedback.to != nil && @feedback.answer == nil\n format.html { redirect_to feedbacks_url, notice: t(:feedback_was_successfully_updated, scope: [:notices]) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4087e95b72b4f10465b695efcfeb71ff",
"score": "0.6725785",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, :notice => 'Feedback was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "09b2db17aa7669d628ece27edf8373d4",
"score": "0.67231864",
"text": "def update\n respond_to do |format|\n if @feedback.update_attributes(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d97fd66c7d8019c07e552de6def88213",
"score": "0.67007077",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d97fd66c7d8019c07e552de6def88213",
"score": "0.67007077",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d97fd66c7d8019c07e552de6def88213",
"score": "0.67007077",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d97fd66c7d8019c07e552de6def88213",
"score": "0.67007077",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7998462af24da894eb090d158c1e95e8",
"score": "0.6691448",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to feedbacks_path, notice: 'Feedback was successfully updated.' }\n format.json { render :index, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "91f1b7380c4df4e45f78d510dfa08e1d",
"score": "0.6684711",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "91f1b7380c4df4e45f78d510dfa08e1d",
"score": "0.6684711",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "653937f7b57ba0c9e98e01ed3c262ec6",
"score": "0.6658651",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n @feedbacks = Feedback.all\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n format.line { render :index }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n format.line { render json: flex_text(@feedback.errors.to_s) }\n end\n end\n end",
"title": ""
},
{
"docid": "a80b695089fb2578fa3a253c08906263",
"score": "0.6658444",
"text": "def update\n respond_to do |format|\n if @my_feedback.update(my_feedback_params)\n format.html { redirect_to @my_feedback, notice: 'My feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @my_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9323d4e68eab7ba4692486d8eaf97233",
"score": "0.66522336",
"text": "def update\n @feedback = Feedback.find(params[:id])\n params[:feedback][:my_tag_ids] ||= []\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to(admin_feedbacks_url, :notice => 'Feedback was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2afa9a3c324a89578954155040c1c1f6",
"score": "0.66246927",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2afa9a3c324a89578954155040c1c1f6",
"score": "0.66246927",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2afa9a3c324a89578954155040c1c1f6",
"score": "0.66246927",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2afa9a3c324a89578954155040c1c1f6",
"score": "0.66246927",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f021b15bc863ea56e2fba2c77028312",
"score": "0.6609493",
"text": "def update\n respond_to do |format|\n if @question_feedback.update(question_feedback_params)\n format.html { redirect_to @question_feedback, notice: 'Question feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6a38247de5bb33e675b2ee68d54607a5",
"score": "0.65712464",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to feedbacks_url, notice: t('flash.notice.updating_feedback') }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit, alert: t('flash.alert.updating_feedback') }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb7cdae32a3fdeb1f32763041fc51d93",
"score": "0.6530432",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to user_root_url, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6d80928c1cb9f12e8fda4b864e3b2a6d",
"score": "0.65096587",
"text": "def update\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to dashboard_show_url, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "45e6fef71fb7c18c99c0049331e28425",
"score": "0.6475485",
"text": "def update\n add_breadcrumb 'New Feedback'\n\n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html do\n redirect_to feedbacks_url, notice: 'Feedback was successfully updated.'\n end\n # format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit , status: :unprocessable_entity }\n format.json do\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"title": ""
},
{
"docid": "7cc74745db25b61b19a4a2c39bd0f428",
"score": "0.6465787",
"text": "def update\n redirect_to :root\n return\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4c6095a0b0219485269bc3cad8334729",
"score": "0.6453515",
"text": "def update\n @admin_feedback = Admin::Feedback.find(params[:id])\n\n respond_to do |format|\n if @admin_feedback.update_attributes(params[:admin_feedback])\n format.html { redirect_to admin_feedback_path(@admin_feedback), notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8317e9e166000bf5056a38e591f4414a",
"score": "0.64488226",
"text": "def update\n @user = User.find(current_user)\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8317e9e166000bf5056a38e591f4414a",
"score": "0.64488226",
"text": "def update\n @user = User.find(current_user)\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2f2e57dcf72896f29455b845ed6b764f",
"score": "0.6439101",
"text": "def submit_feedback(label, feedback)\n response = @api.request(\n :put,\n \"#{@location}/#{label}\",\n headers: { 'content-type' => @api.version_header[:accept] },\n body: feedback.to_json\n )\n rescue Gini::Api::RequestError => e\n if e.api_status == 422\n raise Gini::Api::DocumentError.new(\n \"Failed to submit feedback for label '#{label}' (code=#{e.api_status}, msg=#{e.api_response.body})\",\n response\n )\n end\n raise\n end",
"title": ""
},
{
"docid": "2a64c90e5773ad000bb52d1614192b0c",
"score": "0.64128387",
"text": "def update\n @user_feedback = UserFeedback.find(params[:id])\n\n respond_to do |format|\n if @user_feedback.update_attributes(params[:user_feedback])\n format.html { redirect_to @user_feedback, notice: 'User feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "abb0b2a231c60a272856415082e0e30f",
"score": "0.64016724",
"text": "def update\n respond_to do |format|\n if @user_feedback.update(user_feedback_params)\n format.html { redirect_to @user_feedback, notice: 'User feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "043c027a58983887a4aeb5bb053c9c1e",
"score": "0.6378956",
"text": "def update\n respond_to do |format|\n p = feedback_params\n p.delete('user_id') unless @feedback.new_record?\n if current_user.super_admin?\n if feedback_params[:response] != @feedback.response and feedback_params[:response] != \"\"\n FeedbackMailer.with(feedback: @feedback, admin: current_user).feedback_response_email.deliver_later\n else\n p.delete('response_username') # do not update response_username when an admin didn't write/change the response\n end\n end\n if @feedback.update(p)\n format.html { redirect_to @feedback, notice: t('flash.notice.feedback_updated') }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8411de15d9d9211865cdbb558c0e8a67",
"score": "0.63488024",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to [:admin, @feedback], notice: 'Отзыв успешно обновлен.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ddc29c35424a268d8b236f01d22d7977",
"score": "0.6302591",
"text": "def update\n respond_to do |format|\n if @cms_feedback.update(cms_feedback_params)\n format.html { redirect_to @cms_feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cms_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fc6a2dd6fca958fbfeafdf2c80dce82b",
"score": "0.6278712",
"text": "def update\n respond_to do |format|\n if @feedback_input.update(feedback_input_params)\n format.html { redirect_to @feedback_input, notice: 'Feedback input was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dfd0b8ad3737f33ac75c4f6f2f537769",
"score": "0.6273239",
"text": "def update\n respond_to do |format|\n if @user_feedback.update(user_feedback_params)\n format.html { redirect_to @user_feedback, notice: 'User feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_feedback }\n else\n format.html { render :edit }\n format.json { render json: @user_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "427ecc28dc6373cd67afba87858bc8d9",
"score": "0.6270735",
"text": "def update\n @feedback = Feedback.find(params[:id])\n authorize! :update , @feedback\n\n respond_to do |format|\n if @feedback.update_attributes(feedback_params)\n format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "706b586961802c238a9838c7419a7214",
"score": "0.62667805",
"text": "def user_feedback\n @response = ApplicationRecord::Response.find(params[:id])\n @response.update(feedback: params[:response][:feedback])\n redirect_to feedback_response_path\n end",
"title": ""
},
{
"docid": "77acad6ed0a83e5d7420d786da9dbab5",
"score": "0.6258561",
"text": "def set_generated_feedback\n @generated_feedback = GeneratedFeedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "60a6fa7e28e061f371258da4fdd80de3",
"score": "0.62534004",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html { redirect_to(@feedback, :notice => 'Feedback was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b5da7c5a06c8be007743945b1a240e6b",
"score": "0.62430525",
"text": "def update\n @feedback = Feedback.find(params[:id])\n logger.info \"フィードバック #{@feedback.id} を更新します。\"\n @feedback.last_updated_at = Time.now\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @feedback.update_attributes(feedback_params)\n logger.info \"フィードバック #{@feedback.id} を更新しました。\"\n format.html { redirect_to article_path(@feedback.article_id), notice: get_resource('success') }\n #format.json { head :no_content }\n else\n logger.info \"フィードバックの更新に失敗しました。\"\n format.html { render action: \"edit\" }\n #format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "557c841bd7cab336c361d5bed6d78075",
"score": "0.62104416",
"text": "def update\n @feedback = Feedback.find(params[:id])\n if params[:submit_final_button]\n @feedback.submitted = true\n end\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n format.html do\n redirect_to edit_review_feedback_path(@review.id, @feedback.id)\n flash[:success] = 'Feedback was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "895f2c4707e9a490ca7d4da2aa4f20c1",
"score": "0.62028295",
"text": "def update\n respond_to do |wants|\n if @feedback.update_attributes(params[:feedback])\n flash[:notice] = 'Model was successfully updated.'\n wants.html { redirect_to(@feedback) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "681a9bf432b1887e5b0d4fba2fd15e69",
"score": "0.61981505",
"text": "def update\n respond_to do |format|\n if @negative_feedback.update(negative_feedback_params)\n format.html { redirect_to @negative_feedback, notice: 'Negative feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @negative_feedback }\n else\n format.html { render :edit }\n format.json { render json: @negative_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c49117d02f1e8c419d5d06a9d8422890",
"score": "0.61974436",
"text": "def patch\n @enquiry_feedback_form = EnquiryFeedback.find(params[:id])\n @enquiry_feedback_form.update!(\n message: params[:enquiry_feedback][:message]\n )\n redirect_to '/export-opportunities/', notice: 'Thanks, your feedback has been recorded'\n end",
"title": ""
},
{
"docid": "f8d8c949f3a81dd8eea8f9e4789b5ff4",
"score": "0.61950976",
"text": "def update\n @validate = params[:commit] != \"Save as Draft\"\n respond_to do |format|\n @feedback.attributes = params[:feedback]\n if @feedback.save(:validate => @validate)\n format.html { execute_button_action(format) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fabbd44af7fe1e82fe6873aba465b70f",
"score": "0.61864084",
"text": "def update\n respond_to do |format|\n if @interviewerfeedback.update(interviewerfeedback_params)\n format.html { redirect_to @interviewerfeedback, notice: 'Interviewerfeedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @interviewerfeedback }\n else\n format.html { render :edit }\n format.json { render json: @interviewerfeedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6c33c51da3bda54973dbaf0e4608d8cd",
"score": "0.61819994",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n flash[:notice] = 'Feedback was successfully updated.'\n format.html { redirect_to(@feedback) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e7b2c092f75440ead6e47d58f95cd30",
"score": "0.61563337",
"text": "def update\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n if @customer_feedback.update_attributes(customer_feedback_params)\n format.html { redirect_to @customer_feedback, notice: 'Customer feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "66765e9e5687b1302cc1956005aa2b62",
"score": "0.6153094",
"text": "def update\n respond_to do |format|\n if @userfeedback.update(userfeedback_params)\n format.html { redirect_to @userfeedback, notice: 'Userfeedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @userfeedback }\n else\n format.html { render :edit }\n format.json { render json: @userfeedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb7efae2a3d149de5fe26ec85de929d0",
"score": "0.6136867",
"text": "def update\n respond_to do |format|\n if @patient_feedback.update(patient_feedback_params)\n format.html { redirect_to @patient_feedback, notice: \"Patient feedback was successfully updated.\" }\n format.json { render :show, status: :ok, location: @patient_feedback }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @patient_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d645941bdf9bdbc8dede98a457643d47",
"score": "0.61293805",
"text": "def update\n respond_to do |format|\n if @feedback.update(contact_params)\n format.html { redirect_to [@contact,@feedback], notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback }\n else\n format.html { render :edit }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7afa414aa545770906f88beacc91f760",
"score": "0.6097346",
"text": "def update\n respond_to do |format|\n if @feedback_comment.update(feedback_comment_params)\n format.html { redirect_to @feedback_comment, notice: 'Feedback comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback_comment }\n else\n format.html { render :edit }\n format.json { render json: @feedback_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "369edcbfd0414fe6b8509d7112b505fb",
"score": "0.60952765",
"text": "def update\n respond_to do |format|\n if @petition_client_satisfaction.update(petition_client_satisfaction_params)\n format.html { redirect_to @petition_client_satisfaction.petition, notice: 'Client feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @petition_client_satisfaction }\n else\n format.html { render :edit }\n format.json { render json: @petition_client_satisfaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "96d3d3eea7fce4382b186788be9c3d5f",
"score": "0.609272",
"text": "def submit\n @feedback = Feedback.find(params[:id])\n @feedback.submitted = true\n\n respond_to do |format|\n if @feedback.save\n format.html { redirect_to welcome_index_path, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fc6e1346c0024737fdfdc872e842a1f5",
"score": "0.60772306",
"text": "def update\n respond_to do |format|\n if @feedback_form.update(feedback_form_params)\n format.html { redirect_to @feedback_form, notice: 'Feedback form was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback_form }\n else\n format.html { render :edit }\n format.json { render json: @feedback_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b961768ab426262bce2dcaa9ffec353e",
"score": "0.6074563",
"text": "def update_feedback_and_notes(params)\n self.feedback_comment = params[:feedback_comment]\n self.private_note = params[:private_note]\n unless params[:feedback].blank?\n self.feedback = params[:feedback]\n end\n if self.has_feedback?\n self.feedback_updated_at = Time.now\n end\n self.save\n end",
"title": ""
},
{
"docid": "7bf97121eafb17c78cb7abfb0d84e8c0",
"score": "0.6071897",
"text": "def patch\n @enquiry_feedback_form = EnquiryFeedback.find(params[:id])\n\n @enquiry_feedback_form.update!(\n message: params[:enquiry_feedback][:message]\n )\n redirect_to '/', notice: 'Thanks, your feedback has been recorded'\n end",
"title": ""
},
{
"docid": "3f845f56c7cdbdaf5cc17b1741cbee56",
"score": "0.60324895",
"text": "def update\n respond_to do |format|\n if @feedback_for_meal.update(feedback_for_meal_params)\n format.html { redirect_to @feedback_for_meal, notice: 'Feedback for meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback_for_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85082606343ba99d1726fcd063d55304",
"score": "0.5977064",
"text": "def update\n respond_to do |format|\n if @feedback_item.update(feedback_item_params)\n format.html { redirect_to @feedback_item, notice: 'Feedback item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feedback_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dcd6bc9fa1ec1f120610c2fec8ea9171",
"score": "0.5976598",
"text": "def update\n respond_to do |format|\n if @feedback_message.update(feedback_message_params)\n format.html { redirect_to @feedback_message, notice: 'Feedback message was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback_message }\n else\n format.html { render :edit }\n format.json { render json: @feedback_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0ce947b8fa820651b4878f3dd2abd41d",
"score": "0.5963668",
"text": "def update\n \n if @feedback.update(feedback_params)\n redirect_to @feedback, notice: 'Feedback was successfully updated.'\n else\n render :edit\n end\n end",
"title": ""
},
{
"docid": "e6168cf82e332632bbc7ab6d74c85c2d",
"score": "0.59598845",
"text": "def update\n @feedback = Feedback.find(params[:id])\n\n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n Workstream.register_user_action(@company.id, @current_user.id, request.remote_ip,\n \" support voted as #{@feedback.vote}\", \"updated\", @current_user.branch_id)\n format.html { redirect_to(@feedback, :notice => 'Feedback was successfully updated.') }\n format.xml { head :ok }\n else\n @menu = \"Feedback\"\n @page_name = \"User Feedback\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "359211ba5b0f17dabe07a5abafa0ee9f",
"score": "0.5959679",
"text": "def update\n @feedback_vote = FeedbackVote.find(params[:id])\n\n respond_to do |format|\n if @feedback_vote.update_attributes(params[:feedback_vote])\n format.html { redirect_to @feedback_vote, notice: 'Feedback vote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feedback_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ca13ade387b466efeb7edf9c66bf4a0",
"score": "0.59538025",
"text": "def update\n respond_to do |format|\n if @admin_feedback.update(admin_feedback_params)\n @admin_feedbacks = Admin::Feedback.paginate(:page => params[:page])\n format.html { redirect_to @admin_feedback, notice: 'Feedback was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_feedback }\n format.js { render :layout => false }\n else\n format.html { render :edit }\n format.json { render json: @admin_feedback.errors, status: :unprocessable_entity }\n format.js { render :layout => false }\n end\n end\n end",
"title": ""
},
{
"docid": "bb1fd14aa4124ede6d16b84f92f174f6",
"score": "0.5925248",
"text": "def update\n @feedback = Feedback.find(params[:id]) \n if current_user.feedbacks.exists?(@feedback.id) && Time.now-@feedback.created_at < 3600 #write something here that checks how old feedback is \n respond_to do |format|\n if @feedback.update_attributes(params[:feedback])\n @updated = true\n format.html { redirect_to root_path, notice: 'Feedback was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n @updated = false\n format.html { redirect_to edit_feedback_path(@feedback.id), notice: \"Errors prevented your edits from being saved\" }\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n format.js \n end\n end\n else\n redirect_to root_path, notice: \"You don't have permission to do that\"\n end\n end",
"title": ""
},
{
"docid": "488dddce2982772fb9c11b20aee6fd80",
"score": "0.59046775",
"text": "def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n \n \n # adds a create event to the board feed\n feed = Feed.new\n \n feed.message = \"Updated\" + @feature.title\n feed.feature_id = @feature.id\n feed.user_id = current_user.id\n feed.doc_id = @feature.parent_doc_list[0]\n feed.feedtype = \"Feature update\" \n feed.save\n \n \n # email notificaiton\n doc = Doc.find(@feature.parent_doc_list[0])\n @followers = doc.followers\n\n @followers.each do |f|\n user = current_user\n send_to_user = f\n # Tell the UserMailer to send a welcome Email after save\n #UserMailer.comment_email(user, doc, feature, comment).deliver\n UserMailer.section_email(user, doc, @feature, send_to_user).deliver\n end\n \n format.html { redirect_to @feature, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1ad70a742799d87076535e0b8aaf9d8",
"score": "0.5903895",
"text": "def update\n @feedback_note = @feedback.feedback_notes.find(params[:id])\n\n respond_to do |format|\n if @feedback_note.update_attributes(params[:feedback_note])\n flash[:notice] = 'FeedbackNote was successfully updated.'\n format.html { redirect_to(@feedback_note) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @feedback_note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.5899424",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.5899424",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "dfcb255734d0fafb88f9d88935ac6115",
"score": "0.5857335",
"text": "def feedback_params\n params.require(:feedbacks).permit(:feedback)\n end",
"title": ""
},
{
"docid": "6c3842d14b4c2e5f777943289cf074e3",
"score": "0.58489704",
"text": "def update\n respond_to do |format|\n original_date = @review.feedback_deadline.to_s(:short_date)\n if @review.update_attributes(params[:review])\n message = \"Review was successfully updated.\"\n if feedback_deadline_changed?(original_date)\n message = \"Review was updated. Your invitees have been notified of the new feedback deadline.\"\n notify_stakeholders(@review)\n end\n flash[:success] = message\n\n format.html { redirect_to @review }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d7b70cfda8ccdddc3ab831503872ba15",
"score": "0.5843927",
"text": "def create\n @feedback = Feedback.new(feedback_params)\n\n respond_to do |format|\n if @feedback.save\n format.json { render json: @feedback, status: :created, location: api_feedback_url(@feedback) }\n else\n format.json { render json: @feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "93aef2cbd851ba11efb9c6c0aea1a809",
"score": "0.5842391",
"text": "def feedback_params\n params.require(:feedback).permit(:title, :survey_type, :survey_url, :representative_profile_id)\n end",
"title": ""
},
{
"docid": "9b773faa1fd011157e7e2498176fc2bf",
"score": "0.5842114",
"text": "def feedback_params\n params.require(:feedback).permit(:user_id, :text, :response, :response_username, :created_at, :updated_at)\n end",
"title": ""
},
{
"docid": "95b4a76f2344776437a30fc90a8e6136",
"score": "0.58388126",
"text": "def update\n @prov_feedbacks = ProvFeedbacks.find(params[:id])\n\n respond_to do |format|\n if @prov_feedbacks.update_attributes(params[:prov_feedbacks])\n flash[:notice] = 'Feedback was successfully updated.'\n format.html { redirect_to edit_prov_feedback_path(@prov_feedbacks) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prov_feedbacks.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "7bce9cddf0eb3361c5ef86c7af02baec",
"score": "0.5821248",
"text": "def set_feedback\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "238578b4fd11c7b315cff44a0d0d4dca",
"score": "0.58136374",
"text": "def feedback_params\n params.require(:feedback).permit(:given_to_id, :given_by_id, :fluency, :vocabulary, :grammar,\n :notes)\n end",
"title": ""
},
{
"docid": "ebfb536cb9686ff4150eb20e3fedf0ed",
"score": "0.5813442",
"text": "def set_feedback\r\n @feedback = Feedback.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "aff9d9dd9159fff11ff3604343c6afad",
"score": "0.5804872",
"text": "def update\n @maintain_customer_feedback = Maintain::CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n if @maintain_customer_feedback.update_attributes(params[:maintain_customer_feedback])\n format.html { redirect_to @maintain_customer_feedback, notice: 'Customer feedback was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @maintain_customer_feedback.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "87d21b994c61225bb6f22397b5dddcc6",
"score": "0.5802394",
"text": "def feedback_params\n params.require(:feedback).permit(:meet_needs_answer, :suggestions, :challenges)\n end",
"title": ""
},
{
"docid": "b015fe04ed4121b31e7342d73ca7e9ba",
"score": "0.579375",
"text": "def feedback_params\n params.require(:feedback).permit(:user_id, :title, :description, :status)\n end",
"title": ""
},
{
"docid": "0bf9cf654e65373a11756810a1e8c42f",
"score": "0.578893",
"text": "def edit\n @feedback = Feedback.find(params[:id])\n end",
"title": ""
},
{
"docid": "5fd5f00640bdb0c785bcac4689a46f3c",
"score": "0.57827806",
"text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end",
"title": ""
},
{
"docid": "cc5b0b51ba74362d9ef3f6be8f0659e3",
"score": "0.57818747",
"text": "def update\n respond_to do |format|\n if @feedback_section.update(feedback_section_params)\n format.html { redirect_to @feedback_section, notice: 'Feedback section was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback_section }\n else\n format.html { render :edit }\n format.json { render json: @feedback_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7d9787d538d28b76f26f59d3c59d9dc",
"score": "0.5780729",
"text": "def update\n current_user = warden.authenticate(scope: :user)\n set_feedback_for_update\n render json: {errors: [\"Feedback not found.\"]}, status: :not_found and return if @feedback.nil?\n expiry_time = GlobalSetting.where(setting_name: 'feedback_expiry_time').first.setting_value.to_i\n\n render json: {errors: [\"Code expired\"]}, status: :unprocessable_entity and return if((Time.zone.now - @feedback.created_at ) > expiry_time.minutes)\n if current_user.nil?\n if @feedback.update(feedback_params)\n @feedback.completed = true\n @feedback.save\n render json: {points: @feedback.points, outlet_name: @feedback.outlet.name, outlet_location: @feedback.outlet.address}, status: :ok\n else\n render json: {errors: @feedback.errors.full_messages}, status: :unprocessable_entity\n end\n else\n Feedback.transaction do\n authorize! :create, Feedback\n points = @feedback.points\n outlet = @feedback.outlet\n outlet_points_before = outlet.rewards_pool\n user_points_before = current_user.points_available\n code_before = @feedback.code\n outlet.add_points_to_rewards_pool(points)\n current_user.update_points_and_feedbacks_count(points)\n @feedback.rewards_pool_after_feedback = outlet.rewards_pool\n @feedback.user_points_after_feedback = current_user.points_available\n @feedback.user = current_user\n @feedback.code = nil\n @feedback.completed = true\n unless current_user.interacted_before?(outlet)\n @feedback.first_interaction = true\n end\n if @feedback.update(feedback_params)\n FeedbackLog.create({customer_id: outlet.customer_id, outlet_id: outlet.id, outlet_name: outlet.name, feedback_id: @feedback.id,\n user_id: current_user.id, user_first_name: current_user.first_name, user_last_name: current_user.last_name, user_email: current_user.email,\n code: code_before, points: @feedback.points, outlet_points_before: outlet_points_before, outlet_points_after: outlet.rewards_pool,\n user_points_before: user_points_before, user_points_after: current_user.points_available })\n render json: {points: @feedback.points, outlet_name: outlet.name, outlet_location: outlet.address}, status: :ok\n else\n render json: {errors: @feedback.errors.full_messages}, status: :unprocessable_entity\n end\n end\n end\n end",
"title": ""
},
{
"docid": "97ab0785fa128e87fecff229678a047b",
"score": "0.5780175",
"text": "def update\n respond_to do |format|\n if @feedback_assignment.update(feedback_assignment_params)\n format.html { redirect_to @feedback_assignment, notice: 'Feedback assignment was successfully updated.' }\n format.json { render :show, status: :ok, location: @feedback_assignment }\n else\n format.html { render :edit }\n format.json { render json: @feedback_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a850d54a8092e24107e03db46fb256a0",
"score": "0.5780122",
"text": "def update\n @deletion_feedback = DeletionFeedback.find(params[:id])\n\n respond_to do |format|\n if @deletion_feedback.update_attributes(params[:deletion_feedback])\n format.html { redirect_to(@deletion_feedback, :notice => 'Deletion feedback was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deletion_feedback.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f95ab0a2696bf0149faa1a3eec99acad",
"score": "0.5777488",
"text": "def update\n if @feedback.update(feedback_params)\n redirect_to booking_path(@feedback.booking), notice: 'Takk for tilbakemeldingen!'\n else\n redirect_to booking_path(@feedback.booking), notice: 'Klarte ikke å lagre tilbakemeldingen. Prøv igjen senere.'\n end\n end",
"title": ""
},
{
"docid": "2fb7b4c1e990872af0f68ca7692295be",
"score": "0.57711834",
"text": "def update\n respond_to do |format|\n # example_params = {\"lifted\"=>\"1\"}\n # p \"vt.Patch.update: Time.now=#{Time.now}\"\n # example_params['lifted_at'] = Time.now\n # example_params = {:def => 8}\n # example_params = {:lift_code => 8}\n # example_params['lifted_at'] = 'hi'\n # example_params['lift_code'] = 6\n # example_params[\"abc\"] = \"bye\"\n # example_params[\"abc\"] = \"bye\"\n p \"vt.Patch.update: example_params=#{example_params}\"\n # p \"vt.Patch.update: example_params[:lifted]=#{example_params[:lifted]}\"\n # p \"vt.Patch.update: example_params[:lifted_at]=#{example_params[:lifted_at]}\"\n # p \"vt.Patch.update: example_params[:abc]=#{example_params[:abc]}\"\n # @example.reload\n # By touching the record we force udpates even if the value is unchanged.\n # We need this because we have triggers on some fields e.g 'lifted'\n # that causes 'lifted_at' to get updated. We want 're-lifts' to force\n # 'lifted_at' to get updated, so we need \"redundant\" updates to actually\n # be performed. Probably not a good idea on a high-performance db, but\n # hopefully not too big a deal on this small db.\n # @example.touch\n if @example.update(example_params)\n # if @example.update(lift_code: 18, lift_score: 20)\n format.html { redirect_to @example, notice: 'Example was successfully updated.' }\n format.json { render :show, status: :ok, location: @example }\n else\n format.html { render :edit }\n format.json { render json: @example.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "651f5ae86d16563387d760563ac74fdc",
"score": "0.57710797",
"text": "def update\n respond_to do |format|\n if @assignfeedback_file.update(assignfeedback_file_params)\n format.html { redirect_to @assignfeedback_file, notice: 'Assignfeedback file was successfully updated.' }\n format.json { render :show, status: :ok, location: @assignfeedback_file }\n else\n format.html { render :edit }\n format.json { render json: @assignfeedback_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "79c25c8b666a4b151906aae0cd2fdf33",
"score": "0.57675153",
"text": "def set_feedback\n @feedback = Feedback.where(id: params[:id]).first\n end",
"title": ""
}
] |
59680d95ab2dee54edc31d1c803b09cb
|
1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = 2640. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
|
[
{
"docid": "87d73bb1db982a3c6143c4e683c05b72",
"score": "0.0",
"text": "def sum_of_squares( range )\n range.inject(0){ |sum, i| sum + i**2 }\nend",
"title": ""
}
] |
[
{
"docid": "978b7cd00819d4961d7b5be41889c4bd",
"score": "0.82670116",
"text": "def p6\n ans = ( ((1..100).inject(:+) )**2 ) - ( (1..100).reduce { |sum, n| sum += n**2 } )\n puts \"The difference between the sum of the squares of the first \"\\\n \"one hundred natural numbers and the square of the sum is: \"\\\n \"#{ans}.\"\n end",
"title": ""
},
{
"docid": "44a77ea75517a0101178514f5ad97948",
"score": "0.783762",
"text": "def sum_square_difference(number)\n sum_square = (1..number).reduce(:+) ** 2\n sqaure_sum = (1..number).reduce { |sum, i| sum + i ** 2 }\n sum_square - sqaure_sum\nend",
"title": ""
},
{
"docid": "e85108c53798f60d4ccd360b524fe560",
"score": "0.781957",
"text": "def sum_square_difference\n numbers = (1..100).to_a\n (numbers.inject(:+) ** 2) - (numbers.map { |num| num ** 2 }.inject(:+) )\nend",
"title": ""
},
{
"docid": "8232a8ecfabc1e38f7d9a148ac4a3b26",
"score": "0.7790245",
"text": "def sum_square_difference(num)\n sum_square = ((1..num).sum) **2\n square_sum = (1..num).reduce { |sum, n| sum += n **2 }\n (sum_square - square_sum).abs\nend",
"title": ""
},
{
"docid": "5513f296bd9e285600d0964cebcef5fc",
"score": "0.7746074",
"text": "def sum_square_difference(int) \n numbers = (1..int)\n sum_square = (numbers.sum) ** 2\n squares_sum = numbers.reduce() { |total, num| num**2 + total }\n\n sum_square - squares_sum\nend",
"title": ""
},
{
"docid": "87ade6cbe6d1b6956fbcb926ce000641",
"score": "0.7644199",
"text": "def sum_square_difference(num)\n sum = (1..num).reduce(&:+) ** 2\n square = (1..num).reduce(0) { |sum, n| sum += n ** 2 }\n sum - square\nend",
"title": ""
},
{
"docid": "6fb97ad3c00cb9fa317f2b1518c28cab",
"score": "0.76402116",
"text": "def sum_square_difference(num)\n(1..num).reduce(&:+) ** 2 - (1..num).map {|num| num ** 2}.reduce(&:+)\nend",
"title": ""
},
{
"docid": "f4a5ae2de3b6763864cda8dabc8da727",
"score": "0.7603391",
"text": "def sum_square_difference(num)\n square_sum = (1..num).reduce(&:+) ** 2\n sum_squares = (1..num).map { |item| item ** 2 }.reduce(&:+)\n square_sum - sum_squares\nend",
"title": ""
},
{
"docid": "0e5d476ca70edf5fc202f7ab0ea9b9d6",
"score": "0.75925153",
"text": "def sum_square_difference(number)\n sum = (1.upto(number).reduce(:+))**2\n sum_of_squares = (1.upto(number).reduce(0){ |sum, i| sum += i**2 })\n sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "65c34bd4baef871d753b95189ffb6dfb",
"score": "0.7583788",
"text": "def sum_square_difference(num)\n sum = 0\n squares = 0\n 1.upto(num) do |number|\n sum += number\n squares += number ** 2\n end\n (sum ** 2) - squares\nend",
"title": ""
},
{
"docid": "5b3fb63952d93387d4a879e5c7befae6",
"score": "0.7555618",
"text": "def sum_square_difference(num)\n\t(1..num).reduce(:+)**2 - (1..num).to_a.map{|i|i*i}.reduce(:+)\nend",
"title": ""
},
{
"docid": "53ce44ed0b89d3d17e216c3b84e877ee",
"score": "0.75391155",
"text": "def sum_square_difference(num)\n sum_of_squares = (1..num).to_a.map {|num| num ** 2}.reduce(:+)\n square_of_sums = (1..num).reduce(:+) ** 2\n square_of_sums - sum_of_squares\nend",
"title": ""
},
{
"docid": "ae02a9907f231b2afa82e2787cbe46f6",
"score": "0.7512122",
"text": "def sum_square_difference(number)\n digits = []\n squares = []\n\n 1.upto(number) do |num|\n digits << num\n squares << num**2\n end\n\n (digits.sum)**2 - squares.sum\nend",
"title": ""
},
{
"docid": "03b21faf8f85eca86d55fbcd89fd6d97",
"score": "0.7506495",
"text": "def problem_six\n\t# Square first 100 numbers\n\tsquare = [ ]\n\t1.upto(100).each do |x|\n\t\tsquare << x ** 2 \n\tend\n\n\t# Add those square numbers\n\tsquare_sum = 0\n\tsquare.each do |y|\n\t\tsquare_sum += y\n\tend\n\t\n\t# Add first 100 numbers\n\tsum = 0\n\t1.upto(100).each do |n|\n\t\tsum += n\n\tend\n\n\t# Square sum of 100 numbers\n\tsum_square = sum ** 2\n\n\t# Find the difference\n\tdifference = sum_square - square_sum\n\treturn difference\n\nend",
"title": ""
},
{
"docid": "4e42c7e478561c3f788dde0295140bbf",
"score": "0.75032055",
"text": "def sum_square_difference(num)\n integers = (1..num).to_a\n integers.reduce(:+)**2 - integers.reduce(0) { |sum, n| sum += n**2 }\nend",
"title": ""
},
{
"docid": "4f56e84207936172f65de23e23deeccc",
"score": "0.74545556",
"text": "def sum_square_difference(number)\n arr = (1..number).to_a\n sum_square = arr.inject(:+) ** 2\n square_sum = arr.map { |e| e ** 2 }.inject(:+)\n sum_square - square_sum\nend",
"title": ""
},
{
"docid": "1c2bde18c186484f94ef9f0c7f5c5868",
"score": "0.7448163",
"text": "def sum_square_difference_2\n # Sum of consecutive squares (1..N) = N * (N + 1) * (2N + 1) / 6\n sum_of_squares = 100 * 101 * 201 / 6\n # Sum of consecutive numbers = N * (N + 1) / 2\n sum = 100 * 101 / 2\n square_of_sum = sum * sum\n return square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "2a30ab176ed9cf72531487dd19cd7279",
"score": "0.74244547",
"text": "def sum_square_difference(number)\n array = (1..number).to_a\n squares = []\n array.each do |element|\n squares << element**2\n end\n difference = (array.sum**2) - squares.sum\n end",
"title": ""
},
{
"docid": "050e88aac377c707b99893fdbc72fc20",
"score": "0.7419",
"text": "def sum_square_difference(number)\n array = (1..number).to_a\n sum = 0\n sum_of_squares = 0\n square_of_sum = sum ** 2\n array.each do |num|\n sum += num\n sum_of_squares += num ** 2\n end\n return square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "10851c535d4144a75aba359f85b9d7c9",
"score": "0.7413685",
"text": "def sum_square_difference(n)\n numbers = (1..n).to_a\n square_of_sums = numbers.inject(:+) ** 2\n sum_of_squares = numbers.map { |n| n ** 2 }.inject(:+)\n square_of_sums - sum_of_squares\nend",
"title": ""
},
{
"docid": "7f219235a9a323b4a19c8ee2fd7d31eb",
"score": "0.74012566",
"text": "def sum_square_difference(n)\n sum = 0\n sum_square = (1.upto(n).reduce(:+))\n (1..n).each { |n| sum += n ** 2 }\n sum_square**2 - sum\nend",
"title": ""
},
{
"docid": "1abf39fd8c63cf097efb25ee09bac040",
"score": "0.73972785",
"text": "def sum_square_difference(num)\n num_list = (1..num).to_a\n square_of_sum = num_list.sum**2\n sum_of_squares = num_list.map { |n| n**2 }.sum\n\n square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "b48af282639b9826b74b441f3b137f77",
"score": "0.7381684",
"text": "def sum_square_difference(number)\n sum = (1..number).to_a.inject(:+)\n square_of_sum = sum ** 2\n sum_of_squares = 0\n 1.upto(number) do |index|\n sum_of_squares += index ** 2\n end\n \n square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "e92857c70d5aa100664e694c9a39f9b9",
"score": "0.73499185",
"text": "def sum_square_difference(int)\n (1..int).sum ** 2 - (1..int).map { |i| i ** 2 }.sum\nend",
"title": ""
},
{
"docid": "885b5713c1de1a46c4219c30930b6b81",
"score": "0.7348187",
"text": "def sum_square_difference(num)\n sum_square = ((1..num).inject(:+))**2\n \n square_sum = (1..num).map {|num| num**2}.inject(:+)\n\n sum_square - square_sum\nend",
"title": ""
},
{
"docid": "8ec0adf53f93e6f78fe94387ebef5448",
"score": "0.73473275",
"text": "def sum_square_difference(n)\n ((1..n).inject(:+)) ** 2 - (1..n).inject {|sum, n| sum + (n ** 2)}\nend",
"title": ""
},
{
"docid": "214a17adb47fab67c370b4356bc75cdc",
"score": "0.7337752",
"text": "def sum_square_difference(int)\n sq_sums = ((1..int).reduce(:+) * (1..int).reduce(:+))\n sum_sqs = (1..int).reduce {|square, num| square + (num * num)}\n sq_sums - sum_sqs\nend",
"title": ""
},
{
"docid": "339d0c488375f97de413bc4583563923",
"score": "0.73351485",
"text": "def sum_square_dif(n)\r\n ((1..n).inject(1) {|acc, num| acc + num } ** 2) - (1..n).inject(1) {|acc, num| acc + (num ** 2) } \r\nend",
"title": ""
},
{
"docid": "8969107a66d57469230e36e5ff24041a",
"score": "0.7330399",
"text": "def natural_numbers\nsquare_of_sums = []\n#TOTAL for sum of squares\nsum_of_squares = []\n\nfor x in (1..100) \n square_of_sums << x**2\nend\n\nfor x in (1..100)\n sum_of_squares << x\nend\n #print square_of_sums\n #puts \"\"\n #print sum_of_squares\n\n result = ((sum_of_squares.inject(0) { |r, e| r + e })**2) - \n (square_of_sums.inject(0) { |r, e| r + e })\n puts result \n\nend",
"title": ""
},
{
"docid": "48df8224ab918fb79014372c49ea1563",
"score": "0.7325914",
"text": "def sum_square_difference(num)\n square_sum(num) - sum_square(num)\nend",
"title": ""
},
{
"docid": "93739a93c091e87cb101798cc9f1e6d1",
"score": "0.7320995",
"text": "def difference()\n num = 1\n sum_of_squares = 0\n subtotal = 0\n square_of_sums = 0\n difference = 0\n while num <= 100\n sum_of_squares += num ** 2\n num += 1\n end\n # p sum_of_squares\n num = 1\n while num <= 100\n subtotal += num\n num += 1\n end\n # p subtotal\n square_of_sums = subtotal ** 2\n # p square_of_sums\n difference = square_of_sums - sum_of_squares\n p difference\nend",
"title": ""
},
{
"docid": "5aa78033953396e76e284fae9e8d3799",
"score": "0.7311257",
"text": "def sum_square_difference(n)\n square_sum = (1..n).sum ** 2\n sum_squares = (1..n).reduce(0) { |sum, num| sum += num ** 2}\n square_sum - sum_squares\nend",
"title": ""
},
{
"docid": "cd3d549d16efcadc6f45032eef509547",
"score": "0.73074806",
"text": "def difference_of_squares(n)\n\n# square of the sum of numbers\n sum1 = 0\n (1..n).to_a.each do |num|\n sum1 += num\n end\n sum1 = sum1**2\n\n# the sum of the squares of numbers\n\n sum2 = 0\n (1..n).to_a.each do |num|\n sum2 += (num**2)\n end\n\n return sum1-sum2\nend",
"title": ""
},
{
"docid": "91b7f6bac15648bbc64de75f78a3e554",
"score": "0.7298272",
"text": "def sum_square_difference(n)\n sum_square = (1..n).reduce(:+)**2\n square_sum = (1..n).reduce { |total, num| total += num**2 }\n\n sum_square - square_sum\nend",
"title": ""
},
{
"docid": "517b620a8ab5b35a3bddaf9063535cd4",
"score": "0.7290986",
"text": "def sum_square_diff(n)\r\n (1..n).reduce(:+)**2 - (1..n).map { |num| num**2}.reduce(:+)\r\nend",
"title": ""
},
{
"docid": "2b9c10974584e21415d86e4550f0481e",
"score": "0.72899604",
"text": "def sum_square_difference(n)\n square_of_sum = (1..n).sum ** 2\n sum_of_squares = (1..n).map { |i| i ** 2 }.sum\n square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "7b6036dc677e52b5e0708298fbbe2124",
"score": "0.7278319",
"text": "def sum_square_difference(num)\n sum = 0\n each_squared = 0\n num_range = (1..num).to_a\n num_range.each do |num|\n sum += num\n each_squared += num **2\n end\n sum_squared = sum ** 2\n sum_squared - each_squared\nend",
"title": ""
},
{
"docid": "a57e5e06a5a0ba058d52ecb00762e14b",
"score": "0.7277107",
"text": "def diff_sum_of_squares_square_of_sum(x)\n sum_of_squares, square_of_sum = 0, 0\n\n (1..x).each do |i|\n sum_of_squares += i * i\n square_of_sum += i\n end\n\n (square_of_sum * square_of_sum) - sum_of_squares\nend",
"title": ""
},
{
"docid": "ef54dd705edc98a9eebb66c18575e939",
"score": "0.7274446",
"text": "def sum_square_difference(n)\n sum_square = (1..n).sum**2\n square_sum = (1..n).map { |num| num**2 }.sum\n\n sum_square - square_sum\nend",
"title": ""
},
{
"docid": "915fbca11e59fe6bf48032cfca9ee4e9",
"score": "0.7271041",
"text": "def square_of_sum\n (@first_hundred.inject(0) { |result, element| result + element }) ** 2\n end",
"title": ""
},
{
"docid": "48dbb257135ff6244bf6fe0f669e1633",
"score": "0.7263504",
"text": "def sum_square_difference(number)\n array_all_numbers = []\n\n 1.upto(number) do |n|\n array_all_numbers << n\n end\n sum_of_squares_arr = array_all_numbers.map { |num| num**2 }.reduce(:+)\n\n array_all_numbers.sum**2 - sum_of_squares_arr\nend",
"title": ""
},
{
"docid": "9cf357c90a3bfc2927c89ac4e6a7d4bb",
"score": "0.72585934",
"text": "def sum_square_difference(number)\n sum_squared(number) - squared_sum(number)\nend",
"title": ""
},
{
"docid": "b6333642a780cf4f182178bb5a426d93",
"score": "0.7258129",
"text": "def sum_square_difference(n) \n (1..n).inject(:+)**2 - (1..n).map { |num| num**2 }.inject(:+)\nend",
"title": ""
},
{
"docid": "e43d81bfee1d182526acc67b968faea5",
"score": "0.72519284",
"text": "def sum_square_difference(max)\n sum_of_squares = 1\n sum = 1\n (2..max).each do |num|\n sum += num\n sum_of_squares += num * num\n end\n square_of_sum = sum * sum\n square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "1486c856c49196dcef31210b0b774409",
"score": "0.72499293",
"text": "def sum_of_squares\n @first_hundred.inject(0) { |result, element| result + element ** 2 }\n end",
"title": ""
},
{
"docid": "b2bff16bbcc943791d1355bf9d388e4c",
"score": "0.72327745",
"text": "def sum_square_difference(num)\n arr = (1..num).to_a\n arr.sum ** 2 - arr.map { |int| int**2 }.sum\nend",
"title": ""
},
{
"docid": "3482c12199bb4ad938bf7978967b9677",
"score": "0.72273207",
"text": "def sum_square_difference_v2(n)\n sum_of_n = (n * (n + 1))/2\n sum_of_n_squared = (n * (n + 1) * ( 2*n + 1))/ 6\n (sum_of_n ** 2 - sum_of_n_squared)\nend",
"title": ""
},
{
"docid": "300214bd9e2f01a66103267e8fcd3a5f",
"score": "0.7227019",
"text": "def sum_square_difference(n)\n square_sum = (1..n).sum ** 2\n sum_of_squares = (1..n).map{|ele| ele**2}.sum\n square_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "bc9c215e12f25a4e9d633cc49ed1c224",
"score": "0.7226141",
"text": "def sum_square_difference(num)\n set = (1..num).to_a\n sum_of_squares = 0\n sum_of_numbers = 0\n set.each do |x|\n sum_of_squares += x * x\n sum_of_numbers += x\n end\n\n return (sum_of_numbers * sum_of_numbers) - sum_of_squares\nend",
"title": ""
},
{
"docid": "96830f5644be954031998a79f9f1d4ee",
"score": "0.71996206",
"text": "def sum_square_difference(n)\n sum_of_ns = 0\n sum_of_squares = 0\n 1.upto(n) do |i|\n sum_of_ns += i\n sum_of_squares += i * i\n end\n (sum_of_ns * sum_of_ns) - (sum_of_squares)\nend",
"title": ""
},
{
"docid": "16ac22df7252330bcbffd535583599c2",
"score": "0.7191853",
"text": "def sum_square_difference(n)\n return 0 if n < 0\n numbers_to_n = []\n 1.upto(n) do |num|\n numbers_to_n << num\n end\n \n square_of_sum = numbers_to_n.reduce(:+)**2\n integers_to_n_squared = numbers_to_n.map { |num| num**2 }\n sum_of_square = integers_to_n_squared.reduce(:+)\n \n square_of_sum - sum_of_square\nend",
"title": ""
},
{
"docid": "fc82c693d31eaf2cc84247e387672d5d",
"score": "0.7175856",
"text": "def difference_of_squares(n)\n\tsum_of_squares = (1..n).map { |natural_num| natural_num ** 2 }.reduce(:+)\n\tsquare_of_sum = (1..n).reduce(:+) ** 2\n\n\tsquare_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "df28a5f90b02f6aad5652615f56d0fed",
"score": "0.71745586",
"text": "def sum_square_difference(int)\n sum_of_squares = 0\n square_of_sum = 0\n 1.upto(int) do |i|\n sum_of_squares += (i ** 2)\n square_of_sum += i\n end\n square_of_sum**2 - sum_of_squares\nend",
"title": ""
},
{
"docid": "6ee43fe842884343af590766e8b0b4c8",
"score": "0.7173712",
"text": "def sum_square_difference(number)\n array = []\n 1.upto(number) do |num|\n array << num\n end\n \n squares = array.map do |num|\n num*num\n end\n\n (array.reduce(:+))**2 - squares.reduce(:+)\nend",
"title": ""
},
{
"docid": "f25800c059056ddd0d115c3fab3186fd",
"score": "0.71673524",
"text": "def sum_square_difference(n)\n n_array = (1..n).to_a\n sum_square = n_array.inject(:+) ** 2\n square_sum = n_array.inject(0) {|sum, num| sum + num ** 2 }\n sum_square - square_sum\nend",
"title": ""
},
{
"docid": "6ee0a8873fc3522bbb88c788f52ad85d",
"score": "0.7150629",
"text": "def sum_square_diff(num)\n num1 = 0\n sum_of_squares = (num + 1).times {|x| num1 += x ** 2 }\n \n num2 = 0\n square_of_sums = (num + 1).times {|x| num2 += x }\n square = num2 ** 2\n \n return square - num1\nend",
"title": ""
},
{
"docid": "59e5ad1faf4c699df40525174fb08dac",
"score": "0.71473616",
"text": "def find_difference(n)\n sq_sum = (n * (n + 1) / 2)**2\n sum_sqs = (n * (2 * n + 1) * (n + 1)) / 6\n sq_sum - sum_sqs\nend",
"title": ""
},
{
"docid": "488865198b121c5e85f583b4d3a6e1ac",
"score": "0.714525",
"text": "def difference_of_squares(x)\n square_of_sum = (1..x).reduce(:+) ** 2\n sum_of_squares = (1..x).reduce { |sum, number| sum + (number ** 2) }\n\n square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "937465c6526600b021ff3d7f507a4909",
"score": "0.71398807",
"text": "def sum_square_difference(num)\n sum = 0\n square = 0\n 1.upto(num) do |x|\n sum += x\n square += x**2\n end\n sum**2 - square\nend",
"title": ""
},
{
"docid": "f8fd3cc5d6b3646ec12f7e381443b544",
"score": "0.71377295",
"text": "def sum_square_difference(num)\n sums = 0\n squares = 0\n \n 1.upto(num) do |value|\n sums += value\n squares += value**2\n end\n sums**2 - squares\nend",
"title": ""
},
{
"docid": "78caacca5b8f1dc759f1d9e18bebc51a",
"score": "0.71323925",
"text": "def sum_square_difference(integer)\n range = (1..integer).to_a\n square_of_sums = range.reduce(:+) ** 2\n sum_of_squares = range.map {|element| element ** 2}\n square_of_sums - sum_of_squares.reduce(:+)\nend",
"title": ""
},
{
"docid": "8f42ce4a86fcceada1c4754f9c5f9e44",
"score": "0.7129774",
"text": "def sum_square_difference(int)\n sum = 0\n squared_sums = 0\n 1.upto(int) { |num| sum += num }\n 1.upto(int) { |num| squared_sums += num**2 }\n\n sum **= 2\n sum - squared_sums\nend",
"title": ""
},
{
"docid": "b882105123ad11a7c0964382c8678ca8",
"score": "0.71186537",
"text": "def sum_square_difference(n)\n sum_of_squares = 0\n sum = 0\n\n n.times do |i|\n i = i + 1\n sum += i\n sum_of_squares += i**2\n end\n\n (sum_of_squares - sum**2).abs\nend",
"title": ""
},
{
"docid": "03ca43e64a645d861c04e4764994e034",
"score": "0.71179634",
"text": "def sum_square_difference(n)\n array = (1..n).to_a\n square_of_sums = (array.reduce(:+))**2\n sum_of_squares = array.map { |n| n**2 }.reduce(:+)\n square_of_sums - sum_of_squares\nend",
"title": ""
},
{
"docid": "a76553304bb111ffbbc67f34551d18ad",
"score": "0.70988184",
"text": "def square_difference(n)\n return square_of_sum(n) - sum_of_squares(n)\nend",
"title": ""
},
{
"docid": "45351b0cd242419e46196b545346bc71",
"score": "0.709562",
"text": "def difference_between_sum_of_squares limit\n\tsquares = (1..limit).map { |i| i ** 2 }\n\tsum_of_squares = squares.inject(:+)\n\tsum = (1..limit).inject(:+)\n\tsquare_of_sums = sum ** 2\n\n\tsquare_of_sums - sum_of_squares\nend",
"title": ""
},
{
"docid": "024f34e4c5f652fa9c9c94ed4ae3d321",
"score": "0.70945805",
"text": "def sum_square_difference(n)\n array = (1..n).to_a\n square_of_sum = array.reduce(:+)**2\n sum_of_squares = array.reduce(0){ |squares, el| squares + el**2 }\n square_of_sum - sum_of_squares\nend",
"title": ""
},
{
"docid": "7c4099e292e65279648faa723f7225e8",
"score": "0.7085442",
"text": "def sum_square_difference(n)\n sum_of_integers = 0\n sum_of_squared_integers = 0\n\n for current_num in 0..n\n sum_of_integers += current_num\n sum_of_squared_integers += current_num**2\n end\n sum_of_integers**2 - sum_of_squared_integers\nend",
"title": ""
},
{
"docid": "531d8970c76d8bcd4aafb0acb35afdec",
"score": "0.70723265",
"text": "def sum_square_difference(n)\n sum = 0\n sum_of_sq = 0\n 1.upto(n) do |current_num|\n sum += current_num\n end\n 1.upto(n) do |current_num|\n sum_of_sq += (current_num**2)\n end\n (sum**2) - sum_of_sq\nend",
"title": ""
},
{
"docid": "028c2f12b555f61d5187dd608e21672f",
"score": "0.7046318",
"text": "def get_sum_square_difference(n)\n a = 0\n b = 0\n\n (1..n).each do |j|\n a += j\n b += (j * j)\n end\n a *= a\n a - b\nend",
"title": ""
},
{
"docid": "a855aace57b6a868144b59f93a857f9d",
"score": "0.7029144",
"text": "def sum_square_difference(n)\n arr = 1.upto(n).to_a\n square_sum = arr.sum**2\n sum_squares = arr.map { |x| x**2 }.sum\n\n square_sum - sum_squares\nend",
"title": ""
},
{
"docid": "bff5f1be7f58027f997c06e59f2a01d7",
"score": "0.7008162",
"text": "def diff(n)\n sum_of_squares = (1..n).inject(0) {|s,a| s + a**2}\n sum = n*(n+1)/2\n return sum**2 - sum_of_squares\nend",
"title": ""
},
{
"docid": "78686d623aa0e2e01fb4f01f0751d1a8",
"score": "0.7005709",
"text": "def sum_square_difference(n)\n sequence = (1..n).to_a\n sum_of_squares = 0\n sequence.each do |num|\n sum_of_squares += num * num\n end\n \n ((sequence.sum)**2) - sum_of_squares\nend",
"title": ""
},
{
"docid": "c2afdf7d6e82edee2a20aabe46ed720a",
"score": "0.699872",
"text": "def difference\n difference = (1..100).to_a.inject(:+) ** 2 - (1..100).to_a.map {|n| n ** 2}.inject(:+)\n puts difference\nend",
"title": ""
},
{
"docid": "8f429d3baccb1a2f947688246766f985",
"score": "0.698666",
"text": "def sum_square_difference(n)\n range = [*1..n]\n square_of_sums = range.sum ** 2\n sum_of_squares = range.sum { |num| num ** 2 }\n square_of_sums - sum_of_squares\nend",
"title": ""
},
{
"docid": "a0a51a28cff9e344fffe8bcc6307570f",
"score": "0.69685906",
"text": "def sum_square_difference(n)\n sum = 0\n sum_of_squares = 0\n\n 1.upto(n) do |value|\n sum += value\n sum_of_squares += value**2\n end\n\n sum**2 - sum_of_squares\nend",
"title": ""
},
{
"docid": "a0a51a28cff9e344fffe8bcc6307570f",
"score": "0.69685906",
"text": "def sum_square_difference(n)\n sum = 0\n sum_of_squares = 0\n\n 1.upto(n) do |value|\n sum += value\n sum_of_squares += value**2\n end\n\n sum**2 - sum_of_squares\nend",
"title": ""
},
{
"docid": "a0a51a28cff9e344fffe8bcc6307570f",
"score": "0.69685906",
"text": "def sum_square_difference(n)\n sum = 0\n sum_of_squares = 0\n\n 1.upto(n) do |value|\n sum += value\n sum_of_squares += value**2\n end\n\n sum**2 - sum_of_squares\nend",
"title": ""
},
{
"docid": "a0a51a28cff9e344fffe8bcc6307570f",
"score": "0.69685906",
"text": "def sum_square_difference(n)\n sum = 0\n sum_of_squares = 0\n\n 1.upto(n) do |value|\n sum += value\n sum_of_squares += value**2\n end\n\n sum**2 - sum_of_squares\nend",
"title": ""
},
{
"docid": "694741cdab701532c396323039469fef",
"score": "0.6959728",
"text": "def sum_square_difference(max)\r\n\t(square_of_sum(max) - sum_of_squares(max)).abs\r\nend",
"title": ""
},
{
"docid": "a965924ccd68f2bbcd6b1d7d1bc9189b",
"score": "0.6892345",
"text": "def sum(n)\n sqr = sqr(n)\n array = []\n while n > 0\n array << (n ** 2)\n n -= 1\n end\n diff(array.reduce(:+),sqr) \nend",
"title": ""
},
{
"docid": "ba29f3db4da31d578d0c8c14d34fb699",
"score": "0.68902963",
"text": "def sum_square_difference(n)\n sum = 0\n integers = (1..n).each {|int| sum += int}\n\n sum = (sum ** 2)\n\n product = 0\n elements = (1..n).map {|num| num ** 2}.each {|num| product += num}\n\n (sum - product)\nend",
"title": ""
},
{
"docid": "a101f969670e84d7af042ab3be0671a1",
"score": "0.68855137",
"text": "def diff_sum_square(num, other_num)\n num - other_num\nend",
"title": ""
},
{
"docid": "46ff5e119aa55f23a5df6aa519fc67f2",
"score": "0.6874936",
"text": "def solution_6\n sum_square = (1..100).map { |x| x * x }.reduce(:+)\n square_sum = (1..100).reduce(:+) ** 2\n square_sum - sum_square\n end",
"title": ""
},
{
"docid": "746efbd5e78919940c13ffb052f19fd3",
"score": "0.68383765",
"text": "def sum_square_difference(limit)\n numbers = (1..limit).to_a\n numbers.sum**2 - numbers.map { |num| num**2 }.sum\nend",
"title": ""
},
{
"docid": "b3ae4a476a1fb556496cca305a94b83d",
"score": "0.6764782",
"text": "def totient_sum(n)\r\n\t\tn_23 = (n ** (2/3r)).to_i\r\n\r\n\t\t# Compute moebius function under n^(2/3) by sieve\r\n\t\tmoebius_sieve_rslt = moebius_sieve(n_23)\r\n\r\n\t\t# Compute mertens under n^(2/3)\r\n\t\t$mertens_cache = Array.new(n_23 + 1)\r\n\t\t$mertens_cache[0] = 0\r\n\t\ti = 1\r\n\t\twhile i <= n_23\r\n\t\t\t$mertens_cache[i] = $mertens_cache[i - 1] + moebius_sieve_rslt[i]\r\n\t\t\ti += 1\r\n\t\tend\r\n\r\n\t\trslt = 1\r\n\t\td = 2\r\n\t\twhile d <= n\r\n\t\t\ta = n / d\r\n\t\t\tnext_d = n / a + 1\r\n\t\t\tm = mertens(a)\r\n\t\t\trslt += (d + next_d - 3) * (next_d - d) / 2 * m\r\n\t\t\td = next_d\r\n\t\tend\r\n\r\n\t\treturn rslt\r\n\tend",
"title": ""
},
{
"docid": "f66a85e70f44981daa8d4b54af068c40",
"score": "0.6754642",
"text": "def sumDifference(limit) \n\tsumTotal = 0;\n\tsquareTotal = 0;\n\t1.upto(limit) do |x|\n\t\tsumTotal += x**2\n\t\tsquareTotal += x\n\tend\n\tsquareTotal = squareTotal ** 2\n\tsquareTotal - sumTotal\nend",
"title": ""
},
{
"docid": "7b64c02c5818fb1865609e59987d308f",
"score": "0.67493653",
"text": "def sum_of_multiples_optimized(num)\n\tnum -= 1\n\tgreatest_multiple_of_three = num/3\n\tgreatest_multiple_of_five = num/5\n\tgreatest_multiple_of_common_numbers = num/15\n\tsum = 3*(greatest_multiple_of_three*(greatest_multiple_of_three+1)/2) + 5*(greatest_multiple_of_five*(greatest_multiple_of_five+1)/2) - 15*(greatest_multiple_of_common_numbers*(greatest_multiple_of_common_numbers+1)/2)\n\t# used concept of sum of natural numbers\n\t# eg: 10 multiples of 3 are 3,6,9 or 3(1,2,3) or 3(3((3+1)/2)) \n\t# sum of natural numbers is n(n+1)/2\nend",
"title": ""
},
{
"docid": "0b38bb1ea09c2dee29f9a700d19ee5cd",
"score": "0.6748331",
"text": "def problem_6\n (1.upto(100).reduce(:+) ** 2 ) - (1..100).inject { |sum, n| sum += n**2 }\nend",
"title": ""
},
{
"docid": "94e705ad04a1a3436fa9ce198fe40c89",
"score": "0.6727229",
"text": "def sum_of_squares\n\t\trtnSum = 0\n\t\t#Add the sqare of each number to a sum\n\t\trtnSum = (1..@n_numbers).inject { |sum, n|\n\t\t\tsum += n**2\n\t\t}\n\t\trtnSum\n\tend",
"title": ""
},
{
"docid": "9d9e67dec21eebdba110313d90920a0e",
"score": "0.6722413",
"text": "def diff(n)\n sum1 = 0\n sum2 = 0\n (1..n).each do |i|\n sum1 = sum1 + i\n sum2 = sum2 + (i ** 2)\n end\n diff = (sum1 ** 2) - sum2\n diff\nend",
"title": ""
},
{
"docid": "4d149b85e5dbc45ca7d5cdad9cfed3ff",
"score": "0.67102027",
"text": "def squares_sum(n)\n\tsum = n*(n + 1)*(2*n + 1)/6\n\treturn sum\nend",
"title": ""
},
{
"docid": "e41b1f0111edb3c2286a676ccc1ad405",
"score": "0.6707567",
"text": "def problem_6(num = 100)\n (1..num).reduce {|a,n| a + n } ** 2 -\n (1..num).reduce {|a,n| a + n*n }\nend",
"title": ""
},
{
"docid": "ad557da4c572ac775fb3a286b282a632",
"score": "0.6703728",
"text": "def sumSquaredNumbers(n)\n\treturn ((n * (n + 1) * (2 * n + 1)) / 6)\nend",
"title": ""
},
{
"docid": "0efbbbb754640e5126f51c601ac19248",
"score": "0.6693709",
"text": "def get_diff\n square_of_sum - sum_of_squares\n end",
"title": ""
},
{
"docid": "033ed3b2f713a3c975b3dd5403232864",
"score": "0.6670272",
"text": "def diff_between_sumofsquares_and_squareofsum (k)\n\tsum_of_squared = 0\n\tsquare_of_sum = 0\n\t(1..10).each do |i|\n\t\tsum_of_squared += i * i\n\t\tsquare_of_sum += i\n\tend\n\t(sum_of_squared - square_of_sum ** 2).abs\nend",
"title": ""
},
{
"docid": "d76a089979b091b9fd07e09a0b52fd67",
"score": "0.6640576",
"text": "def compute_sum_of_squares(n)\n ((1/6.0)*n*(n+1)*(2*n+1)).round\nend",
"title": ""
},
{
"docid": "6d3ebe758c51f3ed311de130c8e11413",
"score": "0.6618844",
"text": "def compute\n sumsquare = 0\n squaresum = 0 \n for i in 1..100\n sumsquare += i * i\n squaresum += i \n end\n squaresum *= squaresum\n ans = squaresum - sumsquare\n ans \nend",
"title": ""
},
{
"docid": "a537e9a5932cd7895d9b55e77a065f5a",
"score": "0.66070354",
"text": "def compute_square_of_sum(n)\n ((0.25*n**4 + 0.5*n**3 + 0.25*n**2)).round\nend",
"title": ""
},
{
"docid": "683edb8896eb01a099b19bdf72c5ab8b",
"score": "0.6606518",
"text": "def sum_of_squares\n (n * (n + 1) * (2 * n + 1)) / 6\n end",
"title": ""
},
{
"docid": "fe6e81d3dc358fe4ec4a118ae0aae61e",
"score": "0.6600649",
"text": "def square_of_sum n\n\tn.downto(1).inject(:+) ** 2\nend",
"title": ""
}
] |
2b13b375e28de1c3803f54d869ecbcc9
|
Removes all ConfirmationEvent public for TEST Only
|
[
{
"docid": "835197508e4c86047746950e9bf7ca06",
"score": "0.7904881",
"text": "def remove_all_confirmation_events\n ConfirmationEvent.find_each(&:destroy)\n end",
"title": ""
}
] |
[
{
"docid": "c351ba5fbde40eb9d8eaf8ecddc3009e",
"score": "0.6233453",
"text": "def clear_common_event\r\n @common_event_id = 0\r\n end",
"title": ""
},
{
"docid": "439046cb65de489b9e550784c19a3453",
"score": "0.62034243",
"text": "def clear_common_event\n @common_event_id = 0\n end",
"title": ""
},
{
"docid": "3ae3a14925f06ccffe44cb66ef740dc0",
"score": "0.6192929",
"text": "def edit_multiple_confirmation_events\n set_confirmation_events\n end",
"title": ""
},
{
"docid": "1f028231fc43325cef4e99552d87408c",
"score": "0.6120651",
"text": "def clear_events!\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n end",
"title": ""
},
{
"docid": "8cba1cb9f46605a31bd007f27b989e8e",
"score": "0.6102078",
"text": "def clear_all!\n @events = {}\n end",
"title": ""
},
{
"docid": "d32e1a4498ecd8c5e44c3142f4075c5e",
"score": "0.6082392",
"text": "def clean_temp_evs_helper\n @spawned_event_ids.each{|id| @events.delete(id) unless @events[id].persistent}\n @spawned_event_ids = []\n end",
"title": ""
},
{
"docid": "8cf8e827c6ba3fcf0833269404b6898c",
"score": "0.6075769",
"text": "def destroy\n #@event_event.destroy\n @event_event.deleted = true\n dest = @event_event.id\n type = 7 #event_notifications_code\n Notification.clear_notifications(type,dest)\n @event_event.save\n @event_event.user.remove_event\n respond_to do |format|\n format.html { redirect_to admin_event_events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "de2c1548932c4050f687bc07e52192b8",
"score": "0.60545695",
"text": "def skip_confirmation_notification!; end",
"title": ""
},
{
"docid": "2cdaacf358d7878f9767ff81b597001d",
"score": "0.6043043",
"text": "def clear_events!\n @all_events = []\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n @published_events = []\n self\n end",
"title": ""
},
{
"docid": "f8d3f68c62233b88f9973a61c529f8ab",
"score": "0.59931797",
"text": "def destroy\n @transferred_event_order.destroy\n end",
"title": ""
},
{
"docid": "3f90f5a1031794b3ec8fa8a1f79a28b4",
"score": "0.59816456",
"text": "def purge\n i = 0\n debug \"Purge events on GCal... \"\n g_cal.events_all.each do |e|\n next if e.status == 'cancelled'\n debug \"Delete: #{e}\"\n e.delete\n i += 1\n end\n debug \"Done. #{i} event(s) deleted.\"\n i\n end",
"title": ""
},
{
"docid": "15c6e429e97798c35c4ae0e79e2f8324",
"score": "0.59090805",
"text": "def delete_all_events\n doc = {}\n attach_user_id doc\n attach_storage_id doc\n\n Event.delete_all(doc)\n end",
"title": ""
},
{
"docid": "4d9d97025c4db5db8397b8e4ec6c6296",
"score": "0.5856606",
"text": "def delete_event\n UserMailer.delete_event\n end",
"title": ""
},
{
"docid": "8d001f62826bc116eda5bfbd92606d00",
"score": "0.58557725",
"text": "def confirm_event\n @event.update(confirmed: true)\n end",
"title": ""
},
{
"docid": "b2f1383ce31fd90d4f2db038f345952e",
"score": "0.5851465",
"text": "def clear_events!\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n self\n end",
"title": ""
},
{
"docid": "2ddd07caebfecdd8887fa835ac065b26",
"score": "0.5824179",
"text": "def future_single_events_cleanup\n self.single_events.rule_based_in_future.each do |single_event|\n single_event.delete unless schedule.occurs_at? single_event.occurrence\n end\n end",
"title": ""
},
{
"docid": "0f9fe9268af3051761302a688a3a2c45",
"score": "0.58153194",
"text": "def clear_events!\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n @published_events = []\n self\n end",
"title": ""
},
{
"docid": "296566a8b99a6b5d8d6e104daaaa7c76",
"score": "0.57840806",
"text": "def delete\n MoxiworksPlatform::Event.delete(self.to_hash)\n end",
"title": ""
},
{
"docid": "2a7dda49bd978f0e7b9a5713335b7d49",
"score": "0.57601845",
"text": "def destroy\n @event.delay.call_notification(I18n.t('Notification.event_deleted'), I18n.t('Email.event_deleted'))\n @event.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "69f0d07e44fc434fe83f361a40ea270c",
"score": "0.5729997",
"text": "def pending_any_confirmation; end",
"title": ""
},
{
"docid": "b942a636c076d55d0e726b51fa0971d5",
"score": "0.56985676",
"text": "def destroy_events\n @events.destroy_all\n end",
"title": ""
},
{
"docid": "e0e62af30653dc9d690a759c9d74b672",
"score": "0.5697856",
"text": "def external_unconfirm\n if not self.transaction_source_id.nil? \n self.errors.add(:generic_errors, \"Can't modify the automated generated transaction\")\n return self \n end\n \n self.is_confirmed = false \n if self.save\n self.update_affected_accounts_due_to_un_confirmation\n end\n end",
"title": ""
},
{
"docid": "f94a97896e67eb4554b6e823fddc1a35",
"score": "0.5674733",
"text": "def destroy\n \t@expected_event.destroy\n \trespond_to do |format|\n \t\tformat.html { redirect_to expected_events_url }\n \tend\n end",
"title": ""
},
{
"docid": "4f9cfe3459cfba73219031ada3da231d",
"score": "0.5658688",
"text": "def test05_251RrepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepostPopulate251\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"title": ""
},
{
"docid": "96a072107e64a92a31cab4fec404cbe5",
"score": "0.56541216",
"text": "def reset_confirmation\n self.confirmed_at = nil\n end",
"title": ""
},
{
"docid": "41cc3d8f2375bd989c570c6e639bc91f",
"score": "0.56539625",
"text": "def destroy\r\n @event.destroy\r\n end",
"title": ""
},
{
"docid": "9c93d5b7f81e9b8cc8c1df40e73c9203",
"score": "0.5623375",
"text": "def remove_temporary_spawned_events\n return if @spawned_event_ids.nil?\n clean_self_switches\n clean_temp_evs_helper\n need_refresh = true\n end",
"title": ""
},
{
"docid": "3fb48e1b77ca34adf2a4027326cf7c33",
"score": "0.5615582",
"text": "def skip_confirmation!; end",
"title": ""
},
{
"docid": "957104df13c3f135b0944cd3bb3cf2e6",
"score": "0.55835557",
"text": "def destroy_as_sender\n participants = Participant.for_message(self).uniq\n participants.each do |participant| \n Event.make(:event_type_name => EvType.find(2).name, :participant => participant, :message => self)\n end if ressource.events\n MembershipMessage.delete_relations(self)\n destroy_or_tag_as_removed\n end",
"title": ""
},
{
"docid": "e85d7404e4abdb116def2e9c3ed4ed0c",
"score": "0.55555826",
"text": "def destroyed_event(player,event)\n @player=player\n @event = event\n emails = \"#{player.email},#{player.parent_email},#{player.parent_email2}\"\n mail(to: emails, subject: \"Cancelled #{@event.eventtype.name} on #{event.the_date}\")\n end",
"title": ""
},
{
"docid": "af3a425c94c3a278284c06811a2239ad",
"score": "0.55436534",
"text": "def setup_reserved_common_event\r\n if $game_temp.common_event_reserved?\r\n setup($game_temp.reserved_common_event.list)\r\n $game_temp.clear_common_event\r\n true\r\n else\r\n false\r\n end\r\n end",
"title": ""
},
{
"docid": "e1e985952dc8447edd02e204c750356b",
"score": "0.5534539",
"text": "def clear_all_actions; end",
"title": ""
},
{
"docid": "7f8223b9ab20741c3cbe484a40739a58",
"score": "0.55344164",
"text": "def delete_orphan_spektrix_events\n @spektrix_event_ids = @spektrix_events.collect {|e| e.id.to_i}\n @rooftop_event_ids = @rooftop_events.inject({}) do |hash, e|\n hash[e.id] = e.meta_attributes[:spektrix_id].to_i\n hash\n end\n @rooftop_event_ids.reject! {|k,v| v == 0} #remove events with no spektrix ID; we don't want to remove them.\n spektrix_ids_to_delete = (@rooftop_event_ids.values - (@rooftop_event_ids.values & @spektrix_event_ids))\n rooftop_ids_to_delete = @rooftop_event_ids.select {|k,v| spektrix_ids_to_delete.include?(v)}.keys\n Rooftop::Events::Event.where(post__in: rooftop_ids_to_delete).each do |rooftop_event|\n title = rooftop_event.title\n if rooftop_event.destroy\n @logger.info(\"[spektrix] Removed Rooftop event #{title} which doesn't exist in Spektrix\")\n end\n end\n end",
"title": ""
},
{
"docid": "b593ab077ab7c52994fe81886003c093",
"score": "0.54804283",
"text": "def reset\n @events = []\n end",
"title": ""
},
{
"docid": "e2daf2e429fe1b3875e83c817062b204",
"score": "0.5475527",
"text": "def test_ut_t5_sef_con_017\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:delete]})\n assert ContextNotifier.send_email(email_setting,TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:delete],OLD_STATE_ID,NEW_STATE_ID)\n # manually test by checking the mail.\n end",
"title": ""
},
{
"docid": "d90f04c7aceb296cb2886609c657b155",
"score": "0.5475001",
"text": "def deleteEventData(e)\n @e = Event.find_by(id: e)\n deleteAll(@e.attendings)\n deleteAll(@e.comments)\n deleteAll(@e.reviews)\n deleteEventNotifications(nil, @e.id)\n end",
"title": ""
},
{
"docid": "5d033b4086a56ffabb9b28fe823aadbd",
"score": "0.54668385",
"text": "def destroy\n @event_configurations.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "3ad5845ec3bf30a020daf133c677362b",
"score": "0.5462415",
"text": "def skip_reconfirmation!; end",
"title": ""
},
{
"docid": "36ce1a88948dfd18b4260d5d268bbfb0",
"score": "0.54580796",
"text": "def test_ut_t5_sef_con_004\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:delete]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:delete],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"has been deleted\")\n end",
"title": ""
},
{
"docid": "91e57ebc7eeb84058a43132315ed59d0",
"score": "0.54561055",
"text": "def destroy\n @event.destroy\n end",
"title": ""
},
{
"docid": "91e57ebc7eeb84058a43132315ed59d0",
"score": "0.54561055",
"text": "def destroy\n @event.destroy\n end",
"title": ""
},
{
"docid": "91e57ebc7eeb84058a43132315ed59d0",
"score": "0.54561055",
"text": "def destroy\n @event.destroy\n end",
"title": ""
},
{
"docid": "0dd29cdb7ea18b7aff6bf07ce4dc462e",
"score": "0.54560536",
"text": "def registration_confirm\n mail = RegistrationMailer.confirm(temporary_registration)\n destroy_fixtures\n mail\n end",
"title": ""
},
{
"docid": "7c1a31146b12d074cbd3e8ed33ac4f5e",
"score": "0.5441165",
"text": "def skip_confirmation_notification!\n @skip_confirmation_notification = true\n end",
"title": ""
},
{
"docid": "8b57ea8b193900e576e4b87e2d0f72d9",
"score": "0.54409117",
"text": "def destroy_all\n unless current_user.nil?\n #current_user.events.delete_all # why this line doesn't work on production, seriously?\n Event.delete_all(user_id: current_user.id)\n redirect_to :back, notice: \"All events have been deleted.\"\n else\n redirect_to :back, alert: \"Deleting an event is restricted to logged-in users.\"\n end\n end",
"title": ""
},
{
"docid": "98ba10cf0b37faf229ecde93aff55edd",
"score": "0.5439141",
"text": "def clear_baicheng_event\n BaichengEvent.find_by_design(self.id).try(:destroy_all)\n end",
"title": ""
},
{
"docid": "66961dacba33574cda164cfe23e89b4a",
"score": "0.54375076",
"text": "def saved_and_unsaved_events\n registration_competition_events.reject(&:marked_for_destruction?).map(&:event)\n end",
"title": ""
},
{
"docid": "5bc03d33bc368c3bbe957da689b1aec2",
"score": "0.5424568",
"text": "def test01_250RepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepostPopulate250\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"title": ""
},
{
"docid": "a2f3999c2c26bdd8337aee378156d81c",
"score": "0.541132",
"text": "def destroy\r\n super(@event, 'Post apagado com sucesso', events_url)\r\n end",
"title": ""
},
{
"docid": "fa6cac7e553703a115a5184e3a00fb15",
"score": "0.54062533",
"text": "def delete_event(event)\n notifications = \"sendNotifications=#{event.send_notifications?}\"\n send_events_request(\"/#{event.id}?#{notifications}\", :delete)\n end",
"title": ""
},
{
"docid": "5b171c9e44d348d12058fc60e71d7b5a",
"score": "0.5401445",
"text": "def test_ignored_events\n\tpeer2peer do |remote|\n\t model = Tasks::Simple.new_submodel do\n\t\tevent :unknown, :command => true\n\t end\n\t remote.plan.add_mission(t1 = Tasks::Simple.new(:id => 1))\n\t remote.plan.add_mission(t2 = Tasks::Simple.new(:id => 2))\n\t remote.plan.add_mission(u = model.new(:id => 0))\n\n\t t1.signals(:start, u, :unknown)\n u.forward_to(:unknown, t2, :start)\n\n\t remote.singleton_class.class_eval do\n\t\tdefine_method(:remove_relations) do\n\t\t t1.event(:start).remove_signal u.event(:unknown)\n\t\t u.event(:unknown).remove_forwarding t2.event(:start)\n\t\tend\n\t end\n\tend\n\n\tu = subscribe_task(:id => 0)\n\tt1 = remote_task(:id => 1)\n\tt2 = remote_task(:id => 2)\n\n\tassert(remote_peer.connected?)\n\n\tremote.remove_relations\n\tprocess_events\n\tassert(remote_peer.connected?)\n end",
"title": ""
},
{
"docid": "5592fea5840a1751a121c5355562e02c",
"score": "0.54006195",
"text": "def destroy\n @event = Event.find(params[:id])\n #Instead of destroying the event set it to Canceled\n #@event.destroy\n @event.update_attribute(:status,\"Cancelado\")\n\n respond_to do |format|\n\n if(@event.client)\n Notifier.client_event_canceled(@event).deliver\n end\n if(@event.professional) \n Notifier.professional_event_canceled(@event).deliver\n end\n\n flash[:notice] = \"Evento cancelado com sucesso!\"\n format.html { redirect_to(events_url) }\n format.js\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e3b84b93a71358db61607e8f2f8bc21b",
"score": "0.5387271",
"text": "def clear_gevent\r\n @num_of_suspend = 0\r\n @proc_queue.clear\r\n end",
"title": ""
},
{
"docid": "d7827ff5ded139583403b74eb7ccfa65",
"score": "0.5387187",
"text": "def destroy\n # if the event was unapproved, add it to our import blacklist\n unless @event.approved?\n Blacklist.create(fb_id: @event.fb_id, name: @event.title)\n end\n\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7f3fd7c8782d9f7f5fab55cc10ed5f5d",
"score": "0.53851426",
"text": "def reset!\n @events = nil\n end",
"title": ""
},
{
"docid": "0a124b90376f1daef0ea87d66ec89dc7",
"score": "0.5384234",
"text": "def deleteEventNotifications(u, e)\n @ns = getEventNotifications(u, e)\n @ns.each do |n|\n n.destroy\n end\n if u != nil\n redirect_to \"/notifications\", notice: \"All notifications for \" + Event.find_by(id: e).name + \" deleted.\"\n end\n end",
"title": ""
},
{
"docid": "34284bd025e5567ffd01ee122eae97be",
"score": "0.5377402",
"text": "def teardown\n @appointment = nil\n end",
"title": ""
},
{
"docid": "23ccc63aeb6a5737214625fdb8f583ed",
"score": "0.53773177",
"text": "def test02_repostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"title": ""
},
{
"docid": "cd164cc3702530d5dea105bfe2c20949",
"score": "0.53771394",
"text": "def before_confirm\n return if defined?(SpreeProductAssembly)\n return unless @order.checkout_steps.include? 'delivery'\n\n packages = @order.shipments.map(&:to_package)\n @differentiator = Spree::Stock::Differentiator.new(@order, packages)\n @differentiator.missing.each do |variant, quantity|\n @order.contents.remove(variant, quantity)\n end\n end",
"title": ""
},
{
"docid": "b576a6b9e7e8f3cffba994467f68907b",
"score": "0.53717387",
"text": "def skip_reconfirmation_in_callback!; end",
"title": ""
},
{
"docid": "0fb6c2db69861889b04d52c6125ecc06",
"score": "0.5369124",
"text": "def remove_exhibitor_from_event\n session_event = SessionRelationship.find_by_session_id(self.event_id)\n if session_event.blank?\n Event.find(self.event_id).sessions.each do |s| \n pstr = EventExhibitor.find_by_event_id_and_exhibitor_id(s.id, self.exhibitor_id)\n\tpstr.destroy if pstr\n end\n end\n end",
"title": ""
},
{
"docid": "f731881dfc8beaa311d76ebea2e838fe",
"score": "0.53554016",
"text": "def prune_events\n queue = Array.new(3)\n events_to_delete = []\n self.events.order('timestamp ASC').each do |e|\n queue.shift\n queue.push(e)\n next if queue.compact.size != 3\n event_type_id = e.event_type_id\n events_to_delete << e.id if queue.all?{|e| e.event_type_id == event_type_id}\n\n if events_to_delete.size >= 100\n Event.transaction do\n events_to_delete.each do |e|\n Event.delete(e)\n end\n end\n events_to_delete.clear\n end\n end\n\n Event.transaction do\n events_to_delete.each do |e|\n Event.delete(e)\n end\n events_to_delete.clear\n end\n true\n end",
"title": ""
},
{
"docid": "d30ab2484e0715d97bfcd7fbe91ba590",
"score": "0.53450173",
"text": "def send_delete_event_notification(event, user)\n if event.notify?\n if user.use_email? && user.confirmed? && event.use_email?\n UserMailer.event_delete_email(user, event).deliver rescue user\n end\n if user.use_text? && user.confirmed_text? && event.use_text?\n success, error = TwilioHandler.new.send_text(user, t('texts.deleted_event', params: get_event_text_params(event, false), type: event.eventType.capitalize))\n end\n if user.use_call? && user.confirmed_call? && event.use_call?\n success, error = TwilioHandler.new.send_call(user, t('texts.deleted_event', params: get_event_text_params(event, false), type: event.eventType.capitalize))\n end\n end\n end",
"title": ""
},
{
"docid": "d41a637aa18aa3507b7fa6180579cb59",
"score": "0.53272134",
"text": "def awaiting_confirmation\n @awaiting_confirmation ||= []\n end",
"title": ""
},
{
"docid": "ba5abc9a076ecd95b7a7fcdf36555a1c",
"score": "0.5326017",
"text": "def skip_confirmation!\n self.confirmed_at = Time.now.utc\n end",
"title": ""
},
{
"docid": "ba5abc9a076ecd95b7a7fcdf36555a1c",
"score": "0.5326017",
"text": "def skip_confirmation!\n self.confirmed_at = Time.now.utc\n end",
"title": ""
},
{
"docid": "e4cbdaa61fbc71f8d34ddef062145a9d",
"score": "0.53006124",
"text": "def destroy\n @clock_event.destroy\n end",
"title": ""
},
{
"docid": "c7cf1c1a231c6ee2e84a8fff74a75f08",
"score": "0.5293902",
"text": "def after_confirmation; end",
"title": ""
},
{
"docid": "893bd2a7ad117596c9e1f117272b4fa3",
"score": "0.5285373",
"text": "def remove\n \t@watcher.remove(@event, @prok)\n end",
"title": ""
},
{
"docid": "57f83634e551b5f81db19a074428b270",
"score": "0.52821606",
"text": "def clear_common_event_variables\n $game_variables[TH::Common_Event_Variables::User_Variable] = 0\n $game_variables[TH::Common_Event_Variables::Target_Variable] = 0\n $game_variables[TH::Common_Event_Variables::Item_Variable] = 0\n $game_variables[TH::Common_Event_Variables::Skill_Variable] = 0\n @common_event_user = nil\n @common_event_target = nil\n @common_event_item = nil\n @common_event_skill = nil\n end",
"title": ""
},
{
"docid": "dc2ecc144427d6b774b398278ee7e59d",
"score": "0.5268084",
"text": "def reset_confirmation!\n self.update_column(:confirmed_at, nil)\n end",
"title": ""
},
{
"docid": "416ca600aa94982d668cdd693e35f358",
"score": "0.5261928",
"text": "def permitted_events\n events = self.states_events_config.map { |se| se[:event] }\n events.delete_if { |e| !event_permitted(e) }\n end",
"title": ""
},
{
"docid": "016e833bf8ac29d4d5db53cba5895b19",
"score": "0.524616",
"text": "def send_confirmations_to_owner\n return @send_confirmations_to_owner\n end",
"title": ""
},
{
"docid": "81328f0de83c931f11f9c0e833fa9ced",
"score": "0.5244771",
"text": "def destroy\n @event.users.map do |user|\n if UserEventRelationship.find_by(user_id: user.id, event_id: @event.id).receive_notification\n HardWorkerThree.perform_async(@event.name, user.email, user.user_name)\n end\n end\n\n UserEventRelationship.where(event_id: @event.id).map do |relationship|\n relationship.destroy\n end\n @event.destroy\n flash[:danger] = 'Event was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "56d3c47c87a1a393e3535af2e9940711",
"score": "0.5231432",
"text": "def destroy\n @event = @reservation.event\n @reservation.update_attribute(:status, \"Cancelled\")\n \n begin\n if !@event.available_seats && @event.reservations.where(status: \"Waiting_List\").any?\n ReservationsMailer.send_waiting_list(@event).deliver\n end\n rescue => e\n logger.info(e)\n end\n\n @event.save\n flash[:notice] = \"Your reservation has been cancelled.\"\n redirect_to event_path @event\n end",
"title": ""
},
{
"docid": "421ed4c8011578a7d8ae40da68ef8e4e",
"score": "0.5229335",
"text": "def cancel_all\n self.each { |event| self.cancel(event) }\n end",
"title": ""
},
{
"docid": "b22d75d5afb6dca8d1202dc71ebde0b7",
"score": "0.52255565",
"text": "def destroy\n expire_action :action => [:shadyside, :south_side, :lawrenceville, :oakland, :bloomfield, :strip_district, :downtown]\n @event.destroy\n respond_to do |format|\n Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now)\n format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3dc2288dff65c99f910626bc4b1dfedc",
"score": "0.5224408",
"text": "def destroy(event)\n @delete_is_ok &&= event.destroy\n end",
"title": ""
},
{
"docid": "43259bafdad46eb0a518f033c9073210",
"score": "0.521821",
"text": "def test04_GroupRepostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\tgroupAddRemoveAdd \"Repost text #{random}.\"\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"title": ""
},
{
"docid": "8ced891fd8da69d076ba0cb49f3c7f0c",
"score": "0.52029294",
"text": "def send_email_before_destroy\n\n #Do nothing if challenge has been closed\n return if(self.start_date + self.duration < Date.current)\n\n contestants = self.users\n\n #Send email to creator\n UserMailer.challenge_deleted_creator(self.creator, self).deliver\n\n #Send email to contestants\n contestants.each do |c|\n UserMailer.challenge_deleted_contestant(c, self).deliver\n end\n\n end",
"title": ""
},
{
"docid": "f000a6d3c3d6a7f8d8b878639535e66d",
"score": "0.52003145",
"text": "def remove message\n @events.delete message.sequence\n end",
"title": ""
},
{
"docid": "6fdec5c9cbc29bff5ad68e18c80ea0ae",
"score": "0.51975423",
"text": "def remove_except_follower\n events=$PokemonGlobal.dependentEvents\n $PokemonGlobal.dependentEvents.each_with_index do |event,i|\n next if event[8][/FollowerPkmn/]\n events[i] = nil\n @realEvents[i] = nil\n @lastUpdate += 1\n end\n events.compact!\n @realEvents.compact!\n end",
"title": ""
},
{
"docid": "1964256cbc05c8f1fe11d92b088d1038",
"score": "0.519717",
"text": "def delete(confirm_delete=true)\n puts \"Deleting Registration Window #{@appointment_window_info_name}\"\n on RegistrationWindowsCreate do |page|\n page.remove(@appointment_window_info_name, @period_key)\n page.loading.wait_while_present\n while true\n begin\n sleep 1\n wait_until { page.window_collection_table.exists? }\n break\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n puts \"rescued StaleElementReferenceError\"\n end\n end\n if confirm_delete\n page.confirm_delete\n else\n page.cancel_delete\n end\n end\n end",
"title": ""
},
{
"docid": "2d102607d875ab40564ac2d346815436",
"score": "0.51930046",
"text": "def after_confirmation\n end",
"title": ""
},
{
"docid": "833e6e8996d437936e3bfc3434200644",
"score": "0.5192338",
"text": "def disposing(ev)\n end",
"title": ""
},
{
"docid": "972bd97a2f607991e3336abd753668e1",
"score": "0.51905525",
"text": "def delete_validator\n if is_used?\n self.errors.add \"This event is used on participant records. You must remove all participant events before deleteing this event type\"\n false\n end\n end",
"title": ""
},
{
"docid": "428815177cfc14bd752213a7add55b98",
"score": "0.5187324",
"text": "def test_confirm_does_not_blow_away_duplicates\n #KS- make sure there are 3 emails with the same address\n emails = Email.find(:all, :conditions => [ \"address = :address\", { :address => \"unconfirmed@skobee.com\" } ])\n assert_equal 3, emails.length\n assert_equal 1, emails.find_all{|email| email.user_id == 2 && email.confirmed == Email::UNCONFIRMED}.length\n assert_equal 1, emails.find_all{|email| email.user_id == 3 && email.confirmed == Email::UNCONFIRMED}.length\n assert_equal 1, emails.find_all{|email| email.user_id == 4 && email.confirmed == Email::UNCONFIRMED}.length\n \n #KS- confirm one of them\n emails[0].confirmed = 1\n emails[0].save\n \n #KS- make sure they're both still there (shouldn't delete unconfirmed ones anymore)\n emails = Email.find(:all, :conditions => [ \"address = :address\", { :address => \"unconfirmed@skobee.com\" } ])\n assert_equal 3, emails.length\n assert_equal 1, emails.find_all{|email| email.user_id == 2 && email.confirmed == Email::CONFIRMED}.length\n assert_equal 1, emails.find_all{|email| email.user_id == 3 && email.confirmed == Email::UNCONFIRMED}.length\n assert_equal 1, emails.find_all{|email| email.user_id == 4 && email.confirmed == Email::UNCONFIRMED}.length\n end",
"title": ""
},
{
"docid": "ecdf9a950a3bebcba6600ed3fe5d5a5e",
"score": "0.51762885",
"text": "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\t\tics_for_all #########\n respond_to do |format|\n\t\t\tformat.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1546d6facc46dbd1131f80787196e834",
"score": "0.5173488",
"text": "def destroy\n attendances = Attendance.where(:event_id => @event.id).map { |a| a }\n messages = @event.messages\n logger.info \"Deleting event #{@event.id} and #{attendances.length} attendance records\"\n @event.destroy\n attendances.each { |a| a.destroy }\n messages.each { |m| m.destroy }\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fe1ca5cfbf7a5bfb5daae378f562e9c9",
"score": "0.5153651",
"text": "def gcdelete_event\n cal_event = Event.find_by(gamecall_tag: self.id)\n cal_event.destroy if cal_event\n end",
"title": ""
},
{
"docid": "24754b5c6be227c175cfaa30504ac99c",
"score": "0.514749",
"text": "def test04_EventOneComment_TC_24319\n\t\tcommentEventPop\n\t\tcommentPopSubmit\n\tend",
"title": ""
},
{
"docid": "5db567b90387acdaee373c2923298a40",
"score": "0.5145251",
"text": "def registration_confirmed\n mail = RegistrationMailer.confirmed(registration.id)\n destroy_fixtures\n mail\n end",
"title": ""
},
{
"docid": "379e2bb2d35e4eb1fe7800a819cc30fb",
"score": "0.5134753",
"text": "def remove_event(event)\n if event.kind_of?(ManageIQ::Consumption::ShowbackEvent)\n if showback_events.include?(event)\n showback_events.delete(event)\n else\n errors.add(:showback_events, \"not found\")\n end\n else\n errors.add(:showback_events, \"Error Type #{event.type} is not ManageIQ::Consumption::ShowbackEvent\")\n end\n end",
"title": ""
},
{
"docid": "f367f8cd1fd0e3ffd209eb4684bcb3e2",
"score": "0.513195",
"text": "def delete_observers\n sync_peers do |peers|\n peers.clear\n end\n end",
"title": ""
},
{
"docid": "5214d9b1384dcd2302b46923f9dd8468",
"score": "0.51318437",
"text": "def clear_callbacks\r\n @callbacks = []\r\n end",
"title": ""
},
{
"docid": "0945ae92370c62cd2058df6262e59899",
"score": "0.51275736",
"text": "def test \n Email.booking_deleted_by_admin(Booking.last, '1').deliver\n \n redirect_to root_url\n end",
"title": ""
},
{
"docid": "1ec3f13234e250bf09444e418939ffee",
"score": "0.5124851",
"text": "def action_remove\n notifying_block do\n delete_config\n end\n end",
"title": ""
},
{
"docid": "202694cbdaf4823b98b7739aead32720",
"score": "0.51234114",
"text": "def remove_presenter_from_event\n session_event = SessionRelationship.find_by_session_id(self.event_id)\n if session_event.blank?\n Event.find(self.event_id).sessions.each do |s| \n pstr = EventPresenter.find_by_event_id_and_presenter_id(s.id, self.presenter_id)\n\tpstr.destroy if pstr\n end\n end\n end",
"title": ""
},
{
"docid": "92815a7f7dce88ae125fdf14a5602343",
"score": "0.5118887",
"text": "def confirm_all_pending_purchases\r\n self.pending_purchases.each{|purchase| purchase.confirm}\r\n end",
"title": ""
},
{
"docid": "a6df16370611cccfe05bc5874b540e47",
"score": "0.51184154",
"text": "def nullify_jabber_confirmation\n unconfirm_jabber if saved_change_to_attribute?(:jabber)\n end",
"title": ""
}
] |
8784f4698f667ec82a25b0c3a4505036
|
POST /therapists POST /therapists.json
|
[
{
"docid": "5df7d6b3019d76b25828496db980cf21",
"score": "0.61932355",
"text": "def create\n @therapist = Therapist.new(therapist_params)\n @therapist.user_id = current_user.id\n @therapist.specialty_ids = params[:therapist][:specialty_ids]\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to root_path, notice: \"Therapist was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "9f2142b93dc29198f09831d312479608",
"score": "0.64040893",
"text": "def create\n @therapist = Therapist.new(params[:therapist])\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render json: @therapist, status: :created, location: @therapist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "722bddbf9a07fb7e54d749bfdacebc0d",
"score": "0.63288975",
"text": "def create\n @therapist = Therapist.new(therapist_params)\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render :show, status: :created, location: @therapist }\n else\n format.html { render :new }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "722bddbf9a07fb7e54d749bfdacebc0d",
"score": "0.63288975",
"text": "def create\n @therapist = Therapist.new(therapist_params)\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render :show, status: :created, location: @therapist }\n else\n format.html { render :new }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0848a785d25d6e58f0961cd92ff6c43f",
"score": "0.61631703",
"text": "def create\n @therapist = Therapist.new(therapist_params.merge({code: create_code}))\n if @therapist.save\n render :json => {\n id: @therapist.id,\n email: @therapist.email,\n firstName: @therapist.first_name,\n lastName: @therapist.last_name,\n prefix: @therapist.prefix,\n profession: @therapist.profession,\n code: @therapist.code,\n token: get_token(@therapist)\n }\n else\n render json: @therapist.errors, status: :unprocessable_entity\n # render json: @therapist.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e20bbbb9af90acbad66d1be311beca7f",
"score": "0.575704",
"text": "def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"title": ""
},
{
"docid": "ea832060aeb4c9ebfcbff69a43d89ea8",
"score": "0.56643975",
"text": "def register_therapist(attributes)\n user = register_user(attributes)\n user.add_role(Role::Therapist)\n user.save\n user\n end",
"title": ""
},
{
"docid": "358fb40a038b76893e121a3f6d62e571",
"score": "0.55949473",
"text": "def create\n @artist = Artist.new(artist_params)\n @artist.artist_echo_info\n @artist.related_artists_echo\n @artist.twitter_echo\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { redirect_to root_path, notice: \"Musiak couldn't index that request. Maybe try a different spelling.\" }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a7c3c74da30b16e1c858f1ecc698073c",
"score": "0.5583514",
"text": "def create\n @pist = Pist.new(pist_params)\n\n respond_to do |format|\n if @pist.save\n format.html { redirect_to @pist, notice: 'Pist was successfully created.' }\n format.json { render :show, status: :created, location: @pist }\n else\n format.html { render :new }\n format.json { render json: @pist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "24e3156456ff743bdfd04c215cda7a45",
"score": "0.55344725",
"text": "def set_therapist\n @therapist = Therapist.includes(:specialties).find(params[:id])\n end",
"title": ""
},
{
"docid": "b62341c820a41020c9fe0dad82b74586",
"score": "0.55214167",
"text": "def index\n @therapists = Therapist.all\n end",
"title": ""
},
{
"docid": "b62341c820a41020c9fe0dad82b74586",
"score": "0.55214167",
"text": "def index\n @therapists = Therapist.all\n end",
"title": ""
},
{
"docid": "b62341c820a41020c9fe0dad82b74586",
"score": "0.55214167",
"text": "def index\n @therapists = Therapist.all\n end",
"title": ""
},
{
"docid": "b62341c820a41020c9fe0dad82b74586",
"score": "0.55214167",
"text": "def index\n @therapists = Therapist.all\n end",
"title": ""
},
{
"docid": "309f360898c7fcce157b107a28fd5881",
"score": "0.5423171",
"text": "def new\n @therapist = Therapist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @therapist }\n end\n end",
"title": ""
},
{
"docid": "d33e5a63056fac536664bdc2791ca5c7",
"score": "0.5403069",
"text": "def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"title": ""
},
{
"docid": "91d99e3932cec244deb3a570c4805618",
"score": "0.53796643",
"text": "def therapist_params\n params.require(:therapist).permit(:name, :address, :specialty)\n end",
"title": ""
},
{
"docid": "4725e14848f6ffba1a331fc091057521",
"score": "0.5350915",
"text": "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"title": ""
},
{
"docid": "1924e5b9b294f29ca73789cf32f3afb2",
"score": "0.53136873",
"text": "def update\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapist }\n else\n format.html { render :edit }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1924e5b9b294f29ca73789cf32f3afb2",
"score": "0.53136873",
"text": "def update\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapist }\n else\n format.html { render :edit }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1924e5b9b294f29ca73789cf32f3afb2",
"score": "0.5313048",
"text": "def update\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapist }\n else\n format.html { render :edit }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a295ae6fe0509125f0eb22f4fec9adbc",
"score": "0.52832824",
"text": "def create\n @nutritionist = Nutritionist.new(params[:nutritionist])\n\n respond_to do |format|\n if @nutritionist.save\n format.html { redirect_to @nutritionist, notice: 'Nutritionist was successfully created.' }\n format.json { render json: @nutritionist, status: :created, location: @nutritionist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nutritionist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9ce16b8c0c8cd2aaa092088092dd6a13",
"score": "0.52744955",
"text": "def create\n artist = Artist.new({\n name: params[:artist][:name],\n first_name: params[:artist][:first_name],\n age: params[:artist][:age],\n alive: params[:artist][:alive]\n })\n\n artist.save\n redirect_to '/artists'\n end",
"title": ""
},
{
"docid": "dfee1a1a7835292a7406b82a098ca060",
"score": "0.525378",
"text": "def therapist_params\n params.require(:therapist).permit(:about_me, :hourly_rate, :profile_image, :user_id, :specialty_ids)\n end",
"title": ""
},
{
"docid": "e441449542f05ccd773b7e06e0da11d7",
"score": "0.52532744",
"text": "def set_therapist\n @therapist = Therapist.find(params[:id])\n end",
"title": ""
},
{
"docid": "e441449542f05ccd773b7e06e0da11d7",
"score": "0.52532744",
"text": "def set_therapist\n @therapist = Therapist.find(params[:id])\n end",
"title": ""
},
{
"docid": "e441449542f05ccd773b7e06e0da11d7",
"score": "0.52532744",
"text": "def set_therapist\n @therapist = Therapist.find(params[:id])\n end",
"title": ""
},
{
"docid": "f7982c3025d3278e90c7e40cde19b89d",
"score": "0.5250536",
"text": "def create_url\n \"#{api_url}/gists\"\n end",
"title": ""
},
{
"docid": "a13d8688c8b5443a03823266d3514543",
"score": "0.5208286",
"text": "def create\n @botanist = Botanist.new(botanist_params)\n\n respond_to do |format|\n if @botanist.save\n format.html { redirect_to @botanist, notice: 'Botanist was successfully created.' }\n format.json { render :show, status: :created, location: @botanist }\n else\n format.html { render :new }\n format.json { render json: @botanist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff0e7431cc4e94a0c35add655d2a0ac4",
"score": "0.518077",
"text": "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"title": ""
},
{
"docid": "a31d32d9a258e2d5bdbca497dd373068",
"score": "0.5144865",
"text": "def create\n neo = Neography::Rest.new\n city = neo.create_node(params[:city])\n redirect_to cities_path\n end",
"title": ""
},
{
"docid": "99ce6978791900dc4d4e7b6f019c45c8",
"score": "0.5139502",
"text": "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"title": ""
},
{
"docid": "0a84463cec5edf9624c95230761b0ffa",
"score": "0.51344264",
"text": "def create\n @gist = Gist.new(params[:gist])\n current_user.gists << @gist\n \n respond_to do |format|\n if @gist.save\n format.html { redirect_to @gist, notice: 'Gist was successfully created.' }\n format.json { render json: @gist, status: :created, location: @gist }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fbe012919ad1c961e8378edc19686f8",
"score": "0.5100555",
"text": "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, :notice => 'Artist was successfully created.' }\n format.json { render :json => @artist, :status => :created, :location => @artist }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fbe012919ad1c961e8378edc19686f8",
"score": "0.5100555",
"text": "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, :notice => 'Artist was successfully created.' }\n format.json { render :json => @artist, :status => :created, :location => @artist }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a6d6bd58e9d135ccfa7804f1876dc822",
"score": "0.5081224",
"text": "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { render :new }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a6d6bd58e9d135ccfa7804f1876dc822",
"score": "0.5081224",
"text": "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { render :new }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e2c2bf10977a88682587cb33e6c0ebea",
"score": "0.50754696",
"text": "def create\n @uchronist = Uchronist.new(params[:uchronist])\n\n respond_to do |format|\n if @uchronist.save\n format.html { redirect_to @uchronist, notice: 'Uchronist was successfully created.' }\n format.json { render json: @uchronist, status: :created, location: @uchronist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uchronist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d4646c61169cdbba9635a8de1ffab99b",
"score": "0.5066915",
"text": "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\n else\n # print error message\n \"Error Code #{RESPONSE.code}\"\n end\n end",
"title": ""
},
{
"docid": "73cd19298fa522afeb6ee7f2a90c0370",
"score": "0.5066855",
"text": "def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"title": ""
},
{
"docid": "b46299db4225e7b73ff1bd3dacecffe2",
"score": "0.5052559",
"text": "def create\n\t\t@owner = Prover.find(params[:owner])\n\t\t@owner.follow(Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "80fb9d3f441d4e20255439d9810aba0b",
"score": "0.50449866",
"text": "def create\n @animal = @shelter.animals.build(animal_params)\n respond_with(@shelter)\n end",
"title": ""
},
{
"docid": "ea118c1ba9ede7500485fad5f72f061e",
"score": "0.5034375",
"text": "def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c6daebf17c6f87780eb548a81cb27b27",
"score": "0.5029763",
"text": "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n\n format.json { render :show, status: :created, location: @artist }\n\n else\n\n format.html { render :new }\n\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"title": ""
},
{
"docid": "f98693c748d8cfa411dbd0cde5da218d",
"score": "0.5022583",
"text": "def create\n @kristine_toy = KristineToy.new(kristine_toy_params)\n\n respond_to do |format|\n if @kristine_toy.save\n format.html { redirect_to @kristine_toy, notice: 'Kristine toy was successfully created.' }\n format.json { render :show, status: :created, location: @kristine_toy }\n else\n format.html { render :new }\n format.json { render json: @kristine_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb1a36587a34b76ee126772326457e6f",
"score": "0.50212353",
"text": "def create\n @order_yurist = OrderYurist.new(order_yurist_params)\n\n respond_to do |format|\n if @order_yurist.save\n format.html { redirect_to @order_yurist, notice: 'Order yurist was successfully created.' }\n format.json { render :show, status: :created, location: @order_yurist }\n else\n set_project_and_apartments\n format.html { render :new }\n format.json { render json: @order_yurist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d9e86a10018e33880b167866ba76083",
"score": "0.50207716",
"text": "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: t(:create_notice) }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { render :new }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4ddcfe47a1a359ad748ebe8ec24faba6",
"score": "0.50146186",
"text": "def create\n @therapy = Therapy.new(therapy_params)\n category = TherapyCategory.create(name: @therapy.name)\n category.therapies << @therapy\n\n respond_to do |format|\n if @therapy.save\n format.html { redirect_to @therapy }\n format.json { render :show, status: :created, location: @therapy }\n else\n format.html { render :new }\n format.json { render json: @therapy.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0ddeec9867734cbc7597ae18142b133f",
"score": "0.5003709",
"text": "def destroy\n @therapist.destroy\n respond_to do |format|\n format.html { redirect_to therapists_url, notice: 'Therapist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ddeec9867734cbc7597ae18142b133f",
"score": "0.5003709",
"text": "def destroy\n @therapist.destroy\n respond_to do |format|\n format.html { redirect_to therapists_url, notice: 'Therapist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ddeec9867734cbc7597ae18142b133f",
"score": "0.5003709",
"text": "def destroy\n @therapist.destroy\n respond_to do |format|\n format.html { redirect_to therapists_url, notice: 'Therapist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e5b4625f083f475371812acc015a67a",
"score": "0.49876246",
"text": "def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end",
"title": ""
},
{
"docid": "9f659c18ce713b924ca294663c00c258",
"score": "0.49865305",
"text": "def create_gists(file, options={})\n opts = {:files => {File.basename(file) => { 'content' => File.read(file) }}}\n options.merge!(opts)\n result = self.class.post(\"/gists\", :body => options.to_json, :headers => @headers)\n if result.code == 201\n puts \"You have successfully created a new gist!\"\n end\n end",
"title": ""
},
{
"docid": "c9782aa2a1f6e30fbefd1a41142b55e9",
"score": "0.49865064",
"text": "def create\n @user=User.find(params[:user_id])\n @follower = @user.followers.create(follower_params)\n if @follower.save\n render json: @follower, status: :created\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "b9e57eaad2fa1e643f64641a834f3ee1",
"score": "0.49830568",
"text": "def create\n @specialist = Specialist.new(specialist_params)\n\n respond_to do |format|\n if @specialist.save\n format.html { redirect_to [:admins, @specialist], notice: 'Specialist was successfully created.' }\n format.json { render :show, status: :created, location: [:admins, @specialist] }\n else\n format.html { render :new }\n format.json { render json: @specialist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2084c1661e59e28cc24a1217b3f62681",
"score": "0.49729082",
"text": "def create\n @consists_of = ConsistsOf.new(consists_of_params)\n\n respond_to do |format|\n if @consists_of.save\n format.html { redirect_to @consists_of, notice: 'Consists of was successfully created.' }\n format.json { render :show, status: :created, location: @consists_of }\n else\n format.html { render :new }\n format.json { render json: @consists_of.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94e291b4683b7db660d65e151431019b",
"score": "0.49489",
"text": "def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d80f795260a2be8c2350a606fd2cd541",
"score": "0.4930716",
"text": "def destroy\n @therapist = Therapist.find(params[:id])\n @therapist.destroy\n\n respond_to do |format|\n format.html { redirect_to therapists_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8229cf3293977ff025e9977c8d485921",
"score": "0.4924206",
"text": "def create\n @artist_tag = ArtistTag.new(params[:artist_tag])\n\n respond_to do |format|\n if @artist_tag.save\n format.html { redirect_to artist_tags_path, notice: 'Artist tag was successfully created.' }\n format.json { render json: @artist_tag, status: :created, location: @artist_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @artist_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "781c81f496045c974329528a63ca3938",
"score": "0.49221134",
"text": "def create\n @gist = Gist.new(gist_params)\n\n respond_to do |format|\n if @gist.save\n format.html { redirect_to @gist, notice: 'Gist was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gist }\n else\n format.html { render action: 'new' }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7d25d307344cb68f601fcbf9cc0912a4",
"score": "0.4918969",
"text": "def create\n @party = Party.new(params[:party])\n\n respond_to do |format|\n if @party.save\n format.html { redirect_to @party, notice: 'Party was successfully created.' }\n format.json { render json: @party, status: :created, location: @party }\n else\n format.html { render action: \"new\" }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ed15ed38700ffdfd53ca84da8764bc89",
"score": "0.48984843",
"text": "def create\n @forest = Forest.new(params[:forest])\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render json: @forest, status: :created, location: @forest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0a256caf56eb3d0d417e1d5e69a7fdc",
"score": "0.48942572",
"text": "def create\n @artist = Artist.new(params[:artist])\n @artist.user = @current_user\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to session[:redirect_origin].pop || artist_url(@artist), notice: 'Artist was successfully created.' }\n format.json { render json: @artist, status: :created, location: @artist }\n else\n format.html { render action: 'new' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae442e95644e5baa4d00d3fa76a86dd0",
"score": "0.48935655",
"text": "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"title": ""
},
{
"docid": "59ca9d54af001aac6e6abcc4a079c49f",
"score": "0.48846033",
"text": "def create\n megam_rest.post_node(to_hash)\n end",
"title": ""
},
{
"docid": "8adc84c7f7f1d7c13518675efdf7891d",
"score": "0.4869603",
"text": "def create\n @laboratorist = Laboratorist.new(laboratorist_params)\n\n respond_to do |format|\n if @laboratorist.save\n format.html { redirect_to @laboratorist, notice: 'Laboratorist was successfully created.' }\n format.json { render :show, status: :created, location: @laboratorist }\n else\n format.html { render :new }\n format.json { render json: @laboratorist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "49c70906e21de620bdbf09986898275d",
"score": "0.48625234",
"text": "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"title": ""
},
{
"docid": "836ce5c667505bfb045154f0a7b7d57b",
"score": "0.48559028",
"text": "def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend",
"title": ""
},
{
"docid": "1feff7d3142a99d8ba84e335a7c0828f",
"score": "0.48507565",
"text": "def create\n @seeker = Seeker.new(seeker_params)\n @seeker.user_id = User.find(session[:user_id]).uid\n @seeker.skill_list.add(params[:seeker][:skill_list].to_s.downcase, parse: true)\n\n respond_to do |format|\n if @seeker.save\n format.html { redirect_to root_path, notice: 'Seeker was successfully created.' }\n format.json { render action: 'show', status: :created, location: @seeker }\n else\n format.html { render action: 'new' }\n format.json { render json: @seeker.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb379a2b02d18079fa2b8a03c3e423ce",
"score": "0.48507217",
"text": "def create\n @similar_artist = SimilarArtist.new(similar_artist_params)\n\n respond_to do |format|\n if @similar_artist.save\n format.html { redirect_to @similar_artist, notice: 'Similar artist was successfully created.' }\n format.json { render :show, status: :created, location: @similar_artist }\n else\n format.html { render :new }\n format.json { render json: @similar_artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2fab79f6b50fb96b6591e1ab649c6a27",
"score": "0.48484394",
"text": "def update\n @therapist.specialty_ids = params[:therapist][:specialty_ids]\n respond_to do |format|\n if @therapist.update(therapist_params)\n format.html { redirect_to root_path, notice: \"therapist was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "408e38c43950eaf0a04d6334958faf98",
"score": "0.48463896",
"text": "def therapist_params\n params.require(:therapist).permit(:pt_id, :name, :summary, :phone)\n end",
"title": ""
},
{
"docid": "cbd4a83387d6207edcb1e44c753001e9",
"score": "0.4845833",
"text": "def create\n @party = Party.new(party_params)\n\n respond_to do |format|\n if @party.save\n format.html { redirect_to @party, notice: 'Party was successfully created.' }\n format.json { render :show, status: :created, location: @party }\n else\n format.html { render :new }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8357d8dce2a7cd08a55f905133ba8403",
"score": "0.48452312",
"text": "def create\n @forest = Forest.new(forest_params)\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forest }\n else\n format.html { render action: 'new' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "23517a5ccf76b8a623a62f6dcea05916",
"score": "0.48402986",
"text": "def add_contributors\n @hash[:contributors].each do |json_contrib|\n my_hash = json_contrib.slice('contributor_name', 'contributor_type', 'created_at', 'updated_at', 'award_number')\n @ar_resource.contributors << StashDatacite::Contributor.create(my_hash)\n # btw affiliations for contributors are not really used in Dash data, so skipping that headache, though we have some test data for it\n end\n end",
"title": ""
},
{
"docid": "8f355fb07b27ecce6161146a969ec085",
"score": "0.4840266",
"text": "def gist_url\n \"#{api_url}/gists/%s\"\n end",
"title": ""
},
{
"docid": "fe5c524fbf43a5907bfb0d1e80e5cd37",
"score": "0.4830255",
"text": "def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end",
"title": ""
},
{
"docid": "85b2fc2b6731f7fe0357573a0c4eee77",
"score": "0.4827149",
"text": "def create\n @user_artist = UserArtist.new\n\t@artist = Artist.find params[:artist_id]\n\t@user_artist.user_id = @current_user.id\n\t@user_artist.artist_id = @artist.id\n\t\n respond_to do |format|\n if @user_artist.save\n format.html { redirect_to @artist, notice: 'User artist was successfully created.' }\n format.json { render :show, status: :created, location: @user_artist }\n else\n format.html { render :new }\n format.json { render json: @user_artist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ec7caf4de69d497414813b1effea9ef",
"score": "0.4815362",
"text": "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"title": ""
},
{
"docid": "473b633d3bb3ec6e1096b6fef03e084e",
"score": "0.4809785",
"text": "def create\n @shelter = Shelter.new(shelter_params)\n\n if @shelter.save\n render json: @shelter, status: :created, location: @shelter\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c92db42a8356c6583edc5babc0cd67dc",
"score": "0.48089617",
"text": "def create\n @odist = Odist.new(odist_params)\n\n respond_to do |format|\n if @odist.save\n format.html { redirect_to @odist, notice: 'Odist was successfully created.' }\n format.json { render :show, status: :created, location: @odist }\n else\n format.html { render :new }\n format.json { render json: @odist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7d550dc4d6b5389f3d41d3194d54fa7",
"score": "0.4802128",
"text": "def create\n name_normalized = ActsAsTaggableOn::Tag.normalize(params['name'])\n\n if name_normalized.nil? || name_normalized.empty?\n render :nothing => true, :status => 403\n else\n @tag = ActsAsTaggableOn::Tag.find_or_create_by_name(name_normalized)\n @tag_following = current_user.tag_followings.new(:tag_id => @tag.id)\n\n if @tag_following.save\n render :json => @tag.to_json, :status => 201\n else\n render :nothing => true, :status => 403\n end\n end\n end",
"title": ""
},
{
"docid": "9c6e06befa0102178692c385363fe014",
"score": "0.47935447",
"text": "def create\n res = self.class.post('/', body: attrs)\n res.created?\n end",
"title": ""
},
{
"docid": "4d4086f6bf40b63f0cddd36116bdfdd5",
"score": "0.47885573",
"text": "def create\n @turistum = Turistum.new(turistum_params)\n\n respond_to do |format|\n if @turistum.save\n format.html { redirect_to @turistum, notice: 'Turistum was successfully created.' }\n format.json { render :show, status: :created, location: @turistum }\n else\n format.html { render :new }\n format.json { render json: @turistum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f7ed4499a157592c2b3005e6ed2a25d3",
"score": "0.47848174",
"text": "def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end",
"title": ""
},
{
"docid": "ca2a750bd58240e2091231e2bc891f04",
"score": "0.47775766",
"text": "def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end",
"title": ""
},
{
"docid": "cc71f6ab5d0eec0b81cd9e87100fc83b",
"score": "0.47763395",
"text": "def create\n @ministry = Ministry.find(params[:ministry_id])\n current_user.follow(@ministry)\n respond_to do |format|\n format.html { redirect_to @ministry, notice: 'Ministry Followed' }\n format.js\n end\n end",
"title": ""
},
{
"docid": "d09ba16b50f66179ea43b3b41ab23d71",
"score": "0.47730482",
"text": "def api_request(name) \n\tresponse = HTTParty.post('https://api.talentiq.co/v2/person', \n :body => {:name => name }.to_json,\n :headers => { 'Content-Type' => 'application/json', \n \t\t\t'x-api-key:' => 'e058cdd334c69c31d45d87e44b405d128a9e8937939e7d0ab2496334',\n 'Accept' => 'application/json' })\n puts response.body\nend",
"title": ""
},
{
"docid": "31b2b40d639be572deba60c613ec4a55",
"score": "0.47668386",
"text": "def create\n @person_interest = PersonInterest.new(params[:person_interest])\n\n respond_to do |format|\n if @person_interest.save\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully created.' }\n format.json { render json: @person_interest, status: :created, location: @person_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7cfa4fd0d30fda29fb696d4d12a0fd82",
"score": "0.47667074",
"text": "def create\n @hood = Hood.new(hood_params)\n\n respond_to do |format|\n if @hood.save\n format.html { redirect_to @hood, notice: 'Hood was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hood }\n else\n format.html { render action: 'new' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aec648ebbbf99f6ad104ac0f2663fcd8",
"score": "0.47664413",
"text": "def create\n if @mission.torched_by? current_user\n return respond_to do |format|\n format.html { redirect_to mission_path(@mission) }\n format.json { head :no_content }\n end\n end\n @mission.torches.create torcher: current_user\n respond_to do |format|\n # TODO: notification and activity\n format.html { redirect_to mission_path(@mission), notice: t('missions.torch_awarded_successfully') }\n format.json { render json: { count: @mission.torches.count } }\n end\n end",
"title": ""
},
{
"docid": "9a60363edb2a421a3b38a04b8b3c7895",
"score": "0.47646105",
"text": "def create\n @stundent = Stundent.new(params[:stundent])\n\n respond_to do |format|\n if @stundent.save\n format.html { redirect_to @stundent, notice: 'Stundent was successfully created.' }\n format.json { render json: @stundent, status: :created, location: @stundent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stundent.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a6d8c9be4dab345844994d6c64eca6d8",
"score": "0.4763404",
"text": "def artists\n render :nothing => true and return if params[:id].nil?\n\n if ( params[:meta] == 'tattoos' )\n @artist = Artist.find(params[:id], :include => :tattoos)\n render :json => @artist.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @artist = Artist.find(params[:id])\n render :json => @artist.to_json(:include => :assets)\n end",
"title": ""
},
{
"docid": "77a32ab71ef62ecb28e0b81634312a2f",
"score": "0.4760552",
"text": "def create\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n\n @specialist = Specialist.new(params[:specialist])\n\n respond_to do |format|\n if @specialist.save\n format.html { redirect_to @specialist, notice: 'Specialist was successfully created.' }\n format.json { render json: @specialist, status: :created, location: @specialist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @specialist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "48cb13451b858bc599b45220e6989f5e",
"score": "0.47573256",
"text": "def create\n @specialty = Specialty.new(specialty_params)\n\n if @specialty.save\n render json: @specialty, status: :created, location: @specialty\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "4a8971f3c5de50f47a79c029fc6661e5",
"score": "0.47563288",
"text": "def perform(*args)\n # call petfinder\n response = HTTParty.get('http://api.petfinder.com/pet.find?key=49b6e87785e4e2811b2d5a9668eee5af&format=xml&location=ontario&count=1000')\n # parse xml\n xml_doc = Nokogiri::XML(response.body)\n\n # create hash of attributes\n xml_doc.xpath('//pet').each do |pet_xml|\n pet_attributes = {\n petfinder_id: pet_xml.xpath('id/text()').to_s.to_i,\n city: pet_xml.xpath('contact/city/text()').to_s,\n animal_type: pet_xml.xpath('animal/text()').to_s,\n breed: pet_xml.xpath('breeds/breed/text()')[0].to_s,\n name: pet_xml.xpath('name/text()').to_s,\n gender: pet_xml.xpath('sex/text()').to_s,\n size: pet_xml.xpath('size/text()').to_s,\n age: pet_xml.xpath('age/text()').to_s,\n status: pet_xml.xpath('status/text()').to_s,\n photo: pet_xml.xpath('media/photos/photo[3]/text()').to_s,\n description: pet_xml.xpath('description/text()').to_s,\n shelter_id: pet_xml.xpath('shelterId/text()').to_s\n }\n # save in DB\n #Pet.find_or_create_by!(petfinder_id: pet_id) do |pet|\n # pet.update(pet_attributes)\n #end\n Pet.create!(pet_attributes) unless (Pet.exists?(petfinder_id: pet_attributes[:petfinder_id]) || !Shelter.exists?(shelter_id: pet_attributes[:shelter_id]))\n end\n end",
"title": ""
},
{
"docid": "86b05e1036fbbcb02add7f0cf305e674",
"score": "0.47545165",
"text": "def artist_params\n params.permit(:city, :state, :spotify_id, :name, :followers, :popularity, :genres, :images)\n end",
"title": ""
},
{
"docid": "76c0edeb3197fc5064d7cd88b0b64f2f",
"score": "0.47473946",
"text": "def create\n @plant = Plant.find(params[:plant])\n @friendship = @plant.friendships.build(:friend_id => params[:friend])\n if @friendship.save\n flash[:notice] = \"added friend\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to request.referer\n end\n end",
"title": ""
},
{
"docid": "0f4e8433c86af18a3910cf18997fea99",
"score": "0.47452712",
"text": "def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"title": ""
},
{
"docid": "497a4c936900cb3d2ab006ebef16dded",
"score": "0.47394475",
"text": "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"title": ""
},
{
"docid": "77577e0a915981d8ebf084c85faa644d",
"score": "0.4735081",
"text": "def create\n @trustee = Trustee.new(trustee_params)\n\n respond_to do |format|\n if @trustee.save\n format.html { redirect_to @trustee, notice: 'Trustee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trustee }\n else\n format.html { render action: 'new' }\n format.json { render json: @trustee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
2aed6295049d6012538e82e80d0b6ed2
|
POST /textiles POST /textiles.json
|
[
{
"docid": "737e35647590da751fbfcefa1474b544",
"score": "0.6782706",
"text": "def create\n @textile = Textile.new(textile_params)\n\n respond_to do |format|\n if @textile.save\n format.html { redirect_to @textile, notice: 'Textile was successfully created.' }\n format.json { render :show, status: :created, location: @textile }\n else\n format.html { render :new }\n format.json { render json: @textile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "6028023c3fce075928700008fb8bf438",
"score": "0.63485086",
"text": "def index\n @textiles = Textile.all\n end",
"title": ""
},
{
"docid": "0ad99512631716d3e9ea7760924277e5",
"score": "0.63054466",
"text": "def textile_params\n params.require(:textile).permit(:size, :material, :picture, :name)\n end",
"title": ""
},
{
"docid": "a366ba234bc605581a4bda5369e24d1b",
"score": "0.57593876",
"text": "def set_textile\n @textile = Textile.find(params[:id])\n end",
"title": ""
},
{
"docid": "eb33e115bf9ec336c3bbb0b2de70736a",
"score": "0.5708605",
"text": "def sentiment(text)\n RestClient.post \"http://api.datumbox.com/1.0/SentimentAnalysis.json\", {api_key: '', text: text}, {content_type: :json, accept: :json}\nend",
"title": ""
},
{
"docid": "f007bb2050fa0d82c6ce7960c9e5432d",
"score": "0.5683824",
"text": "def textile(text)\n textilize(text)\n end",
"title": ""
},
{
"docid": "14e56da616e802eb130f0ff08d9fda07",
"score": "0.5442453",
"text": "def textile_preview\n @data = params[:data]\n render :layout => false\n end",
"title": ""
},
{
"docid": "b1f1590f4cc583798a3d392f22a8f0a9",
"score": "0.5437984",
"text": "def createForText\n #takes the :id for the text and converts it to text_id for image\n if params[\"id\"]\n params[\"image\"][\"text_id\"] = params[\"id\"].to_i\n end\n render json: Image.create(params[\"image\"])\n end",
"title": ""
},
{
"docid": "ffb56494cd060c85426ba7aaa786a146",
"score": "0.53150606",
"text": "def create_return_english_objectivity_multipart_form text\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/objectivity\"\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"X-Mashape-Key\" => @x_mashape_key\r\n }\r\n\r\n # prepare parameters\r\n parameters = {\r\n \"text\" => text\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers:headers, parameters:parameters\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"title": ""
},
{
"docid": "0cf761a557c1584887708bd21262ac98",
"score": "0.53081393",
"text": "def sentiment_analysis(text)\n RestClient.post \"http://api.datumbox.com/1.0/SentimentAnalysis.json\", :api_key => @api_key, :text => text\n end",
"title": ""
},
{
"docid": "cf37e405232837c2a5b6c25bb7359463",
"score": "0.5283223",
"text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to user_collection_path(@user, @collection), notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04a8b7b456ee17bb7e39631dc8f4503c",
"score": "0.52362204",
"text": "def post_analysis\n issues.each do |i|\n text_content = i[:comment_body]\n\n response = RestClient.post(\n 'https://apis.paralleldots.com/v4/sentiment',\n {\n api_key: ENV['PARALLEL_DOTS_API_KEY'],\n text: text_content\n }\n )\n\n response = JSON.parse(response)\n markdown(\"Username: #{i[:username]}\\nMessage: #{text_content}\\n\\n#{format_response(response)}\\n\")\n end\n end",
"title": ""
},
{
"docid": "02820d836e3e33043b363ea1d7253e43",
"score": "0.52062553",
"text": "def readability(text)\n RestClient.post \"http://api.datumbox.com/1.0/ReadabilityAssessment.json\", {api_key: '', text: text}, {content_type: :json, accept: :json}\nend",
"title": ""
},
{
"docid": "7c45373a3ca77310fd57b394e1fe77ce",
"score": "0.5199463",
"text": "def update\n respond_to do |format|\n if @textile.update(textile_params)\n format.html { redirect_to @textile, notice: 'Textile was successfully updated.' }\n format.json { render :show, status: :ok, location: @textile }\n else\n format.html { render :edit }\n format.json { render json: @textile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c03b37f571c2f176b1c5d98a7bc87412",
"score": "0.519088",
"text": "def index\n @texts = Text.all\n render json: @texts, status: 200\n end",
"title": ""
},
{
"docid": "4ef8b8fd39d91da5142a88898c7df1ec",
"score": "0.5159067",
"text": "def twitter_sentiment_analysis(text)\n RestClient.post \"http://api.datumbox.com/1.0/TwitterSentimentAnalysis.json\", :api_key => @api_key, :text => text\n end",
"title": ""
},
{
"docid": "3edcc4d62485806b8b6a988cdb6d95d3",
"score": "0.51261634",
"text": "def parse_textile\n # text = Pressesend.iso_slett_tegn((params[:data]))\n text = params[:data]\n render :text => RedCloth.new(text).to_html\n # render :text => RedCloth.new(params[:data]).to_html\n # text = norsk2html(params[:data])\n # render :text => norsk2html(params[:data])\n\n end",
"title": ""
},
{
"docid": "debb42aa8b1b5627b5238d3006038c61",
"score": "0.51213443",
"text": "def add_trophy\n if request.post?\n @name = params[:name]\n @level = params[:level]\n @score = params[:score]\n success, trophy = Trophy.add_trophy_to_database(@name,\n @level, @score, params[:image])\n if success\n flash[:success] = \"تم ادخال الانجاز #{trophy.name} بنجاح\"\n redirect_to \"/admin/list/trophies\"\n else\n flash[:error] = trophy.errors.messages\n end\n end\n end",
"title": ""
},
{
"docid": "9eb3f915ef0823e1b729d04657f5d335",
"score": "0.51104754",
"text": "def destroy\n @textile.destroy\n respond_to do |format|\n format.html { redirect_to textiles_url, notice: 'Textile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f9449660495a4c971e8914de718547d7",
"score": "0.5101187",
"text": "def create\n render json: Text.create(params[\"text\"])\n end",
"title": ""
},
{
"docid": "29d7a1dbd0c5b8eeef4864b205a49492",
"score": "0.50365996",
"text": "def create\n @text = Text.new(text_params)\n if @text.save!\n render json: @text\n else\n flash.now[:errors] = @text.errors.full_messages\n render json: @text\n end\n end",
"title": ""
},
{
"docid": "8a4b3545b94d892f73db283893aba0b1",
"score": "0.5030214",
"text": "def upload_phrases\n load_phrases unless @phrases_flat\n\n batch_requests = @phrases_flat.inject([]) do |o,(k,v)| \n # ToDo: Materialize ALL CLDR plural tags if at least one is present for a leaf node.\n o << {:string_key => k, :string => v}\n end\n\n @project.input_bulk(batch_requests)\n end",
"title": ""
},
{
"docid": "70bbcc364e7b409f10e4e9511536431f",
"score": "0.49835393",
"text": "def post(rectype,attribs,http)\r\n endpoint=\"#{URL_PREFIX}/t#{rectype}s.json\"\r\n req = Net::HTTP::Post.new(endpoint,initheader = {'Content-Type' =>'application/json'})\r\n req.body = attribs.to_json\r\n http.request(req)\r\nend",
"title": ""
},
{
"docid": "088a5a47f662e1b16952d9bd846c614e",
"score": "0.49513948",
"text": "def create\n @written_testimony = WrittenTestimony.new(params.require(:written_testimony).permit(:user_text))\n\n respond_to do |format|\n if @written_testimony.save\n format.html { redirect_to written_testimonies_url,\n notice: 'WrittenTestimony was successfully created.' }\n format.json { render json: @written_testimony, status: :created, location: @written_testimony }\n else\n format.html { render action: \"new\" }\n format.json { render json: @written_testimony.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7fe5734ece79b4a070a36ce5ec4274e",
"score": "0.49512976",
"text": "def queryText(_request, _response,image)\n call_features=[{\n type: 'TEXT_DETECTION',\n maxResults: 1\n }]\n results=apiRequest(image,call_features)\n _response.status = 200\n _response['Content-Type'] = 'application/json'\n _response.body=results.body\nend",
"title": ""
},
{
"docid": "aeda32948f03daccffa0bd5d31da0229",
"score": "0.49462947",
"text": "def keyword_extraction(text, n)\n RestClient.post \"http://api.datumbox.com/1.0/KeywordExtraction.json\", :api_key => @api_key, :text => text, :n => n\n end",
"title": ""
},
{
"docid": "95219740de71c73e0643e1b301e2d8a2",
"score": "0.494302",
"text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: t(:successful_created, scope: :texts) }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5b49fba327925bb19ec0c1c35b10d32f",
"score": "0.49428064",
"text": "def create\n respond_to do |format|\n if @text.save\n format.html { redirect_to expanded_modification_path(@text.modifications.first), flash: {success: t(\"texts.created\")} }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c9271b901160dcec7c249ecbc9987452",
"score": "0.49373725",
"text": "def create\n @text = Text.new(params[:text])\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Yeah, Square was successfully created.'}\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c4dea0ae76a9ae58ea27ad824aa45d48",
"score": "0.49322566",
"text": "def create\n tags = params[:textual]['tags']\n params[:textual].delete(\"tags\")\n @textual = Textual.new(params[:textual])\n\n respond_to do |format|\n if @textual.save\n unless tags.nil?\n @textual.tag_with tags\n end\n flash[:notice] = 'Textual was successfully created.'\n format.html { redirect_to([:admin, @textual]) }\n format.xml { render :xml => @textual, :status => :created, :location => @textual }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @textual.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fdbb16e5818a6720925a26ba0ee68917",
"score": "0.4924186",
"text": "def create\n @mile = Mile.new(params[:mile])\n\n respond_to do |format|\n if @mile.save\n format.html { redirect_to @mile, notice: 'Mile was successfully created.' }\n format.json { render json: @mile, status: :created, location: @mile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0943912e84f8b717cee24c96820bddde",
"score": "0.4909826",
"text": "def subjective_analysis(text)\n RestClient.post \"http://api.datumbox.com/1.0/SubjectivityAnalysis.json\", :api_key => @api_key, :text => text\n end",
"title": ""
},
{
"docid": "d97be13651c7647857c923dc5267befa",
"score": "0.49080604",
"text": "def create\n params[:words].each do |word|\n dbword = Word.new(:word => word)\n dbword.save\n end\n \n respond_to do |format|\n format.json { head :created }\n end\n end",
"title": ""
},
{
"docid": "672fec5451335f0d1b9fc2fb695f05fc",
"score": "0.48992327",
"text": "def post url, body = nil\n http.post do |req|\n req.url url\n req.headers['Content-Type'] = 'text/turtle'\n req.body = body\n yield req if block_given?\n end\n end",
"title": ""
},
{
"docid": "fcc6e6b968f603d3e55f39b5e8b47633",
"score": "0.48915067",
"text": "def index\n @texts = Text.all\n render json: @texts\n end",
"title": ""
},
{
"docid": "8777f901e647ba488dccf09bca74acba",
"score": "0.48904195",
"text": "def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['messages'] << message\n end",
"title": ""
},
{
"docid": "dd38ec2b448fc01e27a276005273287f",
"score": "0.48866627",
"text": "def upload_floor_plan(args = {}) \n post(\"/files.json/floorplan/images\", args)\nend",
"title": ""
},
{
"docid": "a4cdeebbd9383b2bd102ba6a3c89e8b2",
"score": "0.4883876",
"text": "def text_to_structure(text)\n request.post('/text-to-structure', data: { text: text })\n end",
"title": ""
},
{
"docid": "eccaa775c61f86bcae086d07120b5830",
"score": "0.48824582",
"text": "def preset_nlp(methodName, text)\n specs = NLP_SPECS[methodName]\n result = POST(specs[:path], specs[:params], {text: text}, :json)\n result[:annotations].each do |key, value|\n value.map! { |an| assign_text(an, text) }\n end\n result\n end",
"title": ""
},
{
"docid": "003188aa2ed2569532f57973af054d47",
"score": "0.48596072",
"text": "def test_body\n blob = JSON.parse(params[:blob])\n\n d = Dictionary.create!\n\n render :json => blob\n end",
"title": ""
},
{
"docid": "72586fa5fb67934e4766f0ad5b6f0c59",
"score": "0.48501775",
"text": "def create\r\n @textura = Textura.new(textura_params)\r\n\r\n respond_to do |format|\r\n if @textura.save\r\n format.html { redirect_to textura_path(@textura), notice: 'Textura criada com sucesso.' }\r\n format.json { render :show, status: :created, location: @textura }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @textura.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "35e5ba6de990637f5059eb4711e153c7",
"score": "0.48428053",
"text": "def create\n @text = Text.new(params[:text])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbe6500a6c4a615eb91cd77d6de2788c",
"score": "0.4836071",
"text": "def post(data, tags_in = {}) ; post_to nil, data, tags_in end",
"title": ""
},
{
"docid": "1e0c5ab8fd0ad0701ffc3f6c18e23ea7",
"score": "0.48091173",
"text": "def new\n @text_resource = @project.text_resources.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_resource }\n end\n end",
"title": ""
},
{
"docid": "0711dbcd712092a39a31105736dc23b8",
"score": "0.47954726",
"text": "def create_allele(a)\n allele_data = request(\n :url => \"alleles.json\",\n :method => \"post\",\n :payload => { :allele => a }.to_json\n )\n allele = JSON.parse(allele_data)[\"allele\"]\n return allele\nend",
"title": ""
},
{
"docid": "975319bf87cc407ff59060a71fa97535",
"score": "0.47939017",
"text": "def create\n @toilet = Toilet.new(params[:toilet])\n\n respond_to do |format|\n if @toilet.save\n format.html { redirect_to @toilet, :notice => 'Toilet was successfully created.' }\n format.json { render :json => @toilet, :status => :created, :location => @toilet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @toilet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "32fe1a96f3f668502f6a18ef029d41fb",
"score": "0.47933635",
"text": "def type(text:)\n conn = multipart_connection(port: 8060)\n text.split(//).each do |c|\n path = \"/keypress/LIT_#{CGI::escape(c)}\"\n response = conn.post path\n return false unless response.success?\n end\n return true\n end",
"title": ""
},
{
"docid": "7ac613cc3c3f553f0c4b6e8b585e56c6",
"score": "0.4792154",
"text": "def create\n @text_stat = TextStat.new(params[:text_stat])\n\n respond_to do |format|\n if @text_stat.save\n format.html { redirect_to @text_stat, notice: 'Text stat was successfully created.' }\n format.json { render json: @text_stat, status: :created, location: @text_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "881303734742336d4714591891482fc4",
"score": "0.47864142",
"text": "def index\n # @texts = Text.all\n @texts = Text.where(\"univ = ? and status = ?\", params[:univ], 1)\n @texts.each do |text| \n if(text.teacher != nil)then\n text.teacher = text.teacher.force_encoding('utf-8')\n end\n if(text.lecture_name != nil)then\n text.lecture_name = text.lecture_name.force_encoding('utf-8')\n end\n if(text.textbook_name != nil) then\n text.textbook_name = text.textbook_name.force_encoding('utf-8')\n end\n if(text.comment != nil)then\n text.comment = text.comment.force_encoding('utf-8')\n end\n if(text.univ != nil)then\n text.univ = text.univ.force_encoding('utf-8')\n end \n if(text.file_name != nil)then\n text.file_name = text.file_name.force_encoding('utf-8')\n end \n \n end\n\n \n\n render :json => @texts.to_json(:include => {:user => { :only => ['link']}})\n #render :json => @texts\n # render :json => @texts.to_json(:include => [:image])\n end",
"title": ""
},
{
"docid": "bc629193749bb7156c94ec9659552e77",
"score": "0.4782676",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "bc629193749bb7156c94ec9659552e77",
"score": "0.4782676",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "bc629193749bb7156c94ec9659552e77",
"score": "0.4782676",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "32c96a1a6418f2ec624da5f217f4fdd6",
"score": "0.47788763",
"text": "def create\n @text_item = TextItem.new(text_item_params)\n\n respond_to do |format|\n if @text_item.save\n format.html { redirect_to text_items_url, notice: 'Text item was successfully created.' }\n format.json { render :show, status: :created, location: @text_item }\n else\n format.html { render :new }\n format.json { render json: @text_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e5b8befbd14db66f2ba2f81b3710d0bc",
"score": "0.47730085",
"text": "def create\n if params[:matter_image]\n matter = Matter.build( params[:ask_for_dapei][:user_id], nil, nil, params[:matter_image])\n params[:ask_for_dapei][:matter_id] = matter.id \n p matter\n end\n \n @ask_for_dapei = AskForDapei.new( params[:ask_for_dapei] )\n\n respond_to do |format|\n if @ask_for_dapei.save\n if params[:tags]\n @ask_for_dapei.tag_list.add( params[:tags] )\n end\n \n format.html { redirect_to @ask_for_dapei, notice: 'Ask for dapei was successfully created.' }\n format.json { render_for_api :public, :json => @ask_for_dapei, :meta=>{:result=>\"0\"} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ask_for_dapei.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5b0edbc325760195e2f3a7a587af1724",
"score": "0.47714534",
"text": "def topic_classification(text)\n RestClient.post \"http://api.datumbox.com/1.0/TopicClassification.json\", :api_key => @api_key, :text => text\n end",
"title": ""
},
{
"docid": "50c2ebde7dba3da6d3f509eeea560a62",
"score": "0.47658566",
"text": "def artcile_params\n params.require(:artcile).permit(:title, :body)\n end",
"title": ""
},
{
"docid": "5e04beb44ae2ff6c9c0971d306ee7222",
"score": "0.4764079",
"text": "def create\n terrain_array = []\n\n all_terrain_params.each do |terrain|\n terrain_array << terrain[\"img_src\"][-5]\n end\n\n @allTerrain = AllTerrain.new(game_session_id: all_terrain_params[0][\"game_session_id\"], img_src_array: terrain_array)\n @allTerrain.save\n render json: @allTerrain\n end",
"title": ""
},
{
"docid": "a35f0efeddebfe3a3f5a91af80c25854",
"score": "0.47614118",
"text": "def create\n @toilet = Toilet.new(params[:toilet])\n\n respond_to do |format|\n if @toilet.save\n format.html { redirect_to @toilet, notice: 'Toilet was successfully created.' }\n format.json { render json: @toilet, status: :created, location: @toilet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @toilet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a35f0efeddebfe3a3f5a91af80c25854",
"score": "0.47614118",
"text": "def create\n @toilet = Toilet.new(params[:toilet])\n\n respond_to do |format|\n if @toilet.save\n format.html { redirect_to @toilet, notice: 'Toilet was successfully created.' }\n format.json { render json: @toilet, status: :created, location: @toilet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @toilet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3135ef06c226d13125eae2c10539ec08",
"score": "0.47606942",
"text": "def create_batch\n authorize @intellectual_object, :create?\n begin\n files = JSON.parse(request.body.read)\n rescue JSON::ParserError, Exception => e\n respond_to do |format|\n format.json { render json: {error: \"JSON parse error: #{e.message}\"}, status: 400 } and return\n end\n end\n GenericFile.transaction do\n @generic_files = []\n files.each do |gf|\n file = @intellectual_object.generic_files.new(gf)\n file.state = 'A'\n file.institution_id = @intellectual_object.institution_id\n @generic_files.push(file)\n end\n end\n respond_to do |format|\n if @intellectual_object.save\n format.json { render json: array_as_json(@generic_files), status: :created }\n else\n errors = @generic_files.map(&:errors)\n format.json { render json: errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ce0fc92768aa23dddd2877170f271e36",
"score": "0.47500655",
"text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.json { render :show, status: :created, location: api_text_url(@text) }\n else\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2fceb3c77938fd5587e33a39120c3eaa",
"score": "0.47454813",
"text": "def create\n # params = ActionController::Parameters.new({\"unigrams\"=>[\"0\"=>{\"ticker_id\"=>1, \"text\"=>\"Hello world\", \"count\"=>3, \"positive_count\"=>3, \"neutral_count\"=>0, \"negative_count\"=>0}, \"1\"=>{\"ticker_id\"=>1, \"text\"=>\"Hello android\", \"count\"=>2, \"positive_count\"=>0, \"neutral_count\"=>2, \"negative_count\"=>0}]})\n # puts params[:unigrams]\n # puts 'Hello'\n params[:unigrams].each do |uni_params|\n uni_params = uni_params.permit(:ticker_id, :text, :count, :positive_count, :negative_count, :neutral_count)\n @unigram = Unigram.new(uni_params)\n @unigram.save\n end\n\n respond_to do |format|\n msg = { :status => :ok, :message => \"Success!\", :html => '<b></b>' }\n format.html do\n redirect_to '/'\n end\n format.json { render :json => msg }\n end\n\n #@unigram = Unigram.new(unigram_params)\n\n #respond_to do |format|\n #if @unigram.save\n #format.html { redirect_to @unigram, notice: params[:unigram]}#'Unigram was successfully created.' }\n # format.json { 'ok' }\n #else\n # format.html { render action: 'new' }\n # format.json { render json: @unigram.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"title": ""
},
{
"docid": "3f100d7c5c1768f6826d93b20814cbe8",
"score": "0.47367474",
"text": "def create\n @liga_tymy = LigaTymy.new(liga_tymy_params)\n\n respond_to do |format|\n if @liga_tymy.save\n format.html { redirect_to @liga_tymy, notice: 'Liga tymy was successfully created.' }\n format.json { render :show, status: :created, location: @liga_tymy }\n else\n format.html { render :new }\n format.json { render json: @liga_tymy.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "78110ea6e340bb0c6dd778eb24884345",
"score": "0.47273523",
"text": "def text_params\n params.require(:text).permit(:title, :body, :description, :collection_id)\n end",
"title": ""
},
{
"docid": "0c0cbecc296a11f25fb411bf373d00db",
"score": "0.47226268",
"text": "def send_sentence\n\n require 'json'\n\n upload_tag_array = request.body.read.split\n\n sentence = []\n\n upload_tag_array.each do |ele|\n json_ele = JSON.parse(ele)\n update_str = json_ele[\"tag\"] + \"\\t\" + json_ele[\"word\"]\n sentence << update_str\n end\n\n if $cache[$name][1][0]\n\n $cache[$name][0][$cache[$name][1][1]] = sentence\n $cache[$name][1][0] = false\n elsif sentence.length != 0\n $cache[$name][0] << sentence\n end\n\n respond_to do |format|\n\n msg = {:status => true}\n\n format.json {render :json => msg}\n\n end\n end",
"title": ""
},
{
"docid": "079fd095b6f9542bc8e371b5969089c0",
"score": "0.46971366",
"text": "def create_files\n path = params[:path]\n \n if (path != \"\")\n data = JSON.parse(params[:post])\n data.each do |el|\n Dagr.add_dagr(current_user,el[\"name\"], path,el[\"size\"], el[\"name\"].split(\".\")[0], nil)\n end\n flash[:danger] = \"Dagrs added\"\n else\n flash[:danger] = \"path must be filled out\"\n end\n render 'new'\n end",
"title": ""
},
{
"docid": "87dec5841850fbbb10bb870eadede941",
"score": "0.46797282",
"text": "def putActionText(actionId, text)\n\tresponse = RestClient.put(\n\t\t\t'https://api.trello.com/1/actions/'+actionId+'/text',\n\t\t\t:value \t=> text,\n\t\t\t:key \t=> $key,\n\t\t\t:token \t\t\t=> $token\n\t)\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "83edeb1621084aecbf921e42e91b7cad",
"score": "0.4678232",
"text": "def create\n name = params[:recipeName]\n ingredients = params[:ingredients].split('\\n')\n instructions = params[:instructions].split('\\n')\n image_src = params[:image]\n # create new recipe and add params\n @new_recipe = Recipe.new(name: name, image_src: image_src)\n # add the ingredients for the recipe\n ingredients.each do |ingredient|\n this_ingredient = Ingredient.find_or_create_by(name: ingredient)\n @new_recipe.ingredients.push(this_ingredient)\n end\n # add the instructions for the recipe\n order_key = 0\n instructions.each do |instruction|\n @new_recipe.recipe_directions.push(RecipeDirection.create!(desc: instruction, step_idx: order_key += 1))\n end\n if @new_recipe.save\n respond_to do |format|\n format.json { render json: @new_recipe.to_json }\n end \n else\n respond_to do |format|\n format.json { render json: @new_recipe.errors.full_messages, status: 422 }\n end\n end\n end",
"title": ""
},
{
"docid": "a54d7b2a3f1ef81c702bdb1c53bcc8f3",
"score": "0.46772212",
"text": "def create\n @reptile = Reptile.new(reptile_params) \n @reptile.save \n respond_with @reptile\nend",
"title": ""
},
{
"docid": "e4824c766f28c052534e7b7a9ddb92ad",
"score": "0.46744522",
"text": "def create\n @licenses = License.all\n @text = Text.create(params[:text])\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to texts_url, :notice => 'Successfully created' }\n format.json { render :json => @text, :status => :created, :location => @text }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5628ee446c2eeea081cf75810e67a426",
"score": "0.46736118",
"text": "def add_trophy\n params[:name] = params[:name].strip\n params[:level] = params[:level].strip\n params[:score] = params[:score].strip\n success, trophy = Trophy.add_trophy_to_database(params[:name],\n params[:level], params[:score], params[:image])\n if success\n flash[:success] = \"تم ادخال الانجاز #{trophy.name} بنجاح\"\n flash[:successtype] = \"addtrophy\"\n else\n flash[:error] = trophy.errors.messages\n flash[:errortype] = \"addtrophy\"\n end\n flash.keep\n if success\n redirect_to action: \"index\", anchor: \"admin-list-trophies\"\n else\n redirect_to action: \"index\", anchor: \"admin-add-trophy\", \n fargs: {addtrophy: params}\n end\n end",
"title": ""
},
{
"docid": "e61779624fff5507369d6c633b01855e",
"score": "0.46726337",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @texts }\n end\n end",
"title": ""
},
{
"docid": "d8bad367ff32c644733dd8cab761c9cf",
"score": "0.4667112",
"text": "def postList(listName, idBoard)\n\tresponse = RestClient.post(\n\t\t'https://api.trello.com/1/lists',\n\t\t:name => listName, \n\t\t:idBoard => idBoard,\n\t\t:key=>$key,\n\t\t:token=>$token\n\t)\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "a3f46863df6d83aaabee0c96c2037e11",
"score": "0.46665",
"text": "def new_word\n #guardar el parametro del objeto\n word = params[:word][:palabra]\n #guargar en una variable lo que regrese\n resp = Unirest.get('http://transmors.hol.es/new.php?', parameters: {:tex => \"#{word}\"})\n #Mandar a la vista lo que regreso y ponerlo en el body\n #con ajax se agregara a una parte de la vista\n render plain: \"#{resp.body}\"\n end",
"title": ""
},
{
"docid": "e46c413db22ce8a44b812c9b85c20b66",
"score": "0.46648908",
"text": "def tile_params\n params.require(:tile).permit(:title, :text, :url, :group, :major, :minor, :image, :show)\n end",
"title": ""
},
{
"docid": "813c8e93498579b99d24d6f178a56dc3",
"score": "0.46555346",
"text": "def create\n @text_image = TextImage.new(text_image_params)\n\n respond_to do |format|\n if @text_image.save\n format.html { redirect_to @text_image, notice: 'Image was sucessfully uploaded. Processing.' }\n format.json { render :show, status: :created, location: @text_image }\n else\n format.html { render :new }\n format.json { render json: @text_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f46d25d1a8d8323e128f53a593d1dfb2",
"score": "0.46495703",
"text": "def homepage_tile_params\n params.require(:homepage_tile).permit(:text)\n end",
"title": ""
},
{
"docid": "facc8ae5bb0067543f099a1049bd8cb6",
"score": "0.46330455",
"text": "def mass_tikify(text)\n sentences = NLP.sentences(text)\n\n sentences.map do |s|\n tokens = NLP.tokenize(s).reject do |t|\n # Don't include usernames/urls as tokens\n t.include?('@') || t.include?('http')\n end\n\n tokens.map { |t| tikify(t) }\n end\n end",
"title": ""
},
{
"docid": "12a132336d520cfdd6cda2238e2aee29",
"score": "0.46296996",
"text": "def test_create\n user = login\n params = create_term_params\n\n assert_no_difference(\"Image.count\") do\n post(:create, params: params)\n end\n\n term = GlossaryTerm.last\n assert_equal(params[:glossary_term][:name], term.name)\n assert_equal(params[:glossary_term][:description], term.description)\n assert_not_nil(term.rss_log)\n assert_equal(user.id, term.user_id)\n assert_response(:redirect)\n end",
"title": ""
},
{
"docid": "a08386c95dab7c15658d3b8c5278e43a",
"score": "0.4622659",
"text": "def create\n @projectile = Projectile.new(projectile_params)\n\n respond_to do |format|\n if @projectile.save\n format.html { redirect_to @projectile, notice: 'Projectile was successfully created.' }\n format.json { render :show, status: :created, location: @projectile }\n else\n format.html { render :new }\n format.json { render json: @projectile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cf84fa8e21bf12fc0f1967654117e935",
"score": "0.46199405",
"text": "def create\n @word = Word.new(params[:word])\n\n @word.created_at_mill = (Time.now.to_f * 1000.0).to_i\n \n # Get text instance\n text_id = @word.text_id\n \n if text_id != 0\n \n text = Text.find(text_id.to_i)\n \n else\n\n text = nil\n \n end\n \n respond_to do |format|\n if @word.save\n if text != nil\n \n text.words << @word\n \n write_log2(\n LOG_PATH,\n \"word added to the text: word id => \" + @word.id.to_s,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s) \n \n _post_data(Const::BACKUP_URL_WORDS, @word)\n # _post_data(BACKUP_URL, @word)\n \n else\n \n write_log2(\n LOG_PATH,\n \"text == nil(for the word #{@word.w1})\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s) \n \n end\n\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n # format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f3b75aec625a7402bb2a24fd1e3fc57f",
"score": "0.46179202",
"text": "def textile_sandbox\n if request.method == \"POST\"\n @code = params[:code]\n @submit = params[:commit]\n else\n @code = nil\n end\n render(action: :textile_sandbox)\n end",
"title": ""
},
{
"docid": "c14ded209793686708c4dd009ad9bf13",
"score": "0.4616608",
"text": "def create\n @note = Note.new(note_params)\n current_user.notes << @note\n\n # SUMMARIZER: Send post request to summarization API with given parameters\n response = Unirest.post \"https://textanalysis-text-summarization.p.mashape.com/text-summarizer-text\",\n headers:{\n \"X-Mashape-Key\" => \"aosLn4ArKSmshDQj2fLRpXFdIjKep1G9sPcjsnzUapJMEo5TUT\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\",\n \"Accept\" => \"application/json\"\n },\n parameters:{\n \"sentnum\" => 3,\n \"text\" => @note.text\n }\n\n # AUTO TAGGER: Send post request to Google NL API with given parameters\n tag_scraper = Unirest.post \"https://language.googleapis.com/v1/documents:analyzeEntities?key=AIzaSyA4A03W32VwKt313lZiEVD4_47P2A9lMeQ\",\n headers:{\n \"Content-Type\" => \"application/json\"\n },\n parameters: JSON.generate({\n \"encodingType\": \"UTF8\",\n \"document\": {\n \"type\": \"PLAIN_TEXT\",\n \"content\": @note.text}})\n\n # Set up array and push relevant entities into the array, then remove repeated entities and sort it alphabetically\n tag_arr = []\n tag_scraper.body[\"entities\"].each do |entity|\n if entity[\"type\"] != \"OTHER\"\n tag_arr.push(entity[\"name\"])\n end\n end\n tag_arr.uniq!\n tag_arr.sort_by!(&:downcase)\n\n @note.tag_list = tag_arr\n @note.summary = response.body[\"sentences\"].join(\" \")\n @note.creator_id = current_user.id\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f31a78e0a8842842988d54af13369619",
"score": "0.46109018",
"text": "def perform_webhook\n http_request.body = {'text' => params[:text]}.to_json.to_s\n http_request.query = {'token' => params[:token]}\n HTTPI.post(http_request)\n end",
"title": ""
},
{
"docid": "aadebb98bea34082acfdc0ae50081a4d",
"score": "0.46021658",
"text": "def index\n @text_images = TextImage.all\n end",
"title": ""
},
{
"docid": "4f375164164a6d25b17968a2de9582b7",
"score": "0.46016183",
"text": "def create\n @aile = Aile.new(aile_params)\n\n respond_to do |format|\n if @aile.save\n format.html { redirect_to @aile, notice: 'Aile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @aile }\n else\n format.html { render action: 'new' }\n format.json { render json: @aile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eabb8ac36fc8e586c54f9be7c58fd98c",
"score": "0.45968798",
"text": "def create\n @texto_lancamento = TextoLancamento.new(texto_lancamento_params)\n\n respond_to do |format|\n if @texto_lancamento.save\n format.html { redirect_to @texto_lancamento, notice: 'Texto lancamento was successfully created.' }\n format.json { render :show, status: :created, location: @texto_lancamento }\n else\n format.html { render :new }\n format.json { render json: @texto_lancamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "916c1003495fe87fb7dda8f9cf74de2e",
"score": "0.45927146",
"text": "def create\n learning = Learning.create(name: params[:name], description: params[:description].to_json)\n create_tags learning\n\n if learning\n render json: learning\n else\n render json: learning.errors\n end\n end",
"title": ""
},
{
"docid": "875b028d66aaeaf7505a8b4ded3dc907",
"score": "0.45919132",
"text": "def create\n @legislation = Legislation.new(params[:legislation])\n @legislation.post = Post.create(:title => params[:legislation][:title],\n :content => @legislation.summary,\n :user_id => current_user.id)\n\n\n respond_to do |format|\n if @legislation.save\n format.html { redirect_to @legislation, notice: 'Legislation was successfully created.' }\n format.json { render json: @legislation, status: :created, location: @legislation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @legislation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ac66c821c1d1ecdbedaebfd5277b962",
"score": "0.45871258",
"text": "def index\n @textos = Texto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @textos }\n end\n end",
"title": ""
},
{
"docid": "8dcc30d97f44fd0556c3e581b6afbc52",
"score": "0.45852444",
"text": "def create\n result = Dee['text.poster'].create(\n user: current_user,\n params: text_params,\n )\n @text = result.text\n\n respond_to do |format|\n if result.ok?\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render action: 'show', status: :created, location: @text }\n else\n format.html { render action: 'new' }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3f14a759bbdae75db12ca9bb1fe4e4b3",
"score": "0.45823407",
"text": "def process_text(body, *args)\n http_method = :post\n path = '/corpus/processText'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"title": ""
},
{
"docid": "e2267d4cbc258cadd6b62b06e9b3b68c",
"score": "0.45809725",
"text": "def create\n # to create multiple annotations using * as bullet points\n annotation_params[:body_source].split('* ').reject {|x| x.empty?}.each do |body_source|\n Annotation.create(source_id: annotation_params[:source_id], body_source: body_source)\n end\n\n redirect_back(fallback_location: root_path)\n end",
"title": ""
},
{
"docid": "306536f3e3147b632cbb365cedcf1dd7",
"score": "0.45806357",
"text": "def create\n @wiki = Wiki.new(params.require(:wiki).permit(:title, :body))\n\n if @wiki.save\n render json: @wiki, status: :created, location: @wiki\n else\n render json: @wiki.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "bbc1a060970bba1e87dd866c2728a6a5",
"score": "0.45774794",
"text": "def postChecklist(name, idBoard)\n\n\thash = Hash.new\t\n\thash[:name] = name\n\thash[:idBoard] = idBoard\n\thash[:key] = $key\n\thash[:token] = $token\n\n\tresponse = RestClient.post 'https://api.trello.com/1/checklists', hash\n\tresponse = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "b6dd44b284c4ede21477c355daac8602",
"score": "0.45773515",
"text": "def new\n @text_stat = TextStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_stat }\n end\n end",
"title": ""
},
{
"docid": "c7828e2bbe65c3e1ca922d50bf466926",
"score": "0.45770195",
"text": "def create\n @landing_text = LandingText.new(landing_text_params)\n\n respond_to do |format|\n if @landing_text.save\n format.html { redirect_to landing_texts_path }\n format.json { render :show, status: :created, location: @landing_text }\n else\n format.html { render :new }\n format.json { render json: @landing_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "38d3abf3751876d3c6646e5e2075f49c",
"score": "0.45613956",
"text": "def post_type\n :textos\n end",
"title": ""
},
{
"docid": "a1ea5e21bef8a3ef9b055815a21fe19f",
"score": "0.45596358",
"text": "def tagAdd(tag)\n http, req = initReq(\"tags/\", \"POST\")\n req.body = {\"name\" => tag.to_s}.to_json\n JSON.parse(http.request(req).body)\nend",
"title": ""
},
{
"docid": "a1ea5e21bef8a3ef9b055815a21fe19f",
"score": "0.45596358",
"text": "def tagAdd(tag)\n http, req = initReq(\"tags/\", \"POST\")\n req.body = {\"name\" => tag.to_s}.to_json\n JSON.parse(http.request(req).body)\nend",
"title": ""
},
{
"docid": "389029fe3540c36ca6dcf8eef84ecc86",
"score": "0.45571372",
"text": "def create\n @textpage = Textpage.new(params[:textpage])\n\n respond_to do |format|\n if @textpage.save\n format.html { redirect_to textpages_url }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
}
] |
0fa6afe21b7ac803b1f41bfe34287ccc
|
angular momentum of rotating rigid body with moment_inertia rotating at angular_velocity_ (vector in J s)
|
[
{
"docid": "240974d21b73b5d0ed36b619fab4d6d4",
"score": "0.8494529",
"text": "def angular_momentum_rigid_(moment_inertia, angular_velocity_)\n moment_inertia * angular_velocity_\n end",
"title": ""
}
] |
[
{
"docid": "9241a7b845da227950745f90e4b72331",
"score": "0.7441311",
"text": "def init_angular_velocity\n z = rotation_axis()\n v = init_linear_velocity_direction()\n d = z.cross(v) # if d points to the center, init_anglar_velocity > 0, \n \n to_c = center - @init_position.origin\n sign_d = to_c.dot(d) > 0 ? 1 : -1\n return sign_d * init_linear_speed / rotation_radius\n end",
"title": ""
},
{
"docid": "8883e38804883ced773bf4ce39038540",
"score": "0.69971335",
"text": "def angular_momentum_(axis_, position_, mass, velocity_)\n (position_ - axis_).cross_product_(momentum_(mass,velocity_))\n end",
"title": ""
},
{
"docid": "0a4b2d9f27d64b720a645689b731ed84",
"score": "0.6503245",
"text": "def get_angular_damping\n MSPhysics::Newton::Body.get_angular_damping(@address)\n end",
"title": ""
},
{
"docid": "0a4b2d9f27d64b720a645689b731ed84",
"score": "0.6502932",
"text": "def get_angular_damping\n MSPhysics::Newton::Body.get_angular_damping(@address)\n end",
"title": ""
},
{
"docid": "d9644dbc73469040e0f0e9e495daf281",
"score": "0.6473814",
"text": "def get_angular_damping\n Body.validate(self)\n MSPhysics::Newton::Body.get_angular_damping(@_address)\n end",
"title": ""
},
{
"docid": "2fd5a816930c2eb750c478f22f201be1",
"score": "0.64309675",
"text": "def perifocal_velocity(angular_momentum, eccentricity, true_anomaly, mu = Kepler::MU)\n h = angular_momentum\n e = eccentricity\n theta = true_anomaly.to_rad\n\n (mu / h) *\n Vector[-Math.sin(theta), e + Math.cos(theta), 0]\n end",
"title": ""
},
{
"docid": "0f7b0a9ece5f151eefa8f2c5210ec300",
"score": "0.63494873",
"text": "def test_07_angularVelocity\n\t\taVel = nil\n\t\t\n\t\tassert_nothing_raised { aVel = @body.angularVelocity } \n\t\tassert_in_delta( @body.angularVelocity[X], 0.0, 0.001 ) \n\t\tassert_in_delta( @body.angularVelocity[Y], 0.0, 0.001 ) \n\t\tassert_in_delta( @body.angularVelocity[Z], 0.0, 0.001 ) \n\tend",
"title": ""
},
{
"docid": "2150f9cfad4c5bae128eb0b3518b2499",
"score": "0.62425506",
"text": "def moment_inertia_rod(mass, length)\n (mass*length**2) / 12.0\n end",
"title": ""
},
{
"docid": "f0e5b3bcab72b59138d41bb3c2e606c5",
"score": "0.6232861",
"text": "def moment_inertia_ball(mass, radius)\n (2*mass*radius**2) / 5.0\n end",
"title": ""
},
{
"docid": "7fad3ec1af07fd5082acd40e6beeb27b",
"score": "0.6230843",
"text": "def momentum_(mass, velocity_)\n mass * velocity_\n end",
"title": ""
},
{
"docid": "d3e3c28fc8474bb8e7541f3959753cf2",
"score": "0.6207101",
"text": "def rotation\n MSPhysics::Newton::Body.get_rotation(@address)\n end",
"title": ""
},
{
"docid": "d3e3c28fc8474bb8e7541f3959753cf2",
"score": "0.62065053",
"text": "def rotation\n MSPhysics::Newton::Body.get_rotation(@address)\n end",
"title": ""
},
{
"docid": "d9ff8f2c327b1683ab24de626bf5672e",
"score": "0.6157846",
"text": "def orbital_velocity(radius, mass)\n Math.sqrt((mass * G) / radius)\n end",
"title": ""
},
{
"docid": "3c60ff13db1fd370d03a2ba661bf2e1e",
"score": "0.6064733",
"text": "def update_velocity(gravity, damping, dt); end",
"title": ""
},
{
"docid": "3c60ff13db1fd370d03a2ba661bf2e1e",
"score": "0.6064733",
"text": "def update_velocity(gravity, damping, dt); end",
"title": ""
},
{
"docid": "3c60ff13db1fd370d03a2ba661bf2e1e",
"score": "0.6064733",
"text": "def update_velocity(gravity, damping, dt); end",
"title": ""
},
{
"docid": "676306eeedf784c11fefa701dc000a4e",
"score": "0.5988429",
"text": "def moment_inertia_sphere(mass, radius)\n (2*mass*radius**2) / 3.0\n end",
"title": ""
},
{
"docid": "9948ab176d7ee6416198ea84995e5766",
"score": "0.5961809",
"text": "def moment_inertia_parallel_axis(moment_inertia_cm, mass, axis_distance)\n moment_inertia_cm + mass*axis_distance**2\n end",
"title": ""
},
{
"docid": "3ec15112c7b8577415f1b04c9aa04d11",
"score": "0.59606344",
"text": "def specific_angular_momentum\n return self.periapsis * self.periapsis_velocity\n end",
"title": ""
},
{
"docid": "2301f2d48ada33c0f91e10f7205b427e",
"score": "0.5907725",
"text": "def get_rotation\n Body.validate(self)\n MSPhysics::Newton::Body.get_rotation(@_address)\n end",
"title": ""
},
{
"docid": "976b8df3a340475cfbf284eb731b378e",
"score": "0.5862338",
"text": "def get_velocity\n MSPhysics::Newton::Body.get_velocity(@address)\n end",
"title": ""
},
{
"docid": "976b8df3a340475cfbf284eb731b378e",
"score": "0.5862266",
"text": "def get_velocity\n MSPhysics::Newton::Body.get_velocity(@address)\n end",
"title": ""
},
{
"docid": "ce08534b5e90de98c98502247fd0600e",
"score": "0.5829347",
"text": "def get_torque_acc\n MSPhysics::Newton::Body.get_torque_acc(@address)\n end",
"title": ""
},
{
"docid": "ff74ace65fe81c31423c9b308a731fc3",
"score": "0.57906675",
"text": "def get_torque_acc\n Body.validate(self)\n MSPhysics::Newton::Body.get_torque_acc(@_address)\n end",
"title": ""
},
{
"docid": "fdaad77fcf95419a9c381a6dc540a2a6",
"score": "0.5755299",
"text": "def get_velocity\n Body.validate(self)\n MSPhysics::Newton::Body.get_velocity(@_address)\n end",
"title": ""
},
{
"docid": "966789381734f2980f1522fb7e7a0d97",
"score": "0.57107097",
"text": "def rotary_spring(other_physical, rest_angle, stiffness, damping)\n rotary_spring = CP::Constraint::DampedRotarySpring.new(physical.body, other_physical.body, rest_angle, stiffness, damping)\n @actor.stage.register_physical_constraint rotary_spring\n @constraints << rotary_spring\n rotary_spring\n end",
"title": ""
},
{
"docid": "28665220aa1047af6c8733b3bceff54b",
"score": "0.56938285",
"text": "def accelerate\n @shape.body.apply_force(@shape.body.rot * (3000.0/SUBSTEPS), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "daf51afc4654dd37c27ff703437a1218",
"score": "0.568866",
"text": "def update(time)\n localTranslation.addLocal(self.localRotation.get_rotation_column(2, @temp_va).multLocal(@velocity * time))\n rotateWheels(time);\n processLean(time);\n end",
"title": ""
},
{
"docid": "a149c39846ace276dd6a07ad268ee194",
"score": "0.56777304",
"text": "def test_08_angularVelocity_eq\n\n\t\tassert_nothing_raised {@body.angularVelocity = [1.0, 10.0, 100.0]} \n\t\tassert_in_delta( @body.angularVelocity[X], 1.0, 0.001 ) \n\t\tassert_in_delta( @body.angularVelocity[Y], 10.0, 0.001 ) \n\t\tassert_in_delta( @body.angularVelocity[Z], 100.0, 0.001 ) \n\n\t\tassert_raises( TypeError ) { @body.angularVelocity = \"broken\" } \n\t\tassert_raises( TypeError ) { @body.angularVelocity = 1 } \n\tend",
"title": ""
},
{
"docid": "a5ef83266f6bb9851c34658deea3ffde",
"score": "0.56500536",
"text": "def update(time)\n self.localTranslation.addLocal(self.localRotation.getRotationColumn(2, @tempVa).multLocal(@velocity * time))\n rotateWheels(time);\n processLean(time);\n end",
"title": ""
},
{
"docid": "4c7eeaf6f390eb150795a1357a577a63",
"score": "0.56491095",
"text": "def physical_rotation=(degrees)\n @body.rotation = Jemini::Math.degrees_to_radians(degrees)\n end",
"title": ""
},
{
"docid": "3eaae7419cee9af67599f242a48c5a97",
"score": "0.56399274",
"text": "def max_angular_velocity\n parse('drone.max_angular_velocity')\n end",
"title": ""
},
{
"docid": "05359752778ad3f60184f27760f207c7",
"score": "0.5630528",
"text": "def compute_forces (pa,pb,dt)\n\t\t#first calculate the distance between the two objects\n\t\tr = pa.pos - pb.pos;#vectors\n\t\t#Using Gravitation law and Newton second law, find the acceleration imparted on pa\n\t\tpa.acceleration = ((- G*pb.mass) / r.magnitude**2) * r.normalize\n\t\t# ...now that we know acceleration, do step-calculation of the velocity\n\t\tpa.velocity += pa.acceleration * dt\n # ... what is left is to calculate the new position..... from the velocity\n\tend",
"title": ""
},
{
"docid": "369b13d4afdd01c037d59cffa0d842e9",
"score": "0.55973756",
"text": "def set_angular_damping(*args)\n Body.validate(self)\n if args.size == 3\n data = [args[0], args[1], args[2]]\n elsif args.size == 1\n data = args[0]\n else\n raise(ArgumentError, \"Wrong number of arguments! Expected 1 or 3 arguments, but got #{args.size}.\", caller)\n end\n MSPhysics::Newton::Body.set_angular_damping(@_address, data)\n end",
"title": ""
},
{
"docid": "c5c5ecbc390973fe07b0942f6179dec3",
"score": "0.5585634",
"text": "def move()\r\n # movement in a gravitational system\r\n # a = 1/2 * g * t^2\r\n # y(t) = y0 + v0t + a\r\n\r\n #update position\r\n dt = Time.now - @last_update\r\n a = (@@gravity * dt**2) /2\r\n @position.z += @vector.z * dt + a\r\n @position.x += dt * @vector.x\r\n @position.y += dt * @vector.y\r\n \r\n # update velocity\r\n @vector.z += @@gravity * dt\r\n @last_update = Time.now\r\n\r\n # did we pass through the zero plane\r\n if @vector.z < 0 && (@position.z - @@radius) < 0\r\n # flip the Z set_value\r\n @vector.z = -@vector.z * @@damping\r\n end\r\n end",
"title": ""
},
{
"docid": "853f30c2e7f23f88ae491bc40867477b",
"score": "0.5584699",
"text": "def rotate theta\n Vector.from_mag_dir(mag, dir + theta)\n end",
"title": ""
},
{
"docid": "8d7e76d53f2863a3e9e3f8523f926f18",
"score": "0.557352",
"text": "def momentum_relativistic(mass, speed)\n lorentz_factor(speed) * mass * speed\n end",
"title": ""
},
{
"docid": "3930d1e14e97f5bf854bfb4537615f6b",
"score": "0.5551618",
"text": "def accelerate\n @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (10000.0/SUBSTEPS)), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "1e639bc614ff10cab6c62e26cee97368",
"score": "0.553406",
"text": "def set_angular_damping(*args)\n if args.size == 3\n data = [args[0], args[1], args[2]]\n elsif args.size == 1\n data = args[0]\n else\n raise(ArgumentError, \"Wrong number of arguments! Expected 1 or 3 arguments but got #{args.size}.\", caller)\n end\n MSPhysics::Newton::Body.set_angular_damping(@address, data)\n end",
"title": ""
},
{
"docid": "566994d2949a6b569d5dd0e914454508",
"score": "0.551369",
"text": "def get_torque\n MSPhysics::Newton::Body.get_torque(@address)\n end",
"title": ""
},
{
"docid": "566994d2949a6b569d5dd0e914454508",
"score": "0.55128396",
"text": "def get_torque\n MSPhysics::Newton::Body.get_torque(@address)\n end",
"title": ""
},
{
"docid": "6bbbea14a5b978916df0826d15a47604",
"score": "0.5510965",
"text": "def set_angular_damping(*args)\n if args.size == 3\n data = [args[0], args[1], args[2]]\n elsif args.size == 1\n data = args[0]\n else\n raise(ArgumentError, \"Wrong number of arguments! Expected 1 or 3 arguments, but got #{args.size}.\", caller)\n end\n MSPhysics::Newton::Body.set_angular_damping(@address, data)\n end",
"title": ""
},
{
"docid": "86513cbf37e431e9af1437f6d8dac1e2",
"score": "0.5508519",
"text": "def final_velocity_v1(initial_velocity, acceleration, time)\n return initial_velocity + (acceleration * time.to_f)\n end",
"title": ""
},
{
"docid": "d9b4a40c2dc4d6bf10d72981c8c49488",
"score": "0.5502599",
"text": "def rotateWheels(time)\n # Rotate the tires if the vehicle is moving.\n if (vehicleIsMoving())\n if(@velocity > FastMath::FLT_EPSILON)\n @angle = @angle - ((time) * @velocity * 0.5)\n if (@angle < -360)\n @angle = 0\n end\n else\n @angle = @angle + ((time) * @velocity * 0.5)\n if (@angle > 360)\n @angle = 0;\n end\n end\n @rot_quat.fromAngleAxis(@angle, @wheel_axis)\n @frontwheel.local_rotation.multLocal(@rot_quat)\n @backwheel.setLocalRotation(@frontwheel.local_rotation())\n end\n end",
"title": ""
},
{
"docid": "9d5e3e858c7bce4101935358d5e6ca2f",
"score": "0.54946196",
"text": "def rotateWheels(time)\n # Rotate the tires if the vehicle is moving.\n if (vehicleIsMoving())\n if(@velocity > FastMath::FLT_EPSILON)\n @angle = @angle - ((time) * @velocity * 0.5)\n if (@angle < -360)\n @angle = 0\n end\n else\n @angle = @angle + ((time) * @velocity * 0.5)\n if (@angle > 360)\n @angle = 0;\n end\n end\n @rotQuat.fromAngleAxis(@angle, @wheelAxis)\n @frontwheel.getLocalRotation().multLocal(@rotQuat)\n @backwheel.setLocalRotation(@frontwheel.getLocalRotation())\n end\n end",
"title": ""
},
{
"docid": "3a877b6747b296a235cca824e10b992e",
"score": "0.54720193",
"text": "def accelerate\n #@shape.body.apply_impulse(@shape.body.a.radians_to_vec2, CP::Vec2.new(0.0, 0.0))#(@shape.body.a.radians_to_vec2 * (3000.0/SUBSTEPS))\n @shape.body.apply_impulse((@shape.body.a.radians_to_vec2 * 4), CP::Vec2.new(0.0, 0.0))#(@shape.body.a.radians_to_vec2 * (3000.0/SUBSTEPS))\n @states[:thrust] = 1.0\n end",
"title": ""
},
{
"docid": "df63f8cc6f3d80a914ad3ce00796093a",
"score": "0.5466997",
"text": "def mean_motion\n return self.mean_angular_velocity\n end",
"title": ""
},
{
"docid": "e61fa7fc01479a81c8ab30409fdec196",
"score": "0.5465671",
"text": "def rotation= rotation\n @shape.body.a = rotation % (2*Math::PI)\n end",
"title": ""
},
{
"docid": "f087f5d84dc21501d4cca98279942791",
"score": "0.54602075",
"text": "def final_velocity_v2(initial_velocity, acceleration, displacement)\n return ((initial_velocity ** 2) + (2 * acceleration * displacement)) ** 0.5\n end",
"title": ""
},
{
"docid": "d63e1d5eb31d8263558d68cf995e7a17",
"score": "0.5446445",
"text": "def get_angular_velocity_period\n send_request(FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 4, 'L')\n end",
"title": ""
},
{
"docid": "729e2c1155d0446bac6acff57ef4d66a",
"score": "0.5443045",
"text": "def velocity_gravity_acceleration_(velocity0_, time)\n velocity_constant_acceleration_(velocity0_, ACCELERATION_GRAVITY_, time)\n end",
"title": ""
},
{
"docid": "3af3da8c56a9f0b858474e0963bb001c",
"score": "0.54300296",
"text": "def set_angular_velocity_period(period)\n send_request(FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, '')\n end",
"title": ""
},
{
"docid": "2e193e7d5efcbeae07c63c15c3312f9d",
"score": "0.54228604",
"text": "def accelerate\n @body.apply_force((@body.a.radians_to_vec2 * (50.0)), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "8722566efc428a58b473107d5f41b45b",
"score": "0.54223275",
"text": "def get_torque\n Body.validate(self)\n MSPhysics::Newton::Body.get_torque(@_address)\n end",
"title": ""
},
{
"docid": "a5e33565da2312e1da2eb92305f2a28c",
"score": "0.5418165",
"text": "def calculate_spin_degree(velocity, time)\n ((time.to_f * velocity.to_f) / ((ROOMBA_WHEELBASE * Math::PI) / 360)) / 10**10\n end",
"title": ""
},
{
"docid": "a0eb20375fbc21f56e98c8a78f1b632c",
"score": "0.53977615",
"text": "def limit_velocity\n speed = Math.sqrt(@body.vel.x ** 2 + @body.vel.y ** 2)\n if speed > MAX_VELOCITY\n vel_cos = @body.vel.x / speed\n vel_sin = @body.vel.y / speed\n rot_matrix = Matrix[[vel_cos, -vel_sin], [vel_sin, vel_cos]]\n new_vel_cos, new_vel_sin = (rot_matrix * Matrix[[MAX_VELOCITY], [0]]).to_a.flatten\n\n @body.vel = CP::Vec2.new(new_vel_cos, new_vel_sin)\n end\n end",
"title": ""
},
{
"docid": "3b0c4a6edf076a89d30ac75a6cf20ce6",
"score": "0.5392767",
"text": "def impulse_v2(initial_velocity, final_velocity, mass)\n return (final_velocity - initial_velocity) * mass.to_f\n end",
"title": ""
},
{
"docid": "5d48c174d567534436441b62f2b51731",
"score": "0.538017",
"text": "def rotate direction, origin = Vector[0,0,0], angle\n @atoms.each{|v| v.pos = v.pos.rotate(direction.to_v,origin.to_v,angle)}\n self\n end",
"title": ""
},
{
"docid": "25a497478c97a3a1fa9d0db235cc29fb",
"score": "0.53273493",
"text": "def displacement_v3(final_velocity, acceleration, time)\n return (final_velocity * time) - (0.5 * acceleration * (time ** 2))\n end",
"title": ""
},
{
"docid": "7a8acbb49fb835aae0ed22af44d78126",
"score": "0.53085613",
"text": "def mean_velocity\n return self.mean_motion * self.semimajor_axis\n end",
"title": ""
},
{
"docid": "589b4279e3b4205b05207bb8d6865877",
"score": "0.5303373",
"text": "def update\n # Update velocity\n @velocity += acceleration\n # Limit speed\n velocity.set_mag(MAXSPEED) {velocity.mag > MAXSPEED}\n @location += velocity\n # Reset accelertion to 0 each cycle\n @acceleration *= 0\n end",
"title": ""
},
{
"docid": "2339035f926695978a28e8444c40c66d",
"score": "0.53005",
"text": "def linear_damping\n MSPhysics::Newton::Body.get_linear_damping(@address)\n end",
"title": ""
},
{
"docid": "fe2f40e0ea1f5e50237d67befb8d58d7",
"score": "0.5287174",
"text": "def update_velocity\n @position += @velocity\n end",
"title": ""
},
{
"docid": "c21ae5d4cb531c2bd4813f10049da15f",
"score": "0.52841157",
"text": "def mean_angular_velocity\n if self.closed?\n return 2.0 * Math::PI / self.period\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "89ded5f9d24ac6763c4f53c42351f292",
"score": "0.52840066",
"text": "def get_linear_damping\n MSPhysics::Newton::Body.get_linear_damping(@address)\n end",
"title": ""
},
{
"docid": "ede03fb39dc3b6ecc4dc4fe6be82412a",
"score": "0.52802444",
"text": "def cur_velocity\n MSPhysics::Newton::Spring.get_cur_velocity(@address)\n end",
"title": ""
},
{
"docid": "d9c5ec68302cb0ec3287cb14b0fd9c1b",
"score": "0.5277446",
"text": "def velocity_constant_acceleration_(velocity0_, acceleration_, time)\n velocity0_ + acceleration_ * time\n end",
"title": ""
},
{
"docid": "98ea311f49744d681a3f2a35f725b932",
"score": "0.5275087",
"text": "def escape_velocity(particle)\n Math.sqrt(2 * GRAV_CONST * particle.mass / distance(particle))\n end",
"title": ""
},
{
"docid": "5da5f7cdd0cb0ec158b24113350f92d7",
"score": "0.5262559",
"text": "def applyForce(vector)\n vector = vector.clone\n force = vector / @material.mass\n @grounded = false #just use this opportunity to check if it really is grounded\n @acceleration += force #adds the force to this frames acceleration\n end",
"title": ""
},
{
"docid": "8b84c4066fa95a2e637c6725048d7d80",
"score": "0.52456754",
"text": "def velocities(initial_ke_in_ev, n, angle)\n vx = []\n vy = []\n\n ke_per_atom_in_joules = initial_ke_in_ev * JOULES_PER_EV / n\n\n mass_in_kg = MASS * KILOGRAMS_PER_DALTON\n v_per_atom_in_mks = Math.sqrt(2 * ke_per_atom_in_joules / mass_in_kg)\n v = v_per_atom_in_mks * MW_VELOCITY_UNITS_PER_METER_PER_SECOND\n\n for i in 0...n do\n vx.push(v * Math.cos(angle))\n vy.push(v * Math.sin(angle))\n end\n\n return [vx, vy]\nend",
"title": ""
},
{
"docid": "ffc0444f348b78c8839ea54bf72fd8a0",
"score": "0.52364063",
"text": "def get_omega\n MSPhysics::Newton::Body.get_omega(@address)\n end",
"title": ""
},
{
"docid": "ffc0444f348b78c8839ea54bf72fd8a0",
"score": "0.52364063",
"text": "def get_omega\n MSPhysics::Newton::Body.get_omega(@address)\n end",
"title": ""
},
{
"docid": "c7cf882bc1035a1464a6bb16abda08d1",
"score": "0.5230926",
"text": "def displacement_v2(initial_velocity, acceleration, time)\n return (initial_velocity * time) + (0.5 * acceleration * (time ** 2))\n end",
"title": ""
},
{
"docid": "aed49d6a5362acb5406ed54044abc158",
"score": "0.5226382",
"text": "def calculate_velocity(scope, rabu_iterations)\n v = velocity_from_scope scope\n iteration_count = 1\n if rabu_iterations && rabu_iterations.size >= 2\n v += velocity_from_scope rabu_iterations[rabu_iterations.size - 1][:included]\n v += velocity_from_scope rabu_iterations[rabu_iterations.size - 2][:included]\n iteration_count += 2\n elsif rabu_iterations && rabu_iterations.size == 1\n v += velocity_from_scope rabu_iterations[rabu_iterations.size - 1][:included]\n iteration_count += 1\n end\n v / iteration_count\n end",
"title": ""
},
{
"docid": "f62ef2b2169a430c64258bee90300ec9",
"score": "0.52197564",
"text": "def net_joint_torque\n MSPhysics::Newton::Body.get_net_joint_tension2(@address)\n end",
"title": ""
},
{
"docid": "3fe3308192c31d1396b1fa6a8f6ba366",
"score": "0.52087206",
"text": "def get_omega\n Body.validate(self)\n MSPhysics::Newton::Body.get_omega(@_address)\n end",
"title": ""
},
{
"docid": "31ba62bc2b853f1915b5f15b39aaef50",
"score": "0.51907116",
"text": "def init_linear_velocity\n project_v0(@init_velocity)\n end",
"title": ""
},
{
"docid": "b81e914d262fa801a12904a8f325a270",
"score": "0.5180938",
"text": "def update\n @velocity += acceleration\n @location += velocity\n @acceleration *= 0\n @lifespan -= 2.0\n end",
"title": ""
},
{
"docid": "91b64d89fa64b44007b9b84d523454ff",
"score": "0.51771474",
"text": "def get_force_acc\n MSPhysics::Newton::Body.get_force_acc(@address)\n end",
"title": ""
},
{
"docid": "45bf4ee7e2c5e0b128aa5d45558009f6",
"score": "0.51685196",
"text": "def velocity(object,time)\n if object.position(time).nil? or object.position(time-1).nil?\n return nil\n else\n return Vector.new_from_points(object.position(time),object.position(time-1))\n end\nend",
"title": ""
},
{
"docid": "44dc28d750357e6b96207024425748e0",
"score": "0.5163674",
"text": "def update_vel( dt )\n\n if @acceleration.magnitude > 0\n # Apply the acceleration to the current velocity\n @velocity += @acceleration\n else\n # Apply the deceleration\n @velocity *= @deceleration\n end\n\n # Cap the speed so the player doesn't go too fast\n @velocity.magnitude = @max_speed if @velocity.magnitude > @max_speed\n end",
"title": ""
},
{
"docid": "223e05fe49cfca74d8be8031970b40d5",
"score": "0.51605314",
"text": "def magnet_force\n MSPhysics::Newton::Body.get_magnet_force(@address)\n end",
"title": ""
},
{
"docid": "223e05fe49cfca74d8be8031970b40d5",
"score": "0.51585203",
"text": "def magnet_force\n MSPhysics::Newton::Body.get_magnet_force(@address)\n end",
"title": ""
},
{
"docid": "2821bee5464c48360d47e69945944daa",
"score": "0.5157907",
"text": "def particle_displacement(amplitude, angular_velocity, time)\n return amplitude * Math.cos(angular_velocity * time)\n end",
"title": ""
},
{
"docid": "33c25a486402ed0714b84569725fa6ef",
"score": "0.51347077",
"text": "def rotation\n\t\t\tquat = @chassis.body.rotation\n\t\t\treturn \"R: %0.1f P: %0.1f Y: %0.1f\" %\n\t\t\t\t[ quat.roll * RadToDeg, quat.pitch * RadToDeg, quat.yaw * RadToDeg ]\n\t\tend",
"title": ""
},
{
"docid": "0fd1da9b83111c32de371a6690923d43",
"score": "0.51312494",
"text": "def driving_force\n # f = m * (VD - vx.abs) / TAU\n # f *= -1 if (red? && f > 0) || (blue? && f < 0)\n # self.fx += f\n driving_v = vd\n driving_v = 0 if dead\n delta_x = (dx - x)\n delta_y = (dy - y)\n mod = Math.sqrt(delta_x ** 2 + delta_y ** 2)\n e_x = delta_x / mod\n e_y = delta_y / mod\n # angle = Math.atan2(delta_y, delta_x)\n fx = m * (driving_v * e_x - vx) / TAU\n fy = m * (driving_v * e_y - vy) / TAU\n # fx = f * Math.cos(angle).abs\n # fy = f * Math.sin(angle).abs\n # fx *= -1 if red?\n # fy *= -1 if y > H / 2\n self.fx += fx\n self.fy += fy\n end",
"title": ""
},
{
"docid": "84aa48a0226c6ca1433cc997b57ec2d5",
"score": "0.51294214",
"text": "def get_linear_damping\n Body.validate(self)\n MSPhysics::Newton::Body.get_linear_damping(@_address)\n end",
"title": ""
},
{
"docid": "8297aad0b47d47f90ee036051491d00c",
"score": "0.51291984",
"text": "def moment_inertia_point_mass(mass, distance)\n mass * distance**2\n end",
"title": ""
},
{
"docid": "8fe856a2d70f0f7bde75adc34a0bc631",
"score": "0.512578",
"text": "def displacement_v1(initial_velocity, final_velocity, time)\n return 0.5 * (initial_velocity + final_velocity) * time\n end",
"title": ""
},
{
"docid": "2bb2dbfcc0121198bbf3ddcc8b883d76",
"score": "0.511555",
"text": "def rotate_physical(degrees)\n @body.adjust_rotation Jemini::Math.degrees_to_radians(degrees)\n end",
"title": ""
},
{
"docid": "f65ab2b7ed69de63a0e30dd68c5df875",
"score": "0.51142585",
"text": "def stiffness\n convert(material, :modulus) * inertia\n end",
"title": ""
},
{
"docid": "67d633d4f14268fcb2b611af67bab2c5",
"score": "0.51142573",
"text": "def applyVelocity(theSystem)\n\n\ttheSystem.each do |theMoon|\n\t\ttheMoon[:pos].add(theMoon[:vel]);\n\tend\t\t\n\nend",
"title": ""
},
{
"docid": "3a275d8bf0f59dbc1dd21a2219e690b1",
"score": "0.51078963",
"text": "def accumulate_forces\r\n @particles.each do |p|\r\n p.acc = MVector.new(0,0,0)\r\n p.forces.each do |f|\r\n case f.type\r\n when :gravity\r\n p.acc += @gravity\r\n else\r\n p.acc += f.vector\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "e750f4f169b615f99fd01f67f1c5def3",
"score": "0.510585",
"text": "def friction\n @body.friction\n end",
"title": ""
},
{
"docid": "8d369c039d9e15e90399a7bbf560fa84",
"score": "0.5104318",
"text": "def rotate!(vector, angle)\n # Normalize\n r = vector.r\n vector[0] = 1.0*vector[0]/r\n vector[1] = 1.0*vector[1]/r\n vector[2] = 1.0*vector[2]/r\n\n x = @elements[0]\n y = @elements[1]\n z = @elements[2]\n u = vector[0]\n v = vector[1]\n w = vector[2]\n a = angle\n\n ux = u*x\n uy = u*y\n uz = u*z\n vx = v*x\n vy = v*y\n vz = v*z\n wx = w*x\n wy = w*y\n wz = w*z\n sa = Math.sin(a)\n ca = Math.cos(a)\n x = u*(ux + vy + wz) + (x*(v*v + w*w) - u*(vy + wz))*ca + (-wy + vz)*sa\n y = v*(ux + vy + wz) + (y*(u*u + w*w) - v*(ux + wz))*ca + ( wx - uz)*sa\n z = w*(ux + vy + wz) + (z*(u*u + v*v) - w*(ux + vy))*ca + (-vx + uy)*sa\n\n @elements[0] = x\n @elements[1] = y\n @elements[2] = z\n\n self\n end",
"title": ""
},
{
"docid": "fc5c147b76dfa881b9257132ea8c0766",
"score": "0.50914836",
"text": "def calc_velocity_for_bounce(v0, bounce, coefficient)\r\n v = v0 * coefficient**bounce\r\nend",
"title": ""
},
{
"docid": "bbfbb1fce0e20fdffc85cc68588399bd",
"score": "0.50699943",
"text": "def set_velocity(axis, references)\n starting_position = @position[axis]\n acceleration = 0\n references.each do |reference|\n if starting_position < reference\n acceleration += 1\n elsif starting_position > reference\n acceleration -= 1\n end\n end\n @velocity[axis] += acceleration\n end",
"title": ""
},
{
"docid": "47e731d59ca7bb8891e86501b6cf7f1c",
"score": "0.5060114",
"text": "def particle_velocity(angular_velocity, amplitude, particle_displacement, return_sign = nil)\n return_value = angular_velocity * (((amplitude ** 2) - (particle_displacement ** 2)) ** 0.5)\n if return_sign == '-'\n return (- return_value)\n elsif return_sign == '+'\n return return_value\n else\n return [return_value, (- return_value)]\n end\n end",
"title": ""
},
{
"docid": "0ace20f6b3f87497cbe1c5eef893f713",
"score": "0.5053454",
"text": "def integrate\n if @dimension == 2\n sumVelocities = Coord2d.new(0.0, 0.0)\n elsif @dimension == 3\n sumVelocities = Coord3d.new(0.0, 0.0, 0.0)\n end\n \n sumVelSquared = 0.0\n \n 0.upto(@positions.length-1) do |i|\n newPos = @newPositions[i].times(2).minus(@positions[i]).plus(@forces[i].times(@timestep**2))\n @velocities[i] = newPos.minus(@positions[i]).times(1.0/(2*@timestep))\n newPos = newPos.elementMod(@box)\n sumVelocities = sumVelocities.plus(@velocities[i])\n sumVelSquared += @velocities[i].dot(@velocities[i])\n @positions[i] = @newPositions[i]\n @newPositions[i] = newPos\n end\n \n # K = 0.5 * m * v**2\n @kineticEnergy = 0.5 * sumVelSquared\n @temperature = @kineticEnergy / (2*@positions.length)\n end",
"title": ""
},
{
"docid": "eedea89d3e47430eab04cff4eee995bd",
"score": "0.5046571",
"text": "def accelerate strength = 1.0\n self.speed += self.rotation_vector * strength/SUBSTEPS\n end",
"title": ""
}
] |
6ad64d8c10ab8aa3e6609de9a4e6f918
|
Returns true if this input is a coinbase input.
|
[
{
"docid": "6e0f281b0688edafc707289d321db20a",
"score": "0.69452494",
"text": "def coinbase?\n return self.previous_index == INVALID_INDEX && self.previous_hash == ZERO_HASH256\n end",
"title": ""
}
] |
[
{
"docid": "8ec34e42de903f43db73c8b4d25dc737",
"score": "0.8398845",
"text": "def coinbase?\n self.inputs.size == 1 && self.inputs[0].coinbase?\n end",
"title": ""
},
{
"docid": "f64a4823021eef71b647e29006ad3b5a",
"score": "0.74623275",
"text": "def coinbase?\n (@prev_out_index == 4294967295) && (@prev_out == \"\\x00\"*32)\n end",
"title": ""
},
{
"docid": "854de2743114570abbb339ede44e57d3",
"score": "0.61894965",
"text": "def isBase58?(addr = BTC_ADDR)\n if addr.startsWith(\"1\") || addr.startsWith(\"3\")\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "95067952a87cef5bef0905a419d2328e",
"score": "0.6016785",
"text": "def is_tx_coinbase(binary_tx_hash)\n quick_result = @output_cache.is_tx_coinbase(binary_tx_hash)\n if quick_result != nil\n return quick_result\n end\n\n hash = Toshi::Utils.bin_to_hex_hash(binary_tx_hash)\n\n result = if dbtx = Toshi::Models::RawTransaction.where(hsh: hash).first\n dbtx.bitcoin_tx.is_coinbase?\n elsif tx = tx_in_current_block(hash)\n tx.is_coinbase?\n else\n false\n end\n\n @output_cache.set_tx_coinbase(binary_tx_hash, result)\n return result\n end",
"title": ""
},
{
"docid": "f9872a263cd4342593a4b9c2597571bb",
"score": "0.59307295",
"text": "def any_inputs_spent?(tx)\n tx.inputs.each{|txin|\n hash, i = txin.previous_output, txin.prev_out_index\n if input = Toshi::Models::UnconfirmedInput.where(prev_out: hash, index: i).first\n return true if !input.transaction.is_orphan?\n end\n }\n false\n end",
"title": ""
},
{
"docid": "8f27d31e6a69d026d5f64152336404d2",
"score": "0.5892853",
"text": "def cash?\n self.bil_types.include?(CASH_BILLING.to_s)\n end",
"title": ""
},
{
"docid": "7c83b2fe506f00a331540541c1d46d6f",
"score": "0.58591056",
"text": "def valid?\n return false if @input_currency.nil?\n return false if @sender.nil?\n return false if @recipients.nil?\n true\n end",
"title": ""
},
{
"docid": "4c2b5205d731333f6d66fda76117bfe9",
"score": "0.57960176",
"text": "def binary?\n ancestors.include?(Operator::Binary)\n end",
"title": ""
},
{
"docid": "6304e72adc483af7dba14c27a9cac290",
"score": "0.57632565",
"text": "def accounts_payable?\n type == 'ACCPAYCREDIT'\n end",
"title": ""
},
{
"docid": "a617ca41d706f63e80137de779f19db5",
"score": "0.5736228",
"text": "def are_inputs_standard?(tx, for_test=false)\n return true if tx.is_coinbase?\n\n tx.inputs.each do |txin|\n txout = @storage.output_for_outpoint(txin.prev_out, txin.prev_out_index, for_test)\n txout = @mempool.output_for_outpoint(txin) if !txout\n pk_script = Bitcoin::Script.new(txout.pk_script)\n # check that the script pubkey is standard\n return false if !pk_script.is_standard?\n num_args_expected = script_args_expected(pk_script)\n return false if num_args_expected < 0\n\n # parse the script sig\n script = Bitcoin::Script.new(txin.script)\n\n # check that serialized p2sh scripts are also standard\n if pk_script.is_p2sh?\n return false if script.chunks.length < 1\n serialized_script = script.chunks[-1]\n inner_script = Bitcoin::Script.new(serialized_script)\n return false if inner_script.is_p2sh? || !inner_script.is_standard?\n inner_num_args_expected = script_args_expected(inner_script)\n return false if inner_num_args_expected < 0\n num_args_expected += inner_num_args_expected\n end\n\n # we already know all of the script elements are pushes\n return false if num_args_expected != script.chunks.length\n end\n\n true\n end",
"title": ""
},
{
"docid": "643eb8ae5c87d0ad55854b4746cc167b",
"score": "0.5678798",
"text": "def accounts_payable?\n type == 'ACCPAY'\n end",
"title": ""
},
{
"docid": "741880fdf9aeeb1b3fc34be872cc03c0",
"score": "0.56779504",
"text": "def is_base?\n base_quantities.size == 1 &&\n @base_quantity_hash[base_quantities.first] == 1 ? true : false\n end",
"title": ""
},
{
"docid": "f67dafd33dffc82093d6ef8f5bdd9b07",
"score": "0.56339455",
"text": "def testnet?\n self.network.testnet?\n end",
"title": ""
},
{
"docid": "14ad06df01a24568e579172f8f4ff1b0",
"score": "0.5600299",
"text": "def check_inputs(block, tx, state, check_scripts, strict_p2sh, include_memory_pool, verify_dersig)\n return true if tx.is_coinbase?\n\n if !self.verify_inputs_are_available(tx, include_memory_pool)\n # This doesn't trigger the DoS code on purpose; if it did, it would make it easier\n # for an attacker to attempt to split the network.\n raise TxValidationError, \"CheckInputs() : #{tx.hash} inputs unavailable\"\n return false\n end\n\n # Get the height for the current block\n height = 1 + @storage.height_for_block(block.prev_block_hex)\n\n value_in = 0\n\n # Perform inexpensive checks on all inputs.\n tx.inputs.each do |txin|\n txout = @storage.output_for_outpoint(txin.prev_out, txin.prev_out_index)\n if !txout && include_memory_pool\n txout = @mempool.output_for_outpoint(txin)\n end\n\n # If spending a coinbase, make sure it's mature enough.\n if @storage.is_tx_coinbase(txin.prev_out)\n output_height = @storage.height_for_tx(txin.prev_out)\n maturity = Bitcoin.network[:coinbase_maturity]\n depth = height - output_height\n if depth < maturity\n raise TxValidationError, \"CheckInputs() : tried to spend coinbase at depth #{depth} < #{maturity}\"\n return false\n end\n end\n\n # Check for negative or overflow input values\n value_in += txout.value\n\n if !valid_money_range(txout.value) || !valid_money_range(value_in)\n # DoS 100\n raise TxValidationError, \"CheckInputs() : txin values out of range\"\n return false\n end\n\n end # each input\n\n value_out = self.tx_value_out(tx)\n\n if value_in < value_out\n # DoS 100\n raise TxValidationError, \"CheckInputs() : tx #{tx.hash} value in < value out\"\n return false\n end\n\n # Tally transaction fees\n fee = (value_in - value_out)\n\n if !valid_money_range(fee)\n raise TxValidationError, \"CheckInputs() : fees out of range\"\n return false\n end\n\n # The first loop above does all the inexpensive checks.\n # Only if ALL inputs pass do we perform expensive ECDSA signature checks.\n # Helps prevent CPU exhaustion attacks.\n\n # Skip ECDSA signature verification when connecting blocks\n # before the last block chain checkpoint. This is safe because block merkle hashes are\n # still computed and checked, and any change will be caught at the next checkpoint.\n # This flag is set earlier, in connect_block method.\n #\n if check_scripts\n # For each input, execute the script.\n tx.inputs.each_with_index do |txin, i|\n if !txin.coinbase?\n txout = @storage.output_for_outpoint(txin.prev_out, txin.prev_out_index)\n if !txout && include_memory_pool\n txout = @mempool.output_for_outpoint(txin)\n end\n script_pubkey = txout.pk_script\n #puts \"Script check: #{script_pubkey.inspect}\"\n if !tx.verify_input_signature(i, script_pubkey, block.time, { verify_dersig: !!verify_dersig })\n raise TxValidationError, \"Script evaluation failed\"\n false\n end\n end\n end # each input\n end # if check_scripts\n\n # Tx is valid, add some extra aggregate data for use in @storage\n self.cache_additional_tx_fields(tx, fee, value_in, value_out)\n\n return true\n end",
"title": ""
},
{
"docid": "03824ae9ec8489188e1984a0de9ecac7",
"score": "0.5577566",
"text": "def binary?\n [:binary].include?(type)\n end",
"title": ""
},
{
"docid": "110d277bfd2109f725d0fd93b8012cba",
"score": "0.5575087",
"text": "def is_operation_input(data_type, schema)\n schema.services.each do |service_name, servicedef|\n servicedef.operations.each do |operation_name, oper_definition|\n if (data_type.name == oper_definition.request || data_type.name == oper_definition.header)\n return true\n end\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "516170a826f79f264fa07efa2bc77922",
"score": "0.5544989",
"text": "def sign_a_contract?\n nil\n end",
"title": ""
},
{
"docid": "1ddbc3991a084409f7b190154eb5dfb0",
"score": "0.5544628",
"text": "def trade?\n type == \"trade\"\n end",
"title": ""
},
{
"docid": "bb3a8de501ac8cd721f404d5ebbe117a",
"score": "0.55286705",
"text": "def valid_oxum?\n bag_info[\"Payload-Oxum\"] == payload_oxum\n end",
"title": ""
},
{
"docid": "87a4c32f1a6d5801d71e85f4cfdc4b92",
"score": "0.55263585",
"text": "def json_input?\n return request.content_type == 'application/json'\n end",
"title": ""
},
{
"docid": "541f43148ee9f084d7d2c8c78071eef5",
"score": "0.5522548",
"text": "def accepts?(input)\n resp = feed(input)\n resp[:accept]\n end",
"title": ""
},
{
"docid": "541f43148ee9f084d7d2c8c78071eef5",
"score": "0.5522548",
"text": "def accepts?(input)\n resp = feed(input)\n resp[:accept]\n end",
"title": ""
},
{
"docid": "c851c8504836d8b1b015e9a33b6053ab",
"score": "0.55115515",
"text": "def has_contract?\n !@contract.nil?\n end",
"title": ""
},
{
"docid": "f7658453a8617764e6fcd0b879b61e43",
"score": "0.5504647",
"text": "def valid?\n return false if @transaction_type.nil?\n return false if @token.nil?\n return false if @node.nil?\n return false if @network.nil?\n return false if @sub_network.nil?\n transaction_state_validator = EnumAttributeValidator.new('String', [\"PENDING\", \"CLEARED\", \"COMPLETION\", \"DECLINED\", \"ERROR\", \"ALL\"])\n return false unless transaction_state_validator.valid?(@transaction_state)\n return false if @gpaorder.nil?\n return false if @gateway_log.nil?\n true\n end",
"title": ""
},
{
"docid": "2dea2b9dfecfd1b8e61edd88b205b80e",
"score": "0.5503971",
"text": "def webhook_valid?(transaction, ip)\n sanity_check!\n md5sum = Digest::MD5.hexdigest([\n id,\n transaction[:tr_id],\n transaction[:tr_amount],\n transaction[:tr_crc],\n security_code\n ].join)\n Tpay.valid_ip?(ip) && transaction[:md5sum] == md5sum\n end",
"title": ""
},
{
"docid": "228fe0919316c4e81792b3a1c048ef3c",
"score": "0.5474874",
"text": "def valid?\n return false if @beez_up_order_item_id.nil?\n return false if @order_item_order_item_type.nil?\n return true\n end",
"title": ""
},
{
"docid": "60a9ff32ec72553912ab23d65764bcfe",
"score": "0.5466831",
"text": "def valid?(input)\n OPERATORS.include?(input) || numeric?(input)\n end",
"title": ""
},
{
"docid": "2482a2c6ab52e07adfe4747a6b09bd38",
"score": "0.5461035",
"text": "def can_precheck_borrow_direct?(request)\n return false unless @use_bd_api\n\n isbn(request).present?\n end",
"title": ""
},
{
"docid": "13b5f1599e8543e2dec7d7077b18b3ed",
"score": "0.54553396",
"text": "def invoice?\n (payment_on_account? || payment_received?) && fully_shipped?\n end",
"title": ""
},
{
"docid": "653fad6b0f4770397e6f5a0e23e61bf9",
"score": "0.54394245",
"text": "def check_transaction(request)\n\t\tif request.include?(:transaction)# and request.include?(:operations) and request.include?(:transactionNum) \n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"title": ""
},
{
"docid": "bb79b49a837e2174ef91e760d0d1aecf",
"score": "0.5424532",
"text": "def verify_inputs_are_available(tx, include_memory_pool=false)\n return true if tx.is_coinbase?\n outpoints = tx.inputs.map{|txin| [txin.prev_out, txin.prev_out_index] }\n mempool = include_memory_pool ? @mempool : nil\n return @storage.all_outpoints_are_available(tx.hash, outpoints, mempool)\n end",
"title": ""
},
{
"docid": "b5198b18be20dc5b99f620d15c41a794",
"score": "0.5422985",
"text": "def validate_contract_data?\n initial_call_off_period.present? ? initial_call_off_period.positive? : false\n end",
"title": ""
},
{
"docid": "b5198b18be20dc5b99f620d15c41a794",
"score": "0.5422985",
"text": "def validate_contract_data?\n initial_call_off_period.present? ? initial_call_off_period.positive? : false\n end",
"title": ""
},
{
"docid": "ffe46e9e8e216af25a208470b22e848f",
"score": "0.54176795",
"text": "def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end",
"title": ""
},
{
"docid": "fbf40c62c226bf9af37ad994554ba5dc",
"score": "0.5412413",
"text": "def valid?\n return false if @currency_code.nil?\n return false if @transaction_type.nil?\n transaction_type_validator = EnumAttributeValidator.new('String', ['atm_withdrawal', 'purchase', 'other'])\n return false unless transaction_type_validator.valid?(@transaction_type)\n return false if @card_id.nil?\n return false if @amount.nil?\n return false if @date.nil?\n true\n end",
"title": ""
},
{
"docid": "5a271b296745630afd52dda33765bd7b",
"score": "0.5405376",
"text": "def binary_content?\n transfer_encoding && transfer_encoding == 'binary'\n end",
"title": ""
},
{
"docid": "374ef44276ceb505da2860c6f6a02490",
"score": "0.5399187",
"text": "def valid?\n return false if @account.nil?\n return false if @currency.nil?\n return true\n end",
"title": ""
},
{
"docid": "55e943d6748a2b52a6eaf777f30b56a9",
"score": "0.5396542",
"text": "def transaction?\n type == \"transaction\"\n end",
"title": ""
},
{
"docid": "231cf440c311a0e1a7e8a0d12f31153e",
"score": "0.53930765",
"text": "def input_port?\n @type == :input\n end",
"title": ""
},
{
"docid": "f3169fd3f4d63881db66fed863baf167",
"score": "0.53891844",
"text": "def valid_contract?()\n\t\t((self.house.kind_of?(Party)) ? true : false) and self.class.valid_contract?\n\tend",
"title": ""
},
{
"docid": "6d5d8d49b0b86197771532d0f0cfd2fa",
"score": "0.53794914",
"text": "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n input_currency == o.input_currency &&\n payin_methods == o.payin_methods &&\n metadata == o.metadata &&\n sender == o.sender &&\n recipients == o.recipients &&\n traits == o.traits &&\n state == o.state &&\n input_amount == o.input_amount &&\n payin_reference == o.payin_reference &&\n paid_amount == o.paid_amount &&\n due_amount == o.due_amount &&\n created_at == o.created_at &&\n expires_at == o.expires_at &&\n external_id == o.external_id &&\n id == o.id &&\n errors == o.errors\n end",
"title": ""
},
{
"docid": "282eafcc3b3a270b625625168ff8ae08",
"score": "0.5372619",
"text": "def payin_created?\n transaction_status == 'PAYIN_CREATED'\n end",
"title": ""
},
{
"docid": "2866abc983d76783ad48e58feaa00eab",
"score": "0.53623235",
"text": "def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : false\n end",
"title": ""
},
{
"docid": "e52fb4b49e2b224e10d9f6f195c96a35",
"score": "0.5358283",
"text": "def currency_required? \n deposit_type?\n end",
"title": ""
},
{
"docid": "93868d244deacc5bb74918b6c9b34789",
"score": "0.5356462",
"text": "def base_class?\n base_class == self\n end",
"title": ""
},
{
"docid": "870704249ff28620de46af416786625e",
"score": "0.5355978",
"text": "def inputable?\n return super\n end",
"title": ""
},
{
"docid": "7c28fe6943f69041ad99ab4c0d69a424",
"score": "0.53450245",
"text": "def cash?\n (payment_method == CASH)\n end",
"title": ""
},
{
"docid": "41c8d79bd471861ced57cc811ea10599",
"score": "0.53382164",
"text": "def binary?\n @format == 1\n end",
"title": ""
},
{
"docid": "e119b115ccfa3b6498fc087203f7a7d8",
"score": "0.5338128",
"text": "def virgin?\n self.transactions.empty?\n end",
"title": ""
},
{
"docid": "0db7eb9d09cb1d1153962902dfa45983",
"score": "0.53319186",
"text": "def valid?\n content.is_a?(TrueClass) || content.is_a?(FalseClass)\n end",
"title": ""
},
{
"docid": "6c7b1e4e03493583b132e597f3f15390",
"score": "0.5329718",
"text": "def sign?\n source.match(SIGN_REGEX)\n end",
"title": ""
},
{
"docid": "c4848c9eccb23865af9bf32598d0cfcc",
"score": "0.532953",
"text": "def is?(btype)\n type == btype\n end",
"title": ""
},
{
"docid": "152aba48403f89fe2f746ba73334175a",
"score": "0.53180426",
"text": "def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end",
"title": ""
},
{
"docid": "c9954bccb0c014278e9f6cbe9a5ad927",
"score": "0.53101665",
"text": "def valid?\n return false if @body_type.nil?\n return false if @sensitivity.nil?\n return false if @discriminator.nil?\n true\n end",
"title": ""
},
{
"docid": "2f5067c6929a93b1a5411a61292c0501",
"score": "0.53006655",
"text": "def bytes?\n type == \"BYTES\"\n end",
"title": ""
},
{
"docid": "e6a9d1523158e9c64da17fab8587b4e5",
"score": "0.5297837",
"text": "def standard?\n return false if version > MAX_STANDARD_VERSION\n return false if weight > MAX_STANDARD_TX_WEIGHT\n inputs.each do |i|\n # Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed keys (remember the 520 byte limit on redeemScript size).\n # That works out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627\n # bytes of scriptSig, which we round off to 1650 bytes for some minor future-proofing.\n # That's also enough to spend a 20-of-20 CHECKMULTISIG scriptPubKey, though such a scriptPubKey is not considered standard.\n return false if i.script_sig.size > 1650\n return false unless i.script_sig.push_only?\n end\n data_count = 0\n outputs.each do |o|\n return false unless o.script_pubkey.standard?\n data_count += 1 if o.script_pubkey.op_return?\n # TODO add non P2SH multisig relay(permitbaremultisig)\n return false if o.dust?\n end\n return false if data_count > 1\n true\n end",
"title": ""
},
{
"docid": "9a4331363f996ae0e323c31bc63d321c",
"score": "0.5295525",
"text": "def token?\n parent_id.present? && coin?\n end",
"title": ""
},
{
"docid": "62abf6147f8172aa70665953e8e09df6",
"score": "0.5295231",
"text": "def is_namecoin?\n is_name_new? || is_name_firstupdate? || is_name_update?\n end",
"title": ""
},
{
"docid": "2943bf7cafdba5f9cc822b8e8e266ec4",
"score": "0.5289565",
"text": "def instruction?\n not elements.select { |e| e.respond_to?(:to_bin) }.empty?\n end",
"title": ""
},
{
"docid": "887cf7d1214479746b2c91bac8125360",
"score": "0.5288094",
"text": "def valid?\n return false if @income_type.nil?\n return false if @tax_rate.nil?\n return false if @tax_amount.nil?\n return false if @tax_amount_no_vat.nil?\n return false if @withheld.nil?\n return false if @vat_type.nil?\n true\n end",
"title": ""
},
{
"docid": "65cd7d567ea9a4f03455c9315bbdbaeb",
"score": "0.5287807",
"text": "def check_transaction(tx, state)\n # Basic checks that don't depend on any context\n if tx.inputs.empty?\n raise TxValidationError, \"CheckTransaction() : vin empty\"\n return false\n end\n\n if tx.outputs.empty?\n raise TxValidationError, \"CheckTransaction() : vout empty\"\n return false\n end\n\n # Size limits\n if (tx.payload || tx.to_payload).bytesize > Bitcoin::MAX_BLOCK_SIZE\n raise TxValidationError, \"CheckTransaction() : size limits failed\"\n return false\n end\n\n # Check for negative or overflow output values\n total_value_out = 0\n tx.outputs.each do |output|\n if output.value < 0\n raise TxValidationError, \"CheckTransaction() : txout.nValue negative\"\n return false\n end\n if output.value > Bitcoin.network[:max_money]\n raise TxValidationError, \"CheckTransaction() : txout.nValue too high\"\n return false\n end\n\n total_value_out += output.value\n if total_value_out > Bitcoin.network[:max_money]\n raise TxValidationError, \"CheckTransaction() : txout total out of range\"\n return false\n end\n end\n\n # Check for duplicate inputs\n inputs = tx.inputs.map{|input| [input.prev_out, input.prev_out_index] }\n if inputs.size != inputs.uniq.size\n raise TxValidationError, \"CheckTransaction() : duplicate inputs\"\n return false\n end\n\n if tx.is_coinbase?\n if !tx.inputs.first.script.bytesize.between?(2,100)\n raise TxValidationError, \"CheckTransaction() : coinbase script size\"\n return false\n end\n else\n if tx.inputs.any?{|input| input.prev_out == Bitcoin::Protocol::TxIn::NULL_HASH }\n raise TxValidationError, \"CheckTransaction() : prevout is null\"\n return false\n end\n end\n\n true\n end",
"title": ""
},
{
"docid": "cf4e046b134d1b886ea2a823cf81b4ab",
"score": "0.5280552",
"text": "def binary?\n BINARY_ENCODINGS.include?(encoding)\n end",
"title": ""
},
{
"docid": "0d161f81bc897a48d572651e13579d1a",
"score": "0.52805483",
"text": "def valid?\n\t\tunless self.has_valid_payload?\n\t\t\tself.log.error \"Corrupted payload in block %d (hash mismatch)\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\treturn true if self.genesis?\n\n\t\tunless self.previous_hash_valid?\n\t\t\tself.log.error \"Hash mismatch in block %d\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\tunless self.has_valid_proof?\n\t\t\tself.log.error \"Invalid proof-of-work in block %d\" % [ self.index ]\n\t\t\treturn false\n\t\tend\n\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "9bc0587f18dbdc8705d62bf4283e7858",
"score": "0.5272764",
"text": "def valid?\n return false if @transaction_type.nil?\n transaction_type_validator = EnumAttributeValidator.new('String', ['scoreOnly'])\n return false unless transaction_type_validator.valid?(@transaction_type)\n return false if @original_transaction_type.nil?\n original_transaction_type_validator = EnumAttributeValidator.new('String', ['transaction/authorization', 'transaction/authorization-reversal', 'transaction/deposit', 'transaction/deposit-reversal', 'transaction/purchase', 'transaction/purchase-reversal', 'transaction/refund-authorization', 'transaction/refund-deposit', 'transaction/verification', 'transaction/balance-inquiry'])\n return false unless original_transaction_type_validator.valid?(@original_transaction_type)\n return false if @original_transaction_id.nil?\n return false if @amount.nil?\n return false if @currency_code.nil?\n return false if @payment.nil?\n return false if @merchant.nil?\n true\n end",
"title": ""
},
{
"docid": "c73ba7067549571673c3921cd4ce480a",
"score": "0.52702016",
"text": "def binary?\n @kind == :binary\n end",
"title": ""
},
{
"docid": "f408fbfbe7e124838a3619156d8786a3",
"score": "0.5269893",
"text": "def has_transaction?\r\n !transaction_id.blank?\r\n end",
"title": ""
},
{
"docid": "324915a1c1faef37f21a987129c684c1",
"score": "0.5269017",
"text": "def inputable?\r\n normal? && !auto_battle?\r\n end",
"title": ""
},
{
"docid": "9824b0585bfff99d93f77ab4964eee87",
"score": "0.5268017",
"text": "def valid_cryptography?(transaction)\n # The signature of the message needs to be valid and come from the sender.\n if transaction[\"id\"] != Digest::SHA256.hexdigest(transaction[\"signature\"])\n $logger.warn(\"Transaction ID isn't the SHA256 of the signature\")\n return false\n end\n\n # The signature should be valid.\n if transaction[\"message\"][\"type\"] != \"mining_reward\"\n public_key = ECDSA::Format::PointOctetString.decode(\n Base58.base58_to_binary(transaction[\"message\"][\"from\"]),\n ECDSA::Group::Secp256k1,\n )\n\n digest = Digest::SHA256.digest(transaction[\"message\"].sort.to_h.to_json)\n\n signature = ECDSA::Format::SignatureDerString.decode(\n Base58.base58_to_binary(transaction[\"signature\"])\n )\n\n if ECDSA.valid_signature?(public_key, digest, signature) == false\n $logger.warn(\"Transaction signature is invalid\")\n return false\n end\n end\n end",
"title": ""
},
{
"docid": "55b8a65eb733a34c3c2f9cf3e092b095",
"score": "0.5266182",
"text": "def input?\n !@mplab_pin.output?\n end",
"title": ""
},
{
"docid": "402427cba4d7c1aac2185ad18e86e0d4",
"score": "0.5265875",
"text": "def binary?\n @binary\n end",
"title": ""
},
{
"docid": "131eb5b214fcf6d708f643082bbe8c22",
"score": "0.52643836",
"text": "def binary?\n BINARY_OPERATORS.include?(selector) && arguments.length == 1 && arguments.first.type != :splat\n end",
"title": ""
},
{
"docid": "c835380a4f354c8b02921ffd94ad38ee",
"score": "0.525174",
"text": "def binary?\n @binary\n end",
"title": ""
},
{
"docid": "a968cbf1012a6a678fd178f0dab4f700",
"score": "0.52462095",
"text": "def valid?\n valid!\n return true\n rescue InvalidTransactionError\n return false\n end",
"title": ""
},
{
"docid": "90497e07bec45717722b7f1a52f4a585",
"score": "0.52462083",
"text": "def accepting?\n\treturn self.type == \"Accepting\"\n end",
"title": ""
},
{
"docid": "35bd551f3d2ce318b513b10287037cd5",
"score": "0.52449393",
"text": "def header_only?\n\t\tcoins.empty? && parent.nil?\n\tend",
"title": ""
},
{
"docid": "72c9b748dee3625f3cebfea8d79a6e8c",
"score": "0.5241638",
"text": "def input_valid?\n could_refund = @order.total_price - @order.refund_price\n @params[:refund_price].to_f.positive? && @params[:refund_price].to_f <= could_refund\n end",
"title": ""
},
{
"docid": "2aee90651e46eba4f3465da10a402350",
"score": "0.5239453",
"text": "def logged_in?\n\t !current_merchant.nil?\n\tend",
"title": ""
},
{
"docid": "ec539756826ba3d5b20b7d00fb2d071c",
"score": "0.5239063",
"text": "def already_processed?(transaction)\n transaction['type'] != 'AA'\n end",
"title": ""
},
{
"docid": "fa9cc12913e9663c360f881f01161742",
"score": "0.52348363",
"text": "def startup_has_balance?\n AccountTransaction.sufficient_funds?(self.startup.account, self.total_price)\n end",
"title": ""
},
{
"docid": "e2d2f29d013d848c39b78420bcf4b6fa",
"score": "0.5229906",
"text": "def can_cash?\n if self.tier && self.tier.piggy_bank\n if rate = find_bonus_rate\n # transfer cents\n if rate.cents.to_i > 0 && rate.funding_source.piggy_bank &&\n cashed_events_limit_not_reached?(rate.max_events_per_month)\n result = rate.funding_source.piggy_bank.transfer(self.receiver.piggy_bank, \n Money.new(rate.cents, rate.default_currency))\n if result.success?\n self.description = result.message \n return true\n end\n end\n end\n end\n false\n end",
"title": ""
},
{
"docid": "0f84ce1490f0ae2e80ddc6a303175d3b",
"score": "0.52289957",
"text": "def binary?\n t = @type.downcase\n !!((t =~ /binary/) || (t =~ /blob/))\n end",
"title": ""
},
{
"docid": "3dbf0270b7710e2f34d7811622106a5c",
"score": "0.52240795",
"text": "def valid?(other)\n self.signature === other\n end",
"title": ""
},
{
"docid": "7a510ebca581df0a23958bb190536b31",
"score": "0.52203995",
"text": "def valid?\r\n @bytes.same_bytes_as?(CAFE_BABE)\r\n end",
"title": ""
},
{
"docid": "d7184a2196e1d81f360be12883f07c42",
"score": "0.52099586",
"text": "def blocable?\n return data.blocable\n end",
"title": ""
},
{
"docid": "1c94c62cc10a651c9430095b39a6d667",
"score": "0.52095675",
"text": "def base?\n if self.base != nil\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "d96173da3fdafd58a726a89123b95e26",
"score": "0.52047783",
"text": "def reference?(input)\n input.is_a?(Hash) && input.key?('_plugin')\n end",
"title": ""
},
{
"docid": "4a1961a1fb9f81dc7978097277ae9661",
"score": "0.5199714",
"text": "def valid?\n return false if @push_uri.nil?\n return false if @terms_uri.nil?\n return false if @checkout_uri.nil?\n return false if @confirmation_uri.nil?\n true\n end",
"title": ""
},
{
"docid": "3381ba97d9583d7477ab60a82c021eb4",
"score": "0.5199366",
"text": "def valid?\n @input != \"exit\" && @input != \"quit\"\n end",
"title": ""
},
{
"docid": "9997cefb6888ce0bed1bf6bf8a97f325",
"score": "0.5195424",
"text": "def valid?\n return false if @additional_details.nil?\n return false if @blockchain.nil?\n blockchain_validator = EnumAttributeValidator.new('String', [\"bitcoin\", \"bitcoin-cash\", \"litecoin\", \"dogecoin\", \"dash\", \"ethereum\", \"ethereum-classic\", \"xrp\", \"zcash\"])\n return false unless blockchain_validator.valid?(@blockchain)\n return false if @fee_priority.nil?\n fee_priority_validator = EnumAttributeValidator.new('String', [\"slow\", \"standard\", \"fast\"])\n return false unless fee_priority_validator.valid?(@fee_priority)\n return false if @network.nil?\n network_validator = EnumAttributeValidator.new('String', [\"mainnet\", \"testnet\", \"ropsten\", \"mordor\"])\n return false unless network_validator.valid?(@network)\n return false if @recipients.nil?\n return false if @total_transaction_amount.nil?\n return false if @transaction_request_status.nil?\n transaction_request_status_validator = EnumAttributeValidator.new('String', [\"created\", \"await-approval\", \"pending\", \"prepared\", \"signed\", \"broadcasted\", \"success\", \"failed\", \"rejected\", \"mined\"])\n return false unless transaction_request_status_validator.valid?(@transaction_request_status)\n return false if @transaction_type.nil?\n transaction_type_validator = EnumAttributeValidator.new('String', [\"coin\", \"token\"])\n return false unless transaction_type_validator.valid?(@transaction_type)\n return false if @unit.nil?\n return false if @wallet_id.nil?\n true\n end",
"title": ""
},
{
"docid": "15c95c4fc5e784d817184a1f483d9744",
"score": "0.5190302",
"text": "def serialize?(argument)\n argument.is_a?(klass)\n end",
"title": ""
},
{
"docid": "15c95c4fc5e784d817184a1f483d9744",
"score": "0.5190302",
"text": "def serialize?(argument)\n argument.is_a?(klass)\n end",
"title": ""
},
{
"docid": "bf75050cb1a3809d6efccb53d590cfd5",
"score": "0.5184814",
"text": "def is_foreign_transaction?\n return true if @extra_details.has_key?('currencyRate')\n false\n end",
"title": ""
},
{
"docid": "9c7db68190619aa222811401b4127a90",
"score": "0.51780903",
"text": "def validate_billcoins(address)\r\n\t\tif not @billcoins.include? address\r\n\t\t\treturn false, \"Internal Error: #{address} does not exist in the billcoin dictionary\"\r\n\t\tend\r\n\r\n\t\tif @billcoins[address] < 0\r\n\t\t\tsuccess = false\r\n\t\t\terror_msg = \"Invalid block, address #{address} has #{@billcoins[address]} billcoins!\"\r\n\t\t\treturn success, error_msg\r\n\t\tend\r\n\r\n\t\treturn true, ''\r\n\tend",
"title": ""
},
{
"docid": "509923627597471357aa01dffead29a3",
"score": "0.5176773",
"text": "def valid_instruction\n input.all? { |value| VALID_INSTRUCTIONS.include?(value) }\n end",
"title": ""
},
{
"docid": "78d7be36a4a4f49f4e9d19ad0554987e",
"score": "0.5174476",
"text": "def can_cash?\n self.capture_and_cash\n end",
"title": ""
},
{
"docid": "32c77e095f2288ea06d6f6322bb77968",
"score": "0.51636523",
"text": "def high_bid_is_copart_buy_now?\n get_high_bid_bid_type_code == BidType::AURORA_BUY_NOW_CODE\n end",
"title": ""
},
{
"docid": "f946f89fe128efdb59469b02f5e455d2",
"score": "0.51624966",
"text": "def signal?\n type == :signal\n end",
"title": ""
},
{
"docid": "3f6c76d740761597223b98b90a4ddaf9",
"score": "0.51583475",
"text": "def is_type?\n !self.output_buffer.nil?\n end",
"title": ""
},
{
"docid": "86c67d3c0f7ed824624ee15ce9dc1fc4",
"score": "0.5150243",
"text": "def binary_required?\n @binary_required\n end",
"title": ""
},
{
"docid": "8ed1053adbb0edacef610c1e4d6753f6",
"score": "0.51470196",
"text": "def binary?\n @encoding == 'base64'\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "ce85e824167329495258f1a03b560ed6",
"score": "0.0",
"text": "def set_billhi\n @billhi = Billhi.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339844",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6014297",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.5921944",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59137523",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59137523",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5898428",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58904207",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58904207",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58904207",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.58896065",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.5877539",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863542",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58097845",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57384336",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57295334",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5715592",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703502",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56912124",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56675047",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651801",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.564916",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5636393",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627456",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5609225",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.55986106",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598327",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.559026",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5559285",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5559285",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5508948",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.55042",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.54657644",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.54656667",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54481184",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54453874",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54387546",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.5416965",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410795",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410795",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5398594",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53924775",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53924775",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.53916943",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5386349",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5379919",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53580743",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53488183",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.53475624",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.5345627",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5343045",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.53417665",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.5325395",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.5303185",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.52847075",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.52823925",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5258225",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52568495",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52485454",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244581",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.523896",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.523896",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.52377725",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52329445",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300864",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.52240247",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.5222394",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.52201986",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215936",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5214441",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.5209615",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5208719",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.52043825",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5202707",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.52026737",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201883",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963437",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963437",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.51913047",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.51793253",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51773065",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5171983",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5171983",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5171983",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162638",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.51517797",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143676",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51418954",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.5140135",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51385164",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.5132199",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115455",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5112607",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110613",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110613",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110613",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109795",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51077193",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5105791",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51004606",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.5096437",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093091",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
f39dadd565e07294baaafa987a6a74a2
|
Add multiple filters using +add_filter+
|
[
{
"docid": "3782c76b1d0d48a9106181fae2668125",
"score": "0.61016643",
"text": "def add_filters(fields, operators, values)\n if fields.is_a?(Array) && operators.is_a?(Hash) && (values.nil? || values.is_a?(Hash))\n fields.each do |field|\n add_filter(field, operators[field], values && values[field])\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "4e6a938aafa6c7582b1367a74e6acd56",
"score": "0.7975065",
"text": "def add_filters(filters); end",
"title": ""
},
{
"docid": "a9d0bf97082ad54e16ad5ad3f3c05105",
"score": "0.7520046",
"text": "def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end",
"title": ""
},
{
"docid": "b6226982d680c82749d5824645a56dab",
"score": "0.7332675",
"text": "def filters=( args )\n @filters.clear\n add_filters(*args)\n end",
"title": ""
},
{
"docid": "aa83b8f7b0b2a3a85b9b06b7b3c6a4a2",
"score": "0.7143902",
"text": "def add_terms_filters\n add_work_type_filter\n add_user_filter\n add_pseud_filter\n add_collection_filter\n end",
"title": ""
},
{
"docid": "11f6c44b5c30e929337ebed4be33fa2a",
"score": "0.7137597",
"text": "def add_tag_filters\n return if options[:filter_ids].blank?\n options[:filter_ids].each do |filter_id|\n body.filter(:term, filter_ids: filter_id)\n end\n end",
"title": ""
},
{
"docid": "30441a8b434d06f6c00283c431dcb829",
"score": "0.6968679",
"text": "def register_filter(mod); end",
"title": ""
},
{
"docid": "b1b50948ab832c301a25bbb746ba3c49",
"score": "0.688479",
"text": "def add_filters( *args )\n args.flatten.each do |filter|\n next if filter.nil?\n unless filter.kind_of?(::Logging::Filter)\n raise TypeError, \"#{filter.inspect} is not a kind of 'Logging::Filter'\"\n end\n @filters << filter\n end\n self\n end",
"title": ""
},
{
"docid": "54444ac92562be31c5932ea645ca4346",
"score": "0.68748826",
"text": "def filters\n end",
"title": ""
},
{
"docid": "3f1d7495d5a856e01168e503d5a851e5",
"score": "0.68720955",
"text": "def add_filter(filter)\n @filters << filter\n end",
"title": ""
},
{
"docid": "6d2568e7ae53838f5e168ec7fb1d458c",
"score": "0.6814178",
"text": "def add_filters(filters)\n filters.each do |field, value|\n Array(value).each { |v| add_filter(field, v) }\n end\n end",
"title": ""
},
{
"docid": "f40360f64e09bcbd950a31f804aa4d5c",
"score": "0.6765564",
"text": "def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.66842306",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.66842306",
"text": "def filters; end",
"title": ""
},
{
"docid": "85483fb49e1442de72b9c3dcecd405b6",
"score": "0.6683309",
"text": "def add_filter\n @filter = true \n end",
"title": ""
},
{
"docid": "df2f0425d842044cd25fd3af7f167352",
"score": "0.6682686",
"text": "def add_filter filter = nil, &block\n @filters.push( filter ) unless filter.blank?\n @filters.push( block ) if block_given?\n end",
"title": ""
},
{
"docid": "527083655277a6e66adbc8cd8b7c5a56",
"score": "0.6668794",
"text": "def before_filter(filter_name, options)\n [options[:only]].flatten.each do |action|\n add_filter(filter_name, action)\n end\n end",
"title": ""
},
{
"docid": "c3633443268a426e3a11718da31b6905",
"score": "0.6643047",
"text": "def filter_on(values)\n @filters << values\n end",
"title": ""
},
{
"docid": "58e986f1a59fb03a03e1cf24b87e9a90",
"score": "0.662265",
"text": "def add_filter(filter_symbol)\n filters << filter_symbol\n end",
"title": ""
},
{
"docid": "204908c7246b650088714957e6665b19",
"score": "0.6602615",
"text": "def apply_filter\n end",
"title": ""
},
{
"docid": "7884cdde97fad50cc415e68fadaddfd8",
"score": "0.6599358",
"text": "def instance_filter(*args, &block)\n instance_filters << [args, block]\n end",
"title": ""
},
{
"docid": "ddf287017da62d137e4354705efdc498",
"score": "0.656821",
"text": "def add_filters(fields, operators, values)\n fields.each do |field|\n add_filter(field, operators[field], values[field])\n end\n end",
"title": ""
},
{
"docid": "bda03585aeddbbd90e9d7340d6f5b676",
"score": "0.6567884",
"text": "def add_filter(filter)\n @filters << filter\n self\n end",
"title": ""
},
{
"docid": "5944182c8e018dadc69ce06450eef3f5",
"score": "0.6547786",
"text": "def liquid_filters\n [\n DesignResourceFilter,\n AttributeFilter\n ]\n end",
"title": ""
},
{
"docid": "7a7122049215fc3391367609c6c6117e",
"score": "0.64824706",
"text": "def add_filter(*args, &block)\n # 3. block filter\n if block_given?\n filter = File::Visitor::Filter::Proc.new(block)\n @filters.push(filter)\n return true\n end\n\n # 2. custom filter\n if (1 == args.size)\n custom_filter = args.shift\n unless (custom_filter.respond_to?(:match?))\n raise ArgumentError,\n \"custom_filter must implement match?()\"\n end\n @filters.push(custom_filter)\n return true\n end\n\n # 1. built-in filter\n filter_class = File::Visitor::FilterDispatcher.dispatch(args.shift)\n @filters.push(filter_class.new(*args))\n true\n end",
"title": ""
},
{
"docid": "9e1298837217d4658f0f6a8517c149d6",
"score": "0.6416265",
"text": "def add_filter(type, &block)\n filters[type] << block\n end",
"title": ""
},
{
"docid": "058a2a009ec7c0f371f3e98bf25a13aa",
"score": "0.6397035",
"text": "def filter(&callable)\n filters << callable\n end",
"title": ""
},
{
"docid": "6e248db5c370527c8926c3ca5f0d8316",
"score": "0.6382294",
"text": "def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end",
"title": ""
},
{
"docid": "b4806341c2329a47b613f6adaf949887",
"score": "0.63745797",
"text": "def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"title": ""
},
{
"docid": "39141cd307ee4fc2d37fea4a3d1290ac",
"score": "0.635908",
"text": "def add_term_filters\n body.filter(:term, posted: true)\n body.filter(:term, hidden_by_admin: false)\n body.filter(:term, restricted: false) unless include_restricted?\n body.filter(:term, unrevealed: false) unless include_unrevealed?\n body.filter(:term, anonymous: false) unless include_anon?\n body.filter(:term, chapter_count: 1) if options[:single_chapter]\n\n %i(complete language crossover).map do |field|\n value = options[field]\n body.filter(:term, field => value) unless value.nil?\n end\n add_tag_filters\n end",
"title": ""
},
{
"docid": "a2fec21fc2a65033737897cff79d689a",
"score": "0.6348546",
"text": "def filter(type, &b)\n @app.filters[type] << b\n end",
"title": ""
},
{
"docid": "2a5e5a53107fc1154a7231ccaf95811b",
"score": "0.6339596",
"text": "def apply_filters(methods)\n filters.inject(methods) { |methods, filter| filter.apply(methods, self) }\n end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.63394254",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.63394254",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "007e32a81ff2ab7b56dfba94d53f1878",
"score": "0.6312974",
"text": "def register_filter(mod)\n Strainer.global_filter(mod)\n end",
"title": ""
},
{
"docid": "1d84a3cf4bc0821fb2682d83b77dfe5a",
"score": "0.63106376",
"text": "def filters=(*filters)\n @filters = filters.flatten\n end",
"title": ""
},
{
"docid": "6057bd76eeb8a8b6fcbf708a57d6b8f2",
"score": "0.6277081",
"text": "def register_filter(mod)\n StrainerFactory.add_global_filter(mod)\n end",
"title": ""
},
{
"docid": "28c8d270dc1a06cb97f5321110770b3a",
"score": "0.6275306",
"text": "def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end",
"title": ""
},
{
"docid": "e79f54bb8f4196f0ec09bb4fd7983046",
"score": "0.62567025",
"text": "def add_filter_accessors\n @filters.each do |filter|\n singleton_class.class_eval do\n define_method(filter.field_name) { @attributes[filter.field_name] }\n define_method(\"#{filter.field_name}=\") { |value| @attributes[filter.field_name] = value }\n end\n end\n end",
"title": ""
},
{
"docid": "108e3b8536871c26bae02e47298b3fe5",
"score": "0.6223932",
"text": "def filters\n @filters ||= FiltersProvider.new\n end",
"title": ""
},
{
"docid": "c989f74428a3b0c4e0d2498d5d8700c4",
"score": "0.61888343",
"text": "def filters\n [\n GoHiring::SlackMarkdown::Filters::MergeMethodFilter,\n GoHiring::SlackMarkdown::Filters::HeaderFilter,\n GoHiring::SlackMarkdown::Filters::EmptyBlockFilter,\n GoHiring::SlackMarkdown::Filters::BlockBreakerFilter\n ]\n end",
"title": ""
},
{
"docid": "3c8f36d3229e04017d55082c4006effa",
"score": "0.6178548",
"text": "def global_filter; end",
"title": ""
},
{
"docid": "7cba564767eae0f0191ccb91327389f9",
"score": "0.6164429",
"text": "def custom_filters(scope)\n scope\n end",
"title": ""
},
{
"docid": "2b7d6b938fa3cfb7b3546d221a1b6adb",
"score": "0.61608845",
"text": "def add_filter(name, &block)\n raise ArgumentError, \"Expected block to be given\" if block.nil?\n\n @filters[name] = block\n end",
"title": ""
},
{
"docid": "b3cf0fb456552d9f6a8b1d3ae0500706",
"score": "0.6142902",
"text": "def pipeline_filters(options)\n filters = [\n HTML::Pipeline::MarkdownFilter,\n HTML::Pipeline::SanitizationFilter,\n HTML::Pipeline::ImageMaxWidthFilter,\n HTML::Pipeline::HttpsFilter,\n HTML::Pipeline::EmojiFilter,\n GithubMarkdownPreview::Pipeline::TaskListFilter\n ]\n\n if HtmlPreview::SYNTAX_HIGHLIGHTS\n filters << HTML::Pipeline::SyntaxHighlightFilter\n end\n\n if options[:comment_mode]\n filters << HTML::Pipeline::MentionFilter\n else\n filters << HTML::Pipeline::TableOfContentsFilter\n end\n\n filters\n end",
"title": ""
},
{
"docid": "cadeb46af0d75b87f804590644b9a903",
"score": "0.6141733",
"text": "def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end",
"title": ""
},
{
"docid": "c29b1d322e55c5ccded3d95f22d90f86",
"score": "0.6132905",
"text": "def filters\n @filters ||= {}\n end",
"title": ""
},
{
"docid": "38edad6291f5090d99da912d677b5b62",
"score": "0.6119736",
"text": "def add_filter(filter)\n @filters <<\n if filter =~ /\\./\n filter\n else\n \"solr.#{filter}FilterFactory\"\n end\n end",
"title": ""
},
{
"docid": "2b8437a13e86e0f15aeaf2d162c13832",
"score": "0.61007744",
"text": "def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"title": ""
},
{
"docid": "1f8469b9dadc44b905720d09675904f5",
"score": "0.60918665",
"text": "def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"title": ""
},
{
"docid": "1f8469b9dadc44b905720d09675904f5",
"score": "0.60918665",
"text": "def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"title": ""
},
{
"docid": "19ae425905db2aef121e46dee41de694",
"score": "0.6091315",
"text": "def add_after_filters(*after_filter_or_hash_of_after_filters)\n # if the arguement is a hash of after_filters, it will just get\n # merged\n if after_filter_or_hash_of_after_filters.first.is_a?(Hash)\n after_filters = after_filter_or_hash_of_after_filters.shift \n # Otherwise, we collect the after filters \n else\n after_filters = {}\n after_filter_or_hash_of_after_filters.each do |after_filter|\n after_filters[after_filter.class.to_s] = after_filter\n end\n end\n @after_filters.merge!(after_filters)\n end",
"title": ""
},
{
"docid": "39a3dcc59e0df74951625bacdd25d59f",
"score": "0.6084154",
"text": "def define_filter(name, &block)\n filters[name.to_sym] = block\n nil\n end",
"title": ""
},
{
"docid": "46c24c2be4ceca522d8026bb12bc7d33",
"score": "0.6080601",
"text": "def named_filter; end",
"title": ""
},
{
"docid": "7d3db62c0996c313b8f3e8a07135db7e",
"score": "0.60772073",
"text": "def apply_filters(filters, translation)\n filters.each do |filter_class|\n filter = filter_class.new(translation)\n if filter.applies?\n filter.call\n translation = filter.translation\n end\n end\n translation\n end",
"title": ""
},
{
"docid": "b8c43382dd2ff1316845db23ac3f0abc",
"score": "0.60761696",
"text": "def load_filters\n loaded_data = MultiJson.decode(\n File.new(MailFilter.config.value['filter_file'], 'r').read)\n\n loaded_data.each do |name,filter|\n data = {:name => name}.merge(translate(filter))\n add(data)\n end\n end",
"title": ""
},
{
"docid": "3ecc3271bb4740cce78072569142487c",
"score": "0.6075792",
"text": "def filters\n @filters ||= {}\n end",
"title": ""
},
{
"docid": "3ecc3271bb4740cce78072569142487c",
"score": "0.6075792",
"text": "def filters\n @filters ||= {}\n end",
"title": ""
},
{
"docid": "fa15d745fce5430dfe8cebb3e55a6cc3",
"score": "0.60752076",
"text": "def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"title": ""
},
{
"docid": "3316ffb66e3f3bc138384005ee3a99b5",
"score": "0.6070315",
"text": "def add_custom_search_filters(search); end",
"title": ""
},
{
"docid": "e034befbd327c01eb0c4cce4ab13455a",
"score": "0.6066396",
"text": "def add_filter_taggings\n filter = self.canonical? ? self : self.merger\n if filter\n Work.with_any_tags([self, filter]).each do |work|\n work.filter_taggings.find_or_create_by_filter_id(filter.id)\n end\n end\n end",
"title": ""
},
{
"docid": "b73b815c30dead375ec5664cc6f86372",
"score": "0.6058028",
"text": "def filter_items=(values)\n values.each do |value|\n filter_items << Filter.new(value)\n end\n end",
"title": ""
},
{
"docid": "a43aebd2b0038ebae339bdca63ed1af8",
"score": "0.6056379",
"text": "def set_filter(opts)\n opts = check_params(opts,[:filters])\n super(opts)\n end",
"title": ""
},
{
"docid": "e5db2cb479e4866914488574eb2496ce",
"score": "0.60488456",
"text": "def filters\n [\n HTML::Pipeline::SanitizationFilter,\n\n Gitlab::Markdown::EmojiFilter,\n\n Gitlab::Markdown::UserReferenceFilter,\n Gitlab::Markdown::IssueReferenceFilter,\n Gitlab::Markdown::ExternalIssueReferenceFilter,\n Gitlab::Markdown::MergeRequestReferenceFilter,\n Gitlab::Markdown::SnippetReferenceFilter,\n Gitlab::Markdown::CommitRangeReferenceFilter,\n Gitlab::Markdown::CommitReferenceFilter,\n Gitlab::Markdown::LabelReferenceFilter,\n ]\n end",
"title": ""
},
{
"docid": "986e0cb98f625167a44e21ce4cc826eb",
"score": "0.6029807",
"text": "def allowed_filters\n []\n end",
"title": ""
},
{
"docid": "69ab11d6959e98949ffe9684e3a31368",
"score": "0.6022543",
"text": "def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if !@taxon.nil? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end",
"title": ""
},
{
"docid": "f845382d1f244c003396d1b51c81a1a2",
"score": "0.6021499",
"text": "def add_filter(filter)\n @filters = (@filters << filter).sort_by do |f|\n f.respond_to?(:weight) ? f.weight : DEFAULT_WEIGHT\n end.reverse!\n end",
"title": ""
},
{
"docid": "92a3f46a78f6413db1fc7a425a378648",
"score": "0.59950584",
"text": "def _add_filter(where, method_or_filter, options, block)\n self.filters[where] << [method_or_filter, options, block]\n end",
"title": ""
},
{
"docid": "7c0116a931b0ccc9532bc3ab8249f80e",
"score": "0.59765095",
"text": "def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)\n fs\n end",
"title": ""
},
{
"docid": "74ba7b3f26f54bd4e20d7590187cc2bd",
"score": "0.596446",
"text": "def test_add_filter\n flunk\n end",
"title": ""
},
{
"docid": "a027b1f337f93635792be722f0e90021",
"score": "0.5955172",
"text": "def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end",
"title": ""
},
{
"docid": "6bf0e4b7974e8a811ba1411262fa2eb2",
"score": "0.5951779",
"text": "def add_filter(name, assertion, equals)\n @filters << Filter.new(name, assertion, equals)\n end",
"title": ""
},
{
"docid": "fc94ce32132b42c120e6c2cf9cb70fc2",
"score": "0.5949841",
"text": "def add_alternation( filter )\n\t\t\t@filterlist << filter\n\t\tend",
"title": ""
},
{
"docid": "84a0f69d89d301851d3ae528aac3ef8d",
"score": "0.59448016",
"text": "def add_content_filter(*patterns, &filter)\n content_filters << BlockContentFilter.new(patterns, filter)\n end",
"title": ""
},
{
"docid": "b1958d562253c2298283ffaaa2f95a0d",
"score": "0.5934036",
"text": "def initialize( *filters )\n\t\t\t@filters = filters.flatten\n\t\tend",
"title": ""
},
{
"docid": "64e2fd22076ae2d079961698a1df527e",
"score": "0.59042144",
"text": "def add_filter(filter = nil, &block)\n id = \"#{filter.inspect}/#{block.inspect}\".hash\n\n @filters[id] = if filter.is_a?(Filter)\n filter\n elsif filter.is_a?(String)\n StringFilter.new(filter)\n elsif filter.is_a?(Regexp)\n RegexpFilter.new(filter)\n elsif block\n BlockFilter.new(block)\n else\n raise ArgumentError, \"Please specify either a string, \" \\\n \"filter, or block to filter source files with!\"\n end\n\n true\n end",
"title": ""
},
{
"docid": "fa26d828dcbcc5f09561d041bea6c9c1",
"score": "0.5870594",
"text": "def add_filter( tag, function_to_add, priority, accepted_args )\n idx = _wp_filter_build_unique_id( tag, function_to_add, priority )\n priority_existed = !@callbacks[ priority ].nil?\n\n @callbacks[ priority ] = [] unless priority_existed\n @callbacks[ priority ] << {function: function_to_add, accepted_args: accepted_args}\n\n # if we're adding a new priority to the list, put them back in sorted order\n #\t\tif ( ! $priority_existed && count( $this->callbacks ) > 1 ) {\n #\t\t\tksort( $this->callbacks, SORT_NUMERIC );\n #\t\t}\n\n resort_active_iterations( priority, priority_existed ) if @nesting_level > 0\n end",
"title": ""
},
{
"docid": "ed3a9a41b8bedfa9577a314877ec9312",
"score": "0.58681333",
"text": "def apply_filters_ref_array( tag, args )\n # global $wp_filter, $wp_current_filter;\n\n # Do 'all' actions first\n if ( isset( Railspress.GLOBAL.wp_filter['all'] ) )\n Railspress.GLOBAL.wp_current_filter << tag\n all_args = func_get_args()\n _wp_call_all_hook(all_args )\n end\n\n if (!isset(Railspress.GLOBAL.wp_filter[$tag]))\n if (isset(Railspress.GLOBAL.wp_filter['all']))\n array_pop(Railspress.GLOBAL.wp_current_filter)\n end\n return $args[0]\n end\n\n if (!isset(Railspress.GLOBAL.wp_filter['all']))\n Railspress.GLOBAL.wp_current_filter << tag\n end\n\n filtered = Railspress.GLOBAL.wp_filter[tag].apply_filters(args[0], args)\n\n array_pop(Railspress.GLOBAL.wp_current_filter)\n\n return filtered\n end",
"title": ""
},
{
"docid": "23cff1c1fed717f83ece38280ab33ae7",
"score": "0.58658904",
"text": "def filters\n mentos(:get_all_filters)\n end",
"title": ""
},
{
"docid": "a511ea61d971ab63149f028a0348f710",
"score": "0.5857316",
"text": "def initialize_available_filters\n @@available_filters ||= {}\n end",
"title": ""
},
{
"docid": "3e8a2eabd5f874f39a125b7ca8a9a5c6",
"score": "0.5851479",
"text": "def filter(name, value=true)\n name = name.to_sym\n raise NameError, \":#{name} isn't in the defined filters\" unless @model.defined_filters.include? name\n new_filters = @options[:filters] + [[name, value]]\n\n chain_scope filters: new_filters\n end",
"title": ""
},
{
"docid": "74e4b056457e12e02fccc9b9089bd9b0",
"score": "0.5846969",
"text": "def initialize\n @filters = []\n end",
"title": ""
},
{
"docid": "e6deca2f99ffa222983cb311871c77e7",
"score": "0.58383125",
"text": "def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"title": ""
},
{
"docid": "b2b2a9ac0474bd5d7353364e1f4b373e",
"score": "0.58378565",
"text": "def before_filter(&block)\n @before_filter = block\n end",
"title": ""
},
{
"docid": "e772f244d7ab91614f8a813b261e619c",
"score": "0.58373064",
"text": "def add_or_filters(fields, operators, values)\n if fields.present? && operators.present?\n fields.each do |field|\n # Smile specific #340206 Filtre additifs\n add_or_filter(field, operators[field], values && values[field])\n end\n end\n end",
"title": ""
},
{
"docid": "244eb52cd3a97536f5d0d6139c111723",
"score": "0.5836725",
"text": "def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end",
"title": ""
},
{
"docid": "9ca8635f8aa312c0a839e6b21f67e2e5",
"score": "0.58257824",
"text": "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"title": ""
},
{
"docid": "8038f698390a7e8165d21d8625c3a636",
"score": "0.579364",
"text": "def default_filters\n params[:filter].keys.map(&:to_sym) - @request.resource_klass._custom_filters\n end",
"title": ""
},
{
"docid": "e6eeb3d8eebbcdabb6d1c07b5930db06",
"score": "0.5787869",
"text": "def strict_filters=(_arg0); end",
"title": ""
},
{
"docid": "9eefeb86535c5662f54b7109929e8d98",
"score": "0.577541",
"text": "def before method_or_filter, options={}, &block\n _add_filter(:before, method_or_filter, options, block)\n end",
"title": ""
},
{
"docid": "9f9581de51d49d7b6f151eda1b312597",
"score": "0.5765089",
"text": "def config_filters\n []\n end",
"title": ""
},
{
"docid": "de4cf500ecba3047a02f195b59279a51",
"score": "0.57590175",
"text": "def or_filters_provided?\n true\n end",
"title": ""
},
{
"docid": "b52c3c1b8a60de32c1dc21b79560b022",
"score": "0.5757883",
"text": "def _call_filters(filter_set)\n (filter_set || []).each do |filter, rule|\n # Both:\n # * no :only or the current action is in the :only list\n # * no :exclude or the current action is not in the :exclude list\n if (!rule.key?(:only) || rule[:only].include?(action_name)) &&\n (!rule.key?(:exclude) || !rule[:exclude].include?(action_name))\n case filter\n when Symbol, String then send(filter)\n when Proc then self.instance_eval(&filter)\n end\n end\n end\n return :filter_chain_completed\n end",
"title": ""
},
{
"docid": "b9eb66aee26d4fbf1ae1abdc3359ac77",
"score": "0.5751981",
"text": "def initialize()\n @filters ||= []\n end",
"title": ""
},
{
"docid": "fb9ad00a5cd851dca60a2cc7aaaaeab8",
"score": "0.5746226",
"text": "def run_filters\n set_user\n authorize\n end",
"title": ""
},
{
"docid": "2e10b43ad69ee041daf8fc3ea7c7cbd5",
"score": "0.5743034",
"text": "def filter(name, &block)\n @filters[name.to_s] = block\n end",
"title": ""
},
{
"docid": "aaba08d443a0d8518e32fc2728b91c4d",
"score": "0.5734461",
"text": "def add_controller_hook(controller_name, name, filter_list, &block)\n @controller_hooks ||= []\n @controller_hooks << { \n controller_name: controller_name, \n name: name, \n filter_list: filter_list,\n block: block\n }\n end",
"title": ""
},
{
"docid": "eba93a8870494ced86478ade554a950e",
"score": "0.57291573",
"text": "def global_filter(&block)\n @filters[nil] = block\n end",
"title": ""
},
{
"docid": "68459756f56b47488e2a58ef9626c4cf",
"score": "0.5726414",
"text": "def add_file_filter(file_filter)\n @filter_file = file_filter\n end",
"title": ""
},
{
"docid": "68459756f56b47488e2a58ef9626c4cf",
"score": "0.5726414",
"text": "def add_file_filter(file_filter)\n @filter_file = file_filter\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "39be87ce157b7f64ab1225845ddcd3d3",
"score": "0.0",
"text": "def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60315156",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6018921",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59215444",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59146434",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59146434",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.58982897",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58877826",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58877826",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58877826",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.58875746",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58776975",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5860271",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.5808841",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.5742892",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.5733006",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5718553",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5704972",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56959176",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56703776",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651533",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5649987",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5641134",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.56252027",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608981",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5600116",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598888",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589137",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55629355",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55629355",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5506731",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504886",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.54705054",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.54656947",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.5449697",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.5444484",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5443436",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.5418371",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54093206",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54093206",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5403447",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53975695",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53975695",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.539083",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.53904355",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53776276",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53562194",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5350533",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.534902",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.534699",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53462875",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.53407806",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53303957",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.5306387",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5286867",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5280132",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5259861",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.5259054",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.5249912",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.52431136",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.52424717",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5235239",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5235239",
"text": "def action; end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52312696",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52273864",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522314",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52216744",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.5219558",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.52127576",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5212529",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.5210596",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.52059865",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5205524",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5204952",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5204815",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5198996",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51947343",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51947343",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5193696",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51811314",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5180495",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51747334",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51747334",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51747334",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.51655006",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.51567245",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143453",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.5141531",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51412797",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51380795",
"text": "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",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.5136178",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.51166797",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5115066",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5113276",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5106418",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5106418",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5106418",
"text": "def action\n end",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.51045656",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5104123",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.50958395",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.50957185",
"text": "def add_callbacks(base); end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50936866",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
}
] |
3f52973818698070d105a2c20fdb77a5
|
Serializes information the current object
|
[
{
"docid": "1e9eff479be19ed308c24ffa0f0a2a33",
"score": "0.0",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"check32BitOn64System\", @check32_bit_on64_system)\n writer.write_string_value(\"comparisonValue\", @comparison_value)\n writer.write_string_value(\"fileOrFolderName\", @file_or_folder_name)\n writer.write_enum_value(\"operationType\", @operation_type)\n writer.write_enum_value(\"operator\", @operator)\n writer.write_string_value(\"path\", @path)\n end",
"title": ""
}
] |
[
{
"docid": "0795eac2a3b746fc7fea6373714e1986",
"score": "0.7951372",
"text": "def serialize\n end",
"title": ""
},
{
"docid": "762bca0e2db3ff19d91cc4521bb1e1d9",
"score": "0.7645999",
"text": "def serialize(object) end",
"title": ""
},
{
"docid": "a126e681346630c4ec31fd99d7ebfee1",
"score": "0.7579812",
"text": "def serialize; end",
"title": ""
},
{
"docid": "a126e681346630c4ec31fd99d7ebfee1",
"score": "0.7579812",
"text": "def serialize; end",
"title": ""
},
{
"docid": "a53c0fe9b3ab050ba96491d963f00252",
"score": "0.7440032",
"text": "def serialize\n \n end",
"title": ""
},
{
"docid": "bdb05f3eb80d71773cf53569e26e5fca",
"score": "0.720861",
"text": "def serialize\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "bdb05f3eb80d71773cf53569e26e5fca",
"score": "0.720861",
"text": "def serialize\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "4929c1b9891b14e8291b508cbeddebb3",
"score": "0.7207583",
"text": "def dump\r\n super + to_s\r\n end",
"title": ""
},
{
"docid": "d73ec2d15925764e922141210fbd00a7",
"score": "0.7016516",
"text": "def serialize\n self.to_hash.to_json\n end",
"title": ""
},
{
"docid": "b0bfc7c130fee59ad37d80a7f71bdfb2",
"score": "0.70007193",
"text": "def serialized\n serializer_class.new(self).serializable_hash\n end",
"title": ""
},
{
"docid": "962d5fb0e8b384f5445d3b1cd17fdf9f",
"score": "0.6992252",
"text": "def serialize\n @raw_data\n end",
"title": ""
},
{
"docid": "8e4cf6b93bc2bda43b53762bd2648085",
"score": "0.69838214",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end",
"title": ""
},
{
"docid": "3e934d5e32932e9c3ffce2f3901ceb36",
"score": "0.69723576",
"text": "def serialize\n @serializer.serialize(self.output)\n end",
"title": ""
},
{
"docid": "d9aabe9cbbebb021084279a2b501d153",
"score": "0.69666415",
"text": "def serialize(_object, data); end",
"title": ""
},
{
"docid": "d9aabe9cbbebb021084279a2b501d153",
"score": "0.69666415",
"text": "def serialize(_object, data); end",
"title": ""
},
{
"docid": "78e11a2a82cf31eea1575e69ea8ac41a",
"score": "0.6942002",
"text": "def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"title": ""
},
{
"docid": "ad75a298d7cc9868bf7bbd4ca2f42cd1",
"score": "0.69417155",
"text": "def serializer; end",
"title": ""
},
{
"docid": "28ee2da6840feee9562af047de23ca8b",
"score": "0.6933786",
"text": "def serialize!\n end",
"title": ""
},
{
"docid": "46393d4345cfa3e260b7a484a5241da8",
"score": "0.6913977",
"text": "def serialize(object)\n object.serializable_hash\n end",
"title": ""
},
{
"docid": "c3e5b5f046c9433d172fdf8a83c4251b",
"score": "0.6891677",
"text": "def serialize(object)\n object.to_s\n end",
"title": ""
},
{
"docid": "423fb52e969b6cbb23564eabba631387",
"score": "0.68810964",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end",
"title": ""
},
{
"docid": "267430a73d5d76ad390af050c5cba75b",
"score": "0.687664",
"text": "def marshal\n Marshal.dump self\n end",
"title": ""
},
{
"docid": "267430a73d5d76ad390af050c5cba75b",
"score": "0.687664",
"text": "def marshal\n Marshal.dump self\n end",
"title": ""
},
{
"docid": "267430a73d5d76ad390af050c5cba75b",
"score": "0.687664",
"text": "def marshal\n Marshal.dump self\n end",
"title": ""
},
{
"docid": "7505c4f2ba56ad590ef5fdb10aedef3a",
"score": "0.6875119",
"text": "def inspect\n serialize.to_s\n end",
"title": ""
},
{
"docid": "6e12896a516f44f7242feb874b586488",
"score": "0.68510306",
"text": "def serialize\n YAML::dump(self)\n end",
"title": ""
},
{
"docid": "4145618248ebb2dc28500b337e37de91",
"score": "0.68364877",
"text": "def inspect()\n serialize.to_s()\n end",
"title": ""
},
{
"docid": "4145618248ebb2dc28500b337e37de91",
"score": "0.68364877",
"text": "def inspect()\n serialize.to_s()\n end",
"title": ""
},
{
"docid": "f43efb9a4880908dbe66a97701c7cae4",
"score": "0.6825542",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end",
"title": ""
},
{
"docid": "9a528d7cbd57e0600f5f22b81130683c",
"score": "0.6815931",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end",
"title": ""
},
{
"docid": "5a659a36f1b7cf8160675da80f9074c6",
"score": "0.68061364",
"text": "def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end",
"title": ""
},
{
"docid": "1aba29e6bef51939e4e190426b922609",
"score": "0.68006235",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end",
"title": ""
},
{
"docid": "650142b3fdf589633088905b422ae5af",
"score": "0.67944074",
"text": "def serialize(object, data); end",
"title": ""
},
{
"docid": "c0316006221b00f6bc983ef260f72f2f",
"score": "0.67717844",
"text": "def serialize\n JSON.generate(to_h)\n end",
"title": ""
},
{
"docid": "e5973219b67c3d314afa347dd51dd989",
"score": "0.67341864",
"text": "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end",
"title": ""
},
{
"docid": "2ab0dec72eb0d25fd34d20a5c6c88d2a",
"score": "0.67289317",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"title": ""
},
{
"docid": "54a7648e29fbe4f430c43cb78c1d420b",
"score": "0.66964674",
"text": "def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end",
"title": ""
},
{
"docid": "39273db2799aa93f15cb32a0107d13fd",
"score": "0.66828746",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end",
"title": ""
},
{
"docid": "51d190e0b38453bb737902acee90aea5",
"score": "0.6673492",
"text": "def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end",
"title": ""
},
{
"docid": "a7a76e51592ab4cec6d5452778524650",
"score": "0.6668077",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end",
"title": ""
},
{
"docid": "d1f0b2c5ac4047cbf1e820319d475f66",
"score": "0.6666333",
"text": "def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"title": ""
},
{
"docid": "b9615070cc13ef0b292568a262e4c6e0",
"score": "0.6659732",
"text": "def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end",
"title": ""
},
{
"docid": "9de4b58d246a11e5383cd14d25999c96",
"score": "0.6656788",
"text": "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"title": ""
},
{
"docid": "ea29d99cc3e1b2845f204e9cd99896f1",
"score": "0.66513675",
"text": "def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end",
"title": ""
},
{
"docid": "7828008f87df2e46dcfb291bb0f328e4",
"score": "0.6635875",
"text": "def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend",
"title": ""
},
{
"docid": "5bbbc62d7f73be50f37c5dab4651efa4",
"score": "0.66275525",
"text": "def inspect\n serialize.to_s\n end",
"title": ""
},
{
"docid": "5bbbc62d7f73be50f37c5dab4651efa4",
"score": "0.66275525",
"text": "def inspect\n serialize.to_s\n end",
"title": ""
},
{
"docid": "5bbbc62d7f73be50f37c5dab4651efa4",
"score": "0.66275525",
"text": "def inspect\n serialize.to_s\n end",
"title": ""
},
{
"docid": "b5a7868c0ae06ba7f122d40f881182f4",
"score": "0.6627384",
"text": "def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end",
"title": ""
},
{
"docid": "a5dd51fb7ab945e464cf9f676f852d9b",
"score": "0.66165835",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end",
"title": ""
},
{
"docid": "4baec47f3f79d3631a344ec56d375f3c",
"score": "0.66141444",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end",
"title": ""
},
{
"docid": "f27a03603dd4ddbfbd575a4428cddf90",
"score": "0.6611379",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end",
"title": ""
},
{
"docid": "0cbc865b00a852f654b34796b6b3bf65",
"score": "0.6597342",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end",
"title": ""
},
{
"docid": "685f2e80cb97226f43d121d25c2b5876",
"score": "0.65968686",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end",
"title": ""
},
{
"docid": "decc683077b402597abe8bdde6dceb21",
"score": "0.6594517",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end",
"title": ""
},
{
"docid": "884ad7af4ffc538144c1b3e327bab65d",
"score": "0.6592636",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end",
"title": ""
},
{
"docid": "ffb6700ffa44932720b61d1ef2b5d257",
"score": "0.6583964",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end",
"title": ""
},
{
"docid": "3d1c01d6e34e2740ffe9f4904cd42c72",
"score": "0.6580536",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end",
"title": ""
},
{
"docid": "cc358a6baf92f4272145a96c1fb91ec8",
"score": "0.65803635",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end",
"title": ""
},
{
"docid": "d767afb641d31b419487101417d33a01",
"score": "0.6575503",
"text": "def serializable_hash\n self.attributes\n end",
"title": ""
},
{
"docid": "5cdae890afc3942781448f3666d6f45f",
"score": "0.65716475",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end",
"title": ""
},
{
"docid": "c5723d1125e7dc93f23b173ae844bc16",
"score": "0.65712893",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end",
"title": ""
},
{
"docid": "11d9458830fad45fc5e754e9c852925a",
"score": "0.6566952",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end",
"title": ""
},
{
"docid": "00755170642a588cfef44e4a79378bda",
"score": "0.6560253",
"text": "def serialize\n JSON.dump(@hash)\n end",
"title": ""
},
{
"docid": "eac2773d2373ad9f2a762e517902a28d",
"score": "0.65554273",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end",
"title": ""
},
{
"docid": "cc0e97fb4b19160f868e2e44bde26d84",
"score": "0.65410006",
"text": "def to_s\r\n dump\r\n end",
"title": ""
},
{
"docid": "f2b26b2195dd9c93b63aa9c403f38ae1",
"score": "0.65378475",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end",
"title": ""
},
{
"docid": "64ada7b07f9f0e0d824c91480b3b4926",
"score": "0.65346783",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end",
"title": ""
},
{
"docid": "648959a41483769ae15a2fbf8106dedd",
"score": "0.6527361",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end",
"title": ""
},
{
"docid": "e5f65327afba6522ea4ef42d36f64513",
"score": "0.6525178",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end",
"title": ""
},
{
"docid": "b2e0a28980e4fea5b8b6b95e92383ff4",
"score": "0.65242875",
"text": "def serialize(io)\n Encoder.encode(io, self)\n io\n end",
"title": ""
},
{
"docid": "919a4c7ec69fbc37a43c668d36064b87",
"score": "0.65235287",
"text": "def _dump() end",
"title": ""
},
{
"docid": "db44893862c11c031669ec70b2c20eae",
"score": "0.65174305",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end",
"title": ""
},
{
"docid": "f52ad4c04d70e3c8a86f9bd0f4e80107",
"score": "0.65141636",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end",
"title": ""
},
{
"docid": "83d29b1268c5987d9ae7a84dac37a110",
"score": "0.6508169",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end",
"title": ""
},
{
"docid": "30673a84e2be9a2a9d242c7ad0d6f8f5",
"score": "0.6499713",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end",
"title": ""
},
{
"docid": "fa8a1c3cba4886457579c28c6e42d4aa",
"score": "0.6498714",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end",
"title": ""
},
{
"docid": "0f2922e620a615cff647c312c598a573",
"score": "0.6496881",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end",
"title": ""
},
{
"docid": "8b3d2d6e1dfd6ad6b5af18d392a336b0",
"score": "0.6486202",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end",
"title": ""
},
{
"docid": "944f1295549efbe9c292a0569f8f97e0",
"score": "0.6482482",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end",
"title": ""
},
{
"docid": "f57cb590ca9b6cc45778737dd4c690bf",
"score": "0.64814615",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end",
"title": ""
},
{
"docid": "6c387463edcd92e4ee34e0723f973ac1",
"score": "0.6479782",
"text": "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"title": ""
},
{
"docid": "e7c5e272254a8677d7c16d306d28d619",
"score": "0.6476621",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end",
"title": ""
},
{
"docid": "34895100d854717cb2b93b9c4e324859",
"score": "0.6475453",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end",
"title": ""
},
{
"docid": "2bbe333d876a050f18872553a7a9a342",
"score": "0.64677024",
"text": "def _dump()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "93b0dca9366aa8dbd02fced5dfd6ba98",
"score": "0.64633876",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end",
"title": ""
},
{
"docid": "ca21918429a516f5b256d6671271c176",
"score": "0.64619535",
"text": "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end",
"title": ""
},
{
"docid": "7cacc15a57f9b673af011b77df152b4e",
"score": "0.6461202",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end",
"title": ""
},
{
"docid": "3a30428439c66c85040924b41dbf6dfd",
"score": "0.6457243",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end",
"title": ""
},
{
"docid": "41e1f416b15840e65cca6666cc336923",
"score": "0.64497435",
"text": "def inspect\n self.to_hash.inspect\n end",
"title": ""
},
{
"docid": "85079a15e69bfe2d794e0dbb5b546dc0",
"score": "0.6439583",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end",
"title": ""
},
{
"docid": "55d0845d65a1566378f4f56cd777e8b3",
"score": "0.6433183",
"text": "def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end",
"title": ""
},
{
"docid": "6c86b4b6a4d2c8c7d21744264cd8df8b",
"score": "0.643078",
"text": "def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end",
"title": ""
},
{
"docid": "570ef24921c102d38f53af60468bc47d",
"score": "0.6424316",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end",
"title": ""
},
{
"docid": "31c605de67413c0dc87587f7532b9bbe",
"score": "0.6420337",
"text": "def serialize\n super(ATTR_NAME_ARY)\n end",
"title": ""
},
{
"docid": "31c605de67413c0dc87587f7532b9bbe",
"score": "0.6420337",
"text": "def serialize\n super(ATTR_NAME_ARY)\n end",
"title": ""
},
{
"docid": "31c605de67413c0dc87587f7532b9bbe",
"score": "0.6420337",
"text": "def serialize\n super(ATTR_NAME_ARY)\n end",
"title": ""
},
{
"docid": "31c605de67413c0dc87587f7532b9bbe",
"score": "0.6420337",
"text": "def serialize\n super(ATTR_NAME_ARY)\n end",
"title": ""
},
{
"docid": "31c605de67413c0dc87587f7532b9bbe",
"score": "0.6420337",
"text": "def serialize\n super(ATTR_NAME_ARY)\n end",
"title": ""
},
{
"docid": "09f1af26ee6b08b737bc1a49cd6c5083",
"score": "0.6418776",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"title": ""
},
{
"docid": "ac4c49137f2a876e60afef9cd96520d0",
"score": "0.64156514",
"text": "def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end",
"title": ""
}
] |
1de50042ad0ffe1ba10791f8d668fd64
|
CREER UN NOUVEAU POTIN
|
[
{
"docid": "82e0cdeac10320f07f5336e0d4c3601a",
"score": "0.0",
"text": "def new\n @gossip = Gossip.new\n end",
"title": ""
}
] |
[
{
"docid": "af28645848ef7ec87d8260abda095840",
"score": "0.66161615",
"text": "def crea_con_nombre_comun\n ad = Adicional.new\n ad.especie_id = id\n ad.nombre_comun_principal = ad.pon_nombre_comun_principal\n ad\n end",
"title": ""
},
{
"docid": "2ad67147439033e652f0bad8389b491d",
"score": "0.6147888",
"text": "def creerPartie\n\t\t@plateau.completeGrille()\n\t\t#puts @plateau.printOri()\n\t\t@plateau.reduireGrille(@difficulte) # A modifier si on veut changer le niveau de difficulté 2:facile, 3:moyen, 4:difficile\n\t\t@checkPoint.addMemento\n\tend",
"title": ""
},
{
"docid": "bde55243027083bb8848a5d7a45aba22",
"score": "0.59920716",
"text": "def gen_codigo\n #puts \"ini gen_codigo\"\n if self.nivel_id != 1\n codigo = Catalogo.find_by(id: self.padre_id).codigo\n self.codigo = codigo.to_s + self.sigla.to_s\n end\n end",
"title": ""
},
{
"docid": "2837e09705d5ba2013aeab4da40573e5",
"score": "0.5984871",
"text": "def initialize(nombre,proteinas,carbohidratos,lipidos,gei,terreno,nPorciones)\r\n @nombre = nombre\r\n @nPorciones = nPorciones\r\n @proteinas = proteinas*nPorciones\r\n @carbohidratos = carbohidratos*nPorciones\r\n @lipidos = lipidos*nPorciones\r\n @gei = gei*nPorciones\r\n @terreno = terreno*nPorciones\r\n end",
"title": ""
},
{
"docid": "cf83d19464967b7009b89f3402113d9a",
"score": "0.5978971",
"text": "def initialize(numero, titular, saldo)\n # e terá os seguintes atributos (alguns dinâmicos, outros pré-definidos)\n @numero = numero\n @titular = titular\n @saldo = saldo\n # @tipo = \"corrente\" #digo q toda conta é corrente\n end",
"title": ""
},
{
"docid": "70663c31323ca6f15bf8f3d6210c4ee9",
"score": "0.5977947",
"text": "def create_ne\n @pos + @n*(@w/2.0) + @u*(@l/2.0)\n end",
"title": ""
},
{
"docid": "de013f28de97b000d22f222f2ecead6a",
"score": "0.5967081",
"text": "def nuevo_paciente_desde_cita\r\n end",
"title": ""
},
{
"docid": "9243bb496315213aa4ad107a4a1b5148",
"score": "0.5947368",
"text": "def aletorio(cad)\n #cadena donde se guardara el numero binario aleatorio creado\n t_aleatorio=\"\"\n cad.length.times do\n aleatorio= rand(0..1)\n t_aleatorio<< aleatorio.to_s\n end\n @c_aleatorio=t_aleatorio\n @c_aleatorio\n end",
"title": ""
},
{
"docid": "c766add0e8ac8263d4d47ded6cd32bda",
"score": "0.5913396",
"text": "def creerPlateau\n\n\t\ttailleGrille = @grille.largeur\n\t\tespacementCases = 2\n\n\t\t@table = Gtk::Table.new(tailleGrille+2, tailleGrille+2, false) # On rajoute 2 pour insérer les infos et les fleches\n\t\t@mat = Array.new(tailleGrille) {Array.new(tailleGrille)}\n\t\t@matFleche = Array.new(2) {Array.new(tailleGrille)}\n\n\t\t\n\t\t# Création de la grille\n\t\t0.upto(tailleGrille-1){|x|\n\t\t\t0.upto(tailleGrille-1){|y|\n\t\t\t\tcaseTemp = CaseVue.new(\"blanc\", tailleGrille, @grille, x, y)\n\t\t\t\t@table.attach(caseTemp, y+2, y+3, x+2, x+3)\n\t\t\t\t@mat[x][y] = caseTemp\n\t\t\t}\n\t\t}\n\t\t# Définition de l'espacement des cases toutes les 5 cases\n\t\t6.step(tailleGrille, 5){|i|\n\t\t\t@table.set_row_spacing(i, espacementCases)\n\t\t\t@table.set_column_spacing(i, espacementCases)\n\t\t}\n\n\t\treturn @table\n\tend",
"title": ""
},
{
"docid": "d34f4b0b7b68c9d64e7494d85b2981ab",
"score": "0.58996594",
"text": "def crear_nueva_individual(factura_orden_despacho_id)\n\t\n#logger.info 'valores cuando entro al create ' << orden_despacho_id.to_s << ' ' << casa_id.to_s << ' ' << item_nombre.to_s << ' ' << unidad_medida_id.to_s << ' ' << cantidad.to_s << ' ' << costo_real.to_s << ' ' << monto_financiamiento.to_s << ' ' << monto_facturacion.to_s << ' ' << sucursal_id.to_s\n\n\n\nsuccess = true\n begin\n transaction do\n \nfactura_orden_despacho_originals=FacturaOrdenDespacho.find(:all,:conditions=>['id = ?',factura_orden_despacho_id])\n\n#caso en que secuencia se vaya a crear por primera vez\n\n factura_orden_despacho_originals.each { |factura_orden_despacho_original|\n\n if factura_orden_despacho_original.cantidad != factura_orden_despacho_original.cantidad_factura\n \n factura_orden_despacho=FacturaOrdenDespacho.new\n\t factura_orden_despacho.orden_despacho_detalle_id=factura_orden_despacho_original.orden_despacho_detalle_id\n\t #factura_orden_despacho.casa_proveedora_id=factura_orden_despacho_original.casa_proveedora_id\n\t factura_orden_despacho.item_nombre=factura_orden_despacho_original.item_nombre\n\t factura_orden_despacho.unidad_medida_id=factura_orden_despacho_original.unidad_medida_id\n\t factura_orden_despacho.cantidad=((factura_orden_despacho_original.cantidad.to_f) - (factura_orden_despacho_original.cantidad_factura.to_f))\n\t factura_orden_despacho.costo_real=factura_orden_despacho_original.costo_real\n\t #factura_orden_despacho.monto_financiamiento=factura_orden_despacho_original.monto_financiamiento\n\n#antes estaba esto (eliminado) factura_orden_despacho.monto_financiamiento=factura_orden_despacho_original.cantidad * factura_orden_despacho_original.costo_real\n\n#factura_orden_despacho.monto_financiamiento=factura_orden_despacho.cantidad * factura_orden_despacho.costo_real\nfactura_orden_despacho.monto_financiamiento=factura_orden_despacho_original.monto_financiamiento.to_f - factura_orden_despacho_original.monto_factura.to_f\n\n\t #factura_orden_despacho.monto_factura=factura_orden_despacho_original.monto_factura\n\n\t factura_orden_despacho.monto_factura= factura_orden_despacho.monto_financiamiento.to_f\n #factura_orden_despacho.monto_factura=OrdenDespachoDetalle.find(factura_orden_despacho_original.orden_despacho_detalle_id).monto_financiamiento.to_f - factura_orden_despacho.monto_financiamiento.to_f\n #antes estaba esto (eliminado) factura_orden_despacho.monto_factura=0\n\t factura_orden_despacho.cantidad_factura=0\n\n\t factura_orden_despacho.fecha_emision=Time.now\n\t #factura_orden_despacho.sucursal_casa_proveedora_id=factura_orden_despacho_original.sucursal_casa_proveedora_id\n\n secuencia=factura_orden_despacho_original.secuencia.strip.split(\"-\")\n valor=secuencia[secuencia.length - 1]\n valor=valor.to_i + 1\n factura_orden_despacho.secuencia=factura_orden_despacho_original.secuencia.strip + \"-\" + valor.to_s\n\nlogger.debug \"entre aqui en crear nuevas ordenes en validar opciones individual\" << factura_orden_despacho.inspect << \"id de las facturas \" << factura_orden_despacho_original.id.to_s\n\n\t success &&=factura_orden_despacho.save\n \n \n raise Exception, \"#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Errores.error_crear_nueva_factura')} # #{factura_orden_despacho_original.id}\" unless success\n end #del if\n }\n return success\n end\n rescue Exception => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n return e.message\n end\n\n\nend",
"title": ""
},
{
"docid": "f357200e070d4e72ecaa91c1e5248a38",
"score": "0.58941793",
"text": "def gen_naturaleza\n self.naturaleza = Grupo.find_by(id: self.grupo_id).naturaleza.to_s\n end",
"title": ""
},
{
"docid": "bf0c1d7e1b10b6d09af00093670c6b1f",
"score": "0.5877942",
"text": "def initialize angulo=90, punto=Punto.new(0, 0), ojo=true\n # Por defecto la tortuga empieza en la posicion (0, 0), mirando hacia arriba (angulo = 90),\n # y ojo para marcar los pasos activado\n @angulo = angulo\n @punto = punto\n @ojo = ojo\n end",
"title": ""
},
{
"docid": "f1dfdab26734bb34e77c86099d9065e3",
"score": "0.5877768",
"text": "def crear\n @inquilino_nuevo = Inquilino.new\n @oficinas = Oficina.select(:id, :codigo).order(id: :asc)\n end",
"title": ""
},
{
"docid": "20b356b5e4278a90ff7bdf7fa290c7e3",
"score": "0.57940805",
"text": "def nouvellePartie_VersJeu()\n if(Grille_jeu_charger.exist?(@map, \"Aventure\"))\n File.delete(($userPath+\"Aventure\"+'/'+@map.split(\"/\")[2]).delete_suffix(\".txt\"))\n end\n @win.remove(@layoutManager)\n Ecran_jeu.creer(@win, @map, \"Aventure\")\n return self\n end",
"title": ""
},
{
"docid": "bbe3fa5fb69ba260a875cac36439cc33",
"score": "0.57809395",
"text": "def initialize\n @primeraVez = true\n end",
"title": ""
},
{
"docid": "3127ad70bcc8813d709c4c4862e2495c",
"score": "0.5739915",
"text": "def create_aminos\n\t\t\tnas = naseq\n\t\t\t@aa_first_pos = nas.translate.to_s.strip\n\t\t\t@aa_second_pos = nas.translate(2).to_s.strip\n\t\t\t@aa_third_pos = nas.translate(3).to_s.strip\n\t\tend",
"title": ""
},
{
"docid": "9704124e74199cce2d04ed8475e1c71c",
"score": "0.5739788",
"text": "def ingresar_menores\n if @pila_aux[:tope]!=nil\n for i in 1..@pila_aux[:size]\n valor = @pila_aux[:tope][:valor]\n nodo = {\n valor:valor,\n siguiente: nil\n }\n tope = @pila[:tope]\n nodo[:siguiente]=tope\n @pila[:tope]=nodo\n siguiente = @pila_aux[:tope][:siguiente]\n @pila_aux[:tope]=siguiente\n @pasos.push(mostrar_pila())#pasos\n end\n end\n end",
"title": ""
},
{
"docid": "3b44e74011cfcd34dc256b97e904f715",
"score": "0.5727652",
"text": "def hacer_ruido\n\t\treturn super << \"miauuuu!\"\n\t\t\n\tend",
"title": ""
},
{
"docid": "5987163a0d20916007f84cb8a21ef4c3",
"score": "0.5709419",
"text": "def casos_de_prueba_ejercicio_uno\n un_hombre = Hombre.new\n un_hombre.caminar\n otro_hombre = Hombre.new\n otro_hombre.hablar\n un_sapo= Sapo.new\n un_sapo.saltar\n un_aguila= Aguila.new\n un_aguila.volar\n un_perro= Perro.new\n un_perro.volar\nend",
"title": ""
},
{
"docid": "8b0f481f49fd5aea9ef03d409a19b552",
"score": "0.56854635",
"text": "def ingresar_menores\n if @pila_aux[:tope]!=nil\n for i in 1..@pila_aux[:size]\n valor = @pila_aux[:tope][:valor]\n nodo = {\n valor:valor,\n siguiente: nil\n }\n tope = @pila[:tope]\n nodo[:siguiente]=tope\n @pila[:tope]=nodo\n siguiente = @pila_aux[:tope][:siguiente]\n @pila_aux[:tope]=siguiente\n @pasos.push(mostrar_pila())\n end\n end\n end",
"title": ""
},
{
"docid": "8a87e45368b62dc648cab662671ab93f",
"score": "0.5676544",
"text": "def metodoPublico ()\n \"#{@@variableDeClase}:Soy un #{@reino}\" \n end",
"title": ""
},
{
"docid": "f9575f5ea7c4bef19cb66432d8948d8c",
"score": "0.5670284",
"text": "def nuevo(mapa = {})\n objeto = self.prototipo.clone\n objeto.add_prototype(@prototipo)\n mapa.each {\n |clave, valor|\n if clave.to_s.start_with?('@')\n objeto.set_property(clave.to_s.delete('@'), valor)\n else\n objeto.set_property(clave, valor)\n end\n }\n objeto\n end",
"title": ""
},
{
"docid": "829bb04db393ada5dc04756e950c0d72",
"score": "0.5667017",
"text": "def create_unit\n unit = Unit.new(:name => 'tax', :symbol => \"__tx\" )\n unit.visible = false\n unit.save!\n unit\n end",
"title": ""
},
{
"docid": "0df9f1c8501fa3319657338f9615ba42",
"score": "0.56487596",
"text": "def create\n authorize! :edit, Sal7711Gen::Articulo\n @articulo = Sal7711Gen::Articulo.new(articulo_params)\n @articulo.adjunto_descripcion = 'J'\n create_gen(@articulo)\n end",
"title": ""
},
{
"docid": "6512a7842a292e01224c376aa63cd63a",
"score": "0.56483126",
"text": "def nueva_pelicula(titulo, tituloOriginal, añoEstreno, duracion, guion, musica, pais, webOficial, productora, sinopsis, recaudacion)\n\n existe = existe_pelicula(titulo);\n \n if existe\n raise \"Esa película ya está incluida en el sistema\"\n else\n \n pelicula = Pelicula.new(titulo, tituloOriginal, añoEstreno, duracion, guion, musica, pais, webOficial, productora, sinopsis, recaudacion)\n\n incluir_pelicula(pelicula) \n \n end\n \n end",
"title": ""
},
{
"docid": "46e16185b15bc1fa5a4dd6dd52dd5b4e",
"score": "0.56275296",
"text": "def initialize(nombre,proteinas,carbohidratos,lipidos,gei,terreno)\n @nombre=nombre\n @proteinas=proteinas\n @carbohidratos=carbohidratos\n @lipidos=lipidos\n @gei=gei\n @terreno=terreno\n end",
"title": ""
},
{
"docid": "4c7b96899b6eb47ab9024b670d836fa1",
"score": "0.56260353",
"text": "def new\n @pagetitle = \"Nueva factura\"\n @action_txt = \"Create\"\n\n @notas = Notum.all \n @products = Product.all \n\n @invoice = Credit.new\n @invoice[:code] = \"#{generate_guid()}\"\n @invoice[:processed] = false\n \n end",
"title": ""
},
{
"docid": "fdd8f361e27003effc27abc16ab6412e",
"score": "0.5618752",
"text": "def criar\n\n\tend",
"title": ""
},
{
"docid": "219d308182a507b25ebc4bc0fcf0619a",
"score": "0.5608691",
"text": "def ingresar_menores \n for i in 1..@cola_menor[:size]\n if @cola[:tope]==nil\n valor = @cola_menor[:tope][:valor]\n nodo = {\n valor:valor,\n siguiente: nil\n }\n @cola[:tope]=nodo\n @cola[:fondo]=nodo\n @cola[:esta_vacia]=false\n\n @cola_menor[:tope]=@cola_menor[:tope][:siguiente]\n else\n valor = @cola_menor[:tope][:valor]\n nodo = {\n valor:valor,\n siguiente: nil\n }\n fondo = @cola[:fondo]\n fondo[:siguiente]=nodo\n @cola[:fondo]=nodo\n siguiente = @cola_menor[:tope][:siguiente]\n @cola_menor[:tope]=siguiente\n\n end\n @paso.push(mostrar_cola())\n end\n end",
"title": ""
},
{
"docid": "b222edb70bb26c12f151d61066f71a6e",
"score": "0.55789155",
"text": "def neulegen(neu)\n neu.times do\n @reihen.push(Reihe.new([]))\n end\n end",
"title": ""
},
{
"docid": "8237d0a6b575ac305c4b665d8681ee6b",
"score": "0.5575781",
"text": "def thongtin\n\t\t# day la mot bien cuc bo\n\t\ttuoi =0\n\n\tend",
"title": ""
},
{
"docid": "3c8c1c7ae11cbfa2f3b0f0ed6d4eb828",
"score": "0.55733335",
"text": "def create\n @tam_tru = TamTru.new(tam_tru_params)\n\n respond_to do |format|\n @tam_tru.xac_nhan = 'Chưa xác nhận'\n if Current.user\n if NguoiDan.find_by_so_cmnd(Current.user.name)\n @tam_tru.nguoi_dan_id = NguoiDan.find_by_so_cmnd(Current.user.name).id\n end\n end\n if @tam_tru.save\n if Current.user.permision == 0\n format.html { redirect_to @tam_tru, notice: \"Tam tru was successfully created.\" }\n else\n format.html { redirect_to user_show_tam_tru_url(@tam_tru), notice: \"Tam tru was successfully created.\" }\n end\n format.json { render :show, status: :created, location: @tam_tru }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tam_tru.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e72fc719f9450568212eeb349b2b7807",
"score": "0.55722106",
"text": "def create\n @pedido = Pedido.new(params[:pedido])\n\n respond_to do |format|\n if @pedido.save\n\n\t#crear cuotas\n\t#crearCuotas @pedido.numero_cuotas, @pedido.id\n i=0\n\t\t\t\tif @pedido.abono_inicial>0\n\t\t\t\t\ti+=1\n\t\t\t\tend\n while i<@pedido.numero_cuotas\n c = Cuotum.new\n c.pedido_id=@pedido.id\n c.estado=\"Pendiente\"\n c.num_cuota=i+1\n c.save\n i+=1\n end\n\n format.html { redirect_to @pedido, notice: 'Pedido was successfully created.' }\n format.json { render json: @pedido, status: :created, location: @pedido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51ba671bc09476526e77d19d5c0b5f2e",
"score": "0.55711603",
"text": "def initialize(sexo, alimentos) #alimentos es una lista de objetos Alimento\n\t\t@alimentos = alimentos\n\t\tif sexo == \"hombre\"\n\t\t\tvalue = 54\n\t\telse\n\t\t\tvalue = 41\n\t\tend\n\t\t# [kgco2eq, m2anio]\n\t\t@impactoambiental = [0,0]\n\n\t\taliaux = Alimento.new(\"\", [0,0,0,0,0])\n\t\t@cantidad = []\n\t\tcuenta = 0\n\t\tnodo = alimentos.head\n\t\twhile nodo != nil\n\t\t\talimento = nodo.value\n\t\t\taliaux = aliaux + alimento\n\t\t\ta = @impactoambiental[0] + alimento.kgco2eq\n\t\t\tb = @impactoambiental[1] + alimento.m2anio\n\t\t\t@impactoambiental = [ a , b ]\n\t\t\tcuenta = cuenta + alimento.proteinas\n\t\t\tnodo = nodo.next\n\t\t\tcantidad << 1\n\t\tend\n\t\tif (cuenta < value) #si necesitamos repetir un alimento para llegar al minimo de proteinas\n\t\t\ti = 2\n\t\t\twhile cuenta < value\n\t\t\t\tj = 0\n\t\t\t\tnodo = alimentos.head\n\t\t\t\twhile (nodo != nil) && (cuenta < value)\n\t\t\t\t\talimento = nodo.value\n\t\t\t\t\ta = @impactoambiental[0] + alimento.kgco2eq\n\t\t\t\t\tb = @impactoambiental[1] + alimento.m2anio\n\t\t\t\t\taliaux = aliaux + alimento\n\t\t\t\t\t@impactoambiental = [ a , b ]\n\t\t\t\t\tcuenta = cuenta + alimento.proteinas\n\t\t\t\t\tnodo = nodo.next\n\t\t\t\t\tcantidad[j] = i\n\t\t\t\t\tj = j + 1\n\t\t\t\tend\n\t\t\t\ti = i + 1\n\t\t\tend #hago que pille solo 1 unidad de cada uno falta hacer el + de alimento\n\t\t\t#desde la dieta se deberia poder sacar cualquier cosa de cada alimento\n\t\tend\n\t\t@proteinas = aliaux.proteinas.round(4)\n\t\t@carbohidratos = aliaux.carbohidratos.round(4)\n\t\t@lipidos = aliaux.lipidos.round(4)\n\t\t@impactoambiental = [ @impactoambiental[0].round(4), @impactoambiental[1].round(4) ]\n \tend",
"title": ""
},
{
"docid": "3017e027231559fd28a2a6b4850bb268",
"score": "0.5567059",
"text": "def initialize valor,palo\n\t @carta = valor + \"+\" + palo\n\tend",
"title": ""
},
{
"docid": "a6cd47377a8e9a176caddb1ea9c30e16",
"score": "0.5564388",
"text": "def create\n @viaje = current_user.viajesComoChofer.build(viaje_params)\n @viaje.chofer_id = current_user.id\n auto=Car.find(@viaje.car_id)\n @viaje.car = auto\n @viaje.asientos_libres = auto.seats\n @viaje.car_plate= auto.plate\n auto.viajes<<@viaje\n if !@viaje.semana_id.nil?\n @viaje.semana=Semana.find(@viaje.semana_id)\n else\n @viaje.semana=Semana.new\n end\n respond_to do |format|\n if @viaje.save\n format.html { redirect_to @viaje, notice: 'Viaje creado con exito.' }\n format.json { render :show, status: :created, location: @viaje }\n else\n format.html { render :new }\n format.json { render json: @viaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aabddc4351a293504d4a9e8a326fec6c",
"score": "0.5564261",
"text": "def affiche_toi\n builder = Gtk::Builder.new\n\n builder.add_from_file(\"../Glade/EnJeu.glade\")\n\t\t @window = builder.get_object(\"fn_select\")\n @window.signal_connect('destroy') { |_widget| exit!() }\n\n # Récupérations des objets\n # Boutons\n btn_options = builder.get_object(\"Options\")\n btn_undo = builder.get_object(\"Undo\")\n btn_point_de_retour = builder.get_object(\"Point de retour\")\n btn_revenir_point_de_retour = builder.get_object(\"Revenir point de retour\")\n btn_aide = builder.get_object(\"Aide\")\n btn_verification = builder.get_object(\"Verification\")\n btn_indice = builder.get_object(\"Indice\")\n\n # Autres\n @nom_joueur_label = builder.get_object(\"nom_joueur\")\n grid = builder.get_object(\"grilleJeu\")\n\n # Configurations des objets récupéré\n # Boutons\n btn_options.signal_connect('clicked'){afficherOption()}\n btn_undo.signal_connect('clicked'){@plateau.on_click_undo}\n btn_point_de_retour.signal_connect('clicked'){@plateau.on_click_creer_retour}\n btn_revenir_point_de_retour.signal_connect('clicked'){@plateau.on_click_aller_retour}\n btn_aide.signal_connect('clicked'){@plateau.on_click_regle(self)}\n btn_verification.signal_connect('clicked'){self.afficher_erreur}\n btn_indice.signal_connect('clicked'){@plateau.on_click_aide(self)}\n\n\n # initialisation du plateau dans la grille\n grid.set_property \"row-homogeneous\", true\n grid.set_property \"column-homogeneous\", true\n (0..@plateau.taille-1).each do |i|\n (0..@plateau.taille-1).each do |j|\n temp = @plateau.damier[i][j].bouton\n grid.attach temp, j, i, 1, 1\n end\n end\n\n\n # configuration de la fenêtre\n @window.set_title \"Nurikabe!\"\n @window.signal_connect \"destroy\" do\n #Sauvegarde.creer_sauvegarde(self)\n @en_jeu = false\n @window.destroy()\n exit!()\n end\n\n @window.set_window_position :center\n @window.show_all\n\n # lancement du timer\n timer_thread = Thread.new{self.lancer_timer}\n Gtk.main\n\n end",
"title": ""
},
{
"docid": "3a8868286c36f5908b4aa6f16b99b0e9",
"score": "0.5561723",
"text": "def juega_primero mano\n\t\tcarta_a_jugar = nil\n\t\t# elige una carta al azar\n\t\tindice = rand mano.size\n\t\tcarta_a_jugar = mano [indice]\n\t\treturn carta_a_jugar\n\tend",
"title": ""
},
{
"docid": "0ff7eb885e862478de2bf41ee4af2268",
"score": "0.55574805",
"text": "def initialize nom_joueur, joueur_id = 0\n self.nom = nom_joueur\n self.joueur_id = joueur_id\n self.cartes = []\n self.combinaisons = []\n self.compte_tour = 0\n self.a_pose_combien = 0\n self.a_atteint_51 = false\n end",
"title": ""
},
{
"docid": "645e01f992d7f9d24e31e33b47af2e11",
"score": "0.55538505",
"text": "def create_viaje\n #@viaje = Viaje.new(viaje_params)\n #\n #if @viaje.save\n # render json: @viaje, status: :created, location: @viaje, notice: 'Propietario was successfully create.'\n #else\n # render json: @viaje.errors, status: :unprocessable_entity\n #end\n cliente = Cliente.find_by_cedula(params[:cedula])\n if cliente.present?\n attr = cliente.viajes.new({\n :id_auto => nil,\n :cliente_id => cliente.id,\n :tiempo => params[:tiempo],\n :distancia => params[:distancia],\n :valor => params[:valor]\n })\n attr.save!\n #render json: attr, status: :unprocessable_entity\n render_success_format('el viaje se a creado con exito', format_viaje(attr), 200)\n else\n render_default_error(\"el usuario con numero de cedula #{params[:cedula]} no esta registrado\", 400)\n end\n\n end",
"title": ""
},
{
"docid": "56f3cd1849b3a7681288e3fb8319f956",
"score": "0.55529654",
"text": "def cambiar_letras_a_guiones_1\n return \"_ \" * @palabra_secreta.length\n end",
"title": ""
},
{
"docid": "d14f7409ce692c69229a9a3bb132a05c",
"score": "0.5552297",
"text": "def genera_viajes_mensuales()\n #obtener fecha actual\n hoy = Date.today\n #obtener último día del mes\n un_mes = hoy.end_of_month\n #obtener todas las rutas\n rutas = Ruta.all\n\n\n rutas.each do |ruta|\n\n #obtener frecuencia semanal de la ruta\n frecuencia = ruta.frecuencia\n\n #hacer un arreglo con los días que la ruta pasa\n dias_ruta = []\n\n if frecuencia.lunes\n dias_ruta.push(1)\n end\n if frecuencia.martes\n dias_ruta.push(2)\n end\n if frecuencia.miercoles\n dias_ruta.push(3)\n end\n if frecuencia.jueves\n dias_ruta.push(4)\n end\n if frecuencia.viernes\n dias_ruta.push(5)\n end\n if frecuencia.sabado\n dias_ruta.push(6)\n end\n if frecuencia.domingo\n dias_ruta.push(0)\n end\n\n #crear un arreglo con las fechas del mes correspondientes a los días de la semana en que pasa la ruta\n fechas_viaje = (hoy..un_mes).to_a.select{\n |d| dias_ruta.include?(d.wday)\n }\n\n #por cada fecha obtenida, crear un viaje nuevo con la fecha indicada\n fechas_viaje.each do |fecha_viaje| \n viaje = Viaje.new\n viaje.fecha = fecha_viaje \n viaje.estatus= 1\n viaje.estadoviaje_id= 1 \n viaje.ruta_id= ruta.id\n viaje.save\n end\n\n end #each ruta\n\n\n end",
"title": ""
},
{
"docid": "93c5df00effc36ae03308633cef816c5",
"score": "0.555018",
"text": "def initialize # se inciializa la variable para que al crease ejecute su codigo interno \n @pinta = ['C','D','E','T'].sample\n @numero = rand(1..13)\n end",
"title": ""
},
{
"docid": "4c0fee1ad3c063aa4d6b358f6057d73a",
"score": "0.554879",
"text": "def initialize (dni, nombre, sexo, edad)\n #Es conveniente inicializar los atributos, pero no es obligatorio, aunque salga un warning\n @dni = dni\n @nombre = nombre\n @sexo = sexo\n @edad = edad\n @colorOjos = nil\n @@numero_de_persona = @@numero_de_persona + 1\n \n end",
"title": ""
},
{
"docid": "fe4e31f8e0b35ed40838d92191e79955",
"score": "0.5547288",
"text": "def initialize\n @populace = nil # vygenerované vektory ohodnocení\n @instance = nil # instance problemu WSAT\n @poc_klauzuli = 0 # pocet klauzuli problemu\n @poc_promennych_instance = 0 # pocet promennych formule\n @soucet_vsech_vah = 0 # maximalni soucet vahovych ohodnoceni\n @nej_soucet_vah = 0 # vysledny soucet vah nejlepsiho ziskaneho reseni\n @nejlepsi_reseni = nil # nejlepsi ziskane reseni pomoci gen. algoritmu\n end",
"title": ""
},
{
"docid": "1d3dd80ebcf872acd4692f5be761501e",
"score": "0.5541928",
"text": "def ligar #criando um metodo para a classe\n puts 'O carro está pronto para iniciar seu trajeto'\n end",
"title": ""
},
{
"docid": "417e83faf7182e2e253f9872ad5ecc3a",
"score": "0.55415946",
"text": "def numeroCuenta\n numero = @numero_cuenta\n if @vip == 0\n n = \"0-\"\n else\n n = \"1-\"\n end\n @numero_cuenta = n+numero.to_s\n end",
"title": ""
},
{
"docid": "10f90607e672c13946e4b6f68da81d5e",
"score": "0.55324274",
"text": "def start(instance)\n \n # 1)Vygeneruj nahodnou pocatecni populaci P(0)\n nacti_parametry(instance)\n generuj_populaci(VELIKOST_POPULACE)\n \n # Vyhodnot kvalitu kazdeho jedince v populaci P pomoci ohodnocovaci funkce.\n # - zjisti nejlepsiho jedince \n sampion = dej_sampiona(@populace)\n \n # 2)N-krat opakuj:\n citac= 0\n while(citac < POCET_GENERACI)do\n # 3) Vytvoř novou práznou populaci P(N)\n nova_populace = Array.new(VELIKOST_POPULACE)\n nova_populace.each do |prvek| \n prvek = Array.new(@poc_promennych_instance)\n end\n \n # 4)Pouzij selekci na omezeny pocet rodicu z populace P(N-1) a na vitezne:\n pocet_novych = 0\n citac2 = 0\n while(pocet_novych < VELIKOST_POPULACE)do # dokud nenaplnim celou populaci\n \n potomek_a = nil\n potomek_b = nil\n # 5)pouzij se zvolenou pravdepodobnosti krizeni\n if ((Random.rand(1001)/1000.0) < P_KRIZENI) then # (0<X<1)\n # provest krizeni\n potomek_a = (turnajovy_vyber(SELEKCNI_TLAK).dup)\n potomek_b = (turnajovy_vyber(SELEKCNI_TLAK).dup)\n case TYP_KRIZENI \n when 1\n krizeni = KrizeniJednobodove.new(potomek_a,potomek_b)\n when 2\n krizeni = KrizeniDvoubodove.new(potomek_a,potomek_b) \n else\n krizeni = KrizeniUniformni.new(potomek_a,potomek_b) \n end\n krizeni.proved_krizeni\n potomek_a = krizeni.vektor_a.dup\n potomek_b = krizeni.vektor_b.dup\n else\n # provest vyber\n potomek_a = (turnajovy_vyber(SELEKCNI_TLAK).dup) \n end\n \n # 6)pouzij na kazdy bit jedince s urcitou pravdepodobnosti mutaci \n potomek_a = mutace(potomek_a)\n if (potomek_b != nil) then # pokud se provedlo krizeni a ma se provest mutace\n potomek_b = mutace(potomek_b)\n end\n \n # 7)Pridej potomky do nove populace\n nova_populace[pocet_novych] = potomek_a\n pocet_novych+=1\n if ((potomek_b != nil) && (pocet_novych != VELIKOST_POPULACE)) then\n nova_populace[pocet_novych] = potomek_b\n pocet_novych+=1\n end\n \n citac2+=1\n end\n # 8)Nahrad starou populaci novou populaci P(N-1)=P(N)\n \n @populace = nova_populace.dup # stara populace nahrazena novou\n #puts \" #{vypis_populaci(@populace)}\"\n citac+=1\n end\n # 9)Potomek z populace P(N) s nejlepsi kondici (fitness) je resenim\n sampion = dej_sampiona(@populace)\n\n if (dej_pocet_splnenych_klauzuli(sampion, instance.klauzule) == @poc_klauzuli)then # pokud je F splnena\n instance.zapis_vysledek(sampion, true) # zapisi vysledky do instance\n else \n instance.zapis_vysledek(sampion, false)\n end\n \n return instance\n \n end",
"title": ""
},
{
"docid": "a4e3334ef267473d2acb0c08d84b9fb1",
"score": "0.5528676",
"text": "def mk_systeme( n )\n planetes = (0...n).map do |i|\n Planete.new( \"#{i}\",\n 0,\n rand(10E+15),\n Vector[rand(10E+10), rand(10E+10)],\n Vector[rand(10E+10), rand(10E+10)]\n )\n end\n\n SystemePlanetaire.new( *planetes )\nend",
"title": ""
},
{
"docid": "a00e7bc07883ef699b304d039715024d",
"score": "0.552646",
"text": "def initialize\n self.moneda_cotizacion = 1\n self.moneda = :pesos\n self.receptor_doc_nro = 99999999999\n self.receptor_doc_tipo = 99\n end",
"title": ""
},
{
"docid": "2309707e2aef111ef9d155cbcac838fd",
"score": "0.5524919",
"text": "def cargar_insumo;\n\t\t\n\tend",
"title": ""
},
{
"docid": "58a1789af3a1a9f07e969aa3030a8a7e",
"score": "0.5520719",
"text": "def initialize(nombre,proteinas,carbo,lipidos,gases,terreno)\n\t\t#Variable con el nombre del Plato\n\t\t@nombre = nombre\n\t\t#Gramos de Proteinas\n\t\t@proteinas = proteinas\n\t\t#Gramos de Carbohidratos\n\t\t@carbo = carbo\n\t\t#Gramos de lipidos\n\t\t@lipidos = lipidos\n\t\t#Emisones de Gases del Alimento\n\t\t@gases = gases\n\t\t#Uso de Terreno del Alimento\n\t\t@terreno = terreno\n\tend",
"title": ""
},
{
"docid": "3caaea58834fcf1215f8b952c53a97c5",
"score": "0.5517708",
"text": "def initialize\n @cabeza = nil\n @cola = nil\n @numeroNodos = 0\n end",
"title": ""
},
{
"docid": "3caaea58834fcf1215f8b952c53a97c5",
"score": "0.5517708",
"text": "def initialize\n @cabeza = nil\n @cola = nil\n @numeroNodos = 0\n end",
"title": ""
},
{
"docid": "4cbd41582c3f59cb12efbc8efd7c1ab4",
"score": "0.5510888",
"text": "def create\n\n @versement = current_user.versements.new(montant: params[:versement][:montant], user_id: current_user, ecole_id: session[:ecole_id], annee_id: annee_active.id, etudiant_id: params[:versement][:etudiant_id])\n\n respond_to do |format|\n if @versement.save\n\n @libelle = \"Versement de l'etudiant #{@versement.etudiant.nom} #{@versement.etudiant.prenom} ( #{@versement.etudiant.num_inscription})\"\n Caisse.create!(montant: @versement.montant, libelle: @libelle, operation: 'entrée', ecole_id: @versement.ecole_id, annee_id: @versement.annee_id, user_id: current_user.id)\n \n format.html { redirect_to @versement, notice: 'Versement was successfully created.' }\n format.json { render :show, status: :created, location: @versement }\n else\n format.html { render :new }\n format.json { render json: @versement.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "93854ffbad99f83a3b91d1e29a369d2f",
"score": "0.55063635",
"text": "def cuenta_objetivo\n entidad.cuenta(monto.currency,operadora)\n end",
"title": ""
},
{
"docid": "65216d37077adc3376fb92e1069ac0b6",
"score": "0.5494599",
"text": "def nombre_completo # inicio del metodo\n # concateno de manera correcta para maestro\n \"Maestro(#{numero_empleado}): \" << primer_nombre.to_s << \" \" <<\n segundo_nombre.to_s << \" \" << primer_apellido.to_s << \" \" << segundo_apellido.to_s << \" \" << salario.to_s\n end",
"title": ""
},
{
"docid": "27f50c0bb3d1dbafda066ccdeba0baf1",
"score": "0.5490464",
"text": "def create\n @tanques = Tanque.all\n @varillaje = Varillaje.new(varillaje_params)\n \n @varillaje[:inicial] = @varillaje.tanque.varilla \n @varillaje[:compras] = 0\n @varillaje[:directo] = 0\n @varillaje[:consumo] = 0\n @varillaje[:transfe] = 0\n @varillaje[:saldo] = 0\n @varillaje[:dife_dia] = 0\n \n respond_to do |format|\n if @varillaje.save\n \n \n \n @tanque_up = Tanque.find(@varillaje.tanque_id)\n @tanque_up.varilla = @varillaje[:varilla] \n @tanque_up.save\n \n format.html { redirect_to @varillaje, notice: 'Varillaje was successfully created.' }\n format.json { render :show, status: :created, location: @varillaje }\n else\n format.html { render :new }\n format.json { render json: @varillaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9a3e7b43401b7c63a65a9363ece0d2c",
"score": "0.54843724",
"text": "def trg_soma_itens\n self.pedido.gerenciar_acoes\n self.pedido.save\n end",
"title": ""
},
{
"docid": "e9a3e7b43401b7c63a65a9363ece0d2c",
"score": "0.54843724",
"text": "def trg_soma_itens\n self.pedido.gerenciar_acoes\n self.pedido.save\n end",
"title": ""
},
{
"docid": "291d3d4d5afc94fec2ed719978e12426",
"score": "0.5483025",
"text": "def initialize(n, name, peso, talla, edad, sexo, ccintura, ccadera)\n @name = name\n @datos = Nutricion.new(peso, talla, edad, sexo, ccintura, ccadera)\n\n end",
"title": ""
},
{
"docid": "380bdb6f1bc945b5531c37199fc80f7c",
"score": "0.5482519",
"text": "def create\n\n \n \n\n #calculaCoincidencia(@entradaBusqueda)\n\n # @articulo = Articulo.new(articulo_params)\n\n # respond_to do |format|\n # if @articulo.save\n # format.html { redirect_to @articulo, notice: 'Articulo was successfully created.' }\n # format.json { render :show, status: :created, location: @articulo }\n #else\n # format.html { render :new }\n # format.json { render json: @articulo.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"title": ""
},
{
"docid": "ebb27a239303ef612c5464ce68b65d6e",
"score": "0.54824173",
"text": "def etudiant_create\n @versement = @etudiant.versements.new(etudiant_versement_params)\n\n respond_to do |format|\n if @versement.save\n\n @libelle = \"Versement de l'etudiant #{@versement.etudiant.nom} #{@versement.etudiant.prenom} (#{@versement.etudiant.num_inscription})\"\n\n Caisse.create!(montant: @versement.montant, libelle: @libelle, operation: 'entrée', ecole_id: @versement.ecole_id, annee_id: @versement.annee_id, user_id: current_user.id)\n\n\n format.html { redirect_to etudiant_versements_path(@versement.etudiant), notice: 'Versement was successfully created.' }\n format.json { render :show, status: :created, location: @versement }\n else\n format.html { render :new }\n format.json { render json: @versement.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "81f5211fcc7c19db97dd8d600e906f0a",
"score": "0.54704404",
"text": "def initialize\r\n super\r\n @mode = :additive\r\n #print \"Se crea un pez\\n\"\r\n @image = Image[\"comida4.png\"]\r\n @x = rand($window.width)\r\n @y = rand($window.height)\r\n @z = 1\r\n end",
"title": ""
},
{
"docid": "caa29ea2e559d7ee0a529c63ac1c02ac",
"score": "0.5470005",
"text": "def initialize(modelo, potencia)\n @modelo = modelo\n @potencia = potencia\n @@total = @@total+1\n end",
"title": ""
},
{
"docid": "9ea456e03483955dab64d9ce43f87615",
"score": "0.54651797",
"text": "def create_tp_number_max\r\r\n return if !TP_NUMBER_MAX_VISIBLE\r\r\n @tp_number2 = Sprite.new\r\r\n @tp_number2.bitmap = Bitmap.new(@tp_number2_cw * 3, @tp_number2_ch)\r\r\n @tp_number2.z = HUD_Z + TP_NUMBER_Z\r\r\n @tp_number2.x = $game_system.hud_position[0] + TP_NUMBER_MAX_POSITION[0]\r\r\n @tp_number2.y = $game_system.hud_position[1] + TP_NUMBER_MAX_POSITION[1]\r\r\n @tp_number2.opacity = 0 if !$game_system.hud_visible\r\r\n end",
"title": ""
},
{
"docid": "1b4f690c0d125447890209cdb8456e8b",
"score": "0.5460965",
"text": "def initialize(nombre, genero_)\n\n super()\n @alimentoTotal = Alimentos.new({ :nombre => nombre, :prot => 0.0, :carbs => 0.0, :lip => 0.0, :emisiones => 0.0, :terreno => 0.0})\n @genero = genero_\n end",
"title": ""
},
{
"docid": "93636aa58a7a90c2f7c317fcec07acda",
"score": "0.54585534",
"text": "def complemento\n # CAMPO TAMANHO\n # Densidade de gravação 5\n # Unidade de densidade de gravação 3\n '01600BPI'.rjust(294, ' ')\n end",
"title": ""
},
{
"docid": "91626d8d3117db7ac96df8ab729fe608",
"score": "0.54581165",
"text": "def make_solvent\n required_offload = self.amount_of_loans - (self.cash_deposits * 5)\n move_loans_to_nama(required_offload)\n end",
"title": ""
},
{
"docid": "c331474c412954fce6b802cbd8fdc84b",
"score": "0.5457742",
"text": "def ingresar_cola_menor(valor)\n nodo = {\n valor: valor,\n siguiente: nil,\n }\n if @cola_menor[:esta_vacia]\n @cola_menor[:tope]=nodo\n @cola_menor[:fondo]=nodo\n @cola_menor[:esta_vacia]=false\n @cola_menor[:size]+=1\n else\n fondo=@cola_menor[:fondo]\n fondo[:siguiente]=nodo\n @cola_menor[:fondo]=nodo\n @cola_menor[:size]+=1\n end\n end",
"title": ""
},
{
"docid": "22184715e62765b3f6bdf0be89088392",
"score": "0.545346",
"text": "def initialize(nombre, apellidos, edad, genero, peso, talla, cadera, cintura, imc, porcentgrasa, rcc, peso_t_i, gasto_e_basal, efecto_t_a, gasto_ef, factor_actvf, gasto_e_total)\n\n \n \n \n \n @nombre = nombre\n @apellidos = apellidos\n @edad = edad\n @genero = genero\n @peso = peso\n @talla = talla\n @cadera = cadera\n @cintura = cintura\n @imc = imc\n @porcentgrasa = porcentgrasa\n @rcc = rcc\n @peso_t_i = peso_t_i\n @gasto_e_basal = gasto_e_basal\n @efecto_t_a = efecto_t_a\n @gasto_ef = gasto_ef\n @factor_actvf = factor_actvf\n @gasto_e_total = gasto_e_total\n \n \n \n end",
"title": ""
},
{
"docid": "036c9451f82cfedf795ab1a61ec6f603",
"score": "0.5452416",
"text": "def ajouter( les_vins )\n #Valeurs par défaut\n type = 'rouge'\n qte = 1\n appellation = ''\n arg1 = ARGV.shift\n if arg1.partition('=').first == \"--qte\"\n qte = arg1.partition('=').last\n elsif arg1.partition('=').first == \"--type\"\n type = arg1.partition('=').last\n else\n appellation = arg1\n end\n\n if appellation == ''\n arg2 = ARGV.shift\n if arg2.partition('=').first == \"--qte\"\n qte = arg2.partition('=').last\n elsif arg2.partition('=').first == \"--type\"\n type = arg2.partition('=').last\n else\n appellation = arg2\n end\n end\n\n last_line = File.open(depot_a_utiliser).to_a.last\n if !last_line.nil?\n numero = Motifs::NUM_VIN.match(last_line)[0].to_i\n else\n numero = -1\n end\n date = Time.now.strftime(\"%y/%m/%d\")\n date = Date.parse date\n if appellation == ''\n appellation = ARGV.shift\n end\n millesime = ARGV.shift\n #puts millesime\n #puts Motifs::MILLESIME.match(millesime)\n #puts !Motifs::MILLESIME.match?(millesime)\n if !Motifs::MILLESIME.match?(millesime)\n $stderr.puts \"Le millesime entree de correspond pas a un nombre entier positif\"\n end\n nom = ARGV.shift\n prix = ARGV.shift\n verifier_arguments_en_trop( ARGV )\n 1.step(qte.to_i,1) { |i| les_vins << Vin.new( numero + i, date, type.to_sym, appellation, millesime.to_i, nom, prix.to_f) }\n return les_vins\nend",
"title": ""
},
{
"docid": "fb66572866682bc49b07bdb5a67f4008",
"score": "0.54517984",
"text": "def generate_coupons!\n raise 'Cupons já foram criados' if coupons.any?\n\n coupons.create_with(created_at: Time.now, updated_at: Time.now)\n .insert_all!(generate_coupons_code)\n \n #(1..coupon_quantity).each do |number|\n #coupons.create!(code: \"#{code}-#{'%04d' % number}\")\n #end\n end",
"title": ""
},
{
"docid": "632f690dc1c5ca2a04d03f62904ac164",
"score": "0.5451554",
"text": "def create\n\t\t#@trabajador = Trabajador.new(nombres: )\n\t\t@trabajador = Trabajador.new()\n\tend",
"title": ""
},
{
"docid": "37dd51a636bd4f92c4c4bdb82296b191",
"score": "0.5450935",
"text": "def frizz_pharmacolite_triaconter()\n end",
"title": ""
},
{
"docid": "b6c6972e472439b62135aac999a672f0",
"score": "0.54503864",
"text": "def create\n x = PoliceUnit.all.pluck(:id).sort[-1] + 1\n @police_unit = PoliceUnit.new(id: x, name: admin_police_unit_params[\"name\"], police_station_id: admin_police_unit_params[\"police_station_id\"].to_i, local_prosecution_id:admin_police_unit_params[\"local_prosecution_id\"].to_i)\n\n respond_to do |format|\n if @police_unit.save\n format.html { redirect_to admin_police_units_path, notice: 'Unidad Policial ha sido creado con éxito.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "d9d398dac06879e920e2a69ed03b3873",
"score": "0.54440063",
"text": "def initialize(name)\n @name = name\n @nota\n #declaracion v instancia\n end",
"title": ""
},
{
"docid": "b84fd9a6093f1f83b087196160a2c2bc",
"score": "0.5438625",
"text": "def makepasv; end",
"title": ""
},
{
"docid": "d4ef8b37d61c77df75231a3fcbba73ee",
"score": "0.5437339",
"text": "def jugada_de_prueba3\n \tself.tablero = [[1, 1, 2], [2, 1, 0], [0, 2, 1]]\n \tself.turno = 2\n end",
"title": ""
},
{
"docid": "fd5239c63f8a0e0821f86c09730f46c2",
"score": "0.5435094",
"text": "def initialize(nombre, apellidos, edad, genero, peso, talla, cadera, cintura, imc, porcentgrasa, rcc, peso_t_i, gasto_e_basal, efecto_t_a, gasto_ef, factor_actvf, gasto_e_total, paciente, tratamiento)\n\n \n super :nombre, :apellidos, :edad, :genero, :peso, :talla, :cadera, :cintura, :imc, :porcentgrasa, :rcc, :peso_t_i, :gasto_e_basal, :efecto_t_a, :gasto_ef, :factor_actvf, :gasto_e_total\n \n \n @nombre = nombre\n @apellidos = apellidos\n @edad = edad\n @genero = genero\n @peso = peso\n @talla = talla\n @cadera = cadera\n @cintura = cintura\n @imc = imc\n @porcentgrasa = porcentgrasa\n @rcc = rcc\n @peso_t_i = peso_t_i\n @gasto_e_basal = gasto_e_basal\n @efecto_t_a = efecto_t_a\n @gasto_ef = gasto_ef\n @factor_actvf = factor_actvf\n @gasto_e_total = gasto_e_total\n @paciente = paciente\n @tratamiento = tratamiento\n \n \n \n end",
"title": ""
},
{
"docid": "b318320afaf5e0d911747f41c1149e9c",
"score": "0.5434923",
"text": "def nueva\n\t\t@estrella = Estrella.new\n\tend",
"title": ""
},
{
"docid": "50de644e2aeb7e8c48fbe3e55a9a872f",
"score": "0.54334474",
"text": "def createOC_funcion(cliente, proveedor, sku, fechaEntrega, cantidad, precioUnitario, canal)\n\t\tauth_hash = getHash('PUT', '')\n\t\tbody = {'cliente': cliente, 'proveedor': proveedor, 'sku': sku, 'fechaEntrega': fechaEntrega,\n\t\t\t 'cantidad': cantidad, 'precioUnitario': precioUnitario, 'canal': canal}\n\t\tresp = httpPutRequest(BaseURL_oc + 'crear', auth_hash, body)\n\t\treturn resp\n\tend",
"title": ""
},
{
"docid": "d0ee5ee4c4fc969ded51c349f8be2535",
"score": "0.5433096",
"text": "def mKhaziVendorCreate(inName)\n mesh = MushMesh.new(inName)\n\n mesh.mBaseAdd(MushBasePrism.new(:order => 4))\n\n mesh.mBaseDisplacementAdd(MushDisplacement.new(\n\t\t :offset => MushVector.new(0,0,0,2),\n :scale => MushVector.new(2*Math.sqrt(2),2*Math.sqrt(2),2,4)\n\t ))\n\n arms = 2.0\n\n # Nose 1\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 0,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,0,0,-2),\n :scale => 0.7),\n \t\t:num_iterations => 2\n ))\n\n # Nose 2\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 8+7,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,0,0,-2),\n :scale => 0.9),\n \t\t:num_iterations => 2\n ))\n\n # Boom -x\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 6,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(-arms,0,0,0),\n :scale => 0.8\n ),\n\t\t :num_iterations => 1\n ))\n\n # Boom +x\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 4,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(arms,0,0,0),\n :scale => 0.8\n ),\n :num_iterations => 1\n ))\n\n # Boom -y\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 7,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,-arms,0,0),\n :scale => 0.8\n ),\n\t\t :num_iterations => 1\n ))\n\n # Boom +y\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 5,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,arms,0,0),\n :scale => 0.8\n ),\n :num_iterations => 1\n ))\n\n # Boom -z\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 2,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,0,-arms,0),\n :scale => 0.8\n ),\n\t\t :num_iterations => 1\n ))\n\n # Boom +z\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 3,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,0,arms,0),\n :scale => 0.8\n ),\n :num_iterations => 1\n ))\n\n # Tail\n mesh.mExtruderAdd(MushExtruder.new(\n :sourceface => 1,\n :displacement => MushDisplacement.new(\n :offset => MushVector.new(0,0,0,2.0),\n :scale => 0.7),\n \t\t:num_iterations => 1\n ))\n\n mesh.mMaterialAdd(\"#{inName}-mat\")\n\n mesh.mMake\n end",
"title": ""
},
{
"docid": "99f61af7b059a5e538ac43ecdc7269a8",
"score": "0.5430624",
"text": "def to_s()\n \"#{super()} Sesgada con movimientos=#{@movimientos} y rng=#{@rng}\"\n end",
"title": ""
},
{
"docid": "79c5d51443d85dfe59a5d100244f5f05",
"score": "0.5428302",
"text": "def generarSemilla\n \t #Asigna el tiempo\n hora = Time.now.hour\n minuto = Time.now.min\n segundo = Time.now.sec\n #Valida el tama.o de la cadena \n if hora.to_s.length == 1\n hora = hora + 10\n end\n if minuto.to_s.length == 1\n minuto = minuto + 10\n end\n if segundo.to_s.length == 1\n segundo = segundo + 10\n end\n #Retorna la cadena concatenada\n return \"#{hora}#{minuto}#{segundo}\"\n end",
"title": ""
},
{
"docid": "c8ee7aba74b80098bdf5bd69e3da895f",
"score": "0.54258585",
"text": "def carte_apres\n id_apres = self.carte_id + 1\n id_apres -= 13 if self.valeur == :R # As suit le Roi\n Carte.new(id_apres)\n end",
"title": ""
},
{
"docid": "bc6500c558320c510168064e301c05e8",
"score": "0.5425136",
"text": "def create_nw\n @pos - @n*(@w/2.0) + @u*(@l/2.0)\n end",
"title": ""
},
{
"docid": "92fac45a4e7c7eeca5f497279c415b6b",
"score": "0.54223204",
"text": "def make_GYT_tubes number\n show do\n title \"make 1:100 GYT dilution for nanodrop\"\n note \"Take #{number} empty, sterile 1.5 mL #{\"tube\".pluralize(number)} and add 990 uL GYT#{number > 1 ? \" to each\" : \"\"}.\" \n note \"Label #{number > 1 ? \"each \" : \"\"}tube as 1:100 dilution. \"\n end\n end",
"title": ""
},
{
"docid": "c123ca06deff87491ed5ad7d5a21620e",
"score": "0.5422101",
"text": "def generate_coupons!\n raise 'Cupons já foram gerados' if coupons.any?\n\n coupon_codes =\n (1..coupon_quantity).map do |number|\n { code: \"#{code}-#{'%04d' % number}\" }\n end\n coupons\n .create_with(created_at: Time.zone.now, updated_at: Time.zone.now)\n .insert_all!(coupon_codes)\n end",
"title": ""
},
{
"docid": "19ee6c1eefe9ac941d6b43be2a0e0bfe",
"score": "0.54211676",
"text": "def preencher\n nome.set('Gabriel')\n #sobrenome.set('')\n end",
"title": ""
},
{
"docid": "b13a38a21d39a95132750db200a3c6be",
"score": "0.5417837",
"text": "def nuevo\n if params[:caso_id].nil?\n respond_to do |format|\n format.html { render inline: 'Falta identificacion del caso' }\n end\n else\n @migracion = Sivel2Sjr::Migracion.new\n cid = params[:caso_id].to_i\n @migracion.caso_id = cid\n fex = Sivel2Gen::Caso.find(cid).fecha\n while (Sivel2Sjr::Migracion.where(caso_id: cid, \n fechasalida: fex.to_s).count > 0) do\n fex += 1\n end\n @migracion.fechasalida = fex\n @migracion.fechallegada = fex+1\n @migracion.fechaPep = nil\n @migracion.salvoNpi = nil\n @migracion.fechaNpi = nil\n if current_usuario && current_usuario.oficina\n @migracion.llegada_pais_id = current_usuario.oficina.pais_id\n @migracion.llegada_departamento_id = current_usuario.oficina.departamento_id\n @migracion.llegada_municipio_id = current_usuario.oficina.municipio_id\n @migracion.llegada_clase_id = current_usuario.oficina.clase_id\n end\n if @migracion.save\n h=@migracion.as_json\n h['migracion'] = @migracion.id\n respond_to do |format|\n format.js { render text: h }\n format.json { render json: h, status: :created }\n format.html { render inline: h.to_s }\n end\n else\n respond_to do |format|\n format.html { \n render inline: @migracion.errors, \n status: :unprocessable_entity \n }\n format.json { \n render json: @migracion.errors, \n status: :unprocessable_entity\n }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "1f48be719823b33dec5e012d5903f1f3",
"score": "0.5415955",
"text": "def criar_conta(nome, saldo, pin, senha, documento, tipoConta)\n if tipoConta == 1\n self.contas << PessoaFisica.new(nome, saldo, pin, senha, documento, tipoConta)\n\n elsif tipoConta == 2\n self.contas << Cnpj.new(nome, saldo, pin, senha, documento, tipoConta)\n end\n end",
"title": ""
},
{
"docid": "3a225f3b58738162e0fe51c7ad20279b",
"score": "0.5415365",
"text": "def initialize(nome, tempo)\n @nome = nome\n @tempo = tempo\n end",
"title": ""
},
{
"docid": "5514853fbeb526c9079c2eee3ac10960",
"score": "0.5413262",
"text": "def definirCorpo\n @body = CP::Body.new(10.0,1.0/0)\n\n @body.p = CP::Vec2.new(500, 100)\n\n @shape_verts = [CP::Vec2.new(0.0, 0.0), CP::Vec2.new(0.0, 70),\n CP::Vec2.new(25, 70), CP::Vec2.new(25, 0.0)]\n @shape = CP::Shape::Poly.new(@body, @shape_verts, CP::Vec2.new(0,0))\n @shape.collision_type = :zumbi\n\n @shape.u = FRICTION\n @shape.e = ELASTICITY\n #Passa para dentro do chipmunk o objeto zumbi\n @shape.object = self\n\n @space.add_body(@body)\n @space.add_shape(@shape)\n\n # #Usado para depuração das shapes no jogo\n # @color = Gosu::Color.new(255,0,255,0)\n # # the more elastic the greener\n # @color.saturation *= ELASTICITY\n # @color.value *= ELASTICITY\n\n end",
"title": ""
},
{
"docid": "46d6e6d3b0a2d0d05ad4e6027c81b0f7",
"score": "0.54114145",
"text": "def initialize\n @altura = 0\n @edad = 0\n @numeroNaranjas = 0\n @naranjasRecolectadas = 0\n @contador_rec = 0\n @contador_cre = 0\n end",
"title": ""
},
{
"docid": "872f22bfd3083b66f00da5cfdcdce3b2",
"score": "0.5411332",
"text": "def initialize(*args)\n super\n self.generado = false\n end",
"title": ""
},
{
"docid": "0f42d51d5ab41a6a4c286a06bb1ab8b7",
"score": "0.5410554",
"text": "def ingresar_cola_mayor(valor) \n nodo = {\n valor: valor,\n siguiente: nil,\n }\n if @cola_mayor[:esta_vacia]\n @cola_mayor[:tope]=nodo\n @cola_mayor[:fondo]=nodo\n @cola_mayor[:esta_vacia]=false\n @cola_mayor[:size]+=1\n else\n fondo=@cola_mayor[:fondo]\n fondo[:siguiente]=nodo\n @cola_mayor[:fondo]=nodo\n @cola_mayor[:size]+=1\n end\n end",
"title": ""
},
{
"docid": "2d345b3ff698ff33ea011f446ccf6098",
"score": "0.5409566",
"text": "def insertar_en_aux(valor)\n\n nodo = {\n valor: valor,\n siguiente: nil,\n }\n if @pila_aux[:esta_vacia]\n @pila_aux[:tope]=nodo\n @pila_aux[:esta_vacia]=false\n @pila_aux[:size]+=1\n else\n tope=@pila_aux[:tope]\n nodo[:siguiente]=tope\n @pila_aux[:tope]=nodo\n @pila_aux[:size]+=1\n end\n end",
"title": ""
},
{
"docid": "38ca923fe043d0fb5cc3c87c764f4db9",
"score": "0.54089886",
"text": "def to_s()\n \"#{super()} Uniforme con movimientos=#{@movimientos} y rng=#{@rng}\"\n end",
"title": ""
},
{
"docid": "2d345b3ff698ff33ea011f446ccf6098",
"score": "0.5408355",
"text": "def insertar_en_aux(valor)\n\n nodo = {\n valor: valor,\n siguiente: nil,\n }\n if @pila_aux[:esta_vacia]\n @pila_aux[:tope]=nodo\n @pila_aux[:esta_vacia]=false\n @pila_aux[:size]+=1\n else\n tope=@pila_aux[:tope]\n nodo[:siguiente]=tope\n @pila_aux[:tope]=nodo\n @pila_aux[:size]+=1\n end\n end",
"title": ""
},
{
"docid": "c1b9313715022b0be1c71c446fe6eda7",
"score": "0.540762",
"text": "def new_VCT\n\tn=0\n\tr=0\n\ta = Array.new\n\tx = @gramos.head\n\t@alimentos.map{ |i|\n\t\t\n\t\tn = i.Valor_energetico*(x.value/100)\n\t\tx = x.next\n\t\ta << 1.0 if n<670\n a << 2.0 if n>=670 && n<=830\n a << 3.0 if n>830\n\t}\n\tr = self.Reduce(a)\n\treturn (Float(r/@alimentos.Size)).round(1)\n\tend",
"title": ""
}
] |
0c4b9b0dd5d48f24dcff1b59012b6e39
|
difference of left and right heights is not more than 1 returns boolean
|
[
{
"docid": "d09b07d6b6d4645e96f75065868c52df",
"score": "0.7193949",
"text": "def balanced?\n left_height = height(@root.left_child)\n right_height = height(@root.right_child)\n return (left_height - right_height).abs <= 1\n end",
"title": ""
}
] |
[
{
"docid": "a879af0a5d892104266312c5005a251c",
"score": "0.6862807",
"text": "def balanced_horiz?\n number_nodes_horiz.between?(2**(get_depth_horiz - 1), 2**get_depth_horiz)\n end",
"title": ""
},
{
"docid": "beb113b91a05f542d6e3934b491d83c7",
"score": "0.6855589",
"text": "def horizontal?\n height < width\n end",
"title": ""
},
{
"docid": "885d93cfd64c4e5bb9d3dc2e359a706f",
"score": "0.6845644",
"text": "def balanced?\n if (height(@root.left) - height(root.right)).abs <= 1\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "14e4c96059bab2da90af0645cefc1997",
"score": "0.6775124",
"text": "def vertical?\n height > width\n end",
"title": ""
},
{
"docid": "fe8d35beed79c5b2731280f324a38bd7",
"score": "0.67687243",
"text": "def check_size?\n rec1 = [(@xa2 - @xa1).abs, (@ya2 - @ya1).abs]\n rec2 = [(@xb2 - @xb1).abs, (@yb2 - @yb1).abs]\n rec1 == rec2 or rec1 == rec2.reverse\n end",
"title": ""
},
{
"docid": "54d1a9adedfe09d8aecaae00fc554b9a",
"score": "0.6720297",
"text": "def balanced?\n return true if @root.nil?\n\n height_l = @root.l_child.nil? ? 0 : height(@root.l_child)\n height_r = @root.r_child.nil? ? 0 : height(@root.r_child)\n height_l - height_r > 1 || height_r - height_l > 1 ? false : true\n end",
"title": ""
},
{
"docid": "4622a10545d0a6398cbdbc25acc2fd08",
"score": "0.67039686",
"text": "def horizontal?\n height < width\n end",
"title": ""
},
{
"docid": "9f7b5da23996f165d0bec1ccac1787c4",
"score": "0.66960245",
"text": "def height_balanced?(node)\n return true if node.nil?\n\n if (find_height(node.left) - find_height(node.right)).abs < 2 &&\n height_balanced?(node.left) && height_balanced?(node.right)\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "8727777141f08f954cdf67626d14860f",
"score": "0.6680357",
"text": "def vertical?\n height > width\n end",
"title": ""
},
{
"docid": "9b1b810493af59c1ac20276c2061f59a",
"score": "0.66765165",
"text": "def balanced?(cur = @root)\n return true if @root.nil?\n\n left_height = height(cur.left)\n right_height = height(cur.right)\n diff = (left_height - right_height).abs\n diff < 2\n end",
"title": ""
},
{
"docid": "27df42ae66c9fe16cc042bed9122834b",
"score": "0.66499346",
"text": "def left_height\n return 0 unless self.left\n self.left.height + 1\n end",
"title": ""
},
{
"docid": "60098986b755a66e857ce6882930b3d9",
"score": "0.66471547",
"text": "def right_height\n return 0 unless self.right\n self.right.height + 1\n end",
"title": ""
},
{
"docid": "d80488b40a8cf829f026d937089d1a23",
"score": "0.6645335",
"text": "def double_height?\n @double_height\n end",
"title": ""
},
{
"docid": "624958507b7dc5e5dd1a77127a08b66a",
"score": "0.6592046",
"text": "def vertical?\r\n return false if self.contents == nil\r\n return self.contents.height > self.height - 32\r\n end",
"title": ""
},
{
"docid": "e214f77eb430d7340a54018aff7213e9",
"score": "0.6585057",
"text": "def out_of_sight?\n return true if y == nil || height == nil\n y < -(height*2) || y > (1 + (height*2))\n end",
"title": ""
},
{
"docid": "98d6a505f7d12f7edce9aba7b987ef79",
"score": "0.6551639",
"text": "def right_outer?\n @total_pages - @page < @right\n end",
"title": ""
},
{
"docid": "b8da5929b18217c401f42518398ecc5d",
"score": "0.65471333",
"text": "def reached_bottom?\n @y > height + @r*4 # If we go a little beyond the bottom\n end",
"title": ""
},
{
"docid": "184b60be663cf2bd534c3be2e2f01a07",
"score": "0.64928764",
"text": "def height\n [self.left_height, self.right_height].max\n end",
"title": ""
},
{
"docid": "7b96564755cafa3073bc6ae37b5cdbe0",
"score": "0.64444613",
"text": "def vertical?\r\n return false if self.bitmap == nil\r\n return self.bitmap.height > self.height\r\n end",
"title": ""
},
{
"docid": "f56ec9558490e952bb0e6ff91a69f660",
"score": "0.6441999",
"text": "def proper_length?(new_row, new_column)\n delta_row = (new_row - position_row).abs\n delta_col = (new_column - position_column).abs\n (delta_row <= 1) && (delta_col <= 1) \n end",
"title": ""
},
{
"docid": "d21da2c5e10564915c952a14c17094ea",
"score": "0.6396646",
"text": "def difference\n difference = 0\n valid_system = [*1...(@width * @height)]\n @blocks.each_with_index do |block, index|\n next if block == 0\n difference += 1 unless block == valid_system[index]\n end\n difference\n end",
"title": ""
},
{
"docid": "04aa3fad29f0b12d56a92fcb35dc9c8a",
"score": "0.63911045",
"text": "def valid?\n lower_left_point.x < upper_right_point.x && lower_left_point.y < upper_right_point.y\n end",
"title": ""
},
{
"docid": "4ca560b2e208424bc792b9de76d97f40",
"score": "0.63835704",
"text": "def right_outer?\n @options[:slice_number] - @slice < @options[:right]\n end",
"title": ""
},
{
"docid": "56d2e09f4879f81029ff9c99d78eb37d",
"score": "0.6379919",
"text": "def can_accomodate_dimensions?(left_x, upper_y, width, height)\n return false if left_x < 0 || upper_y < 0\n right_x = left_x + width - 1\n lower_y = upper_y + height - 1\n return false if right_x >= tile_cache_entry[\"width\"] || lower_y >= tile_cache_entry[\"height\"]\n return true unless tile_cache_entry[\"collision\"]\n (left_x..right_x).each do |x|\n (upper_y..lower_y).each do |y|\n return false if tile_cache_entry[\"collision\"][y * tile_cache_entry[\"width\"] + x] != 0\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "28209396aa06e1433fe7c5d5c3286059",
"score": "0.63711584",
"text": "def height\n [@left.height,@right.height].max+1\n end",
"title": ""
},
{
"docid": "bc5faea7dcd4d4216ffdd968075981c9",
"score": "0.63574594",
"text": "def check_balanced_tree_helper(tree)\n return true, 0 if tree.nil?\n\n left_balanced, left_height = check_balanced_tree_helper(tree.left)\n right_balanced, right_height = check_balanced_tree_helper(tree.right)\n\n balanced = left_balanced && right_balanced && (left_height - right_height).abs <= 1\n return balanced, [left_height, right_height].max + 1\nend",
"title": ""
},
{
"docid": "2fa3da2f2e18a477d07b0f0907808920",
"score": "0.63557684",
"text": "def surrounds?(other)\n other.top > top && other.bottom < bottom\n end",
"title": ""
},
{
"docid": "2fa3da2f2e18a477d07b0f0907808920",
"score": "0.63557684",
"text": "def surrounds?(other)\n other.top > top && other.bottom < bottom\n end",
"title": ""
},
{
"docid": "f28d92b2cfcdac36c4af2fe080443b1e",
"score": "0.63529384",
"text": "def points_up?(x, y)\n (x + y) % 2 == height % 2\n end",
"title": ""
},
{
"docid": "3f2a1dd66d582a80394cfab00ae9fe9b",
"score": "0.6349852",
"text": "def is_balanced(root)\n return true if root.nil?\n !!getHeight(root)\nend",
"title": ""
},
{
"docid": "8811b9bdf9f988d3fbb93f5222d4833c",
"score": "0.63414353",
"text": "def surrounds? (other)\n other.top > top && other.bottom < bottom\n end",
"title": ""
},
{
"docid": "8811b9bdf9f988d3fbb93f5222d4833c",
"score": "0.63414353",
"text": "def surrounds? (other)\n other.top > top && other.bottom < bottom\n end",
"title": ""
},
{
"docid": "378cb659cb3c079234e8c559b033b83e",
"score": "0.6331909",
"text": "def region_change?\n delta_x = @position[:current][:x] - @position[:previous][:x]\n delta_y = @position[:current][:y] - @position[:previous][:y]\n delta_x < 16 || delta_x >= 86 || delta_y < 16 || delta_y >= 88\n end",
"title": ""
},
{
"docid": "6e818c93f00f7f99165c76a07439d834",
"score": "0.6322981",
"text": "def fully_right_of(rect)\n @top_left.x > rect.bottom_right.x\n end",
"title": ""
},
{
"docid": "03e72c1737a10cd5b391c93521a4bdeb",
"score": "0.63203335",
"text": "def wider?\n width > height\n end",
"title": ""
},
{
"docid": "f43bc5005ed049ddd05b0f8903bcde79",
"score": "0.6310544",
"text": "def height\n return 0 if @root.nil?\n return 1 if (@root.left.nil? && @root.right.nil?)\n\n left_height = 1\n height_helper(@root.left, 1) if @root.left\n right_height = 1\n height_helper(@root.right, 1) if @root.right\n\n return left_height >= right_height ? left_height : right_height\n end",
"title": ""
},
{
"docid": "08ffd7aa83c9b64fe3a18f3adad31c6d",
"score": "0.6305874",
"text": "def horizontal?\n horizontal != 0\n end",
"title": ""
},
{
"docid": "09a307abc812451b23b459fccfb0ca9e",
"score": "0.62776893",
"text": "def through_wall?(other)\n @x > other.x + (other.width/2)\n end",
"title": ""
},
{
"docid": "17c7d52433e7aea1826e6debb178b8f6",
"score": "0.6271438",
"text": "def less_half?\n @wins.size + @draws.size + @losses.size < @minuses.size\n end",
"title": ""
},
{
"docid": "12eee36a45bd73950335a1b749bda3fb",
"score": "0.6251408",
"text": "def height_helper(node)\n if node\n left = 1 + height_helper(node.left)\n right = 1 + height_helper(node.right)\n\n return left > right ? left : right\n else \n return 0\n end\n end",
"title": ""
},
{
"docid": "6ae3233bfe26cbc5ace6bbd8e30538ab",
"score": "0.62480116",
"text": "def valid?\n return false if x >= radar_reading.width || x.negative?\n return false if y >= radar_reading.height || y.negative?\n\n (x + 1) - width >= 0 && (y + 1) - height >= 0\n end",
"title": ""
},
{
"docid": "6007b7b97d51d59f6c567a78bb54a292",
"score": "0.6245105",
"text": "def complete?\n @left >= @right\n end",
"title": ""
},
{
"docid": "1faaf2efc893ea6d78d638d8a78801cf",
"score": "0.623523",
"text": "def good?(layout)\n bishop1 = layout.index(:b)\n bishop2 = layout.rindex(:b)\n return false if bishop1 != bishop2 && bishop1 % 2 == bishop2 % 2\n\n rook1 = layout.index(:r)\n rook2 = layout.rindex(:r)\n king = layout.index(:k)\n !(rook1 != rook2 && (king.nil? || king < rook1 || king > rook2))\nend",
"title": ""
},
{
"docid": "077ca110cbe9dc8cb713166116339659",
"score": "0.62299633",
"text": "def vertical?\n @x1 == @x2\n end",
"title": ""
},
{
"docid": "b22689a781052c01493ae8d61374e8c1",
"score": "0.6227208",
"text": "def horizontal?\r\n return false if self.contents == nil\r\n return self.contents.width > self.width - 32\r\n end",
"title": ""
},
{
"docid": "282303a598990123ad6dc9132afe1684",
"score": "0.6217931",
"text": "def horizontal?\n @y1 == @y2\n end",
"title": ""
},
{
"docid": "50e5f1f5d97691652e76724825c8bd70",
"score": "0.621005",
"text": "def left_outer?\n @page <= @left\n end",
"title": ""
},
{
"docid": "c9777fd0ba348bf51116d7163a529dc0",
"score": "0.62043965",
"text": "def stretchy?\n !@height\n end",
"title": ""
},
{
"docid": "e9c03da90f49185f3039f7a93befd253",
"score": "0.6201488",
"text": "def balance\n self.left_height - self.right_height\n end",
"title": ""
},
{
"docid": "5c0c973ef82b3ec374c322bda7a24853",
"score": "0.6190633",
"text": "def pushing_2d_boundary?\n @z_height.times do |i|\n @y_length.times do |j|\n @x_width.times do |k|\n # binding.pry if layer[j][k].nil?\n return true if @grid[i][j][k] == '#' && edge?([j, k])\n end\n end\n end\n end",
"title": ""
},
{
"docid": "082de2f15eccf69e8879b7a9236981ce",
"score": "0.61871827",
"text": "def out_of_boundary?(new_row, new_column)\n new_row < 0 || new_row > 7 || new_column < 0 || new_column > 7\n end",
"title": ""
},
{
"docid": "69b2f784513d7130175d9aecc7b434cb",
"score": "0.61441165",
"text": "def balance()\n left_height = @left ? @left.height : -1\n right_height = @right ? @right.height : -1\n return left_height - right_height\n end",
"title": ""
},
{
"docid": "46e3170d436f2a242341d738c9cea368",
"score": "0.61407477",
"text": "def left_outer?\n @slice <= @options[:left]\n end",
"title": ""
},
{
"docid": "5cd2fc9cc2dbfbf42f64ac5e94cd55ed",
"score": "0.61208683",
"text": "def left_right?\n # (i+2) here represents the actual code number itself ex. 0+2 = 2 then fill number 2\n @black_pegs.each_with_index do |num, i|\n @right_part.fill(i+2, @right_part.size, num) if num != 0\n end\n @white_pegs.each_with_index do |num, i|\n @left_part.fill(i+2, @left_part.size, num) if num != 0\n end\n end",
"title": ""
},
{
"docid": "243ce30396c9fd36627ca7a17b5e3be0",
"score": "0.6120751",
"text": "def heptagonal?\r\n return false unless r = (self * 40 + 9).square?\r\n\r\n q, r = (3 + r).divmod(10)\r\n return false unless 0 == r\r\n\r\n return q\r\n end",
"title": ""
},
{
"docid": "b0fcb2bacbcc0a1eeb8a6f38fd1710e2",
"score": "0.61033493",
"text": "def at_bottom?\r\n lower_siblings.empty?\r\n end",
"title": ""
},
{
"docid": "6b9df847a483aac969cad263894101d9",
"score": "0.6101313",
"text": "def might_have_children?\n (self[right_col_name] - self[left_col_name]) > 1\n end",
"title": ""
},
{
"docid": "874e8adaf5b25fc1773157a4eff23303",
"score": "0.6100589",
"text": "def vertical?\n float_equal(start_point.x, end_point.x)\n end",
"title": ""
},
{
"docid": "52af0cd63ad1118eb9c6d02c9b629848",
"score": "0.6088871",
"text": "def stalemate?\n\t\t# make an array of booleans with three values\n\t\trows_able = [false, false, false]\n\t\t# ternary operator for each row that checks if it contains a \" \"\n\t\tself.top.has_value?(\" \") ? rows_able[0] = true : rows_able[0] = false\n\t\tself.middle.has_value?(\" \") ? rows_able[1] = true : rows_able[1] = false\n\t\tself.bottom.has_value?(\" \") ? rows_able[2] = true : rows_able[2] = false\n\t\tif rows_able.all?(false)\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend",
"title": ""
},
{
"docid": "adcf3a744542704946e5b316d3ea2311",
"score": "0.6079681",
"text": "def balanced?\n (depth(@root.left) - depth(@root.right)).abs <= 1\n end",
"title": ""
},
{
"docid": "238477672e71321620fd91976d8719ae",
"score": "0.6079437",
"text": "def horizontal?\n float_equal(start_point.y, end_point.y)\n end",
"title": ""
},
{
"docid": "76ce209db5beabdab72c35ab22bb9ff9",
"score": "0.60736203",
"text": "def vertical?\n vertical != 0\n end",
"title": ""
},
{
"docid": "4ecad6b2d18ee4cf42c796f01808350c",
"score": "0.60712385",
"text": "def out_of_space?\n return true if x > ending_x\n return true if y > ending_y\n return true if x.negative?\n return true if y.negative?\n\n false\n end",
"title": ""
},
{
"docid": "120600f369d0482533fbd33a49ac94e3",
"score": "0.6070383",
"text": "def square?\n height == width\n end",
"title": ""
},
{
"docid": "28b0224cfcc30bf3f1a26fcd702295e4",
"score": "0.606778",
"text": "def fully_left_of(rect)\n @bottom_right.x < rect.top_left.x\n end",
"title": ""
},
{
"docid": "7da466aa2a21b61d7ae6a34f6c12e19a",
"score": "0.6066242",
"text": "def inside?(x,y)\n if (x < 0 or y < 0) then return false end\n if (x > @width or y > @height) then return false end\n return true \n end",
"title": ""
},
{
"docid": "266f5894c9b5ee31033fce20a0df8d45",
"score": "0.60658264",
"text": "def game_over?\n @tower_three.map{|disk| size_of_disk(disk)} == (1..@tower_height).to_a.reverse\n end",
"title": ""
},
{
"docid": "8947ed8f3459dd8295fbd4cb593338ce",
"score": "0.60615903",
"text": "def horizontal?(x,y)\n x_diff = x_diff(x)\n y_diff = y_diff(y)\n return (x_diff > 0) && (y_diff == 0)\n end",
"title": ""
},
{
"docid": "061648d174bcd1ff9818c454192774b4",
"score": "0.60589",
"text": "def balanced?(node = root)\n height(node.left) == height(node.right) ||\n height(node.left) == height(node.right) + 1 ||\n height(node.left) == height(node.right) - 1\n end",
"title": ""
},
{
"docid": "471dcd243651c5b53fe4f9430fe99a93",
"score": "0.605189",
"text": "def in_area?(x, y)\n w = ((x.to_f-@x.to_f)**2.0)/(@width.to_f/2.0)\n h = ((y.to_f-@y.to_f)**2.0)/(@height.to_f/2.0)\n w + h <= 1\n end",
"title": ""
},
{
"docid": "d76a1ca25d92b1ed3f7d68b2c7cb5b1b",
"score": "0.6047805",
"text": "def digital_left?\n axis_jx < (JX_NEUTRAL - AXIS_TRIM - 46) \n end",
"title": ""
},
{
"docid": "1d45f63a2d35df56ba08ad50889285f9",
"score": "0.60457593",
"text": "def is_smaller_than?(dimensions)\n !is_bigger_than?(dimensions)\n end",
"title": ""
},
{
"docid": "53c790ff7d7f98517fa8715c950f79e7",
"score": "0.60421354",
"text": "def cyclic?\n p0, p1 = self[0], self[-1]\n delta = [(p1.row - p0.row).abs, (p1.col - p0.col).abs]\n delta == [3, 0] || delta == [0, 3] || delta == [2, 2]\n end",
"title": ""
},
{
"docid": "5fabe6ab630b85eb65abf5d7fe608349",
"score": "0.60398304",
"text": "def equal_in_delta?(m0, m1, delta = 1.0e-10)\n delta = delta.abs\n m0.row_size.times {|i|\n m0.column_size.times {|j|\n x=m0[i,j]; y=m1[i,j]\n return false if (x < y - delta or x > y + delta)\n }\n }\n true\n end",
"title": ""
},
{
"docid": "e7ed97d593153bcf6396bdc96c733037",
"score": "0.6036805",
"text": "def balanced?(node = @root)\n return nil if node.nil?\n \n if node.right.nil?\n return false if height(node.left.data) > 1\n \n elsif node.left.nil?\n return false if height(node.right.data) > 1\n \n elsif (height(node.right.data) - height(node.left.data)).abs > 1\n return false\n \n end\n true\n end",
"title": ""
},
{
"docid": "c603e4da1382df241fec41361e0c2753",
"score": "0.6035446",
"text": "def height\n if left_child.nil? && right_child.nil?\n return 0\n end\n [left_child.nil? ? 0 : left_child.height, right_child.nil? ? 0 : right_child.height].max + 1\n end",
"title": ""
},
{
"docid": "750815fe78f40d66d4438c129e4b0227",
"score": "0.6034544",
"text": "def getHeight(top_left, bottom_right)\n (top_left[1] - bottom_right[1]).abs\nend",
"title": ""
},
{
"docid": "7d2d2e2414f992d382837ace3211b169",
"score": "0.6023024",
"text": "def crosses_meridian?\n @sw.lng > @ne.lng \n end",
"title": ""
},
{
"docid": "45a1a225ccf196e4afbe6b12f5250ea9",
"score": "0.6019117",
"text": "def moving_right?\r\n return @x * 128 > @real_x\r\n end",
"title": ""
},
{
"docid": "f1bef7154ced9b874d929328ea8a5f4b",
"score": "0.60173124",
"text": "def beginning_of_half?\n beginning_of_half == self\n end",
"title": ""
},
{
"docid": "26659cae730034220d3027688664b683",
"score": "0.60080683",
"text": "def spent?\n (@x < 0 or @x > 640) or (@y < 0 or @y > 480)\n end",
"title": ""
},
{
"docid": "d8c484a2b2f0ee093a34d9334191aa0d",
"score": "0.6004947",
"text": "def single_gap?\n ((@page == @current_page - @window - 1) && (@page == @left + 1)) ||\n ((@page == @current_page + @window + 1) && (@page == @total_pages - @right))\n end",
"title": ""
},
{
"docid": "1276526ce5c37afaf601e2afeca7229e",
"score": "0.6003719",
"text": "def crosses_meridian?\n @sw.lng > @ne.lng\n end",
"title": ""
},
{
"docid": "8aaeca6823edc1174bd670892d135208",
"score": "0.60012794",
"text": "def monotonic?\n d = @layout.depth\n (0 .. @layout.clustsize - 1).map do |col|\n (@stripes[col, 1..d-1] - @stripes[col, 0..d-2]).gt(0).all?\n end.all?\n end",
"title": ""
},
{
"docid": "70551ffa349bf8afb95496ac188544d2",
"score": "0.5999623",
"text": "def left?\n free_space.include?([$x, $y.to_i - 1])\n end",
"title": ""
},
{
"docid": "95cbb4c0a0013af58a624caf2e7d2d8f",
"score": "0.59981304",
"text": "def square?\n height == width\n end",
"title": ""
},
{
"docid": "beb37b63dc6f5324c296bb1d2b76bec5",
"score": "0.59974223",
"text": "def square?\n @width == @height and @width != 0\n end",
"title": ""
},
{
"docid": "da9bd822cfcd12a5627be09874c5aa66",
"score": "0.5997222",
"text": "def is_right? x1, y1, x2, y2\n sides = [\n \tx1**2 + y1**2,\n \tx2**2 + y2**2,\n \t(x2-x1)**2 + (y2-y1)**2\n ].sort\n sides[0] != 0 and sides[0] + sides[1] == sides[2]\nend",
"title": ""
},
{
"docid": "fd7320a87434473598df90c590536672",
"score": "0.5994728",
"text": "def on_left_edge?\n grid_x == 0\n end",
"title": ""
},
{
"docid": "7b2f140cabb07258ab9706e14338ba72",
"score": "0.59906256",
"text": "def degenerate?\n @x_min == @x_max || @y_min == @y_max\n end",
"title": ""
},
{
"docid": "bfd0ec211dd8d25ccfe1d35dbb2deb7e",
"score": "0.59867203",
"text": "def square?\n width == height\n end",
"title": ""
},
{
"docid": "981fe89ff489d3c84d9c5c56904ce277",
"score": "0.5984559",
"text": "def tall?(height)\n if height >= 180\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "895ba3ded67a83b5e03a35f8ee266008",
"score": "0.5982528",
"text": "def fits_negative_edge?(row_or_column, size)\n row_or_column - size >= 0\n end",
"title": ""
},
{
"docid": "ec00ae5a41360ab7daa8243685f17aaa",
"score": "0.5978005",
"text": "def horizontal?\r\n return false if self.bitmap == nil\r\n return self.bitmap.width > self.width\r\n end",
"title": ""
},
{
"docid": "9bb99a04e2624785dfae0e3804660632",
"score": "0.59750104",
"text": "def lowest_height\n find(&:leaf?)\n end",
"title": ""
},
{
"docid": "22c849994319eb7f449e7b8549de8c91",
"score": "0.59673",
"text": "def intend_between_columns?\n return !@browser.elements(css: @row_background)[@row_target].class_name.include?(\"noMargin_\")\n end",
"title": ""
},
{
"docid": "eb136d6dfcf1c1064115a8157f599291",
"score": "0.5958331",
"text": "def cell? x, y\n xr = [x, 14 - x].sort.first\n yr = [y, 14 - y].sort.first\n (0..7).include? xr and (0..7).include? yr and xr + yr > 4\n end",
"title": ""
},
{
"docid": "b5921ac1a862941f35c97e639c9466ae",
"score": "0.5952046",
"text": "def at_boundary?\n b = false\n if @p.x == 0 \n @notx = \":SOUTH\"\n b = true \n end\n if @p.x == @dimension - 1\n @notx = \":NORTH\"\n b = true\n end \n if @p.y == 0 \n @noty = \":WEST\"\n b = true\n end\n if @p.y == @dimension - 1\n @noty = \":EAST\"\n b = true\n end\n \n return b\n end",
"title": ""
},
{
"docid": "79983ccac6ff1ed2ecf11cfa48eee1ce",
"score": "0.5948074",
"text": "def square?\n self.vsize == self.hsize\n end",
"title": ""
},
{
"docid": "312fbc2eb98366c0d8ac230ff1c99a3e",
"score": "0.5947593",
"text": "def straight?\n @values.last - @values.first == 4 ? true : false\n end",
"title": ""
}
] |
6cafb60056c35b20e714dc8e196d4617
|
Sets which indexer should be used for the given node class. You can share an indexer between several different classes. ==== Example class Contact include Neo4j::NodeMixin index :name has_one :phone end class Phone include Neo4j::NodeMixin property :phone node_indexer Contact put index on the Contact class instead index :phone end Find an contact with a phone number, this works since they share the same index Contact.find('phone: 12345').first => a phone object ! ==== Returns The indexer that should be used to index the given class
|
[
{
"docid": "4521669dcb1b405a7f8c5b82add8ed78",
"score": "0.7098424",
"text": "def node_indexer(clazz)\n indexer(clazz, :node)\n end",
"title": ""
}
] |
[
{
"docid": "b941567c21df40ad3b4fece69974f9a6",
"score": "0.6320463",
"text": "def node_indexer(config = _config || IndexConfig.new(:node), &config_dsl)\n config.instance_eval(&config_dsl)\n indexer(config)\n end",
"title": ""
},
{
"docid": "c35915b6a73ea857533e4efe3d9aff1b",
"score": "0.6104742",
"text": "def initialize(clazz, type) #:nodoc:\n # part of the unique name of the index\n @indexer_for = clazz\n\n # do we want to index nodes or relationships ?\n @entity_type = type\n\n @indexes = {} # key = type, value = java neo4j index\n @field_types = {} # key = field, value = type (e.g. :exact or :fulltext)\n @via_relationships = {} # key = field, value = relationship\n\n # to enable subclass indexing to work properly, store a list of parent indexers and\n # whenever an operation is performed on this one, perform it on all\n @parent_indexers = []\n end",
"title": ""
},
{
"docid": "908f7fbfbc6c0457094f1f09d2e0146d",
"score": "0.5821766",
"text": "def rel_indexer(clazz)\n indexer(clazz, :rel)\n end",
"title": ""
},
{
"docid": "229705254c1000d9bb0bcfbe7d5f6abc",
"score": "0.56760895",
"text": "def set_indexer\n @indexer = Indexer.find(params[:id])\n end",
"title": ""
},
{
"docid": "1141a87b793c2b33606f20c85bcfbec6",
"score": "0.5599105",
"text": "def index_class(et)\n type = case et\n when :vertex\n Pacer::Vertex\n when :edge\n Pacer::Edge\n else\n fail InternalError, \"Unable to determine index class from #{ et.inspect }\"\n end\n type.java_class.to_java\n end",
"title": ""
},
{
"docid": "f0f69d309192312d1174d3b3b3f89654",
"score": "0.5578246",
"text": "def find_index_class(symbol_or_class)\n case symbol_or_class\n when Symbol\n ::ActiveAdmin::Views.const_get(\"IndexAs\" + symbol_or_class.to_s.camelcase)\n when Class\n symbol_or_class\n end\n end",
"title": ""
},
{
"docid": "5b7d565be645135a83b5b27b1d473a81",
"score": "0.5541029",
"text": "def find_index_renderer_class(klass)\n klass.is_a?(Class) ? klass :\n ::ActiveAdmin::LTE::Views.const_get(\"IndexAs\" + klass.to_s.camelcase)\n end",
"title": ""
},
{
"docid": "0c0bef5fd9f37ff5dec5161df12a5d8a",
"score": "0.5494409",
"text": "def find_index_renderer_class(klass)\n klass.is_a?(Class) ? klass :\n ::ActiveAdmin::Views.const_get(\"IndexAs\" + klass.to_s.camelcase)\n end",
"title": ""
},
{
"docid": "9d5dd74d7cfd79c7610f91c1f210147f",
"score": "0.5491451",
"text": "def find_index_renderer_class(klass)\n\n klass.is_a?(Class) ? klass :\n\n ::ActiveAdmin::Views.const_get(\"IndexAs\" + klass.to_s.camelcase)\n\n end",
"title": ""
},
{
"docid": "e802730452e460fb4159c6ed1066be99",
"score": "0.5289476",
"text": "def class_indexes\n @class_indexes ||= definition_indexes(:CLASS)\n end",
"title": ""
},
{
"docid": "d788ac3480724e4615ef9bfc68f33bb7",
"score": "0.5287448",
"text": "def indices\n index_classes\n end",
"title": ""
},
{
"docid": "3aef0151c65f1aa2976259a3fcf09afb",
"score": "0.5276265",
"text": "def index_doc(to_set=nil)\n raise NoMethodError, \"You must define method index_doc in your class for it to be indexable\"\n end",
"title": ""
},
{
"docid": "8c96a2f7456f76c0bcccdf8860413058",
"score": "0.52631336",
"text": "def ferret_index\n ferret_indexes[class_index_dir] ||= create_index_instance\n end",
"title": ""
},
{
"docid": "8c96a2f7456f76c0bcccdf8860413058",
"score": "0.52631336",
"text": "def ferret_index\n ferret_indexes[class_index_dir] ||= create_index_instance\n end",
"title": ""
},
{
"docid": "0d6e5ddc63a9a4eed9667bd3334d6756",
"score": "0.52302927",
"text": "def set_class_index(class_index)\n @class_index = class_index\n end",
"title": ""
},
{
"docid": "2404bf320c5277e9398c316037694cfc",
"score": "0.52251506",
"text": "def multi_index(model_classes)\n model_classes.sort! { |a, b| a.name <=> b.name }\n key = model_classes.inject(\"\") { |s, clazz| s + clazz.name }\n multi_config = aaf_configuration[:ferret].dup\n multi_config.delete :default_field # we don't want the default field list of *this* class for multi_searching\n ActsAsFerret::multi_indexes[key] ||= MultiIndex.new(model_classes, multi_config)\n end",
"title": ""
},
{
"docid": "8253796c79ca6da109496fa910fd727f",
"score": "0.5190254",
"text": "def multi_index(model_classes)\n model_classes.sort! { |a, b| a.name <=> b.name }\n key = model_classes.inject(\"\") { |s, clazz| s << clazz.name }\n multi_config = ferret_configuration.dup\n multi_config.delete :default_field # we don't want the default field list of *this* class for multi_searching\n @@multi_indexes[key] ||= MultiIndex.new(model_classes, multi_config)\n end",
"title": ""
},
{
"docid": "84e7a2ac5b881052872f8aff2e3c759f",
"score": "0.51598305",
"text": "def property_for_node_class(node_class)\n PROPERTY_CLASS_MAP.invert.fetch(node_class)\n end",
"title": ""
},
{
"docid": "ce39a6927551349f9097d04b82395496",
"score": "0.5120011",
"text": "def node_class(cls)\n @node_class = cls\n end",
"title": ""
},
{
"docid": "c8e51440d3255bb51e1da6355b52da1e",
"score": "0.5119041",
"text": "def enable_elastic_indexing( *args )\n classes = [args].flatten\n classes.each do | klass |\n try_and_try_again( Elasticsearch::Transport::Transport::Errors::Conflict, sleep: 0.1, tries: 20 ) do\n klass.__elasticsearch__.client.delete_by_query( index: klass.index_name, body: { query: { match_all: {} } } )\n end\n klass.send :after_save, :elastic_index!\n klass.send :after_destroy, :elastic_delete!\n klass.send :after_touch, :elastic_index!\n end\nend",
"title": ""
},
{
"docid": "c7c598d860bdd970d2da1a73c7d040d6",
"score": "0.51077384",
"text": "def add_class_search_index(index)\n debug_msg \" generating class search index\"\n \n @classes.select { |klass| \n klass.document_self_or_methods\n }.sort.each do |klass|\n index[:searchIndex].push( search_string(klass.name) )\n index[:longSearchIndex].push( search_string(klass.parent.name) )\n index[:info].push([\n klass.name, \n klass.parent.full_name, \n klass.path, \n klass.module? ? '' : (klass.superclass ? \" < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}\" : ''), \n snippet(klass.comment),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "6a6894e209d0b7039b93f2e6604a6544",
"score": "0.51070434",
"text": "def node_index\n raise NotImplementedError, 'this should be overridden in subclass'\n end",
"title": ""
},
{
"docid": "aa18cbb7d1d10f21ebe649f03a1518e5",
"score": "0.51035243",
"text": "def indexed_identifier_for(instance)\n instance.send(indexed_identifier)\n end",
"title": ""
},
{
"docid": "d3ee148f7534dd3d27236796a45ff129",
"score": "0.5098146",
"text": "def register_class(clazz, options = {})\n logger.info \"register class #{clazz} with index #{index_name}\"\n\n if force = options.delete(:force_re_registration)\n index_definition[:registered_models].delete(clazz)\n end\n\n if index_definition[:registered_models].map(&:name).include?(clazz.name)\n logger.info(\"refusing re-registration of class #{clazz}\")\n else\n index_definition[:registered_models] << clazz\n @registered_models_config[clazz] = options\n\n # merge fields from this acts_as_ferret call with predefined fields\n already_defined_fields = index_definition[:ferret_fields]\n field_config = ActsAsFerret::build_field_config options[:fields]\n field_config.update ActsAsFerret::build_field_config( options[:additional_fields] )\n field_config.each do |field, config|\n if already_defined_fields.has_key?(field)\n logger.info \"ignoring redefinition of ferret field #{field}\" if shared? \n else\n already_defined_fields[field] = config\n logger.info \"adding new field #{field} from class #{clazz.name} to index #{index_name}\"\n end\n end\n\n # update default field list to be used by the query parser, unless it \n # was explicitly given by user.\n #\n # It will include all content fields *not* marked as :untokenized.\n # This fixes the otherwise failing CommentTest#test_stopwords. Basically\n # this means that by default only tokenized fields (which all fields are\n # by default) will be searched. If you want to search inside the contents \n # of an untokenized field, you'll have to explicitly specify it in your \n # query.\n unless index_definition[:user_default_field]\n # grab all tokenized fields\n ferret_fields = index_definition[:ferret_fields]\n index_definition[:ferret][:default_field] = ferret_fields.keys.select do |field|\n ferret_fields[field][:index] != :untokenized\n end\n logger.info \"default field list for index #{index_name}: #{index_definition[:ferret][:default_field].inspect}\"\n end\n end\n\n return index_definition\n end",
"title": ""
},
{
"docid": "43e6e60bbe71a3799eb8c107d5c56067",
"score": "0.5087443",
"text": "def enqueue_sphinx_index_for_class\n if @_will_index_class\n Indexer.enqueue(self.class.name)\n end\n\n reset_index_promises\n end",
"title": ""
},
{
"docid": "c0cf99de086b5252f33ef1082e6da887",
"score": "0.5084309",
"text": "def elastic_index(options = {})\n Escargot.register_model(self)\n\n options.symbolize_keys!\n \n self.index_name = options[:index_name] if options[:index_name].present?\n self.elastic_search_type = options[:type] if options[:type].present?\n self.update_index_policy = options[:updates] if options[:updates].present?\n self.index_options = options[:index_options] if options[:index_options].present?\n self.mapping = options[:mapping] if options[:mapping].present? \n \n send :include, InstanceMethods\n \n if update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n\n end",
"title": ""
},
{
"docid": "0b3d6fac97a5224229928cf05373d469",
"score": "0.5032972",
"text": "def add_class_search_index(index)\n debug_msg \" generating class search index\"\n \n self.data.each do |mod_name, mod| \n index[:searchIndex].push( search_string(mod.title) )\n index[:longSearchIndex].push( search_string(mod.title) )\n index[:info].push([\n mod.title,\n '',\n mod.title + '.html',\n '', \n snippet(mod.summary),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "7f21e1ec698931721d5789884e4278fc",
"score": "0.50310177",
"text": "def indexer_name(typI,typR)\n # Generate the name.\n return \"indexer_#{name_to_verilog(typI)}_#{name_to_verilog(typR)}\"\n end",
"title": ""
},
{
"docid": "34ce5edef69b86a57151e3aa20f65d86",
"score": "0.5030935",
"text": "def indexer\n indexer = Traject::Indexer::NokogiriIndexer.new\n indexer.tap do |i|\n i.load_config_file(arclight_config_path)\n end\n end",
"title": ""
},
{
"docid": "34ce5edef69b86a57151e3aa20f65d86",
"score": "0.5030935",
"text": "def indexer\n indexer = Traject::Indexer::NokogiriIndexer.new\n indexer.tap do |i|\n i.load_config_file(arclight_config_path)\n end\n end",
"title": ""
},
{
"docid": "dba4541f39c42be967e125bd90a468d7",
"score": "0.5023124",
"text": "def lookup(index_class, key, value)\n NodeLookup.new(index_class, key, value, @expressions)\n end",
"title": ""
},
{
"docid": "b8105d9a7ff0fcd5551c3674cbbba80a",
"score": "0.50022936",
"text": "def search_class\n acts_as_tree_options[:search_class] or self.class\n end",
"title": ""
},
{
"docid": "ec2154e2e61253945ea69007a668a924",
"score": "0.5000194",
"text": "def index_for_class(collection)\n if collection.respond_to?(:klass) # ActiveRecord::Relation\n collection.klass\n elsif !collection.empty?\n collection.first.class\n end\n end",
"title": ""
},
{
"docid": "3adc09c490c574a292c295f174844230",
"score": "0.49957502",
"text": "def add_class_search_index(index)\n debug_msg \"generating class search index\"\n\n classes.select { |klass| klass.document_self_or_methods }.sort.each do |klass|\n modulename = klass.module? ? '' : (klass.superclass ? (String === klass.superclass ? klass.superclass : klass.superclass.full_name) : '')\n index[:searchIndex].push( search_string(klass.name) )\n index[:longSearchIndex].push( search_string(klass.parent.full_name) )\n index[:info].push([\n klass.name,\n klass.parent.full_name,\n klass.path,\n modulename ? \" < #{modulename}\" : '',\n snippet(klass.comment),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "44b8932be3c744ad5321018eae51a28a",
"score": "0.49744293",
"text": "def indexer\n indexer = Traject::Indexer::NokogiriIndexer.new(repository: @repository_id)\n indexer.tap do |i|\n i.load_config_file(arclight_config_path)\n end\n end",
"title": ""
},
{
"docid": "44b8932be3c744ad5321018eae51a28a",
"score": "0.49744293",
"text": "def indexer\n indexer = Traject::Indexer::NokogiriIndexer.new(repository: @repository_id)\n indexer.tap do |i|\n i.load_config_file(arclight_config_path)\n end\n end",
"title": ""
},
{
"docid": "f700eda2a18a511d239cc9ab569f65a1",
"score": "0.4972947",
"text": "def index(*args)\n conf = args.last.kind_of?(Hash) ? args.pop : {}\n conf_no_via = conf.reject { |k,v| k == :via } # avoid endless recursion\n\n args.uniq.each do | field |\n if conf[:via]\n rel_dsl = @indexer_for._decl_rels[conf[:via]]\n raise \"No relationship defined for '#{conf[:via]}'. Check class '#{@indexer_for}': index :#{field}, via=>:#{conf[:via]} <-- error. Define it with a has_one or has_n\" unless rel_dsl\n raise \"Only incoming relationship are possible to define index on. Check class '#{@indexer_for}': index :#{field}, via=>:#{conf[:via]}\" unless rel_dsl.incoming?\n via_indexer = rel_dsl.target_class._indexer\n\n field = field.to_s\n @via_relationships[field] = rel_dsl\n via_indexer.index(field, conf_no_via)\n else\n @field_types[field.to_s] = conf[:type] || :exact\n end\n end\n end",
"title": ""
},
{
"docid": "bd286831b4b49e88db0d3ea69ab2d642",
"score": "0.49647495",
"text": "def add_class_search_index(index)\n debug_msg \" generating class search index\"\n @classes.uniq.select { |klass|\n klass.document_self_or_methods\n }.sort.each do |klass|\n modulename = klass.module? ? '' : (klass.superclass ? (String === klass.superclass ? klass.superclass : klass.superclass.full_name) : '')\n debug_msg \" #{klass.parent.full_name}::#{klass.name}\"\n index[:searchIndex].push( search_string(klass.name) )\n index[:longSearchIndex].push( search_string(klass.parent.full_name) )\n files = klass.in_files.map{ |file| file.absolute_name }\n index[:info].push([\n klass.name,\n files.include?(klass.parent.full_name) ? files.first : klass.parent.full_name,\n klass.path,\n modulename ? \" < #{modulename}\" : '',\n snippet(klass.comment),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "05361d21823912eb693588df81fc552d",
"score": "0.49349844",
"text": "def indices\n index_classes | type_classes.map(&:index)\n end",
"title": ""
},
{
"docid": "f13ffcd5730d4a3ec89888c0a59f56c2",
"score": "0.49281105",
"text": "def indexer_get key\n raise \"Trying to use 'get' when there is no index\" if @indexer == nil\n # raise \"Indexer key #{key} not found!\" if !@indexer[key]\n @indexer[key] \n end",
"title": ""
},
{
"docid": "ace7f26d071bd0a76d9e3a3b847da8ae",
"score": "0.49233842",
"text": "def base_index_query\n resource_class\n end",
"title": ""
},
{
"docid": "ebf22472480a5c9ed6d221aa6092b1a0",
"score": "0.49222133",
"text": "def indexer\n\t\t@indexer ||= Gem::Indexer.new( self.options.gemsdir )\n\tend",
"title": ""
},
{
"docid": "7f63e4d57c7b6574a2be4625020e6a7a",
"score": "0.49222004",
"text": "def data_accessor_for(clazz)\n @search.data_accessor_for(clazz)\n end",
"title": ""
},
{
"docid": "42ca74cefddc058678255a7c834f9517",
"score": "0.49219596",
"text": "def create_indexer(metadata_mapper)\n SolrIndexer.new(config: self, metadata_mapper: metadata_mapper)\n end",
"title": ""
},
{
"docid": "83939f1b69c38c08e552a9e8826a3e45",
"score": "0.4921854",
"text": "def multi_index(model_classes)\n model_classes.sort! { |a, b| a.name <=> b.name }\n key = model_classes.inject(\"\") { |s, clazz| s << clazz.name }\n @@multi_indexes[key] ||= MultiIndex.new(model_classes, ferret_configuration)\n end",
"title": ""
},
{
"docid": "57eef718c4ea79784d926dabcf254853",
"score": "0.49205256",
"text": "def elastic_index(options = {})\n Escargot.register_model(self)\n\n options.symbolize_keys!\n send :include, InstanceMethods\n @index_name = options[:index_name] || self.name.underscore.gsub(/\\//,'-')\n @update_index_policy = options.include?(:updates) ? options[:updates] : :immediate\n \n if @update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n @index_options = options[:index_options] || {}\n @mapping = options[:mapping] || false\n end",
"title": ""
},
{
"docid": "14d38f12fe4e19fd8c21eb1878f8c011",
"score": "0.49168208",
"text": "def by_fulltext_index(query, options = {})\n if self == Document\n client = Riddle::Client.new\n else\n client = Riddle::Client.new(fulltext_opts[:server], fulltext_opts[:port])\n query = query + \" @classname #{self}\"\n end\n \n client.match_mode = options[:match_mode] || :extended\n\n if (limit = options[:limit])\n client.limit = limit\n end\n\n if (max_matches = options[:max_matches])\n client.max_matches = matches\n end\n\n if (sort_by = options[:sort_by])\n client.sort_mode = :extended\n client.sort_by = sort_by\n end\n \n index_names = \"\"\n class_names = (self == Document ? options[:classes] || [] : [self.to_s])\n class_names.each do |class_name|\n class_name = class_name.to_s\n index_names += \"#{class_name.underscore}_core \"\n index_names += \"#{class_name.underscore}_delta \" if class_name.camelize.constantize.has_delta_index\n end\n debugger\n index_names = \"*\" if index_names.blank?\n result = client.query(query, index_names)\n\n if result and result[:status] == 0 and !(sphinx_matches = result[:matches]).empty?\n matches = sphinx_matches.collect do |row|\n {:classname => MongoSphinx::MultiAttribute.decode(row[:attributes]['csphinx-class']), :id => (row[:doc].to_i)} rescue nil\n end.compact\n return matches if options[:raw]\n objects = []\n matches.each do |match|\n objects << match[:classname].constantize.find_by_sphinx_id(match[:id])\n end\n return objects\n else\n return []\n end\n end",
"title": ""
},
{
"docid": "abfb23e5d524983d24841f4fe0a9be74",
"score": "0.48610342",
"text": "def by_fulltext_index(query, options = {})\n if self == Document\n client = Riddle::Client.new\n else\n client = Riddle::Client.new(fulltext_opts[:server],\n fulltext_opts[:port])\n\n query = query + \" @classname #{self}\"\n end\n\n client.match_mode = options[:match_mode] || :extended\n\n if (limit = options[:limit])\n client.limit = limit\n end\n\n if (max_matches = options[:max_matches])\n client.max_matches = max_matches\n end\n\n if (sort_by = options[:sort_by])\n client.sort_mode = :extended\n client.sort_by = sort_by\n end\n \n if (filter = options[:with])\n client.filters = options[:with].collect{ |attrib, value|\n Riddle::Client::Filter.new attrib.to_s, value\n }\n end\n \n \n if (page_size = options[:page_size] || 20)\n page_size = 20 if (page_size.to_i == 0) # Justin Case\n client.limit = page_size\n end\n \n if (page = options[:page] || 1)\n page = 1 if (page.to_i == 0) # Justin Case\n client.offset = (page-1) * client.limit\n end\n\n result = client.query(query)\n\n #TODO\n if result and result[:status] == 0 and result[:total_found] > 0 and (matches = result[:matches])\n classname = nil\n ids = matches.collect do |row|\n classname = MongoSphinx::MultiAttribute.decode(row[:attributes]['csphinx-class'])\n row[:doc]\n # (classname + '-' + row[:doc].to_s) rescue nil\n end.compact\n\n return ids if options[:raw]\n query_opts = {:_sphinx_id => ids}\n options[:select] and query_opts[:select] = options[:select]\n documents = Object.const_get(classname).all(query_opts).sort_by{|x| ids.index(x._sphinx_id)}\n return MongoSphinx::SearchResults.new(result, documents, page, page_size)\n else\n return MongoSphinx::SearchResults.new(result, [], page, page_size)\n end\n end",
"title": ""
},
{
"docid": "352760ac93155c4d662864c7daf75e94",
"score": "0.4849619",
"text": "def create_indexer(metadata_mapper) # rubocop:disable Lint/UnusedMethodArgument\n raise NoMethodError, \"#{self.class} should override #create_indexer to create an Indexer, but it doesn't\"\n end",
"title": ""
},
{
"docid": "6e570041281f7d8117257b00de5e9f6f",
"score": "0.48488355",
"text": "def set_index\n self[:set_index]\n end",
"title": ""
},
{
"docid": "a9f113dd2ecc8391cf8dbf76c5abd00a",
"score": "0.48477075",
"text": "def searcher_class\n @searcher_class ||= Spree::Core::Search::ProductCustomeSearch\n end",
"title": ""
},
{
"docid": "de5fc64577756df3f0d70c47462b26f8",
"score": "0.48411682",
"text": "def indexing_service\n @indexing_service ||= IndexingService.new(self)\n end",
"title": ""
},
{
"docid": "a5c93cb74fa8f5cf0c0fd49bfb54f450",
"score": "0.48372397",
"text": "def search_index_id\n # Returns a unique id for use in the index. Id must be unique for every element from all entity types\n \"#{self.class.name.downcase}_#{self.id}\"\n end",
"title": ""
},
{
"docid": "da59917445f9f1257097b8fab40a6155",
"score": "0.48201278",
"text": "def indexify!( node:, indextype:, role: nil )\n if role == nil\n role = node.name\n end\n node.children.first.add_previous_sibling %Q{<indexterm type=\"#{indextype}\"><primary role=\"#{role}\">#{node.text}</primary></indexterm>}\n return node\nend",
"title": ""
},
{
"docid": "3b4e80bc9da55a1f84588393157223a1",
"score": "0.48197556",
"text": "def indexes\n indexes = if PuppetLint::Data.class_indexes.empty?\n PuppetLint::Data.defined_type_indexes\n else\n PuppetLint::Data.class_indexes\n end\n end",
"title": ""
},
{
"docid": "d374fa953482b755cafaec8319569ed2",
"score": "0.48064733",
"text": "def get_index_name(str)\n raise \"You must set a model name variable like: MODEL=user\" if str.to_s.strip.blank?\n klass = str.to_s.strip.classify.constantize\n raise \"The class '#{klass}' has no Thinking Sphinx indexes defined\" if !klass.indexes || klass.indexes.empty?\n klass.indexes.first.name \nend",
"title": ""
},
{
"docid": "cb18c17e1d01c3018d00a8431e99da5e",
"score": "0.48051536",
"text": "def write_index(klass,property,options)\n raise DatabaseError.new(\"Readonly database.\") if readonly_data?\n class_index = klass.index_for(property,options)\n if options[:convert]\n # Only convert the index, without (re)storing the values.\n index = Index::Base.create(klass.path_for_index(@path,property),klass,options)\n index.copy(class_index)\n class_index = index\n else\n class_index.each do |key,proxy|\n proxy.save\n end\n end\n class_index.save\n class_index = nil\n end",
"title": ""
},
{
"docid": "3843264a19fab354f63bb506dba69263",
"score": "0.4781708",
"text": "def index_key\n @type ||= self.class.name.split(':').last.downcase\n @options.key[@type][self.name]\n end",
"title": ""
},
{
"docid": "57a5e91c570e17fc01910250f5e2cdea",
"score": "0.47792593",
"text": "def node_class_for_property(property)\n PROPERTY_CLASS_MAP.fetch(property)\n end",
"title": ""
},
{
"docid": "0d7e42bbeb8b7218cbc142ce2e3ad9e3",
"score": "0.4778005",
"text": "def search_index_for(model)\n index_name = model.is_a?(Class) ? model : model.class\n\n \"#{index_name}Index\".constantize.new(search_namespace)\n end",
"title": ""
},
{
"docid": "a38fe44be5f2d7d4a3da8d51f289a4e6",
"score": "0.4765008",
"text": "def rel_indexer(config = _config || IndexConfig.new(:rel), &config_dsl)\n config.instance_eval(&config_dsl)\n indexer(config)\n end",
"title": ""
},
{
"docid": "065f40e4489353f1e26830bdaf4cc6d4",
"score": "0.47522262",
"text": "def index_model(instance)\n search_client.index index: index_name, id: instance.id, type: instance.class.to_s.underscore, body: instance.indexed_for_queue\n end",
"title": ""
},
{
"docid": "065f40e4489353f1e26830bdaf4cc6d4",
"score": "0.47522262",
"text": "def index_model(instance)\n search_client.index index: index_name, id: instance.id, type: instance.class.to_s.underscore, body: instance.indexed_for_queue\n end",
"title": ""
},
{
"docid": "a329495eb56ea41f88da45403be6b493",
"score": "0.475089",
"text": "def indexer_solr(resource)\n resource_indexer.new(resource: resource).to_solr\n end",
"title": ""
},
{
"docid": "77f282461ede53ae30d7682a884daef7",
"score": "0.475044",
"text": "def indexing_search_uri\n respond_to?(:indexingAndSearchUri) ? indexingAndSearchUri : ''\n end",
"title": ""
},
{
"docid": "53a35352a8faa7a3b5c26833776d08e5",
"score": "0.47467837",
"text": "def as_index_document\n as_elasticsearch\n end",
"title": ""
},
{
"docid": "391c4d05e04ec9c90a418431a0416a28",
"score": "0.47346148",
"text": "def client_from_options(options = {})\n config = ThinkingSphinx::Configuration.instance\n client = Riddle::Client.new config.address, config.port\n klass = options[:class]\n index_options = klass ? klass.sphinx_index_options : {}\n\n # The Riddle default is per-query max_matches=1000. If we set the\n # per-server max to a smaller value in sphinx.yml, we need to override\n # the Riddle default or else we get search errors like\n # \"per-query max_matches=1000 out of bounds (per-server max_matches=200)\"\n if per_server_max_matches = config.configuration.searchd.max_matches\n options[:max_matches] ||= per_server_max_matches\n end\n\n # Turn :index_weights => { \"foo\" => 2, User => 1 }\n # into :index_weights => { \"foo\" => 2, \"user_core\" => 1, \"user_delta\" => 1 }\n if iw = options[:index_weights]\n options[:index_weights] = iw.inject({}) do |hash, (index,weight)|\n if index.is_a?(Class)\n name = ThinkingSphinx::Index.name(index)\n hash[\"#{name}_core\"] = weight\n hash[\"#{name}_delta\"] = weight\n else\n hash[index] = weight\n end\n hash\n end\n end\n\n [\n :max_matches, :match_mode, :sort_mode, :sort_by, :id_range,\n :group_by, :group_function, :group_clause, :group_distinct, :cut_off,\n :retry_count, :retry_delay, :index_weights, :rank_mode,\n :max_query_time, :field_weights, :filters, :anchor, :limit\n ].each do |key|\n client.send(\n key.to_s.concat(\"=\").to_sym,\n options[key] || index_options[key] || client.send(key)\n )\n end\n\n options[:classes] = [klass] if klass\n\n client.anchor = anchor_conditions(klass, options) || {} if client.anchor.empty?\n\n client.filters << Riddle::Client::Filter.new(\n \"sphinx_deleted\", [0]\n )\n\n # class filters\n client.filters << Riddle::Client::Filter.new(\n \"class_crc\", options[:classes].collect { |k| k.to_crc32s }.flatten\n ) if options[:classes]\n\n # normal attribute filters\n client.filters += options[:with].collect { |attr,val|\n Riddle::Client::Filter.new attr.to_s, filter_value(val)\n } if options[:with]\n\n # exclusive attribute filters\n client.filters += options[:without].collect { |attr,val|\n Riddle::Client::Filter.new attr.to_s, filter_value(val), true\n } if options[:without]\n\n # every-match attribute filters\n client.filters += options[:with_all].collect { |attr,vals|\n Array(vals).collect { |val|\n Riddle::Client::Filter.new attr.to_s, filter_value(val)\n }\n }.flatten if options[:with_all]\n\n # exclusive attribute filter on primary key\n client.filters += Array(options[:without_ids]).collect { |id|\n Riddle::Client::Filter.new 'sphinx_internal_id', filter_value(id), true\n } if options[:without_ids]\n\n client\n end",
"title": ""
},
{
"docid": "c46baa0d32b18e4f2ee8f9e205cd062c",
"score": "0.47322336",
"text": "def initialize(idx, opts = {})\n direct_idx = opts.include?(:direct_idx) ? opts[:direct_idx] : false\n\n # direct set index(es)\n @config =\n if direct_idx\n # main node index (fb_page, topic, article etc ...)\n ES && ES.include?(idx.to_sym) ? ES[idx.to_sym] : opts\n else\n opts = (ES[idx.to_sym] || opts)\n raise(ArgumentError, \"Missing defined index '#{idx}'\") if\n !opts || opts.empty?\n ES[idx.to_sym].deep_symbolize_keys.merge({\n idx_node_read: get_index(opts, :node, :read),\n idx_node_write: get_index(opts, :node, :write),\n idx_mention_read: get_index(opts, :mention, :read),\n idx_mention_write: get_index(opts, :mention, :write),\n idx_node_read_client: get_index(opts, :node, :read, :client),\n idx_mention_read_client: get_index(opts, :mention, :read, :client),\n node_type: opts[:node_type] || 'document',\n mention_type: opts[:mention_type] || 'document',\n node_alias: opts[:node_alias],\n mention_alias: opts[:mention_alias]\n }).merge(connect: opts[:connect])\n end\n @es = Elasticsearch::Client.new(@config[:connect].dup)\n @es_another =\n if @config.include?(:connect_another) && !@config[:connect_another].empty?\n @config[:connect_another].map do |connect|\n Elasticsearch::Client.new(connect.dup)\n end\n else\n []\n end\n end",
"title": ""
},
{
"docid": "fc60a2b8c86900fbfb925916dccee699",
"score": "0.4731813",
"text": "def indexes(name, options = {}, &block)\n mapping[name] = options\n\n if block_given?\n mapping[name][:type] ||= 'object'\n mapping[name][:properties] ||= {}\n\n previous = @mapping\n @mapping = mapping[name][:properties]\n yield\n @mapping = previous\n end\n\n mapping[name][:type] ||= 'string'\n\n self\n end",
"title": ""
},
{
"docid": "4b0b137109d058c7999311ba29830c9f",
"score": "0.4731509",
"text": "def __elasticsearch__\n @adapter ||= Adapter.new(self)\n end",
"title": ""
},
{
"docid": "4b0b137109d058c7999311ba29830c9f",
"score": "0.4731509",
"text": "def __elasticsearch__\n @adapter ||= Adapter.new(self)\n end",
"title": ""
},
{
"docid": "55d1d6635f81ef681e74de2b89e19abe",
"score": "0.47306395",
"text": "def key_for entry\n @indexer.call entry\n end",
"title": ""
},
{
"docid": "a3956f1ecb439e12b1bacfba1f0ab0ef",
"score": "0.4706121",
"text": "def set_index_options\n raise NotImplementedError, \"You have to implement #{self.class}##{__method__}\"\n end",
"title": ""
},
{
"docid": "fbc34969ce13b12f54433cc97e5b41d5",
"score": "0.4705257",
"text": "def getIndex(node)\n return getIndexAndOrNumber(node,INDEX)\n end",
"title": ""
},
{
"docid": "41ce6449fb8a83e3765a98ec05c77ffb",
"score": "0.46976903",
"text": "def index(*args, &block)\n case args.size\n when 1\n @indexed_methods_hash[args.first] = IndexOptions.new(:weight => 1, :block => block)\n when 2\n # Is it a method name with options?\n if args.last.is_a? Hash\n @indexed_methods_hash[args.first] = IndexOptions.new(args.last.merge(:block => block))\n else\n add_indexes_from args\n end\n else # multiple arguments\n add_indexes_from args\n end\n end",
"title": ""
},
{
"docid": "f5eb265e99e38d8ef95e72f9fb743703",
"score": "0.46966967",
"text": "def [](index_or_name)\n end",
"title": ""
},
{
"docid": "3b4916f91d196c9c49a1b8de1727b910",
"score": "0.4695935",
"text": "def index_type_for(field) #:nodoc:\n return nil unless index?(field)\n @field_types[field.to_s]\n end",
"title": ""
},
{
"docid": "b73efa8e3f9ff59767aba575d2178919",
"score": "0.46788335",
"text": "def index_field(field = nil)\n @index_field = field unless field.nil?\n @index_field\n end",
"title": ""
},
{
"docid": "a4cdb3783865c7e5fd2775d62a2604a9",
"score": "0.46699864",
"text": "def set_indexer_term\n @indexer_term = IndexerTerm.find(params[:id])\n end",
"title": ""
},
{
"docid": "52b968e61c0235fc00ea7adc5aa1d898",
"score": "0.46648896",
"text": "def indexable_with(indice_name, type)\n\n end",
"title": ""
},
{
"docid": "f8fb93ceb0047a3915d86c67d6b33739",
"score": "0.46630147",
"text": "def index_document\n __elasticsearch__.index_document\n end",
"title": ""
},
{
"docid": "5a7f5d7f1288d8cd0de17d6a119cb8d3",
"score": "0.46612298",
"text": "def indexers\n ActiveSearch.indexers(self)\n end",
"title": ""
},
{
"docid": "423b459f754b8a668f680d8c869921da",
"score": "0.46450824",
"text": "def getIndex(node)\n return getIndexAndOrNumber(node,INDEX)\n end",
"title": ""
},
{
"docid": "e4b179100488383df0316b9e92db83af",
"score": "0.46356067",
"text": "def by_fulltext_index(query, options = {})\n if self == Document\n client = Riddle::Client.new\n else\n client = Riddle::Client.new(fulltext_opts[:server],\n fulltext_opts[:port])\n\n query = query + \" @classname #{self}\"\n end\n\n client.match_mode = options[:match_mode] || :extended\n\n if (limit = options[:limit])\n client.limit = limit\n end\n\n if (max_matches = options[:max_matches])\n client.max_matches = matches\n end\n\n if (sort_by = options[:sort_by])\n client.sort_mode = :extended\n client.sort_by = sort_by\n end\n\n result = client.query(query)\n\n #TODO\n if result and result[:status] == 0 and (matches = result[:matches])\n classname = nil\n ids = matches.collect do |row|\n classname = MongoSphinx::MultiAttribute.decode(row[:attributes]['csphinx-class'])\n (classname + '-' + row[:doc].to_s) rescue nil\n end.compact\n\n return ids if options[:raw]\n return Object.const_get(classname).find(ids)\n else\n return []\n end\n end",
"title": ""
},
{
"docid": "68c84a7d11a1caf710f52adc81fdc34e",
"score": "0.46319824",
"text": "def nav_brethren_index_class\n extensions[:MiddlemanPageGroups].options[:nav_brethren_index_class]\n end",
"title": ""
},
{
"docid": "79405e76d11af6e85fff31cc0f518c23",
"score": "0.4612383",
"text": "def [](indexOrName)\n end",
"title": ""
},
{
"docid": "0a9177dadbde25adc0db071878d848be",
"score": "0.46097386",
"text": "def default_interface\n Elasticsearch::MultiClusterInterface.new\n end",
"title": ""
},
{
"docid": "bbea8780121421699cb31284c2589a18",
"score": "0.46080703",
"text": "def class_indexes\n PuppetLint::Data.class_indexes\n end",
"title": ""
},
{
"docid": "36f4a07cf0b7fa362ef77e98210d0ab9",
"score": "0.46046123",
"text": "def declare_document_index(*args)\n # TODO: Update this method to support new column-namespaced attributes\n column_name = args.shift; raise NoColumnNameSpecified unless column_name\n field_name = args.shift; raise NoFieldNameSpecified unless field_name\n search_field_name = \"#{column_name}.#{field_name}\"\n raise NoFieldForThatIndex unless self.send(\"#{column_name}_fields\").include?(field_name)\n class_name = self.name.underscore\n class_table_name = self.table_name\n index_table_name = \"document_indexes_for_#{class_table_name}\"\n #logger.debug \"DOCUMENT_FIELDS: declare_document_index invoked for \\\"#{column_name}\\\" column with \\\"#{field_name}\\\" field on #{class_name}\"\n self.send(\"document_indexes\").send(\"<<\", field_name)\n self.send(\"#{column_name}_indexes\").send(\"<<\", field_name)\n \n instance_eval <<-EOS\n def find_by_#{column_name}_#{field_name}(val)\n find(\n :all, \n :select=>\"*\",\n :from=>\"#{index_table_name}\",\n :conditions=>[\"`#{index_table_name}`.field = ? AND `#{index_table_name}`.value = ?\", \"#{search_field_name}\", val], \n :joins => \"LEFT JOIN `#{class_table_name}` ON `#{class_table_name}`.id = `#{index_table_name}`.doc_id\"\n )\n end\n def find_by_#{field_name}(val)\n find_by_#{column_name}_#{field_name}(val)\n end\n \n def find_with_#{column_name}(hash={})\n conditions = Array.new\n hash.each do |key, val|\n conditions.add_condition([\"`#{index_table_name}`.field = ? AND `#{index_table_name}`.value = ?\", \"#{search_field_name}\", val])\n end\n find(\n :all, \n :select=>\"*\", \n :from=>\"#{index_table_name}\", \n :conditions=>conditions,\n :joins=>\"LEFT JOIN `#{class_table_name}` ON `#{class_table_name}`.id = `#{index_table_name}`.doc_id\"\n )\n end\n EOS\n \n # after_save callback to update index\n define_method(\"update_document_index_#{column_name}_#{field_name}_after_save\") do\n #logger.debug \"DOCUMENT_FIELDS: update_document_index_after_save invoked for \\\"#{field_name}\\\"; not yet updating\"\n class_name = self.class.name.underscore\n class_table_name = self.class.table_name\n index_table_name = \"document_indexes_for_#{class_table_name}\"\n # TODO: Change INSERT behavior into UPDATE+INSERT/UPSERT behavior according to supported databases\n idx_id = ActiveRecord::Base.connection.insert(\"INSERT INTO `#{index_table_name}` (`doc_id`,`field`,`value`) VALUES (\"+self.id.to_s+\", \\\"\"+search_field_name.to_s+\"\\\", \\\"#{self.send(field_name).to_s}\\\")\")\n end\n after_save \"update_document_index_#{column_name}_#{field_name}_after_save\"\n \n # after_destroy callback to update index\n define_method(\"update_document_index_#{column_name}_#{field_name}_after_destroy\") do\n #logger.debug \"DOCUMENT_FIELDS: update_document_index_after_destroy invoked for \\\"#{field_name}\\\"\"\n class_name = self.class.name.underscore\n class_table_name = self.class.table_name\n index_table_name = \"document_indexes_for_#{class_table_name}\"\n num_del = ActiveRecord::Base.connection.delete(\"DELETE FROM `#{index_table_name}` WHERE `doc_id` = #{self.id}\")\n end\n after_destroy \"update_document_index_#{column_name}_#{field_name}_after_destroy\"\n \n end",
"title": ""
},
{
"docid": "2e3762521018fcee6c3515aae86d666f",
"score": "0.46040633",
"text": "def query(index_class, q, index_type = :exact)\n NodeQuery.new(index_class, q, index_type, @expressions)\n end",
"title": ""
},
{
"docid": "5eb8252e8ddf5153b5b078c85fc34323",
"score": "0.45963842",
"text": "def create_index_instance\n if aaf_configuration[:remote]\n RemoteIndex\n elsif aaf_configuration[:single_index]\n SharedIndex\n else\n LocalIndex\n end.new(aaf_configuration)\n end",
"title": ""
},
{
"docid": "e3bcd53ee349b592ddc89c6200180161",
"score": "0.45886043",
"text": "def search_index=(search_index)\n # TODO : Operation.build_search_index(search_index)\n index, opt = case search_index\n when Symbol\n [\"RAAWS::#{search_index.to_s.camelize}\", '']\n when Hash\n [\"RAAWS::#{search_index.keys.first.to_s.camelize}\", search_index.values.first]\n end\n @search_index = index.constantize.new(opt)\n end",
"title": ""
},
{
"docid": "44ea37c61228d5bd19d5143bb05603b2",
"score": "0.45878974",
"text": "def create_index_instance\n rebuild_index unless File.file? \"#{class_index_dir}/segments\"\n Ferret::Index::Index.new(ferret_configuration)\n end",
"title": ""
},
{
"docid": "44ea37c61228d5bd19d5143bb05603b2",
"score": "0.45878974",
"text": "def create_index_instance\n rebuild_index unless File.file? \"#{class_index_dir}/segments\"\n Ferret::Index::Index.new(ferret_configuration)\n end",
"title": ""
},
{
"docid": "96aaf7a249e5635e7aece29551760bdf",
"score": "0.45734656",
"text": "def setter_to_getter(node); end",
"title": ""
},
{
"docid": "f8bf21f925d43251e122367a0bf1d405",
"score": "0.4570778",
"text": "def indexed=(value)\n @indexed = value\n end",
"title": ""
},
{
"docid": "4d1be31af5dd684dc3c2f7b1753cb8a6",
"score": "0.45668265",
"text": "def set_base_elasticsearch\n @base_elasticsearch = BaseElasticsearch.find(params[:id])\n end",
"title": ""
},
{
"docid": "a9176f9a99cd5da5a2f95e340dabae53",
"score": "0.45651162",
"text": "def index_document\n self.__elasticsearch__.index_document\n end",
"title": ""
},
{
"docid": "189bea490938975e1a8b586b5ce8c430",
"score": "0.45649934",
"text": "def index_id #:nodoc:\n InstanceAdapter.index_id_for(\"#{id_prefix}#{@instance.class.name}\", id)\n end",
"title": ""
},
{
"docid": "38c281e077a41b3f04b0a4aed11bee40",
"score": "0.45646542",
"text": "def range_class=(klass)\n @range_class = klass\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "cbd121649bf052d77f8f02585d3df404",
"score": "0.0",
"text": "def set_group\n # byebug\n @group = Group.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163163",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045976",
"text": "def action_hook; end",
"title": ""
},
{
"docid": "b8b36fc1cfde36f9053fe0ab68d70e5b",
"score": "0.5946146",
"text": "def run_actions; end",
"title": ""
},
{
"docid": "3e521dbc644eda8f6b2574409e10a4f8",
"score": "0.591683",
"text": "def define_action_hook; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "bfb8386ef5554bfa3a1c00fa4e20652f",
"score": "0.58349305",
"text": "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",
"title": ""
},
{
"docid": "6c8e66d9523b9fed19975542132c6ee4",
"score": "0.5776858",
"text": "def add_actions; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "6ce8a8e8407572b4509bb78db9bf8450",
"score": "0.5652805",
"text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"title": ""
},
{
"docid": "1964d48e8493eb37800b3353d25c0e57",
"score": "0.5621621",
"text": "def define_action_helpers; end",
"title": ""
},
{
"docid": "5df9f7ffd2cb4f23dd74aada87ad1882",
"score": "0.54210985",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "0464870c8688619d6c104d733d355b3b",
"score": "0.53402257",
"text": "def define_action_helpers?; end",
"title": ""
},
{
"docid": "0e7bdc54b0742aba847fd259af1e9f9e",
"score": "0.53394014",
"text": "def set_actions\n actions :all\n end",
"title": ""
},
{
"docid": "5510330550e34a3fd68b7cee18da9524",
"score": "0.53321576",
"text": "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",
"title": ""
},
{
"docid": "97c8901edfddc990da95704a065e87bc",
"score": "0.53124547",
"text": "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",
"title": ""
},
{
"docid": "4f9a284723e2531f7d19898d6a6aa20c",
"score": "0.529654",
"text": "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",
"title": ""
},
{
"docid": "83684438c0a4d20b6ddd4560c7683115",
"score": "0.5296262",
"text": "def before_actions(*logic)\n self.before_actions = logic\n end",
"title": ""
},
{
"docid": "210e0392ceaad5fc0892f1335af7564b",
"score": "0.52952296",
"text": "def setup_handler\n end",
"title": ""
},
{
"docid": "a997ba805d12c5e7f7c4c286441fee18",
"score": "0.52600986",
"text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "1d50ec65c5bee536273da9d756a78d0d",
"score": "0.52442724",
"text": "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",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "635288ac8dd59f85def0b1984cdafba0",
"score": "0.5232394",
"text": "def workflow\n end",
"title": ""
},
{
"docid": "e34cc2a25e8f735ccb7ed8361091c83e",
"score": "0.523231",
"text": "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",
"title": ""
},
{
"docid": "78b21be2632f285b0d40b87a65b9df8c",
"score": "0.5227454",
"text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "923ee705f0e7572feb2c1dd3c154b97c",
"score": "0.52201617",
"text": "def process_action(...)\n send_action(...)\n end",
"title": ""
},
{
"docid": "b89a3908eaa7712bb5706478192b624d",
"score": "0.5212327",
"text": "def before_dispatch(env); end",
"title": ""
},
{
"docid": "7115b468ae54de462141d62fc06b4190",
"score": "0.52079266",
"text": "def after_actions(*logic)\n self.after_actions = logic\n end",
"title": ""
},
{
"docid": "d89a3e408ab56bf20bfff96c63a238dc",
"score": "0.52050185",
"text": "def setup\n # override and do something appropriate\n end",
"title": ""
},
{
"docid": "62c402f0ea2e892a10469bb6e077fbf2",
"score": "0.51754695",
"text": "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",
"title": ""
},
{
"docid": "72ccb38e1bbd86cef2e17d9d64211e64",
"score": "0.51726824",
"text": "def setup(_context)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "1fd817f354d6cb0ff1886ca0a2b6cce4",
"score": "0.5166172",
"text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"title": ""
},
{
"docid": "5531df39ee7d732600af111cf1606a35",
"score": "0.5159343",
"text": "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",
"title": ""
},
{
"docid": "bb6aed740c15c11ca82f4980fe5a796a",
"score": "0.51578903",
"text": "def determine_valid_action\n\n end",
"title": ""
},
{
"docid": "b38f9d83c26fd04e46fe2c961022ff86",
"score": "0.51522785",
"text": "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",
"title": ""
},
{
"docid": "199fce4d90958e1396e72d961cdcd90b",
"score": "0.5152022",
"text": "def startcompany(action)\n @done = true\n action.setup\n end",
"title": ""
},
{
"docid": "994d9fe4eb9e2fc503d45c919547a327",
"score": "0.51518047",
"text": "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",
"title": ""
},
{
"docid": "62fabe9dfa2ec2ff729b5a619afefcf0",
"score": "0.51456624",
"text": "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",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "adb8115fce9b2b4cb9efc508a11e5990",
"score": "0.5133759",
"text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"title": ""
},
{
"docid": "e1dd18cf24d77434ec98d1e282420c84",
"score": "0.5112076",
"text": "def setup(&block)\n define_method(:setup, &block)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "f54964387b0ee805dbd5ad5c9a699016",
"score": "0.5106169",
"text": "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",
"title": ""
},
{
"docid": "35b302dd857a031b95bc0072e3daa707",
"score": "0.509231",
"text": "def config(action, *args); end",
"title": ""
},
{
"docid": "bc3cd61fa2e274f322b0b20e1a73acf8",
"score": "0.50873137",
"text": "def setup\n @setup_proc.call(self) if @setup_proc\n end",
"title": ""
},
{
"docid": "5c3cfcbb42097019c3ecd200acaf9e50",
"score": "0.5081088",
"text": "def before_action \n end",
"title": ""
},
{
"docid": "246840a409eb28800dc32d6f24cb1c5e",
"score": "0.508059",
"text": "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",
"title": ""
},
{
"docid": "dfbcf4e73466003f1d1275cdf58a926a",
"score": "0.50677156",
"text": "def action\n end",
"title": ""
},
{
"docid": "36eb407a529f3fc2d8a54b5e7e9f3e50",
"score": "0.50562143",
"text": "def matt_custom_action_begin(label); end",
"title": ""
},
{
"docid": "b6c9787acd00c1b97aeb6e797a363364",
"score": "0.5050554",
"text": "def setup\n # override this if needed\n end",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "fd421350722a26f18a7aae4f5aa1fc59",
"score": "0.5036181",
"text": "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",
"title": ""
},
{
"docid": "d02030204e482cbe2a63268b94400e71",
"score": "0.5026331",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"title": ""
},
{
"docid": "4224d3231c27bf31ffc4ed81839f8315",
"score": "0.5022976",
"text": "def after(action)\n invoke_callbacks *options_for(action).after\n end",
"title": ""
},
{
"docid": "24506e3666fd6ff7c432e2c2c778d8d1",
"score": "0.5015441",
"text": "def pre_task\n end",
"title": ""
},
{
"docid": "0c16dc5c1875787dacf8dc3c0f871c53",
"score": "0.50121695",
"text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"title": ""
},
{
"docid": "c99a12c5761b742ccb9c51c0e99ca58a",
"score": "0.5000944",
"text": "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",
"title": ""
},
{
"docid": "0cff1d3b3041b56ce3773d6a8d6113f2",
"score": "0.5000019",
"text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"title": ""
},
{
"docid": "791f958815c2b2ac16a8ca749a7a822e",
"score": "0.4996878",
"text": "def setup_signals; end",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"text": "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",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"text": "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",
"title": ""
},
{
"docid": "5aa51b20183964c6b6f46d150b0ddd79",
"score": "0.49864885",
"text": "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",
"title": ""
},
{
"docid": "7647b99591d6d687d05b46dc027fbf23",
"score": "0.49797225",
"text": "def initialize(*args)\n super\n @action = :set\nend",
"title": ""
},
{
"docid": "67e7767ce756766f7c807b9eaa85b98a",
"score": "0.49785787",
"text": "def after_set_callback; end",
"title": ""
},
{
"docid": "2a2b0a113a73bf29d5eeeda0443796ec",
"score": "0.4976161",
"text": "def setup\n #implement in subclass;\n end",
"title": ""
},
{
"docid": "63e628f34f3ff34de8679fb7307c171c",
"score": "0.49683493",
"text": "def lookup_action; end",
"title": ""
},
{
"docid": "a5294693c12090c7b374cfa0cabbcf95",
"score": "0.4965126",
"text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"title": ""
},
{
"docid": "57dbfad5e2a0e32466bd9eb0836da323",
"score": "0.4958034",
"text": "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",
"title": ""
},
{
"docid": "5b6d613e86d3d68152f7fa047d38dabb",
"score": "0.49559742",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4aceccac5b1bcf7d22c049693b05f81c",
"score": "0.4954353",
"text": "def around_hooks; end",
"title": ""
},
{
"docid": "2318410efffb4fe5fcb97970a8700618",
"score": "0.49535993",
"text": "def save_action; end",
"title": ""
},
{
"docid": "64e0f1bb6561b13b482a3cc8c532cc37",
"score": "0.4952725",
"text": "def setup(easy)\n super\n easy.customrequest = @verb\n end",
"title": ""
},
{
"docid": "fbd0db2e787e754fdc383687a476d7ec",
"score": "0.49467874",
"text": "def action_target()\n \n end",
"title": ""
},
{
"docid": "b280d59db403306d7c0f575abb19a50f",
"score": "0.49423352",
"text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"title": ""
},
{
"docid": "9f7547d93941fc2fcc7608fdf0911643",
"score": "0.49325448",
"text": "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",
"title": ""
},
{
"docid": "da88436fe6470a2da723e0a1b09a0e80",
"score": "0.49282882",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd",
"score": "0.49269363",
"text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"title": ""
},
{
"docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3",
"score": "0.49269104",
"text": "def default_action; end",
"title": ""
},
{
"docid": "3ba85f3cb794f951b05d5907f91bd8ad",
"score": "0.49252945",
"text": "def setup(&blk)\n @setup_block = blk\n end",
"title": ""
},
{
"docid": "80834fa3e08bdd7312fbc13c80f89d43",
"score": "0.4923091",
"text": "def callback_phase\n super\n end",
"title": ""
},
{
"docid": "f1da8d654daa2cd41cb51abc7ee7898f",
"score": "0.49194667",
"text": "def advice\n end",
"title": ""
},
{
"docid": "99a608ac5478592e9163d99652038e13",
"score": "0.49174926",
"text": "def _handle_action_missing(*args); end",
"title": ""
},
{
"docid": "9e264985e628b89f1f39d574fdd7b881",
"score": "0.49173003",
"text": "def duas1(action)\n action.call\n action.call\nend",
"title": ""
},
{
"docid": "399ad686f5f38385ff4783b91259dbd7",
"score": "0.49171105",
"text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"title": ""
},
{
"docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a",
"score": "0.4915879",
"text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"title": ""
},
{
"docid": "6e0842ade69d031131bf72e9d2a8c389",
"score": "0.49155936",
"text": "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",
"title": ""
}
] |
5a1180ed3fddd1d6600a3e2efcbda572
|
sets order status text
|
[
{
"docid": "683d9764342dd4f8082951648263e812",
"score": "0.0",
"text": "def set_ordsts_txt (ordsts)\n if ordsts.to_i==1\n txt=\"Available\"\n elsif ordsts.to_i==2\n txt=\"Submitted\"\n elsif ordsts.to_i==3\n txt=\"Accepted\"\n else \n txt=\"Unknown\"\n end\n return txt\n \nend",
"title": ""
}
] |
[
{
"docid": "be55f2c75d5b5e855d7a617625596f70",
"score": "0.68072915",
"text": "def order_status_label(order)\n cls = {\n 'pending' => 'info',\n 'payed' => 'success',\n 'cancelled' => 'warning'\n }\n \"<span class='label label-#{cls[order.status]}'>#{order.status}</span>\".html_safe\n end",
"title": ""
},
{
"docid": "d32e07da4117e2bdceb6300234dfa31d",
"score": "0.6680164",
"text": "def log_status(state = nil)\n I18n.with_locale(:cn) do\n I18n.t \"models.order.status.#{ORDER_STATUS.key((state||self.status).to_i).downcase}\"\n end\n end",
"title": ""
},
{
"docid": "4c0c6389c63882d5ee2338019f1e3910",
"score": "0.6533485",
"text": "def set_order_status\n @order_status = OrderStatus.find(params[:id])\n end",
"title": ""
},
{
"docid": "d23bce8fec60c1d33ca0573190b345cc",
"score": "0.6527134",
"text": "def update_order_status(order, status)\n id = order.is_a?(String) ? order : order.id\n path = \"/checkout/orders/#{id}\"\n\n response = execute_request(path, {status: status})\n order.status = status unless order.is_a?(String)\n\n response\n end",
"title": ""
},
{
"docid": "0253dab1253ddd2bd73c53164cd5c10f",
"score": "0.6441959",
"text": "def set_to_ordered\n self.status = \"ordered\"\n self.save\n end",
"title": ""
},
{
"docid": "5c7f8fe95a9a51b6827f5daa8f0b93b5",
"score": "0.641987",
"text": "def update_order_status\n order.delivery_status = status\n order.save\n end",
"title": ""
},
{
"docid": "e683d3a0903edb5bbba6b9949f094c38",
"score": "0.6415732",
"text": "def update_order_state\n if self.status_changed?\n self.order.update_attributes(:state => self.status)\n end\n end",
"title": ""
},
{
"docid": "36e607fdf54a01e8c4c2257ffa3df997",
"score": "0.637956",
"text": "def order_status(order_status)\n stat_name = ''\n if order_status == 'deliver'\n stat_name = 'Entregada'\n elsif order_status == 'in_route'\n stat_name = 'Reparto'\n elsif order_status == 'rejected'\n stat_name = 'Rechazada'\n elsif order_status == 'pending'\n stat_name = 'Pendiente'\n elsif order_status.nil?\n stat_name = 'No tiene estado'\n end\n stat_name\n end",
"title": ""
},
{
"docid": "c0191f12be23dc95451a754a2638eaba",
"score": "0.63551253",
"text": "def change_status\n\n res = RResponse.new\n\n order = Order.find_by_id(params[:id])\n order.shipping_status_id = params[\"shipping_status_id\"]\n begin\n order.save\n res.success = true\n res.msg = 'Changed order status to \"' + order.status.name + '\"'\n\n # log this\n type = OrderLogType.find_by_name('status')\n log = OrderLog.create(:account_id => current_user.account.id, :order_log_type_id => type.id, :order_id => order.id, :subject => 'Order Status', :msg => res.msg)\n res.add_action(RAction.new({\n :component_id => 'order-log-' + params[:id],\n :success => true,\n :data => {:log => log.to_a}\n })) \n end\n\n respond(res)\n\n end",
"title": ""
},
{
"docid": "089fc7139fd93cdff5a91c66c242bfe4",
"score": "0.6324173",
"text": "def order_state(order)\n state = order.state.present? ? order.state : 'pending'\n t(\"order_states.#{state}\")\n end",
"title": ""
},
{
"docid": "1ac582d961dd89e46357fc54904278c7",
"score": "0.6317121",
"text": "def status\n case status_id\n when ReferenceData::PO_ITEM_PREPARING\n \"<em style='color:red'>Ordering</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_CENTRAL\n \"<em style='color:brown'>Sent to Central</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_SUPPLIER\n \"<em style='color:green'>Sent to PO</em>\"\n when ReferenceData::PO_ITEM_UNCATEGORIZED\n \"<em style='color:red'>Uncategorized</em>\"\n end\n \n end",
"title": ""
},
{
"docid": "cace7c04a28a4da865d0d6ea504632de",
"score": "0.6282804",
"text": "def delivery_status_text\n case self.delivery_status\n when 1\n 'Waiting for delivery'\n when 2\n 'Delivered'\n when 3\n 'Delivering'\n else\n ''\n end\n end",
"title": ""
},
{
"docid": "9aae79d590719c6e5f6a0847559ca680",
"score": "0.6277537",
"text": "def orderStatusEdit()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n o = Order.find(params[:id])\n status = o.update(order_status: params[:status])\n render json: {status: status, data: \"\", reason: ''}\n end",
"title": ""
},
{
"docid": "960764fa9591fd010cdfd280c1a3dc98",
"score": "0.6245241",
"text": "def orders_details_auto_status_changer(order)\n if order.read_attribute_before_type_cast(:status) == 1\n order.orders_details.each do |order_detail|\n order_detail.update(making_status: 1)\n end\n end\n end",
"title": ""
},
{
"docid": "d33b7ffeb7c5592292bd35433e7bb5c9",
"score": "0.62013644",
"text": "def message text\n $status_message.value = text # trying out 2011-10-9 \n end",
"title": ""
},
{
"docid": "60aa592c5cb5d8be7cedac1385a8e0e3",
"score": "0.6148568",
"text": "def test_status\n assert_equal @order.status, order_status_codes(:ordered_paid_to_ship).name\n end",
"title": ""
},
{
"docid": "b4e0833194b41edcd2aeda91653458ce",
"score": "0.6141367",
"text": "def update\n @order = Order.find(params[:id])\n @order.status = params[:order][:status]\n @order.update(order_params)\n if @order.status = \"入金確認\"\n @order.order_details.each do |order_detail|\n order_detail.update(making_status: 1)\n end\n end\n redirect_back(fallback_location: admin_orders_path)\n end",
"title": ""
},
{
"docid": "23923365966224a0f9bf17b71e6cb668",
"score": "0.61093396",
"text": "def status(text)\n @user.enqueue_message('_' + text + '_')\n end",
"title": ""
},
{
"docid": "23923365966224a0f9bf17b71e6cb668",
"score": "0.61093396",
"text": "def status(text)\n @user.enqueue_message('_' + text + '_')\n end",
"title": ""
},
{
"docid": "2cccf9042622ef07d17ed3afde4d6d16",
"score": "0.61067826",
"text": "def status\n \"#{@description} #{@status}\"\n end",
"title": ""
},
{
"docid": "8b7ed37925e28316aeadbf802281a361",
"score": "0.6024041",
"text": "def display_order_status(order)\n values = order.add_to_hash({})\n\n user = User.with_id(order.order_user_id)\n if user\n user.add_to_hash(values)\n else\n error \"Unknown user\"\n find_common\n end\n\n pays_list = PaysPayment.list_for_order(order)\n unless pays_list.empty?\n values['pays_list'] = pays_list.map do |p| \n res = {\n 'payment_url' => @context.url(PaymentStatus, :display_from_id, p.pys_pay_id)\n }\n p.add_to_hash(res)\n end\n end\n\n values['print_statement'] = url(:print_statement, order.order_id)\n\n standard_page(\"Order Status\", values, ORDER_STATUS)\n end",
"title": ""
},
{
"docid": "f920b9cdaa5b2e03b3efe089b1676eea",
"score": "0.6007333",
"text": "def status_text\n t(IMPORTING_STATUS[status])\n end",
"title": ""
},
{
"docid": "a155a4d2c61d7babc2d20fdda8f38185",
"score": "0.60025966",
"text": "def set_cdg_order_status\n @cdg_order_status = CdgOrderStatus.find(params[:id])\n end",
"title": ""
},
{
"docid": "28490053d898c252124ce106ec29724c",
"score": "0.598466",
"text": "def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend",
"title": ""
},
{
"docid": "dcf0ba1b1e018145f7878af8042dec98",
"score": "0.596778",
"text": "def set_work_order_status\n @work_order_status = WorkOrderStatus.find(params[:id])\n end",
"title": ""
},
{
"docid": "c251f9b5ed827b340515a0278fc513e1",
"score": "0.5965928",
"text": "def cancel_order\n if self.status.downcase == \"pending\"\n self.status = \"Canceled\"\n self.save\n self\n else \n \"Error in Order Model\"\n end\n end",
"title": ""
},
{
"docid": "21e38bec6757be863ec4d66854010802",
"score": "0.5965557",
"text": "def status=(status)\n @content[0] = status\n end",
"title": ""
},
{
"docid": "6709ad9de9237cce2a48c28a1783ca67",
"score": "0.5961846",
"text": "def order_status\n unless order.draft?\n errors.add(:order_status, 'An line_item can only be edited while in the DRAFT status')\n end\n end",
"title": ""
},
{
"docid": "a447ba910940eaf9b6a4b15b16a09357",
"score": "0.59430236",
"text": "def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"title": ""
},
{
"docid": "601a1b360e99ce50182b8c89e9184e5b",
"score": "0.59418434",
"text": "def status=(v)\n @status = alma_string v\n end",
"title": ""
},
{
"docid": "c27fb8cc3ebc9355b92e4036c9c4e454",
"score": "0.5936262",
"text": "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end",
"title": ""
},
{
"docid": "e6c1bcc7098f3261bac8614e7a1006cc",
"score": "0.591529",
"text": "def set_status(status, status_message = '')\n return if status == Algorithm.statuses[self.status]\n self.update_attributes(status: status)\n self.update_attributes(status_message: status_message)\n self.update_attribute(:diva_id, nil) if self.status == 'review' || self.status == 'unpublished_changes'\n self.update_version if self.status == 'published'\n end",
"title": ""
},
{
"docid": "a532836aeb9ce367067d436d051e5442",
"score": "0.59026635",
"text": "def orderStatusDesc(orderStatus)\n\n # Initialize variables\n output = ''\n\n case orderStatus\n when 'P' then output = 'Pending'\n when 'C' then output = 'Confirmed'\n when 'F' then output = 'Finished'\n when 'A' then output = 'Cancelled'\n else 'Error'\n end\n\n return output\n\n end",
"title": ""
},
{
"docid": "368bc6a930244dab59e3e9a9b378b753",
"score": "0.5896457",
"text": "def set_status(val)\n self.status = val\n self\n end",
"title": ""
},
{
"docid": "b037bdc223d0d8fe34fb01484934eded",
"score": "0.5880232",
"text": "def status_text\n case @state\n when 0\n H87Enchant::ST1\n when 1\n H87Enchant::ST2\n when 2\n H87Enchant::STQ\n when 3\n H87Enchant::ST3\n when 4\n H87Enchant::ST4\n when 5\n H87Enchant::ST5\n else\n ; 'ERRORE 01'\n end\n end",
"title": ""
},
{
"docid": "79f9df0daed94376a3e1c88e8c4baeaa",
"score": "0.5852864",
"text": "def status=(val)\n if val.nil?\n delete_element('status')\n else\n replace_element_text('status', val)\n end\n end",
"title": ""
},
{
"docid": "d5f6debdd1e3ade252c1e0456f5a231d",
"score": "0.5850798",
"text": "def status_text\n\t s = Enrollment::STATUS_NAMES[self.enrollment_status]\n\t \n\t if [Enrollment::STATUS_CLOSED,Enrollment::STATUS_FINALIZED].include? self.enrollment_status\n\t s += \"-#{Enrollment::COMPLETION_NAMES[self.completion_status]}\"\n\t end\n\t s\n\tend",
"title": ""
},
{
"docid": "e05e8822593de464ea6553a4683d6f4e",
"score": "0.58353585",
"text": "def test_status\n @order_status = OrderStatusCode.find(@order['order_status_code_id'])\n assert_equal @order_status.name, @order.status\n end",
"title": ""
},
{
"docid": "901d8e8babebda5b3bdafe21ff0a68af",
"score": "0.5830959",
"text": "def set_TransactionStatus(value)\n set_input(\"TransactionStatus\", value)\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5828173",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "bec20d77e8b776b03dae2e185fa8fb75",
"score": "0.5827487",
"text": "def status=(value)\n @status = value\n end",
"title": ""
},
{
"docid": "f424baeb44af3ac869bbf835021f14fc",
"score": "0.5826877",
"text": "def status_message=(val)\n @j_del.setStatusMessage(val)\n end",
"title": ""
},
{
"docid": "2b630f8f44aec1020b47e27b04060872",
"score": "0.5825506",
"text": "def set_status\n self.status = 1\n end",
"title": ""
},
{
"docid": "4dd3c4437d6a7a610dfa3623ec21c0e2",
"score": "0.58207345",
"text": "def set_Status(value)\n set_input(\"Status\", value)\n end",
"title": ""
},
{
"docid": "4dd3c4437d6a7a610dfa3623ec21c0e2",
"score": "0.58207345",
"text": "def set_Status(value)\n set_input(\"Status\", value)\n end",
"title": ""
},
{
"docid": "3b4915bfc9114cb957442dc0f10d5e92",
"score": "0.58183",
"text": "def order_status_changed(order)\n @order_callbacks.each do |c|\n c.call(order)\n end\n end",
"title": ""
},
{
"docid": "fe575c5c8ba32a734f0412421fd13327",
"score": "0.580831",
"text": "def status=(status); end",
"title": ""
},
{
"docid": "3784780a0b89a85430d6ecff4b430c4c",
"score": "0.5807745",
"text": "def order_status(id)\n authenticated_post(\"order/status\", params: {order_id: id.to_i}).body\n end",
"title": ""
},
{
"docid": "bf5eef5b764d5e4374bd962c58581fd4",
"score": "0.5795716",
"text": "def default_status\n\t\tself.status = \"Pending\"\n end",
"title": ""
},
{
"docid": "a1c3529a05631d22d45dbadd7bb0c2ea",
"score": "0.57760954",
"text": "def set_status( statuscode )\n\t\t\tself.log.warn \"Unknown status code %d\" unless CLOSING_STATUS_DESC.key?( statuscode )\n\t\t\tstatus_msg = \"%d %s\" % [ statuscode, CLOSING_STATUS_DESC[statuscode] ]\n\n\t\t\tself.payload.truncate( 0 )\n\t\t\tself.payload.puts( status_msg )\n\t\tend",
"title": ""
},
{
"docid": "e756e69fbacfe5c149830ec1d7976790",
"score": "0.5764171",
"text": "def status_text\n return 'Unknown' if state.blank?\n\n return I18n.t(\"activerecord.attributes.export_job.status.#{state}\") unless in_progress?\n\n I18n.t('activerecord.attributes.export_job.status.in_progress') + progress_text\n end",
"title": ""
},
{
"docid": "e1936c5fab148cbb4445782b9f63d3ce",
"score": "0.57631874",
"text": "def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end",
"title": ""
},
{
"docid": "c2e277e5f770cecdf7e6bff088d87772",
"score": "0.57365584",
"text": "def header_status_text\n\t\tif params[:status] == \"active\"\n\t\t\t'Active'\n\t\telsif params[:status] == \"inactive\"\n\t\t\t'Inactive'\n\t\telse\n\t\t\t'All'\n\t\tend\n\tend",
"title": ""
},
{
"docid": "daf81b0e5e6494d4c624244fcc21cb0d",
"score": "0.57318276",
"text": "def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end",
"title": ""
},
{
"docid": "7fb9544cca9c2a2ae6b2a4271f554ed6",
"score": "0.5727398",
"text": "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end",
"title": ""
},
{
"docid": "8a321a8c24021b41cd38ea3decf6254d",
"score": "0.5711927",
"text": "def ship_order\n self.update_attributes(status: 2)\n end",
"title": ""
},
{
"docid": "d14da87fb01290dfd164abf20bb98b8f",
"score": "0.5705269",
"text": "def status=(status)\n @_status = status\n end",
"title": ""
},
{
"docid": "d14da87fb01290dfd164abf20bb98b8f",
"score": "0.5705269",
"text": "def status=(status)\n @_status = status\n end",
"title": ""
},
{
"docid": "6fae85968e25c7aa98e8c12abaa697ca",
"score": "0.56998897",
"text": "def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "173de3076afa1543a848adaf524812fa",
"score": "0.5699389",
"text": "def status=(status)\n if status && (status.is_a?(String) || status.is_a?(Symbol))\n @status = status.upcase.to_sym\n end\n end",
"title": ""
},
{
"docid": "4b5f2114d87170acec0276becce77bc4",
"score": "0.5693613",
"text": "def mark_as(status)\n self.status = status\n self.save\n end",
"title": ""
},
{
"docid": "d3fd786a572726a147933f2221d441b4",
"score": "0.5693042",
"text": "def display_status(item_status_code)\n case item_status_code\n when 'I' # Initiated (Assigned)\n 'incomplete'\n when 'A', 'R' # Active (Processing) / Received\n 'beingProcessed'\n when 'C', 'W' # Completed / Waived\n 'completed'\n when 'Z' # Incomplete\n 'furtherActionNeeded'\n else\n 'incomplete'\n end\n end",
"title": ""
},
{
"docid": "82f50cb3aaee603703db574cb94c585c",
"score": "0.5691997",
"text": "def draw_status_text\n draw_text(0, 0, contents_width, line_height, status_text, 1)\n end",
"title": ""
},
{
"docid": "09ad8b70cf238f3cd29c2e61f84f7a32",
"score": "0.5676908",
"text": "def editing_complete status=nil\n self.edit_mode = false\n self.status = status.to_s if status\n self.save\n end",
"title": ""
},
{
"docid": "4f31485e17421a1c6e6b4496d18bfdfb",
"score": "0.5670138",
"text": "def update\n status = params[:order][:status]\n order = Order.find(params[:id])\n if order.status != status\n attribute = (status + ' at').gsub(/\\s+/, '_').to_sym\n params[:order][attribute] = Time.now if order.respond_to?(attribute)\n end\n super do |format|\n redirect_to orders_path and return if resource.valid?\n end\n end",
"title": ""
},
{
"docid": "35af3864c1680d52193e51f4ad0152d4",
"score": "0.56685954",
"text": "def status_text\n if skipped?\n 'skipped'\n elsif error?\n 'error'\n else\n 'success'\n end\n end",
"title": ""
},
{
"docid": "c5a2dd3efce1cbc7138d2fa748de66ce",
"score": "0.56622773",
"text": "def status_text\n i = view_status\n if i == 1\n return self.text_before\n elsif i == 2\n return self.text_during\n else\n return self.text_after\n end\n end",
"title": ""
},
{
"docid": "2a0e2dcb20b79739aa2203980ad0b0f4",
"score": "0.5660923",
"text": "def status(status_id)\n attrset Curses::A_REVERSE\n setpos 0, 0\n addstr ' ' * maxx\n text = Status.text(status_id)\n setpos 0, (maxx - text.length) / 2\n addstr text\n attrset(Curses::A_NORMAL)\n refresh\n end",
"title": ""
},
{
"docid": "11833b64136b4aad2a2b8d57d9f169c4",
"score": "0.5659105",
"text": "def status=(status)\n @statusbar.configure(:text => status)\n end",
"title": ""
},
{
"docid": "729c92a5f1b3c1a34880adebc511ff0d",
"score": "0.5657892",
"text": "def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end",
"title": ""
},
{
"docid": "e0addb4a3e495597c0a010c57cd62cb8",
"score": "0.5656582",
"text": "def update\n @breadcrumb = 'update'\n @order_status = OrderStatus.find(params[:id])\n @order_status.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @order_status.update_attributes(params[:order_status])\n format.html { redirect_to @order_status,\n notice: (crud_notice('updated', @order_status) + \"#{undo_link(@order_status)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f4a0d84b81b89272e9e52dd929a346f3",
"score": "0.5644333",
"text": "def customer_status_updated(invoice) \n @invoice = invoice\n mail(:to => invoice.customer.email, :subject => 'Order status update')\n end",
"title": ""
},
{
"docid": "3be21ecb177d47d6feea8f9f543d25de",
"score": "0.5620165",
"text": "def update\n build do\n if params[:order][:status] == 1\n @order.update!(order_params)\n #@task = @order.create_task if @order.ask_confirmed?\n message 'Редактирование заказа'\n view 'member/orders/show'\n end\n end\n end",
"title": ""
},
{
"docid": "9f8b1257717f3290fc120731c16dc09b",
"score": "0.5604142",
"text": "def set_TransactionStatus(value)\n set_input(\"TransactionStatus\", value)\n end",
"title": ""
},
{
"docid": "affe9d56f6f2682727ad754d7799395e",
"score": "0.5597096",
"text": "def send_when_ordered(order)\n @order = order\n mail to: \t order.email,\n \t subject: '注文を承りました'\n end",
"title": ""
},
{
"docid": "21ee289fd25cfe93db5a56f0b1520b9d",
"score": "0.5595371",
"text": "def update\n @order = Order.find(params[:id])\n unless @order.delivery_company_id.blank?\n @order.delivery_company_name=DeliveryCompany.find(@order.delivery_company_id).name\n else\n @order.delivery_company_name=\"\"\n end\n order_status_id=params[:order_status_id].to_i\n if @order.current_order_status.id!=order_status_id\n dict={}\n dict[1]=\"未确认\"\n dict[2]=\"确认\"\n dict[4]=\"正在配货\"\n dict[8]=\"配货完成\"\n dict[16]=\"已发货\"\n dict[64]=\"取消\"\n dict[128]=\"过期\"\n#如果订单标记为退货,则积分不返还,这样就省事一些,退货得退钱到现金账户,没有考虑细节,比如部分退换货\n @order.order_statuses << OrderStatus.create(:name=>dict[order_status_id],:value=>order_status_id,:tuangou=>false,:from=>\"后台订单管理\",:url=>request.fullpath)\n if order_status_id==16 and @order.tuangou==true\n email=@order.user.email\n email=\"frederick.mao@gmail.com\"\n title=@order.tuan.sub_title#以后改成edm_title\n mail=TuanMail.order_send(@order,email,title)\n mail.deliver \n logger.debug(\"TTTTTTTTTTTTREEEEEEEEEEEEEEEEEEEEE\")\n elsif order_status_id==16 and @order.tuangou==false\n CoreMail.order_send(@order).deliver\n logger.debug(\"发送已发货邮件\")\n end\n end\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to([:admin,@order], :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "023ce2ef76adb91580e4fbb69afcf11e",
"score": "0.5591166",
"text": "def making_status_update\n order_detail = OrderDetail.find(params[:id])\n order_detail.update(order_detail_params)\n redirect_to admin_order_path(order_detail.order_id)\n end",
"title": ""
},
{
"docid": "eae8bb5073ce205be73bf51a9700545e",
"score": "0.5589387",
"text": "def notifications\n order = Spree::Order.find_by_number(params[:order_id])\n\n order.payment_state =\n case params[:transaction_status]\n when \"expired\", \"cancel\"\n \"failed\"\n when \"pending\"\n \"pending\"\n when \"capture\"\n \"processing\"\n when \"settlement\"\n \"completed\"\n end\n\n order.save\n head 200\n end",
"title": ""
},
{
"docid": "e2857d939955eb98ba9b544cae0c03bd",
"score": "0.5580014",
"text": "def set_status\n if !draft\n self.status = STATUS[get_status]\n end\n end",
"title": ""
}
] |
3c0cea336c723962096a695126867d0f
|
Provide a detailed, user friendly representation
|
[
{
"docid": "d9cca740a917394a643eb2069194fce8",
"score": "0.0",
"text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.ParticipantInstance #{values}>\"\n end",
"title": ""
}
] |
[
{
"docid": "80363631cebade0e9ef3f8882509b99d",
"score": "0.6817552",
"text": "def details; end",
"title": ""
},
{
"docid": "10e71201c7d33f56a89616b30aa39d6b",
"score": "0.6813698",
"text": "def to_s; description end",
"title": ""
},
{
"docid": "3a05240b53527a0d76b85fb7354ca47f",
"score": "0.6758332",
"text": "def get_detail\n return self.inspect\n end",
"title": ""
},
{
"docid": "215f29191080c4bf1c51441e99ca812a",
"score": "0.6717903",
"text": "def to_display\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "28ad6a7958e484fabc7f9a4df46ff777",
"score": "0.6669525",
"text": "def formatted_info\n \"#{self.name} - #{self.description}\"\n end",
"title": ""
},
{
"docid": "86129319a2a6447f6fe874d37b39c363",
"score": "0.6654881",
"text": "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"title": ""
},
{
"docid": "f9fd9e1b757e39217467b9afc6af84b8",
"score": "0.663228",
"text": "def inspect\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"title": ""
},
{
"docid": "915a7351281d8412eb7a3ea74617017b",
"score": "0.6626862",
"text": "def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end",
"title": ""
},
{
"docid": "f9e37b221823700a3a2a735a93c8277e",
"score": "0.65499413",
"text": "def render\n inspect\n end",
"title": ""
},
{
"docid": "d8a104706d64705628a429e3caba8958",
"score": "0.6519309",
"text": "def overview\n\n end",
"title": ""
},
{
"docid": "84358794044b60e7c5c27fba8d0c3cdb",
"score": "0.64980435",
"text": "def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"title": ""
},
{
"docid": "d5abfa80f2c90a7f7bb23e2bba58b76b",
"score": "0.64802086",
"text": "def render_plain\n short_category(object.action) << \"\\n\" << instance_attributes\n end",
"title": ""
},
{
"docid": "42c4413381d628815a1f7d7cb72dc550",
"score": "0.64776045",
"text": "def details\n\n return @description + \": \" + \"#{@infection}\" + \". \" + @patient.details\n\n end",
"title": ""
},
{
"docid": "2160b36fc03049104a52263f062e7444",
"score": "0.6471904",
"text": "def to_s\n 'Id: ' + @id.to_s +\n ', Expires on: ' + display_expiry_date +\n ', Level: ' + map_number_to_word_level(@level) +\n ', Number of days left to expire: ' + display_num_of_days_left +\n ', Description: ' + @description % self\n end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "3cf00cdf059ad5e7c61304c18faab969",
"score": "0.6450177",
"text": "def description; end",
"title": ""
},
{
"docid": "dd4e3001bd56a6b52110ffe48dc91627",
"score": "0.64365053",
"text": "def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end",
"title": ""
},
{
"docid": "55815c69249b2cb3728087f54d9da808",
"score": "0.64344805",
"text": "def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end",
"title": ""
},
{
"docid": "60af33366fc609b01714e739c2717f5c",
"score": "0.63968587",
"text": "def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"title": ""
},
{
"docid": "c82266f44e9e7da80dbe6478f689cac9",
"score": "0.63913286",
"text": "def to_s\n descr\n end",
"title": ""
},
{
"docid": "f1110915135d459e7d16be72d52f624e",
"score": "0.63848335",
"text": "def details\r\n return @description + \"; \" + @vPatients + \"; \" + @vProfiles + \": \" + @vAppointments\r\n end",
"title": ""
},
{
"docid": "94b600ce1309a96a59534afe13efa709",
"score": "0.6382391",
"text": "def display\n to_h.fetch(:display)\n end",
"title": ""
},
{
"docid": "94b600ce1309a96a59534afe13efa709",
"score": "0.6382391",
"text": "def display\n to_h.fetch(:display)\n end",
"title": ""
},
{
"docid": "88267e4c6b98dc88c6d0f5e5ff8cb61c",
"score": "0.63620836",
"text": "def inspect_details\n\t\treturn \"ID=%s (%s)\" % [\n\t\t\tself.id,\n\t\t\tself.components.keys.map( &:name ).sort.join( '+' )\n\t\t]\n\tend",
"title": ""
},
{
"docid": "f4ea66bb891a11f17520285a3f423ec7",
"score": "0.63579524",
"text": "def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nid: \" + id.to_s + \"\\nservice: \" + service.to_s + \"\\ntitle: \" + title.to_s + \"\\nthumbnail: \" + thumbnail.to_s + \"\\nhref: \" + href.to_s\n\t\tres\n\tend",
"title": ""
},
{
"docid": "2ed9f75645e5e73e2122adfad83ea140",
"score": "0.63527715",
"text": "def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"title": ""
},
{
"docid": "a03c5e201ef0fdf5baff87a2ebd40fbd",
"score": "0.6347614",
"text": "def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"title": ""
},
{
"docid": "6a7103d8623f0bd1960ddf9560c45814",
"score": "0.63460535",
"text": "def details\n end",
"title": ""
},
{
"docid": "004b00c64882712ca414d001f73af0ef",
"score": "0.6333479",
"text": "def to_s\n \"#{represent_status} : #{description}\"\n end",
"title": ""
},
{
"docid": "ee23f194111eb3240934d17af72e4fe8",
"score": "0.6325929",
"text": "def details\n format_description(@description) + \"site name: \" + format_name\n end",
"title": ""
},
{
"docid": "6b2699c2cb8ac02a7a5dc232681f4b06",
"score": "0.63201934",
"text": "def to_s\n\t\tdescription\n\tend",
"title": ""
},
{
"docid": "6b2699c2cb8ac02a7a5dc232681f4b06",
"score": "0.63201934",
"text": "def to_s\n\t\tdescription\n\tend",
"title": ""
},
{
"docid": "0dedca46e99f8982b4b6e6c2dcea21c4",
"score": "0.63162404",
"text": "def to_s_details\n ''\n end",
"title": ""
},
{
"docid": "1b8024824d489bedeac7ab6675e21983",
"score": "0.6312649",
"text": "def details\n\n end",
"title": ""
},
{
"docid": "485f8c18391e93c836e0f852f27498a4",
"score": "0.63112825",
"text": "def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"title": ""
},
{
"docid": "4c2b55d15845122a179721b49c83bf6d",
"score": "0.6311272",
"text": "def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"title": ""
},
{
"docid": "5eea3ad649fa455414b7d8e55e86a2a1",
"score": "0.6307341",
"text": "def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"title": ""
},
{
"docid": "5c44ec0edd0d45b6db1a8097fa51ac61",
"score": "0.6305134",
"text": "def inspect_details\n ''\n end",
"title": ""
},
{
"docid": "9bbc52783a44410c74950a7abb6b11b3",
"score": "0.6300935",
"text": "def inspect\n \"#<#{self.class} ##{id} #{name} (#{slug})>\"\n end",
"title": ""
},
{
"docid": "86975fd8fac786c95a84927715dcd537",
"score": "0.6284969",
"text": "def display_quick\r\n s = ''\r\n for i in @me.keys\r\n s << \" <b>#{i}.</b><br/>\" # country\r\n for j in @me[i].keys\r\n s << \" <b>#{j}:</b><br/>\" if not j == 'unknown' # state\r\n for k in @me[i][j].keys\r\n s << \" #{k}<br/>\" if not k == 'unknown' # county\r\n for l in @me[i][j][k].keys\r\n s << (\" \" + (l == 'unknown' ? \"<i>repository not given</i>\" : \" #{l}\") + \"<br/>\") if not l == nil # repository\r\n s << \" \" + @me[i][j][k][l].keys.collect{|m| \r\n (\"#{@me[i][j][k][l][m]} \" +\r\n case m # the count\r\n when 'female'\r\n \"♀\"\r\n when 'male'\r\n \"♂\"\r\n when 'gynadropmorph'\r\n \"[♀♂]\"\r\n else\r\n \"unknown sex\"\r\n end)}.join(\",\") \r\n s << \"<br/>\" \r\n end\r\n end\r\n end\r\n end\r\n s.html_safe\r\n end",
"title": ""
},
{
"docid": "6b7efcadbc78f2e04a45fda73bfa3c37",
"score": "0.6278761",
"text": "def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"title": ""
},
{
"docid": "1e72b07c609e216276b642f98114f5a1",
"score": "0.6277219",
"text": "def to_s\n super\n end",
"title": ""
},
{
"docid": "6ee9ee5be86a1f9db580f0f4ec9238cd",
"score": "0.62769365",
"text": "def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"title": ""
},
{
"docid": "d1dd91bb039921fda91fe5cc1760de24",
"score": "0.627459",
"text": "def rendered_format; end",
"title": ""
},
{
"docid": "d1dd91bb039921fda91fe5cc1760de24",
"score": "0.627459",
"text": "def rendered_format; end",
"title": ""
},
{
"docid": "183f52581e9fdbba0c332f61e45ded6e",
"score": "0.6259996",
"text": "def to_s\n\t\t\tstr = super() + \"\\n\"\n\t\t\tstr += \"\\tAppaleable? #{appaleable}\\n\" if appaleable\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tLocation: #{location}\\n\" if location\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tReason code: #{reason_code} (see: http://msdn.microsoft.com/en-US/library/bing-ads-editorialfailurereasoncodes.aspx)\\n\" if reason_code\n\n\t\tend",
"title": ""
},
{
"docid": "72d9d3c28a6a82223beb71ceb5f88d35",
"score": "0.6254196",
"text": "def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"title": ""
},
{
"docid": "c373d2c87c399a360034937a221ec21b",
"score": "0.62513214",
"text": "def to_s\n \"\\n\\tTitle: #{@title}\\n\n \\tAuthor: #{@author}\\n\n \\tUrl: #{@url}\\n\\n\"\n end",
"title": ""
},
{
"docid": "8c3811a97a91cfceb8d9e71fefac2a00",
"score": "0.62509006",
"text": "def inspect\n to_s.inspect\n end",
"title": ""
},
{
"docid": "304a28fe9ccd5a55ea69c7e5169632cd",
"score": "0.6249094",
"text": "def details\n data()\n end",
"title": ""
},
{
"docid": "fba7051d844a1bcce527f4c5127d1f2e",
"score": "0.6222669",
"text": "def details\n\n return @description + \"; \" + @firstname + \"; \" + @lastname + \": \" + @dob + \": \"+ @address + \": \"+ @phone + \": \" + \"#{@infection}\"\n\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.6214059",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.6214059",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "7a319af07bba006125709d4017e9f586",
"score": "0.62127525",
"text": "def show\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "4d850aa3a213bc9a8989dec696d4bebc",
"score": "0.6208925",
"text": "def to_s\n long_display\n end",
"title": ""
},
{
"docid": "4d850aa3a213bc9a8989dec696d4bebc",
"score": "0.6208925",
"text": "def to_s\n long_display\n end",
"title": ""
},
{
"docid": "4d850aa3a213bc9a8989dec696d4bebc",
"score": "0.6208925",
"text": "def to_s\n long_display\n end",
"title": ""
},
{
"docid": "4d850aa3a213bc9a8989dec696d4bebc",
"score": "0.6208925",
"text": "def to_s\n long_display\n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bd1eaffb4750192b92c1bb36cca8d17f",
"score": "0.620535",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "8b87c4c0c4933a9dd2b8661e5e68135c",
"score": "0.6200105",
"text": "def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of_description\n\t\tparts << self.none_of_description\n\t\tparts.compact!\n\n\t\tstr = \"#<%p:%#0x matching entities\" % [ self.class, self.object_id * 2 ]\n\t\tif parts.empty?\n\t\t\tstr << \" with any components\"\n\t\telse\n\t\t\tstr << parts.join( ', ' )\n\t\tend\n\t\tstr << \">\"\n\n\t\treturn str\n\tend",
"title": ""
},
{
"docid": "a359b877abd28b7abf7f8c678ea8577d",
"score": "0.61979604",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "df98abfcc162b084f826e90dd7480d02",
"score": "0.6183075",
"text": "def description\n return summary\n end",
"title": ""
},
{
"docid": "04b63bef38a277b288e2673628fd8f3b",
"score": "0.6179973",
"text": "def details\n return @description + \"; \" + @doctorname + \"; \" + @medicine + \": \" + \"#{@cost}\"\n end",
"title": ""
},
{
"docid": "05046bc64773b7ad4835bf77cea768f5",
"score": "0.617754",
"text": "def details\n return \"ID = #{@id}\\n\" + \n \"Name = #{@name}\\n\" + \n \"Topic = #{@topic}\\n\" + \n \"Member Count = #{@member_count}\"\n end",
"title": ""
},
{
"docid": "eeb4e5923ae458958f787feef47171d3",
"score": "0.6175084",
"text": "def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"title": ""
},
{
"docid": "082cdcb08388091f2fd93f62ee529327",
"score": "0.6161662",
"text": "def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"title": ""
},
{
"docid": "b09a163c376f94678dd1a15af1239d2c",
"score": "0.6157751",
"text": "def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"title": ""
},
{
"docid": "4638bec959e5e3fe2050d4a6cd690a58",
"score": "0.615228",
"text": "def inspect\n \"#{self.class}<#{@description.inspect}>\"\n end",
"title": ""
},
{
"docid": "707c588fdba17bf75d431e978d5e67ae",
"score": "0.6151144",
"text": "def description\n end",
"title": ""
},
{
"docid": "707c588fdba17bf75d431e978d5e67ae",
"score": "0.6151144",
"text": "def description\n end",
"title": ""
},
{
"docid": "878c02ac64b8eb45c139f99737f2f611",
"score": "0.61508477",
"text": "def details\n return \" #{@description}, #{@lastname}, #{@date}. #{@start}, #{@hours}, #{@players}, #{@zone}. #{@cost}\"\n end",
"title": ""
},
{
"docid": "a1885d5678ac09248a5c0fa9a53db722",
"score": "0.6145355",
"text": "def display\n\t\tname\n\tend",
"title": ""
},
{
"docid": "a1885d5678ac09248a5c0fa9a53db722",
"score": "0.6145355",
"text": "def display\n\t\tname\n\tend",
"title": ""
},
{
"docid": "a1885d5678ac09248a5c0fa9a53db722",
"score": "0.6145355",
"text": "def display\n\t\tname\n\tend",
"title": ""
},
{
"docid": "a1885d5678ac09248a5c0fa9a53db722",
"score": "0.6145355",
"text": "def display\n\t\tname\n\tend",
"title": ""
},
{
"docid": "c923aa937c73423d72b61b8711b93596",
"score": "0.61349225",
"text": "def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end",
"title": ""
},
{
"docid": "ecee8d2e800511ff7dd4e9717a7a4fe4",
"score": "0.6132939",
"text": "def to_s\n \"#{self.title} - #{self.author} - #{self.date}\"\n end",
"title": ""
},
{
"docid": "5e8967f46c266b0940ea89e58b83ea22",
"score": "0.61301154",
"text": "def details\r\n return @description + \": \" + \". \" + @basic_profile.details\r\n end",
"title": ""
},
{
"docid": "5fbaade9f492fcf28472b79cbfffc246",
"score": "0.61294776",
"text": "def show\n #not needed for our implementation\n end",
"title": ""
},
{
"docid": "2a0b7d87f7bc137acaa248daf77222c0",
"score": "0.6123831",
"text": "def to_s\n super\n end",
"title": ""
},
{
"docid": "400f38055c710e3f9ca3606b0d0e6dcf",
"score": "0.6121496",
"text": "def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"title": ""
},
{
"docid": "3eb9c3ff4d4a2a00ebc392d061fe6996",
"score": "0.61147606",
"text": "def details_partial_for(o)\n \"#{o.class.name.underscore}s/details\"\n end",
"title": ""
},
{
"docid": "5682309ce1e685a1ef4d08ed76cc1f6e",
"score": "0.6111199",
"text": "def display\n puts \"Personal Details\"\n puts \" Name : #{self.name}\"\n puts \" Date of Birth : #{self.dob}\"\n puts \" Marital Status : #{self.marital_status}\"\n puts \" Mobile Number : #{self.mobile_number}\"\n puts \" Email : #{self.email}\"\n end",
"title": ""
},
{
"docid": "91286e9107dc2301c9323fba6becee36",
"score": "0.6109",
"text": "def detail\n attributes.fetch(:detail)\n end",
"title": ""
},
{
"docid": "91286e9107dc2301c9323fba6becee36",
"score": "0.6109",
"text": "def detail\n attributes.fetch(:detail)\n end",
"title": ""
}
] |
4ef945d8f68ba6e556467d3a4aadab75
|
Verify an SSH signature. signed_data The String message that the signature was calculated over. signature The binary String signature with SSH encoding. Returns boolean.
|
[
{
"docid": "5f5dc82e2593476dd60970c5b7b1a695",
"score": "0.7807632",
"text": "def verify(signed_data, signature)\n self.class.ed25519_gem_required!\n\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n if sig_algo != self.class.algorithm_identifier\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n begin\n ed25519_key.verify(raw_sig, signed_data)\n rescue Ed25519::VerifyError\n false\n end\n end",
"title": ""
}
] |
[
{
"docid": "2a1047396367bef9e07e3bf22a0b0160",
"score": "0.8195794",
"text": "def verify(signed_data, signature)\n sig_algo, ssh_sig, _ = Encoding.decode_signature(signature)\n if sig_algo != ALGO_DSA\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n openssl_sig = self.class.openssl_signature(ssh_sig)\n openssl.verify(OpenSSL::Digest::SHA1.new, openssl_sig, signed_data)\n end",
"title": ""
},
{
"docid": "df95db945d4de43182e6fe9123b990af",
"score": "0.80319184",
"text": "def verify(signed_data, signature)\n sig_algo, ssh_sig, _ = Encoding.decode_signature(signature)\n if sig_algo != \"ecdsa-sha2-#{curve}\"\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n openssl_sig = self.class.openssl_signature(ssh_sig)\n digest = DIGEST_FOR_CURVE[curve]\n\n openssl.verify(digest.new, openssl_sig, signed_data)\n end",
"title": ""
},
{
"docid": "6b20cf1efd977dea991584ccc6820907",
"score": "0.7754312",
"text": "def verify_sign(data, signature)\n public_key_file = './public.pem'\n public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file))\n\n digest = OpenSSL::Digest::SHA256.new\n public_key.verify(digest, signature, data)\n end",
"title": ""
},
{
"docid": "faecd0fced00ea4f8e0196e854e59e94",
"score": "0.7752924",
"text": "def _verify_sign(data, signature)\n public_key_file = 'public.pem'\n public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file))\n\n digest = OpenSSL::Digest::SHA256.new\n public_key.verify(digest, signature, data)\n end",
"title": ""
},
{
"docid": "72fa9141682772d8df25bdc9208e3697",
"score": "0.7459017",
"text": "def signature_valid?\n buffer = Buffer.new(signature)\n sig_format = buffer.read_string\n signature_key.ssh_do_verify(buffer.read_string, to_blob_without_signature, host_key: sig_format)\n end",
"title": ""
},
{
"docid": "0790376198ff6f1840593ba280f40261",
"score": "0.74274796",
"text": "def verify_signature(signature)\n\n return false if ::GpbMerchant.cert_file.blank?\n return false if fullhostpath.nil?\n\n data = fullhostpath.to_s\n public_key = OpenSSL::X509::Certificate.new(::GpbMerchant.cert_file).public_key\n public_key.verify(OpenSSL::Digest::SHA1.new(data), Base64.decode64(signature), data)\n\n end",
"title": ""
},
{
"docid": "8946b22af491d0451520e2398f982a8c",
"score": "0.74103963",
"text": "def check_signature(public_key:, signature:, payload:)\n verify_key = RbNaCl::VerifyKey.new(decode_tz(public_key).to_bin)\n\n bin_sig = decode_tz(signature).to_bin\n payload_hash = RbNaCl::Hash::Blake2b.digest(ignore_0x(payload).to_bin, digest_size: 32)\n\n verify_key.verify(bin_sig, payload_hash)\n rescue RbNaCl::BadSignatureError\n false\n end",
"title": ""
},
{
"docid": "10fce6f4588e0be66a943e831fbd8ecc",
"score": "0.7389117",
"text": "def verify_signature(signature, bytes, signer_public_key)\n @virgil_crypto.verify_signature(signature, bytes, signer_public_key)\n end",
"title": ""
},
{
"docid": "d18a37755a1e8be493ba4ef1e1b36ca4",
"score": "0.7298897",
"text": "def verify_signature(public_key_cert, signature, payload)\n verified = public_key_cert.public_key.verify(OpenSSL::Digest::SHA256.new, signature, payload)\n no_errors = OpenSSL.errors.empty? # this method has to be called always as it empties the OpenSSL error stack\n\n verified && no_errors\n end",
"title": ""
},
{
"docid": "ac21ebca6e20dc82699ccbd5b8097679",
"score": "0.7281069",
"text": "def verify_data(data, signature, public_key)\n digest = OpenSSL::Digest::SHA256.new\n public_key.verify(digest, signature, data)\n end",
"title": ""
},
{
"docid": "ac21ebca6e20dc82699ccbd5b8097679",
"score": "0.7281069",
"text": "def verify_data(data, signature, public_key)\n digest = OpenSSL::Digest::SHA256.new\n public_key.verify(digest, signature, data)\n end",
"title": ""
},
{
"docid": "8ecfbf94389e401b0f128253298db67a",
"score": "0.7277962",
"text": "def verify(signature, data, digest = SHA256.new)\n key.public_key.verify digest, signature, data\n end",
"title": ""
},
{
"docid": "178aaadbe713b567685087eec4849307",
"score": "0.71077096",
"text": "def check_signature(signature)\n sig_buf = FFI::MemoryPointer.from_data(signature)\n # workaround 2.2.0 release bug\n if LibBotan::LIB_VERSION == [2, 2, 0]\n rc = LibBotan.botan_pk_op_verify_finish(@ptr, sig_buf, sig_buf.size)\n raise Botan::Error, 'FFI call unexpectedly failed' \\\n unless [0, -1].include?(rc)\n else\n rc = Botan.call_ffi_rc(:botan_pk_op_verify_finish,\n @ptr, sig_buf, sig_buf.size)\n end\n rc.zero?\n end",
"title": ""
},
{
"docid": "8425d42f3ed8b4f0420c9191880c5bcc",
"score": "0.7048339",
"text": "def ssh_do_verify(sig, data, options = {})\n sig_r = sig[0, 20].unpack(\"H*\")[0].to_i(16)\n sig_s = sig[20, 20].unpack(\"H*\")[0].to_i(16)\n a1sig = OpenSSL::ASN1::Sequence([\n OpenSSL::ASN1::Integer(sig_r),\n OpenSSL::ASN1::Integer(sig_s)\n ])\n return verify(OpenSSL::Digest::SHA1.new, a1sig.to_der, data)\n end",
"title": ""
},
{
"docid": "065a2e9397b63f6244801a256d1b3b45",
"score": "0.70189804",
"text": "def ssh_do_verify(sig, data, options = {})\n digest = digester.digest(data)\n a1sig = nil\n\n begin\n sig_r_len = sig[0, 4].unpack('H*')[0].to_i(16)\n sig_l_len = sig[4 + sig_r_len, 4].unpack('H*')[0].to_i(16)\n\n sig_r = sig[4, sig_r_len].unpack('H*')[0]\n sig_s = sig[4 + sig_r_len + 4, sig_l_len].unpack('H*')[0]\n\n a1sig = OpenSSL::ASN1::Sequence([\n OpenSSL::ASN1::Integer(sig_r.to_i(16)),\n OpenSSL::ASN1::Integer(sig_s.to_i(16))\n ])\n rescue StandardError\n end\n\n if a1sig.nil?\n return false\n else\n dsa_verify_asn1(digest, a1sig.to_der)\n end\n end",
"title": ""
},
{
"docid": "6a0409f65be435309d72b352b496dc27",
"score": "0.69790757",
"text": "def verify(signed_data, signature)\n raise \"implement me\"\n end",
"title": ""
},
{
"docid": "ef0011b96bda3b4861b7a7cc7a115a4d",
"score": "0.6971939",
"text": "def verify(key, signature, string)\n rsa_key(key).verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), string)\n end",
"title": ""
},
{
"docid": "7fbe080aad04e1f0f1012ff6fb884e12",
"score": "0.6912185",
"text": "def valid_signature?(signature, payload)\n payload_signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), self.key, payload)\n payload_signature == signature\n end",
"title": ""
},
{
"docid": "6a22125fdeb14398bba32ada51f7eb51",
"score": "0.690288",
"text": "def ssh_do_verify( sig, data )\n verify( OpenSSL::Digest::SHA1.new, sig, data )\n end",
"title": ""
},
{
"docid": "1e1fa5c9dbce21a7ad86f7df3a4c8c60",
"score": "0.68902534",
"text": "def ssh_do_verify( sig, data )\n sig_r = sig[0,20].unpack(\"H*\")[0].to_i(16)\n sig_s = sig[20,20].unpack(\"H*\")[0].to_i(16)\n a1sig = OpenSSL::ASN1::Sequence([\n OpenSSL::ASN1::Integer(sig_r),\n OpenSSL::ASN1::Integer(sig_s)\n ])\n return verify(OpenSSL::Digest::DSS1.new, a1sig.to_der, data)\n end",
"title": ""
},
{
"docid": "5e6d3a39c54a14cff1602103477a4692",
"score": "0.68568665",
"text": "def validate_signature(content, channel_signature)\n return false if !channel_signature || !channel_secret\n\n hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), channel_secret, content)\n signature = Base64.strict_encode64(hash)\n\n variable_secure_compare(channel_signature, signature)\n end",
"title": ""
},
{
"docid": "e74de96caeb70d4f2460429820159ed7",
"score": "0.68524444",
"text": "def verify(data, sig)\n regenerate_pubkey unless @key.public_key\n sig = Bitcoin::OpenSSL_EC.repack_der_signature(sig)\n if sig\n @key.dsa_verify_asn1(data, sig)\n else\n false\n end\n end",
"title": ""
},
{
"docid": "deab196fb014473342c6e534d1fe7ffb",
"score": "0.68064016",
"text": "def valid?(signature, payload)\n @key.verify(@digest, signature, payload)\n rescue OpenSSL::PKey::PKeyError # happens in jruby if the signature is invalid\n false\n end",
"title": ""
},
{
"docid": "c81f22babc23f978e5899ce1899d46c4",
"score": "0.6803634",
"text": "def verify(bytes, signature, signer_public_key)\n signer = Crypto::Native::VirgilSigner.new\n signer.verify(bytes, signature, signer_public_key.value)\n end",
"title": ""
},
{
"docid": "c81f22babc23f978e5899ce1899d46c4",
"score": "0.6803634",
"text": "def verify(bytes, signature, signer_public_key)\n signer = Crypto::Native::VirgilSigner.new\n signer.verify(bytes, signature, signer_public_key.value)\n end",
"title": ""
},
{
"docid": "53d51ba46d3e6d17448077f3d76bb2c9",
"score": "0.6788088",
"text": "def valid_signature?(data)\n ok_sig = false\n\n unless @verify_sigs_with.empty?\n encryptor.verify(data) { |sig| ok_sig = @verify_sigs_with.map(&:fingerprint).include?(sig.key.fingerprint) }\n end\n\n ok_sig\n end",
"title": ""
},
{
"docid": "6748e35ae36a4eecaf150d8ecb2f1aed",
"score": "0.6773666",
"text": "def matches_signature(signature)\n @signature == signature\n end",
"title": ""
},
{
"docid": "c86a66f20b246fae66cbe76fa438ccb1",
"score": "0.6744418",
"text": "def verify_token_signature(signature, token_bytes, public_key)\n @virgil_crypto.verify_signature(signature, token_bytes, public_key)\n end",
"title": ""
},
{
"docid": "c1d4405c19affd2bc03fa067bccfa02d",
"score": "0.6743514",
"text": "def valid_signature?(data,algorithm,signature)\n # we only know how to deal with the SHA256 algorithm:\n # http://techdocs.spid.no/endpoints/#signed-responses\n if algorithm == 'HMAC-SHA256'\n expected_signature = OpenSSL::HMAC.digest('sha256', ENV['PCONF_SPID_CLIENT_SIG_SECRET'], data)\n else\n LOG.error message: \"unknown signature algorithm: #{algorithm}\"\n return false\n end\n\n return false if expected_signature != Base64.decode64(signature)\n true\n end",
"title": ""
},
{
"docid": "e19f12129d22c0f5e30b66c2cfea0cb5",
"score": "0.6728472",
"text": "def check_signature(data)\n #return Base64.decode64(data[\"params\"][\"signature\"])\n #return signature = sign(self.method, self.uuid, JSON[data.to_json.to_s])\n #return serialize_data(JSON[data[\"params\"][\"data\"].to_json.to_s])\n #return {m: data[\"method\"], uuid: data[\"params\"][\"uuid\"], data: JSON[data[\"params\"][\"data\"].to_json.to_s], s: data[\"params\"][\"signature\"]}\n #return data[\"params\"][\"signature\"] \n \n #return verify(data[\"method\"], data[\"params\"][\"uuid\"], JSON[data[\"params\"][\"data\"].to_json.to_s], data[\"params\"][\"signature\"])\n\n if !verify(data[\"method\"], data[\"params\"][\"uuid\"], JSON[data[\"params\"][\"data\"].to_json.to_s], data[\"params\"][\"signature\"])\n raise SecurityException\n end\n\n return true\n\n end",
"title": ""
},
{
"docid": "dd8a67632c756a233e01b2f33509ee82",
"score": "0.6712738",
"text": "def verify_signature(params, given_signature)\n given_signature == signature_from(params)\n end",
"title": ""
},
{
"docid": "3d3af7e1fb699019548aaf8a32ff69c6",
"score": "0.6710166",
"text": "def verified_for_key?(public_key)\n signature = Base64.urlsafe_decode64(self.magic_sig.sig)\n signed_data = self.magic_sig.signable_string# Base64.urlsafe_decode64(self.magic_sig.signable_string)\n\n public_key.verify(OpenSSL::Digest::SHA256.new, signature, signed_data )\n end",
"title": ""
},
{
"docid": "5407509df9bbe9d6f6a553aa6601a3e5",
"score": "0.6642771",
"text": "def valid?(signature, payload)\n hash = @digest.digest(payload)\n r, s = self.class.decode_jws_signature(signature)\n asn1_sig = self.class.encode_asn1_signature(r, s)\n @key.dsa_verify_asn1(hash, asn1_sig)\n end",
"title": ""
},
{
"docid": "463ee53887e9f3998cdc2cd29d1802fe",
"score": "0.66404474",
"text": "def verify_signature(signature, expected_signature)\n return if Castle::Utils::SecureCompare.call(signature, expected_signature)\n\n raise Castle::WebhookVerificationError, 'Signature not matching the expected signature'\n end",
"title": ""
},
{
"docid": "a3475dbfeda80164fccbfa521a018913",
"score": "0.6632977",
"text": "def verify_signature\n @spki.verify(public_key)\n end",
"title": ""
},
{
"docid": "7c0100714db8c13ff000a251f7fdbe4e",
"score": "0.66259706",
"text": "def verify(cert_text, signature, message)\n cert = OpenSSL::X509::Certificate.new(cert_text)\n pubkey = cert.public_key\n ret = pubkey.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), message)\n return false unless ret\n ret = cert.verify(cacert.public_key)\n return ret ? cert : false\n end",
"title": ""
},
{
"docid": "672ef1416169c055d9b733838135db34",
"score": "0.6615683",
"text": "def verify_stream(input_stream, signature, signer_public_key)\n signer = Crypto::Native::VirgilStreamSigner.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n signer.verify(source, signature, signer_public_key.value)\n end",
"title": ""
},
{
"docid": "672ef1416169c055d9b733838135db34",
"score": "0.6615683",
"text": "def verify_stream(input_stream, signature, signer_public_key)\n signer = Crypto::Native::VirgilStreamSigner.new\n source = Crypto::VirgilStreamDataSource.new(input_stream)\n signer.verify(source, signature, signer_public_key.value)\n end",
"title": ""
},
{
"docid": "a6ad584f8b3f53f29e551e2a40ba05de",
"score": "0.652731",
"text": "def verify(signature, message, public_key)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "a664d9c711e31d79d9220ef46d42e693",
"score": "0.64650047",
"text": "def check_signature(params, signature)\n str = params.sort.reduce(\"\") do | memo, v |\n memo << v\n end\n Digest::SHA1.hexdigest(str).eql? signature\n end",
"title": ""
},
{
"docid": "ab73a4f94f4fc5a768397c53a1631753",
"score": "0.6461128",
"text": "def verify(sig, data, algo: :ecdsa)\n return false unless valid_pubkey?\n begin\n case algo\n when :ecdsa\n sig = ecdsa_signature_parse_der_lax(sig)\n secp256k1_module.verify_sig(data, sig, pubkey)\n when :schnorr\n secp256k1_module.verify_sig(data, sig, xonly_pubkey, algo: :schnorr)\n else\n false\n end\n rescue Exception\n false\n end\n end",
"title": ""
},
{
"docid": "738787ebab2fb0f1fb65bc01384b0820",
"score": "0.64405924",
"text": "def confirm_signature(timestamp, msg_signature)\n generate_signature(timestamp)[:signature] == msg_signature\n end",
"title": ""
},
{
"docid": "46acee40eea7d288b8e6b07c16a59e45",
"score": "0.6419967",
"text": "def signature_valid?(params)\n params = params.clone\n signature = params.delete(:signature)\n return false unless signature\n Utils.secure_compare(sign_params(params)[:signature], signature)\n end",
"title": ""
},
{
"docid": "05beaf9a312df5337174dbaad2611312",
"score": "0.64189523",
"text": "def ssh_do_verify(sig, data, options = {})\n digester =\n if options[:host_key] == \"rsa-sha2-512\"\n OpenSSL::Digest::SHA512.new\n elsif options[:host_key] == \"rsa-sha2-256\"\n OpenSSL::Digest::SHA256.new\n else\n OpenSSL::Digest::SHA1.new\n end\n\n verify(digester, sig, data)\n end",
"title": ""
},
{
"docid": "2e45875890cdfb853f830bca76e258fd",
"score": "0.6410035",
"text": "def kinda_valid?(signature, msg)\n if signature > n\n return false\n # Definitely too big\n end\n decoded = \"000\" + signature.powmod(e, n).to_s(16)\n return false unless decoded.size.even?\n decoded = decoded.from_hex.bytes\n return false unless decoded.shift == 0\n return false unless decoded.shift == 1\n decoded.shift while decoded[0] == 255\n return false unless decoded.shift == 0\n hash = Digest::SHA1.hexdigest(msg)\n hash == decoded.pack(\"C*\").to_hex[0,40]\n end",
"title": ""
},
{
"docid": "e253e7fd543268fade62ba463f7e03a2",
"score": "0.63873416",
"text": "def sig_verified?\n checksums = File.open(checksums_file_path, 'r')\n io = File.open(sigfile_path, 'rb')\n crypto = GPGME::Crypto.new\n signature = GPGME::Data.new(io)\n crypto.verify(signature, signed_text: checksums) do |sig|\n return sig.valid? &&\n !(sig.expired_signature? || sig.expired_key? ||\n sig.revoked_key? || sig.bad? || sig.no_key?)\n end\n false\n end",
"title": ""
},
{
"docid": "e45d111a3d105f98e84698afa4ce2779",
"score": "0.63712525",
"text": "def verify(signature, message)\n @context.verify(signature, message, public_key)\n end",
"title": ""
},
{
"docid": "7ae3369ae0f8eb28dea56dcdea966400",
"score": "0.63703907",
"text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), settings.github_secret, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend",
"title": ""
},
{
"docid": "51124475634a40a7efd635a0cac45980",
"score": "0.636308",
"text": "def valid_signature?(header_signature)\n return !header_signature.nil? && header_signature.strip == signature.strip\n end",
"title": ""
},
{
"docid": "be3aaac2872cd5e444bfb81c6989b651",
"score": "0.63619775",
"text": "def valid_signature?(header_signature)\n return !header_signature.nil? && header_signature.strip == signature.strip\n end",
"title": ""
},
{
"docid": "0d7207924e400e3749c81ae2570b7e11",
"score": "0.6347811",
"text": "def valid_signature?(notification)\n \n string =\n notification[:vps_transaction_id].to_s +\n notification[:vendor_transaction_code].to_s +\n notification[:status].to_s +\n notification[:transaction_auth_no].to_s +\n SagePay::Config.vendor_name.to_s +\n notification[:avs_cv2_result].to_s +\n self.security_key.to_s + \n notification[:address_result].to_s +\n notification[:post_code_result].to_s +\n notification[:cv2_result].to_s +\n notification[:gift_aid].to_s +\n notification[:status_3d_secure].to_s +\n notification[:cavv].to_s +\n notification[:address_status].to_s +\n notification[:payer_status].to_s +\n notification[:card_type].to_s +\n notification[:last_4_digits] .to_s \n\n #Digest::MD5.hexdigest(string) == notification[:vps_signature]\n true\n end",
"title": ""
},
{
"docid": "c7aa4c2da75321d4ef17306194ae04ca",
"score": "0.6347343",
"text": "def verify!\n age = Time.now - timestamp\n raise Error.new(\"timestamp is in the future\", self) if age < 0\n raise Error.new(\"timestamp is too old\", self) if age > MAXIMUM_ALLOWED_AGE\n if signature_version != '1'\n raise Error.new(\"unknown signature version: #{signature_version}\", self)\n end\n if signing_cert_url !~ %r[^https://.*amazonaws\\.com/]\n raise Error.new(\"signing certificate is not from amazonaws.com\", self)\n end\n text = string_to_sign # will warn of invalid Type\n cert = CertificateCache.instance.get_certificate(signing_cert_url)\n digest = OpenSSL::Digest::SHA1.new\n unless cert.public_key.verify(digest, signature, text)\n raise Error.new(\"message signature is invalid\", self)\n end\n end",
"title": ""
},
{
"docid": "b163c897543ff4d9ea1eb01df6dddf8b",
"score": "0.6341576",
"text": "def verify(signed_message)\n verified(signed_message) || raise(InvalidSignature)\n end",
"title": ""
},
{
"docid": "b163c897543ff4d9ea1eb01df6dddf8b",
"score": "0.63414353",
"text": "def verify(signed_message)\n verified(signed_message) || raise(InvalidSignature)\n end",
"title": ""
},
{
"docid": "73ddc5f7514d9971e9a1306970809bc4",
"score": "0.63355213",
"text": "def verify(signed_payload, client_secret)\n message_parts = signed_payload.split('.')\n\n encoded_json_payload = message_parts[0]\n encoded_hmac_signature = message_parts[1]\n\n payload_object = Base64.decode64(encoded_json_payload)\n provided_signature = Base64.decode64(encoded_hmac_signature)\n\n expected_signature = sign(client_secret, payload_object)\n\n return false unless secure_compare(expected_signature, provided_signature)\n\n payload_object\nend",
"title": ""
},
{
"docid": "d09c7381ce85d407d9fdece5d2ae6391",
"score": "0.6319283",
"text": "def verify\n ca_key.verify(signed_data, signature)\n end",
"title": ""
},
{
"docid": "45b7f3a1be825615c4a5f358887a6726",
"score": "0.629174",
"text": "def check_signature?(check_signature)\n check_signature == signature\n end",
"title": ""
},
{
"docid": "e71f666febd836406b21d002e300264e",
"score": "0.62875646",
"text": "def verify_message(address, signature, message, prefix: Bitcoin.chain_params.message_magic)\n validate_address!(address)\n sig = Base64.decode64(signature)\n raise ArgumentError, 'Invalid signature length' unless sig.bytesize == Bitcoin::Key::COMPACT_SIGNATURE_SIZE\n digest = message_hash(message, prefix: prefix)\n pubkey = Bitcoin::Key.recover_compact(digest, sig)\n return false unless pubkey\n pubkey.to_p2pkh == address\n end",
"title": ""
},
{
"docid": "4695eb576a55884a284e72d89d192051",
"score": "0.6272927",
"text": "def verify_signature\n @req.verify(public_key)\n end",
"title": ""
},
{
"docid": "121cb1e471d7a1c8d029c567ab8da4c4",
"score": "0.6257302",
"text": "def verify_signature( dh, data, result ) #:nodoc:\n response = build_signature_buffer( dh, data, result )\n\n hash = @digester.digest( response.to_s )\n\n unless result[:server_key].ssh_do_verify(\n result[:server_sig], hash )\n raise Net::SSH::Exception, \"could not verify server signature\"\n end\n\n return hash\n end",
"title": ""
},
{
"docid": "db5e5c8aca026c31036e317a10dd6e1e",
"score": "0.6256909",
"text": "def verify_message(address, signature, message, prefix: Bitcoin.chain_params.message_magic)\n validate_address!(address)\n begin\n sig = Base64.strict_decode64(signature)\n rescue ArgumentError\n raise ArgumentError, 'Invalid signature'\n end\n begin\n # Legacy verification\n pubkey = Bitcoin::Key.recover_compact(message_hash(message, prefix: prefix, legacy: true), sig)\n return false unless pubkey\n pubkey.to_p2pkh == address\n rescue ArgumentError\n # BIP322 verification\n tx = to_sign_tx(message_hash(message, prefix: prefix, legacy: false), address)\n tx.in[0].script_witness = Bitcoin::ScriptWitness.parse_from_payload(sig)\n script_pubkey = Bitcoin::Script.parse_from_addr(address)\n tx_out = Bitcoin::TxOut.new(script_pubkey: script_pubkey)\n interpreter = Bitcoin::ScriptInterpreter.new(checker: Bitcoin::TxChecker.new(tx: tx, input_index: 0, prevouts: [tx_out]))\n interpreter.verify_script(Bitcoin::Script.new, script_pubkey, tx.in[0].script_witness)\n end\n end",
"title": ""
},
{
"docid": "38c203a5c2ba1c72e6591d18332e413b",
"score": "0.6243129",
"text": "def valid_signature?\n Rack::Utils.secure_compare(signature, signature_for(body))\n end",
"title": ""
},
{
"docid": "38c203a5c2ba1c72e6591d18332e413b",
"score": "0.6243129",
"text": "def valid_signature?\n Rack::Utils.secure_compare(signature, signature_for(body))\n end",
"title": ""
},
{
"docid": "e1b33c4c96dcf50fab3f42fcdbd19866",
"score": "0.62157035",
"text": "def verify_signature!\n signature_invalid! unless signature_valid?\n end",
"title": ""
},
{
"docid": "4d5907972b951d935280dd9f8f63b0db",
"score": "0.620996",
"text": "def valid_signature?(signature, timestamp, nonce)\n token = Config.token\n\n local_signature = generate_signature(token,timestamp,nonce)\n local_signature.eql? signature\n end",
"title": ""
},
{
"docid": "dbd162af1ef7c45b0b3386cd0255605b",
"score": "0.62088215",
"text": "def verified? key\n # RSA encryption is needed to compare the signatures\n\n # Get signature to check\n emsa = self.signature key.public_key.modulus.size\n\n # Get signature in payload\n emsa_signature = key.encrypt(@signature)\n\n # RSA gem drops leading 0s since it does math upon an Integer\n # As a workaround, I check for what I expect the second byte to be (\\x01)\n # This workaround will also handle seeing a \\x00 first if the RSA gem is\n # fixed.\n if emsa_signature.getbyte(0) == 1\n emsa_signature = \"\\x00#{emsa_signature}\"\n end\n\n # Does the signature match?\n # Return the result.\n emsa_signature == emsa\n end",
"title": ""
},
{
"docid": "f37557e7ff0d7198d7b9364edf468a62",
"score": "0.62038904",
"text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"title": ""
},
{
"docid": "f37557e7ff0d7198d7b9364edf468a62",
"score": "0.62038904",
"text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"title": ""
},
{
"docid": "f37557e7ff0d7198d7b9364edf468a62",
"score": "0.62038904",
"text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"title": ""
},
{
"docid": "f37557e7ff0d7198d7b9364edf468a62",
"score": "0.6203147",
"text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"title": ""
},
{
"docid": "52e33a114f690bdbbcb501b5e5a50096",
"score": "0.62022567",
"text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"title": ""
},
{
"docid": "52e33a114f690bdbbcb501b5e5a50096",
"score": "0.62017834",
"text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"title": ""
},
{
"docid": "0feb50d634c80704e369e8b9b8e08573",
"score": "0.6181924",
"text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend",
"title": ""
},
{
"docid": "9de75fe36a1dd5db1bdf2c0f1f9453ed",
"score": "0.6173918",
"text": "def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body)\n return halt 401, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend",
"title": ""
},
{
"docid": "cb51ec873f622056683869457d5c2a4d",
"score": "0.61735785",
"text": "def verify\n raise MissingPublicKeyError unless public_key\n\n public_key.verify(jws_signing_input, signature)\n end",
"title": ""
},
{
"docid": "883dc2726c0da4bf1e7e1083b4823d3b",
"score": "0.61700547",
"text": "def valid?(signature, payload)\n Sandal::Util.jwt_strings_equal?(sign(payload), signature)\n end",
"title": ""
},
{
"docid": "1b478d91336c9766bca03e5252095258",
"score": "0.6161459",
"text": "def op_checksig(stack, script, code_separator, transaction)\n pubkey = stack.pop\n sig = stack.pop\n \n hash_type = sig[-1].unpack('C')[0]\n signature = sig[0..-2]\n \n if is_canonical_pubkey?(pubkey) and is_canonical_signature?(signature)\n stack = check_sig(signature, hash_type, pubkey, script, code_separator, transaction)\n return stack.push(0.to_openssl_bn) if !stack\n stack.push(1.to_openssl_bn)\n else\n stack.push(0.to_openssl_bn)\n end\n stack\n end",
"title": ""
},
{
"docid": "8ab5d4935187bdbbadeea959a4a561e0",
"score": "0.6140704",
"text": "def validate(params, secret_key, sign_options = {})\n signature = params.delete('signature') || params.delete(:signature)\n\n return false unless signature\n\n strip_keys_from!(params, *strip_params)\n actual_signature = sign(params, secret_key, sign_options)\n actual_signature == signature\n end",
"title": ""
},
{
"docid": "8c8461ad6dcc4abcb310d0266ccb89f3",
"score": "0.6127048",
"text": "def compare_signature(booking_ref, signature)\n secret = \"mcgeesium602bb8d4ac3f53ce22c269\"\n hashed_booking = Digest::MD5.hexdigest(secret + booking_ref)\n hashed_booking == signature ? true : false\n end",
"title": ""
},
{
"docid": "b91ac25a3b530586e047ef2cfcdfef00",
"score": "0.61264217",
"text": "def signatures_trustworthy?\n cmd = 'sudo -u root -i gpg2 --verify ' \\\n \"#{sigfile_path} #{checksums_file_path}\"\n gpg_verify = Mixlib::ShellOut.new(cmd)\n gpg_verify.run_command\n gpg_verify.exitstatus.zero?\n end",
"title": ""
},
{
"docid": "e34d91189a3ef1a09fb5904eb441aa62",
"score": "0.61117446",
"text": "def verify_telesign_callback_signature(api_key, signature, json_str)\n\n digest = OpenSSL::Digest.new('sha256')\n key = Base64.decode64(api_key)\n\n your_signature = Base64.encode64(OpenSSL::HMAC.digest(digest, key, json_str)).strip\n\n unless signature.length == your_signature.length\n return false\n end\n\n # avoid timing attack with constant time equality check\n signatures_equal = true\n signature.split('').zip(your_signature.split('')).each do |x, y|\n unless x == y\n signatures_equal = false\n end\n end\n\n signatures_equal\n end",
"title": ""
},
{
"docid": "53889dc5c97e9271ce5981b2d67bfdeb",
"score": "0.61103606",
"text": "def main(timestamp, pubkey, signature)\n header = Blockchain.get_header Blockchain.get_height\n return false if timestamp > Header.get_timestamp(header)\n verify_signature signature, pubkey\nend",
"title": ""
},
{
"docid": "d036546d0dfbfcb1f692ad1020165a2e",
"score": "0.6097227",
"text": "def verify(message, sign, public_key)\n e = message % @q\n if e == 0\n e = 1\n end\n nu = public_key.reverse(e, @q)\n z1 = (sign[1] * nu) % @q\n z2 = (-sign[0] * nu) % @q\n c_point = @point * z1 + public_key * z2\n r = c_point.x % @q\n if r == sign[0]\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "0d85f37effb7ceccd8f7b00a1d53d647",
"score": "0.6095068",
"text": "def verify_script(signature_script: nil, output_script: nil)\n\n @stack = []\n @altstack = []\n\n if flag?(SCRIPT_VERIFY_SIGPUSHONLY) && !signature_script.data_only?\n return set_error(SCRIPT_ERR_SIG_PUSHONLY)\n end\n\n if extension = extension_to_handle_scripts(signature_script, output_script)\n return extension.handle_scripts(\n interpreter: self,\n signature_script: signature_script,\n output_script: output_script\n ) && verify_clean_stack_if_needed\n end\n\n if !run_script(signature_script)\n # error is set in run_script\n return false\n end\n\n if !did_execute_signature_script(signature_script)\n # error is set already\n return false\n end\n\n # This is implemented in P2SHExtension\n # stack_copy = if flag?(SCRIPT_VERIFY_P2SH)\n # @stack.dup\n # end\n\n if extension = extension_to_handle_output_script(output_script)\n return extension.handle_output_script(\n interpreter: self,\n output_script: output_script\n ) && verify_clean_stack_if_needed\n end\n\n if !run_script(output_script)\n # error is set in run_script\n return false\n end\n\n if @stack.empty?\n return set_error(SCRIPT_ERR_EVAL_FALSE)\n end\n\n if cast_to_bool(@stack.last) == false\n return set_error(SCRIPT_ERR_EVAL_FALSE)\n end\n\n if !did_execute_output_script(output_script)\n # error is set already\n return false\n end\n\n # Additional validation for pay-to-script-hash (P2SH) transactions:\n # See P2SHExtension#did_execute_output_script.\n\n return verify_clean_stack_if_needed\n end",
"title": ""
},
{
"docid": "206588c342c5c13f7eb0558f35883f8b",
"score": "0.6090297",
"text": "def check_message_signature(message)\n message_sig = message.get_arg(OPENID_NS, 'sig')\n if message_sig.nil?\n raise StandardError, \"#{message} has no sig.\"\n end\n calculated_sig = get_message_signature(message)\n return calculated_sig == message_sig\n end",
"title": ""
},
{
"docid": "f6e0f3f98d73497db14c5a09df2ef800",
"score": "0.6087367",
"text": "def verify_signature\n if @local_path\n if RUBY_PLATFORM =~ /java/\n begin\n jarfile = java.util.jar.JarInputStream.new(FileInputStream.new(@local_path), true)\n @signature_verified = true\n rescue NativeException\n @signature_verified = false\n end\n else\n # Use IO.popen instead of system() to absorb\n # jarsigners messages to $stdout\n response = IO.popen(\"jarsigner -verify #{@local_path}\"){|io| io.gets}\n @signature_verified = ($?.exitstatus == 0)\n end\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "0a77c1300007ab6904cec8d6cf28aab3",
"score": "0.60858124",
"text": "def signature_is_valid?\n node = @response.at_css('xmlns|SignedInfo',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#')\n\n node = node.canonicalize(\n mode=Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0,\n inclusive_namespaces=nil,with_comments=false\n )\n\n signature = @response.at_css(\n 'xmlns|SignatureValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content\n\n signature = Base64.decode64(signature)\n\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"title": ""
},
{
"docid": "a513f4bca31d310c144776e9ea441562",
"score": "0.60777956",
"text": "def valid_signature?\n signature == request_signature\n end",
"title": ""
},
{
"docid": "1000f6fee2c102078062bbd33b817409",
"score": "0.60570896",
"text": "def valid_message?(signed_message)\n return if signed_message.nil? || !signed_message.valid_encoding? || signed_message.blank?\n data, digest = signed_message.split(\"--\".freeze)\n data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data))\n end",
"title": ""
},
{
"docid": "3ac1eef033a9dcf979be1676e6e860f5",
"score": "0.60493124",
"text": "def valid_message?(signed_message)\n return if signed_message.blank?\n\n data, digest = signed_message.split(\"--\")\n data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data))\n end",
"title": ""
},
{
"docid": "0b60ce0d3eb2209045bbb00bc05e51fe",
"score": "0.603673",
"text": "def valid?(signature, payload)\n signature.nil? || signature.empty?\n end",
"title": ""
},
{
"docid": "015ffcb16236dd971852bb1826834764",
"score": "0.6035796",
"text": "def check_signature(request, consumer, token, signature)\n build_signature(request, consumer, token) == signature\n end",
"title": ""
},
{
"docid": "38ac4a4d71c109a8f391e6241b453c43",
"score": "0.60337985",
"text": "def verify_signed_request(data, encoded_sig, payload)\n unless data[\"algorithm\"].upcase == \"HMAC-SHA256\"\n raise \"Unknown algorithm. Expected HMAC-SHA256.\"\n end\n\n secret = Constants::FB_APP_SECRET\n actual_signature = base64_url_decode(encoded_sig)\n expected_signature = Digest::HMAC.digest(payload, secret, Digest::SHA256)\n unless actual_signature == expected_signature\n logger.info \"expected_sig: #{expected_signature}\"\n logger.info \" sig: #{actual_signature}\"\n logger.info \" data: #{data.inspect}\"\n raise \"Bad signed JSON signature.\"\n end\n end",
"title": ""
},
{
"docid": "679e3ee01731c6d587cc68f88b23473a",
"score": "0.6029117",
"text": "def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, LINE_CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"title": ""
},
{
"docid": "b48d25fa333a92a48fe5788d2bfc36dc",
"score": "0.60286224",
"text": "def check_login_locally(signed_data, signature)\n if check_signature(signed_data, signature)\n login_info = JSON.parse(::Tozny::Core.base64url_decode(signed_data))\n return false if login_info[:expires_at] < Time.now.to_i\n login_info\n else\n false\n end\n end",
"title": ""
},
{
"docid": "d12a1a5c5e1de32c60b3c2005afe16f6",
"score": "0.60137427",
"text": "def is_valid_gigya_signature\n if !params[:signature].blank? && !params[:timestamp].blank? && !params[:UID].blank?\n gigya_signature = params[:signature]\n base_string = params[:timestamp]+\"_\"+params[:UID]\n key = ApplicationConfig['gigya']['secret']\n digest = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Base64.decode64(key), base_string)\n if gigya_signature != Base64.encode64(digest).chomp\n return false\n end\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "82ba5f7b9ae44706995a001a3736c02a",
"score": "0.6006854",
"text": "def check_sign_verify_rsa\n text = \"Hello World\"\n\n privkey = OpenSSL::PKey::RSA.new(File.read(\"test-keys/rsa\"))\n\n signature = privkey.sign(OpenSSL::Digest::SHA1.new, text)\n pubkey = SSHPubKeyConvert.convert(File.read(\"test-keys/rsa.pub\"))\n system(\"/bin/echo -n \\\"#{text}\\\" | openssl dgst -sha1 -sign test-keys/rsa > test-keys/rsa.text.sig\")\n cmdline_signature = File.read(\"test-keys/rsa.text.sig\")\n\n v1 = privkey.public_key.verify(OpenSSL::Digest::SHA1.new, signature, text)\n v2 = pubkey.verify(OpenSSL::Digest::SHA1.new, signature, text)\n v3 = pubkey.verify(OpenSSL::Digest::SHA1.new, cmdline_signature, text)\n\n puts \"Verifying privkey->pubkey #{v1}\"\n puts \"Verifying privkey->sshpubkey #{v2}\"\n puts \"Verifying cmdline->sshpubkey #{v3}\"\n end",
"title": ""
},
{
"docid": "aa88f97f924f6b091a1df0988d8ed231",
"score": "0.5983721",
"text": "def valid?\n return false unless given_signature\n #unescape both sides. now it will work even if the given_signature is escaped\n Relax::Query.unescape_value(correct_signature) == Relax::Query.unescape_value(given_signature)\n end",
"title": ""
},
{
"docid": "e210f02262f3fa4c817f35f07bd32dae",
"score": "0.59785694",
"text": "def verified? key\n # RSA encryption is needed to compare the signatures\n # Create the public key from the key\n\n # Retrieve the exponent and modulus from the key string\n key.match /^RSA\\.(.*?)\\.(.*)$/\n modulus = Base64::urlsafe_decode64($1)\n exponent = Base64::urlsafe_decode64($2)\n\n modulus_byte_length = modulus.bytes.count\n modulus = modulus.bytes.inject(0) {|num, byte| (num << 8) | byte }\n exponent = exponent.bytes.inject(0) { |num, byte| (num << 8) | byte }\n\n # Create the public key instance\n key = RSA::Key.new(modulus, exponent)\n keypair = RSA::KeyPair.new(nil, key)\n\n # Get signature to check\n emsa = self.signature modulus_byte_length\n\n # Get signature in payload\n emsa_signature = keypair.encrypt(@signature)\n\n # RSA gem drops leading 0s since it does math upon an Integer\n # As a workaround, I check for what I expect the second byte to be (\\x01)\n # This workaround will also handle seeing a \\x00 first if the RSA gem is\n # fixed.\n if emsa_signature.getbyte(0) == 1\n emsa_signature = \"\\x00#{emsa_signature}\"\n end\n\n # Does the signature match?\n # Return the result.\n emsa_signature == emsa\n end",
"title": ""
},
{
"docid": "e01afef4a18a8489a497531cb456de42",
"score": "0.59776706",
"text": "def verify_player(player_id, bundle_id, public_key_url, signature, salt, timestamp)\n unless verify_public_key_url public_key_url\n logger.debug { \"public key url invalid: #{public_key_url}\" }\n return false\n end\n\n cert = get_public_key_certificate public_key_url\n unless cert\n logger.debug { \"could not get certificate from: #{public_key_url}\" }\n return false\n end\n if @@verify_issuer_certificate && !verify_public_key_certificate(cert)\n logger.debug { \"failed verification of public key certificate from: #{public_key_url}\" }\n return false\n end\n\n salt_decoded = @@base64_decode_salt ? Base64.decode64(salt) : salt\n payload = \"#{player_id}#{bundle_id}#{[timestamp.to_i].pack('Q>')}#{salt_decoded}\"\n signature_decoded = @@base64_decode_signature ? Base64.decode64(signature) : signature\n unless verify_signature cert, signature_decoded, payload\n logger.debug { \"failed signature validation for player id #{player_id}, bundle id #{bundle_id}, timestamp #{timestamp}, salt #{salt} (decode: #{@@base64_decode_salt}), signature #{signature} (decode: #{@@base64_decode_signature}) with certificate from: #{public_key_url}\" }\n return false\n end\n\n true\n end",
"title": ""
}
] |
aa5103c7cbabf143e5715edad86f1ec3
|
Public: Used to read a data_set. data_set The data_set instance to be read. by An ordered array of variable names that define a bygroup (default: []) Examples Example goes here Returns nothing.
|
[
{
"docid": "e6b2904b5e1c170af1493d79e9bec52c",
"score": "0.7779131",
"text": "def read(data_set, by: [])\n RemiLog.sys.debug \"Reading Dataset **#{data_set.name}**\"\n\n data_set.open_for_read(by_groups: Array(by))\n\n begin\n while !data_set.last_row\n data_set.read_row\n yield data_set\n end\n ensure\n data_set.close\n end\n end",
"title": ""
}
] |
[
{
"docid": "5ba1a171732ef6dd5a509e33b4fe9c5c",
"score": "0.5818392",
"text": "def read_data_set_metadata\n metadata = @interface.read_metadata\n @variable_set = metadata[:variable_set]\n end",
"title": ""
},
{
"docid": "667b71eff0fa0ce4ddd1c0f1a0967069",
"score": "0.5568219",
"text": "def get_data_set(data_set_id)\n _get(\"/d2l/api/lp/#{$lp_ver}/dataExport/list/#{data_set_id}\")\n # returns a DataSetData JSON block\nend",
"title": ""
},
{
"docid": "4d80bbeb0d96249576d0a1f11e1c488a",
"score": "0.5502001",
"text": "def interleave(*data_sets, by: [])\n by_groups = Array(by)\n\n by_group_values = lambda { |ds| by_groups == [] ? [0] : by_groups.map { |key| ds[key] } }\n\n\n # Create a basic dataset to hold a row for the result of the interleave\n worklib = DataLib.new(:basic)\n\n data_sets.each do |ds|\n ds.open_for_read(by_groups: by_groups)\n end\n\n # Create variables needed to hold the result of the interleave\n dsi = worklib.build(:dsi)\n dsi.define_variables do\n data_sets.each do |ds|\n var :__ORIGIN_NAME__\n var :__ORIGIN_ID__\n like ds\n end\n end\n dsi.open_for_read\n\n # Array to help figure out which data set to read from next\n next_data_set = []\n data_sets.each do |ds|\n ds.read_row\n next_data_set << [ds, by_group_values.call(ds)]\n end\n\n while next_data_set.size != 0 do\n\n # Determine the next data set to read\n next_data_set.sort! do |a,b|\n result = nil\n a[1].zip(b[1]).each do |va, vb|\n result = (va <=> vb)\n break unless result == 0\n end\n result\n end\n\n\n # Read the next data set until the end of the by group\n ds = next_data_set.shift[0]\n first_read = true\n loop do\n ds.read_row unless first_read\n first_read = false\n\n dsi.read_row\n dsi[:__ORIGIN_NAME__] = ds.name\n dsi[:__ORIGIN_ID__] = ds.object_id\n dsi[] = ds\n\n yield dsi\n\n break if ds.last || ds.last_row\n end\n\n # Read the next row of the data set just read to determine which set to read next\n unless ds.last_row\n ds.read_row\n next_data_set << [ds, by_group_values.call(ds)]\n end\n end\n\n ensure\n data_sets.each do |ds|\n ds.close\n end\n end",
"title": ""
},
{
"docid": "ec5a7a48b12973e0a184da4c6e1e07f8",
"score": "0.5463678",
"text": "def data_set\n @data_set\n end",
"title": ""
},
{
"docid": "dc434da7372307935c5465a3edd180d3",
"score": "0.54581165",
"text": "def group\n @data_hash[\"group_by\"].each_index do |index|\n if @data_hash[\"group_by\"][index].length > 0\n inner_index = 0;array = []\n begin \n array[inner_index] = @new_parameters[index].index(@data_hash[\"group_by\"][index][inner_index]);inner_index +=1\n end while inner_index < (@data_hash[\"group_by\"][index].length)\n grouping = GroupingEngine.new(@data[index]);@data[index] = grouping.group_by(array)\n end\n end \n end",
"title": ""
},
{
"docid": "7de3a4492b9d10d78a2b6a87968ccb1a",
"score": "0.537081",
"text": "def read_group domain, fields, groupby, offset = 0, limit = nil, order = nil\n call! :read_group, domain, fields, groupby, offset, limit, order\n end",
"title": ""
},
{
"docid": "39e86ce6089039de8b27d5d5e3169d0f",
"score": "0.53696674",
"text": "def set_data_set\n @data_set = DataSet.find(params[:id])\n end",
"title": ""
},
{
"docid": "eccb6a3b852a5bdff4ac8d7c9bba6cbb",
"score": "0.5352276",
"text": "def initialize(data_set)\n @data_set = data_set\n end",
"title": ""
},
{
"docid": "ca6a76ee82da01ab2eb6901f824f7494",
"score": "0.5309956",
"text": "def read(query, set, arr = true)\n options = extract_options(query.conditions)\n \n repository_name = query.repository.name\n properties = query.fields\n \n # begin\n complete_form( options )\n results_page = submit_form\n results = parse_results( results_page, query )\n # rescue\n # raise \"Couldn't retrieve the data\"\n # end\n results.each do |values|\n # values = result_values(result, properties, repository_name)\n # This is the core logic that handles the difference between all/first\n arr ? set.load(values) : (break set.load(values, query))\n end if results\n \n end",
"title": ""
},
{
"docid": "dd5c6aa0885a4985bdc9c304787f0a0e",
"score": "0.52969253",
"text": "def get_data_set(data_set_uid)\n # checks if all required parameters are set\n \n raise ArgumentError, 'Missing required parameter \"data_set_uid\"' if data_set_uid.nil?\n \n\n op = NovacastSDK::Client::Operation.new '/data_sets/{data_set_uid}', :GET\n\n # path parameters\n path_params = {}\n path_params['data_set_uid'] = data_set_uid\n op.params = path_params\n\n # header parameters\n header_params = {}\n op.headers = header_params\n\n # query parameters\n query_params = {}\n op.query = query_params\n\n # http body (model)\n \n\n \n # authentication requirement\n op.auths = [\n { name: 'accessKey', key: 'access_token', in_query: true }\n ]\n \n\n resp = call_api op\n\n \n NovacastSDK::EventV1::Models::DataSet.from_json resp.body\n \n end",
"title": ""
},
{
"docid": "985f13cb72e5b51c014c16f16b1540bc",
"score": "0.5185346",
"text": "def sort(set_name, sort_key, start, stop, fields=[])\n things_to_get = fields.inject(\"\") { |s, x|\n \"#{s} get #{set_name}:*:#{x}\"}\n out = cmd \"sort #{set_name} by #{set_name}:*:#{sort_key} limit #{start} #{stop} #{things_to_get}\"\n if fields.length > 1:\n chunks(out, fields.length)\n else\n out \n end\n end",
"title": ""
},
{
"docid": "bed8c6b748976aa94c0f6b40fc60e3bf",
"score": "0.5185052",
"text": "def get_data(dimension, xaxis, op, desired_xlabels, caxis, desired_clabels, laxis, lop, desired_llabels)\n op = \"mean\" if op.nil?\n lop = \"mean\" if lop.nil?\n\n if !dimension.include? \"|\"\n dimension += \"|\" + dimension\n end\n dataset, dim = dimension.split \"|\"\n\n # pull whats needed from dw\n meta = get_metadata(dataset)\n xaxis = meta['default'] if xaxis.nil?\n xlabels = getcol \"#{dataset}|#{xaxis}\"\n raise \"xaxis dimension not found\" if xlabels.empty?\n\n if !caxis.nil?\n clabels = getcol \"#{dataset}|#{caxis}\"\n raise \"caxis dimension not found\" if clabels.empty?\n else\n clabels = [nil]\n end\n\n if !laxis.nil?\n llabels = getcol \"#{dataset}|#{laxis}\"\n raise \"laxis dimension not found\" if llabels.empty?\n end\n\n data = getcol dimension\n\n # select desired labels\n ii=0\n while ii < xlabels.length\n if (desired_xlabels != nil and !desired_xlabels.include? xlabels[ii]) or\n (desired_clabels != nil and !desired_clabels.include? clabels[ii]) or\n (desired_llabels != nil and !desired_llabels.include? llabels[ii])\n xlabels.delete_at(ii)\n clabels.delete_at(ii) if clabels != nil\n llabels.delete_at(ii) if llabels != nil\n data.delete_at(ii)\n else\n ii += 1\n end\n end\n \n full_xlabels = xlabels\n full_llabels = llabels\n full_data = data\n\n ret_xlabels = []\n ret_clabels = clabels.uniq.sort\n ret_llabels = []\n ret_data = []\n ret_clabels.each_with_index do |clabel, cindx|\n xlabels = full_xlabels\n data = full_data\n llabels = full_llabels\n\n # aggregate by xlabels\n agg = {}\n xlabels.each_with_index do |row, ii|\n next if clabel != nil and clabels[ii] != clabel\n agg[row] = [[]] if !agg.key? row\n agg[row][0] << data[ii]\n if laxis != nil\n agg[row][1] = [] if agg[row].length == 1\n agg[row][1] << llabels[ii]\n end\n end\n agg.each { |row, vals| agg[row][0] = self.send(op, vals[0]) }\n if laxis != nil\n agg.each { |row, vals| agg[row][1] = self.send(lop, vals[1]) }\n end\n\n # clear labels and data to fill with sorted, aggregated values\n xlabels = []\n data = []\n llabels = []\n agg.sort.each { |row|\n xlabels << row[0]\n data << row[1][0]\n llabels << row[1][1] if laxis != nil\n }\n ret_xlabels << xlabels\n ret_clabels = nil if caxis == nil\n ret_data << data\n if laxis == nil\n ret_llabels = nil\n else\n ret_llabels << llabels\n end\n end\n\n #puts ret_xlabels.inspect\n #puts ret_data.inspect\n #puts ret_clabels.inspect\n #puts ret_llabels.inspect\n\n # build return value\n { \"dimension\" => dimension,\n \"xaxis\" => xaxis,\n \"xaxislabels\" => ret_xlabels,\n \"caxis\" => caxis,\n \"caxislabels\" => ret_clabels,\n \"laxis\" => laxis,\n \"laxislabels\" => ret_llabels,\n \"data\" => ret_data }\n end",
"title": ""
},
{
"docid": "d9150d8f5302d6a5d5d22e32408f55d8",
"score": "0.5153484",
"text": "def get_data(set, type, from, to)\n # First split up the date range into 1 year intervals.\n splits = [from]\n next_date = from + 365.days\n while next_date < to\n splits << next_date\n next_date = next_date + 365.days\n end\n splits << to\n # Then get data for each interval.\n all_results = []\n from_part = splits[0]\n splits[1..-1].each do |to_part|\n start_date = Ncdc::Client.strftime(from_part)\n end_date = Ncdc::Client.strftime(to_part - 1)\n params = {'stationid' => id, 'datatypeid' => type}\n all_results += @client.get_data(set, start_date, end_date, params)\n from_part = to_part\n end\n # Return the full list of results.\n all_results\n end",
"title": ""
},
{
"docid": "e85793cd3b2bf0a1d046fd15b1d38d46",
"score": "0.5114414",
"text": "def ordered_groups\n output = Array.new\n set_group = proc{|title, fields|\n output.push({title: title, fields: fields})\n }\n return nil unless @control\n if @control[:um]\n set_group.call(\"Unique Mandatory\", @structured_data.dig(:unique, :mandatory))\n end\n if @control.dig(:rm, 0)\n set_group.call(\"Repeated Mandatory (Leg 1)\", @structured_data.dig(:repeated, 0, :mandatory))\n end\n if @control[:uc]\n set_group.call(\"Unique Conditional\", @structured_data.dig(:unique, :conditional))\n end\n if @control.dig(:rc, 0)\n set_group.call(\"Repeated Conditional (Leg 1)\", @structured_data.dig(:repeated, 0, :conditional))\n end\n if @control.dig(:ra, 0)\n set_group.call(\"Repeated Airline Use (Leg 1)\", @structured_data.dig(:repeated, 0, :airline))\n end\n if @control[:legs] && @control[:legs] > 1\n (1..@control[:legs]-1).each do |leg|\n if @control.dig(:rm, leg)\n set_group.call(\"Repeated Mandatory (Leg #{leg+1})\", @structured_data.dig(:repeated, leg, :mandatory))\n end\n if @control.dig(:rc, leg)\n set_group.call(\"Repeated Conditional (Leg #{leg+1})\", @structured_data.dig(:repeated, leg, :conditional))\n end\n if @control.dig(:ra, leg)\n set_group.call(\"Repeated Airline Use (Leg #{leg+1})\", @structured_data.dig(:repeated, leg, :airline))\n end\n end\n end\n if @control[:security]\n set_group.call(\"Security\", @structured_data.dig(:unique, :security))\n end\n if @control[:unknown]\n set_group.call(\"Unknown\", @structured_data[:unknown])\n end\n \n # Check that raw data presence and order in output matches raw input\n if output.map{|g| g[:fields].map{|k,v| v[:raw]}}.join == @raw_data\n return output\n else\n raw_output = Array.new\n raw_output.push({title: \"Raw Data\", fields: {0 => {description: \"Raw\", raw: @raw_data, interpretation: \"Something went wrong and we couldn’t parse this data.\"}}})\n return raw_output\n end\n end",
"title": ""
},
{
"docid": "6c233ed9b6f2618a126cfaf57ea34384",
"score": "0.510427",
"text": "def load_data(set, file)\n\t\tusers_hash = set[:users]\n\t\tmovies_hash = set[:movies]\n\t\tdata = open(file)\n\t\tdata.each_line do |line|\n\t\t\tprocess_line(line, users_hash, movies_hash)\n\t\tend\n\t\tdata.close\n\tend",
"title": ""
},
{
"docid": "9b89b54018000c309b042507352f5a78",
"score": "0.5085621",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetGroupResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "cac5350c7104c3bbf6d373cacbdc875e",
"score": "0.50528103",
"text": "def read_ip_set_with_http_info(ip_set_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiGroupingObjectsIpSetsApi.read_ip_set ...'\n end\n # verify the required parameter 'ip_set_id' is set\n if @api_client.config.client_side_validation && ip_set_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_set_id' when calling ManagementPlaneApiGroupingObjectsIpSetsApi.read_ip_set\"\n end\n # resource path\n local_var_path = '/ip-sets/{ip-set-id}'.sub('{' + 'ip-set-id' + '}', ip_set_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IPSet')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiGroupingObjectsIpSetsApi#read_ip_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "e5f410bb69f6efd6f9724f956bfbd259",
"score": "0.5008985",
"text": "def select_sample_taken_by(data_set)\n takens = data_set[Conservation::STATUS_GROUP.name]\n takens && takens.each_with_index do |by, index|\n add_button_locator = add_button_locator([fieldset(Conservation::ANALYSIS_GROUP.name)])\n taken_by_options_locator = input_options_locator([fieldset(Conservation::ANALYSIS_GROUP.name, index)], Conservation::SAMPLE_BY.name)\n wait_for_element_and_click add_button_locator unless index.zero?\n enter_auto_complete(taken_by_input_locator(index), taken_by_options_locator, by[Conservation::SAMPLE_BY.name], 'Local Persons')\n end\n end",
"title": ""
},
{
"docid": "285b957c22df5d2bd171a99d56d4273a",
"score": "0.49823993",
"text": "def getDataSet(fileInputPath)\n\ndataSet = []\n\nif File.exists?(fileInputPath)\n\n###\n# GET THE FILE CONTENT\n###\ndataContainer = File.open(fileInputPath, “r”)\n\n###\n# FOREACH LINE BREAK APART BY WHITESPACE\n# AND PLACE INTO ARRAY\n###\nflist = []\ndataContainer.readlines.each do |line|\n\nflist.push(line)\n\nend\n\nflist.each do |line|\n\nelements = line.split(” “)\n\nrow = Array.new()\n\nelements.each do |element|\n\nrow.push(element.to_i)\n\nif @globalHash[element.to_i] != nil\n@globalHash[element.to_i] = @globalHash[element.to_i]+1\nelse\n@globalHash[element.to_i] = 1\nend\n\nend\n\n###\n# ADD THE ROW AS AN ARRAY\n# TO THE DATA SET\n###\ndataSet.push(row)\n\nend\n\nelse\n\nputs “Error: File, “+fileInputPath+”, does not exist”\n\nend\n\nreturn dataSet\n\nend",
"title": ""
},
{
"docid": "883026b975fd84dbcd31e6dbb7579ab3",
"score": "0.4979249",
"text": "def get_all_data_sets\n _get(\"/d2l/api/lp/#{$lp_ver}/dataExport/list\")\n # returns a JSON array of DataSetData blocks\nend",
"title": ""
},
{
"docid": "2f29c047fabdf5e8705fac1014cf5b21",
"score": "0.49764675",
"text": "def test_create_group_by\n group = nil\n assembly = mock_assembly do\n group = group_by 'line' do\n first 'offset'\n end\n end\n\n assert_equal Java::CascadingPipe::GroupBy, group.class\n assert_equal Java::CascadingPipe::Every, assembly.tail_pipe.class\n assert assembly.tail_pipe.aggregator?\n assert_equal Java::CascadingOperationAggregator::First, assembly.tail_pipe.aggregator.class\n\n grouping_fields = group.key_selectors['test']\n assert_equal ['line'], grouping_fields.to_a\n\n assert_equal ['line', 'offset'], assembly.scope.values_fields.to_a\n assert_equal ['line', 'offset'], assembly.scope.grouping_fields.to_a\n\n assembly = mock_assembly do\n group = group_by 'offset' do\n first 'line'\n end\n end\n\n assert_equal Java::CascadingPipe::GroupBy, group.class\n assert_equal Java::CascadingPipe::Every, assembly.tail_pipe.class\n assert assembly.tail_pipe.aggregator?\n assert_equal Java::CascadingOperationAggregator::First, assembly.tail_pipe.aggregator.class\n\n grouping_fields = group.key_selectors['test']\n assert_equal ['offset'], grouping_fields.to_a\n\n assert_equal ['offset', 'line'], assembly.scope.values_fields.to_a\n assert_equal ['offset', 'line'], assembly.scope.grouping_fields.to_a\n end",
"title": ""
},
{
"docid": "e77e8e8301475a6ee8d5c589095958a4",
"score": "0.49751738",
"text": "def retrieve_variables\n case params[:sort]\n when \"name\"\n case params[:dir]\n when \"asc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :order => \"name asc\", :limit=>20, :offset=>params[:startIndex].to_i) \n when \"desc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :order => \"name desc\", :limit=>20, :offset=>params[:startIndex].to_i) \n end\n when \"description\"\n case params[:dir]\n when \"asc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :order => \"value asc\", :limit=>20, :offset=>params[:startIndex].to_i) \n when \"desc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :order => \"value desc\", :limit=>20, :offset=>params[:startIndex].to_i) \n end\n when \"category\"\n case params[:dir]\n when \"asc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :order => \"category asc\", :limit=>20, :offset=>params[:startIndex].to_i) \n when \"desc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :order => \"category desc\", :limit=>20, :offset=>params[:startIndex].to_i) \n end\n when \"dataset\"\n case params[:dir]\n when \"asc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :joins=>:dataset, :order => \"datasets.name asc\", :limit=>20, :offset=>params[:startIndex].to_i) \n when \"desc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :joins=>:dataset, :order => \"datasets.name desc\", :limit=>20, :offset=>params[:startIndex].to_i) \n end\n when \"survey\"\n case params[:dir]\n when \"asc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :joins=>{:dataset => :survey}, :order => \"surveys.title asc\", :limit=>20, :offset=>params[:startIndex].to_i) \n when \"desc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :joins=>{:dataset => :survey}, :order => \"surveys.title desc\", :limit=>20, :offset=>params[:startIndex].to_i) \n end\n when \"popularity\"\n case params[:dir]\n when \"asc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :joins=>{:dataset => :survey}, :order => \"surveys.title asc\", :limit=>20, :offset=>params[:startIndex].to_i) \n when \"desc\"\n @variables = Variable.all(:conditions=>{:dataset_id=>@survey.datasets}, :joins=>{:dataset => :survey}, :order => \"surveys.title desc\", :limit=>20, :offset=>params[:startIndex].to_i) \n end\n end\n variables_hash = {\"sort\" => \"#{params[:sort]}\", \"dir\" => \"#{params[:dir]}\", \"pageSize\" => 20, \"startIndex\" => params[:startIndex].to_i, \"recordsReturned\" => 20, \"totalRecords\"=>Variable.all(:conditions=>{:dataset_id=>@survey.datasets}).count, \"results\" => @variables.collect{|variable| {\"id\" => variable.id, \"name\"=> variable.name, \"description\"=>variable.value, \"dataset\"=>variable.dataset.name, \"dataset_id\"=>variable.dataset.id.to_s, \"survey\"=>variable.dataset.survey.title, \"survey_id\"=>variable.dataset.survey.id.to_s, \"year\" => variable.dataset.year, \"category\"=>variable.category, \"popularity\" => VariableList.all(:conditions=>\"variable_id=\" + variable.id.to_s).size}}}\n @variables_json = variables_hash.to_json\n puts @variables_json.to_s\n render :partial=>\"retrieve_variables\"\n end",
"title": ""
},
{
"docid": "0cdc3166449c872554db586664632f0c",
"score": "0.49751475",
"text": "def query_group_data(data)\n data.keys.drop(4)\n end",
"title": ""
},
{
"docid": "69f685fefb404865ccb465b82fd995ab",
"score": "0.49310905",
"text": "def set_data(set_num)\n set = SETS.select { |set| set[:setNumber] == set_num }[0]\n set.nil? ? nil : [\n set[:setNumber],\n set[:setName],\n set[:setLength]\n ]\n end",
"title": ""
},
{
"docid": "aa042559a5ef6e9f6d14873e2d492c19",
"score": "0.4905918",
"text": "def build_dynamic_sets (records)\n sets = []\n records.each do |record|\n # add record to the return array \n sets << OAI::Set.new(spec: get_string_from_hash(record, \"PID\"), name: get_string_from_hash(record, \"dc.title\"), description: get_string_from_hash(record, \"dc.description\"))\n end\n sets\n end",
"title": ""
},
{
"docid": "935f2e4c20e5b75dbff59eec684890c4",
"score": "0.4895429",
"text": "def view_data_set\n if @data_set.is_a? Hash\n puts \"Dataset: #{@data_set.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "051a7188a9f4102df7ab1f8e2659a377",
"score": "0.48936632",
"text": "def data_set(file_path = Rails.root.join('storage', 'data.json'))\n @data_set ||= JSON.parse(File.read(file_path))\n end",
"title": ""
},
{
"docid": "8174c3c9945b3976d7196d338e11572a",
"score": "0.48912466",
"text": "def group_by=(group_by)\n if !group_by.nil? && group_by.length > 3\n fail ArgumentError, 'invalid value for \"group_by\", number of items must be less than or equal to 3.'\n end\n @group_by = group_by\n end",
"title": ""
},
{
"docid": "8dad58b51104315dab81e123d8848672",
"score": "0.4879578",
"text": "def selective_data options={}\n data = nil\n\n unless options[:no_body]\n data = parsed_body options[:parser]\n end\n\n if options[:with_headers]\n data = [parsed_header(options[:with_headers]), data].compact\n end\n\n DataSet.new(data).modify options\n end",
"title": ""
},
{
"docid": "ab08c7e6c15dcd08343f191843ad79c4",
"score": "0.48660448",
"text": "def set_data(record_set)\n @data.clear\n if record_set.is_a? WIN32OLE\n record_set.movefirst unless record_set.bof\n until record_set.eof\n row = Array.new\n record_set.fields.each do |f|\n row << f.value\n end\n @data << row\n record_set.movenext\n end\n else\n @data = record_set\n end\n @data\n end",
"title": ""
},
{
"docid": "ec52bf90b87c7520bf485a55398a8542",
"score": "0.4863554",
"text": "def load_test_data\n ary = (<<END).split(\"\\n\")\ndn: dc=bayshorenetworks,dc=com\nobjectClass: dcObject\nobjectClass: organization\no: Bayshore Networks LLC\ndc: bayshorenetworks\n\ndn: cn=Manager,dc=bayshorenetworks,dc=com\nobjectClass: organizationalrole\ncn: Manager\n\ndn: ou=people,dc=bayshorenetworks,dc=com\nobjectClass: organizationalunit\nou: people\n\ndn: ou=privileges,dc=bayshorenetworks,dc=com\nobjectClass: organizationalunit\nou: privileges\n\ndn: ou=roles,dc=bayshorenetworks,dc=com\nobjectClass: organizationalunit\nou: roles\n\ndn: ou=office,dc=bayshorenetworks,dc=com\nobjectClass: organizationalunit\nou: office\n\ndn: mail=nogoodnik@steamheat.net,ou=people,dc=bayshorenetworks,dc=com\ncn: Bob Fosse\nmail: nogoodnik@steamheat.net\nsn: Fosse\nou: people\nobjectClass: top\nobjectClass: inetorgperson\nobjectClass: authorizedperson\nhasAccessRole: uniqueIdentifier=engineer,ou=roles\nhasAccessRole: uniqueIdentifier=ldapadmin,ou=roles\nhasAccessRole: uniqueIdentifier=ldapsuperadmin,ou=roles\nhasAccessRole: uniqueIdentifier=ogilvy_elephant_user,ou=roles\nhasAccessRole: uniqueIdentifier=ogilvy_eagle_user,ou=roles\nhasAccessRole: uniqueIdentifier=greenplug_user,ou=roles\nhasAccessRole: uniqueIdentifier=brandplace_logging_user,ou=roles\nhasAccessRole: uniqueIdentifier=brandplace_report_user,ou=roles\nhasAccessRole: uniqueIdentifier=workorder_user,ou=roles\nhasAccessRole: uniqueIdentifier=bayshore_eagle_user,ou=roles\nhasAccessRole: uniqueIdentifier=bayshore_eagle_superuser,ou=roles\nhasAccessRole: uniqueIdentifier=kledaras_user,ou=roles\n\ndn: mail=elephant@steamheat.net,ou=people,dc=bayshorenetworks,dc=com\ncn: Gwen Verdon\nmail: elephant@steamheat.net\nsn: Verdon\nou: people\nobjectClass: top\nobjectClass: inetorgperson\nobjectClass: authorizedperson\nhasAccessRole: uniqueIdentifier=brandplace_report_user,ou=roles\nhasAccessRole: uniqueIdentifier=engineer,ou=roles\nhasAccessRole: uniqueIdentifier=ogilvy_elephant_user,ou=roles\nhasAccessRole: uniqueIdentifier=ldapsuperadmin,ou=roles\nhasAccessRole: uniqueIdentifier=ldapadmin,ou=roles\n\ndn: uniqueIdentifier=engineering,ou=privileges,dc=bayshorenetworks,dc=com\nuniqueIdentifier: engineering\nou: privileges\nobjectClass: accessPrivilege\n\ndn: uniqueIdentifier=engineer,ou=roles,dc=bayshorenetworks,dc=com\nuniqueIdentifier: engineer\nou: roles\nobjectClass: accessRole\nhasAccessPrivilege: uniqueIdentifier=engineering,ou=privileges\n\ndn: uniqueIdentifier=ldapadmin,ou=roles,dc=bayshorenetworks,dc=com\nuniqueIdentifier: ldapadmin\nou: roles\nobjectClass: accessRole\n\ndn: uniqueIdentifier=ldapsuperadmin,ou=roles,dc=bayshorenetworks,dc=com\nuniqueIdentifier: ldapsuperadmin\nou: roles\nobjectClass: accessRole\n\ndn: mail=catperson@steamheat.net,ou=people,dc=bayshorenetworks,dc=com\ncn: Sid Sorokin\nmail: catperson@steamheat.net\nsn: Sorokin\nou: people\nobjectClass: top\nobjectClass: inetorgperson\nobjectClass: authorizedperson\nhasAccessRole: uniqueIdentifier=engineer,ou=roles\nhasAccessRole: uniqueIdentifier=ogilvy_elephant_user,ou=roles\nhasAccessRole: uniqueIdentifier=ldapsuperadmin,ou=roles\nhasAccessRole: uniqueIdentifier=ogilvy_eagle_user,ou=roles\nhasAccessRole: uniqueIdentifier=greenplug_user,ou=roles\nhasAccessRole: uniqueIdentifier=workorder_user,ou=roles\nEND\n hash = {}\n while (line = ary.shift) && line.chomp!\n if line =~ /^dn:[\\s]*/i\n dn = $'\n hash[dn] = {}\n while (attr = ary.shift) && attr.chomp! && attr =~ /^([\\w]+)[\\s]*:[\\s]*/\n hash[dn][$1.downcase] ||= []\n hash[dn][$1.downcase] << $'\n end\n end\n end\n hash\nend",
"title": ""
},
{
"docid": "6479bbba325fea2dd3b8682803b118e2",
"score": "0.48627713",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GroupsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "896e2e52ee4ae4598fdf247fcbbea1ae",
"score": "0.48589152",
"text": "def test_create_group_by_many_fields\n group = nil\n assembly = mock_assembly do\n group = group_by 'offset', 'line' do\n min 'offset' => 'min_offset'\n end\n end\n\n assert_equal Java::CascadingPipe::GroupBy, group.class\n assert_equal Java::CascadingPipe::Every, assembly.tail_pipe.class\n assert assembly.tail_pipe.aggregator?\n assert_equal Java::CascadingOperationAggregator::Min, assembly.tail_pipe.aggregator.class\n\n grouping_fields = group.key_selectors['test']\n assert_equal ['offset', 'line'], grouping_fields.to_a\n\n assert_equal ['offset', 'line', 'min_offset'], assembly.scope.values_fields.to_a\n assert_equal ['offset', 'line', 'min_offset'], assembly.scope.grouping_fields.to_a\n end",
"title": ""
},
{
"docid": "fcab58589e260cbd492822aae48684b7",
"score": "0.4856554",
"text": "def create_query_set(set_name , o = {} , &filter)\n qs = QuerySet.new( set_name , o)\n o[:offset] ||= $offset\n o[:file_topic] ||= $file_topic\n o[:topic_pattern] ||= $ptn_qry_title\n \n #Read topic file & generate query list\n # Hypen(\\-) is deleted from queries now\n topics = o[:adhoc_topic] || parse_topic_file(o[:file_topic], o[:topic_pattern]).find_all{|e| (block_given?)? filter.call(e) : true }\n \n if topics.size < 1 then err 'No query found!' ; return end\n\n offset = o[:offset] || 1 ; topics.each do |t|\n qs.add_query Query.new(offset , t)\n offset += 1\n end\n \n # Restrict query by qid (for cross-validation)\n qs.qrys = qs.qrys.each{|e| e.text = \"\" unless o[:range] === e.qid} if o[:range] && o[:range].class == Range\n qs.qrys = qs.qrys.each{|e| e.text = \"\" unless o[:range].include?(e.qid)} if o[:range] && o[:range].class == Array \n qs.qrys = qs.qrys.each{|e| e.text = \"\" if o[:ex_range] === e.qid} if o[:ex_range] && o[:ex_range].class == Range\n qs.qrys = qs.qrys.each{|e| e.text = \"\" if o[:ex_range].find_all{|r|r === e.qid}.size > 0} if o[:ex_range] && o[:ex_range].class == Array \n \n qs.build(o.merge(:filters=>o[:filters])) if !fcheck(set_name+'.qry') || $o[:redo] || o[:redo]\n qs.run(o) if !fcheck(set_name+'.res') || $o[:redo] || o[:redo]\n \n if !o[:skip_eval]\n o[:file_qrel] ||= $file_qrel\n qs.calc_stat(o[:file_qrel] , o)\n end\n \n if !o[:skip_result_set]\n #Add result set\n qs.set_result_set create_result_set(set_name+'.res' , set_name , o.\n merge(:engine=>qs.engine))#{|d| (o[:working_set])? o[:working_set].include?(d.did) : true }\n end\n qs\n end",
"title": ""
},
{
"docid": "d6390eee1cfeac15d4067dcd1a7cf3d1",
"score": "0.48530185",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShowGroupResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "d6390eee1cfeac15d4067dcd1a7cf3d1",
"score": "0.48530185",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShowGroupResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "162a487fa91ab4c3baaf205ced766172",
"score": "0.48496607",
"text": "def group_data\n Etc.group { |g| break g if g.name == group_name }\n end",
"title": ""
},
{
"docid": "4dba28645daa072f27257f7d9c43f725",
"score": "0.4829576",
"text": "def enter_loan_in_info_data(data_set)\n enter_loan_in_id_data data_set\n enter_lender_group data\n end",
"title": ""
},
{
"docid": "3335c34a1b520811165a232e1578e6a7",
"score": "0.48242584",
"text": "def data\n @tags = ActsAsTaggableOn::Tag.order(:name)\n @datasets = Dataset.order(:title)\n end",
"title": ""
},
{
"docid": "7357509bfe9a2084307e12f42a8ef973",
"score": "0.4822444",
"text": "def api_filter(params)\n # Initial preproccessing--convert symbols to keys, etc...\n params = API.preprocess params\n\n api_validate params\n \n dataset = self\n dataset = dataset.api_tags params\n dataset = dataset.api_include params\n dataset = dataset.api_serialize params\n dataset = dataset.api_sort params\n dataset = dataset.api_limit params\n dataset = dataset.api_offset params\n dataset = dataset.api_apply_filter params\n\n # Return dataset\n dataset\n end",
"title": ""
},
{
"docid": "a51c0ec1d51ef2714e72baefd45b79a0",
"score": "0.4810897",
"text": "def build_groups(attributes, data)\n group_array = []\n data['controls'].each do |control|\n group = HappyMapperTools::Benchmark::Group.new\n group.id = control['id']\n group.title = control['gtitle']\n group.description = \"<GroupDescription>#{control['gdescription']}</GroupDescription>\" if control['gdescription']\n\n group.rule = HappyMapperTools::Benchmark::Rule.new\n group.rule.id = control['rid']\n group.rule.severity = control['severity']\n group.rule.weight = control['rweight']\n group.rule.version = control['rversion']\n group.rule.title = control['title'].tr(\"\\n\", ' ') if control['title']\n group.rule.description = \"<VulnDiscussion>#{control['desc']}</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations>#{control['rationale']}</Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>\"\n\n if ['reference.dc.publisher', 'reference.dc.title', 'reference.dc.subject', 'reference.dc.type', 'reference.dc.identifier'].any? { |a| attributes.key?(a) }\n group.rule.reference = build_rule_reference(attributes)\n end\n\n group.rule.ident = build_rule_idents(control['cci']) if control['cci']\n group.rule.ident += build_rule_idents(control['legacy']) if control['legacy']\n\n group.rule.fixtext = HappyMapperTools::Benchmark::Fixtext.new\n group.rule.fixtext.fixref = control['fix_id']\n group.rule.fixtext.fixtext = control['fix']\n\n group.rule.fix = build_rule_fix(control['fix_id']) if control['fix_id']\n\n group.rule.check = HappyMapperTools::Benchmark::Check.new\n group.rule.check.system = control['checkref']\n\n # content_ref is optional for schema compliance\n if attributes['content_ref.name'] || attributes['content_ref.href']\n group.rule.check.content_ref = HappyMapperTools::Benchmark::ContentRef.new\n group.rule.check.content_ref.name = attributes['content_ref.name']\n group.rule.check.content_ref.href = attributes['content_ref.href']\n end\n\n group.rule.check.content = control['check']\n\n group_array << group\n end\n @benchmark.group = group_array\n end",
"title": ""
},
{
"docid": "d1a6d7f79cc191a8c28e80bc060c8be8",
"score": "0.47963974",
"text": "def index\n checked_data #to keep the checkboxes checked after submit\n # step 1: when arriving on dashboard, call filter_data (takes only data for specific user + looks if there is a selection done)\n filter_data\n # step 2: when filter_data is done, it goes to ungrouped_set (does computations for full set)\n ungrouped_set\n # step 3: when more than one selection, it calculates the subset\n subgroup_data\n # step 4: check if more than one selection\n # step 5: it takes all data\n ungrouped_set\n # step 6: split by group_by will feed array, and add keys\n @data_process = {}\n # step 7: iterate over filtered data, eg 2017, 2018\n @data_rows_grouped_year.each do |year, values|\n # step 7: for each eg year, create a hash and push it in data_process array\n @data_process[year] = create_grouped_hash_by_year({year => values})\n end\n end",
"title": ""
},
{
"docid": "4ae32b42608906d79cac158f03dfbd98",
"score": "0.47947338",
"text": "def groups\n data.keys\n end",
"title": ""
},
{
"docid": "220265c1b81d63499f02bd841ec4b237",
"score": "0.47933108",
"text": "def import(*sets); end",
"title": ""
},
{
"docid": "220265c1b81d63499f02bd841ec4b237",
"score": "0.47933108",
"text": "def import(*sets); end",
"title": ""
},
{
"docid": "97273683edfa119aecb4fb903a09a18a",
"score": "0.47921887",
"text": "def get_data(*args)\n params = args.first || {} # params are optional!\n\n sortp = params[\"sort\"]\n\n # Giant hack to fix property field used in sort. Not sure why\n # this is coming in camelized.\n if sortp.is_a?(Array)\n sortp.each { |h|\n h[\"property\"] = h[\"property\"].underscore if\n h.is_a?(Hash) && h[\"property\"]\n }\n end\n\n if !config[:prohibit_read]\n {}.tap do |res|\n # set children to an instance variable in order to access them later\n @records = get_children(params)\n\n # Serialize children\n res[:data] = serialize_data(@records)\n\n res[:total] = count_records(params) if\n config[:enable_pagination] &&\n (params[:node].nil? || params[:node] == 'root')\n end\n else\n flash :error => \"You don't have permissions to read data\"\n { :netzke_feedback => @flash }\n end\n end",
"title": ""
},
{
"docid": "35a79f8aba2ca91ff71d7e561a30c54c",
"score": "0.47860873",
"text": "def call data_set\n @fun ? self.send(@fun, data_set) : []\n end",
"title": ""
},
{
"docid": "c35e461d699b4817b560fc8f2f849d11",
"score": "0.47851712",
"text": "def parse_dataset format, raw, name\n begin\n case format\n when :csv\n CSV.parse(raw, :headers => true, :converters => :all).to_dataset.tap { |da| da.name = name }\n when :excel\n Statsample::Excel.parse(raw, :name => name)\n end\n rescue NameError => e\n STDERR.puts \"Unable to load statsample\"\n raise e\n rescue => e\n STDERR.puts e.inspect\n raise TypeError, \"Format was not as expected; dataset may have moved\"\n end\n end",
"title": ""
},
{
"docid": "b83fff07c7b5f72e7fda42510f927b5b",
"score": "0.47847018",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetAllGroupsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "1cd9f90d78101d237601bc564e71a413",
"score": "0.4777479",
"text": "def data_set\n \t (1..cvs).to_a\n \tend",
"title": ""
},
{
"docid": "97a002ff109c1d1c05c91e77da5ba7e7",
"score": "0.47703654",
"text": "def lemmata=(groups)\n if groups == :all\n @lemmata = GROUPS.dup\n else\n @lemmata = groups\n end\n @client.send(:retrieve_lemmata, flags_for(@lemmata))\n end",
"title": ""
},
{
"docid": "b4d88317019174d83d75deb8b104973b",
"score": "0.47658953",
"text": "def group_data\n return [] if complete_group_data.length == 1\n\n complete_group_data\n end",
"title": ""
},
{
"docid": "628c1dadaed89c96445864e3aee5de03",
"score": "0.4762755",
"text": "def manage_group_by_clause\n @group_by = @params[\"report\"][\"summarize_by\"] if @params[\"report\"] && @params[\"report\"][\"summarize_by\"] && GROUP_BY.include?(@params[\"report\"][\"summarize_by\"])\n end",
"title": ""
},
{
"docid": "a39dc04c9cd9698fcfc4570559b56a8a",
"score": "0.47597417",
"text": "def dataset\n name\nend",
"title": ""
},
{
"docid": "9ebe5c7a28fe6deed57abfa01c1e6212",
"score": "0.47576374",
"text": "def call\n data = {}\n SETS_DIR.glob(\"*.json\").each do |file|\n set_code = file.basename(\".json\").to_s\n data[set_code] = JSON.parse(file.read)\n end\n data = data.sort_by{|set_code, set| [set[\"releaseDate\"], set_code] }\n puts data.to_json\n end",
"title": ""
},
{
"docid": "8902f4912afe1c074bb78b88c56dc39b",
"score": "0.47498178",
"text": "def data_set=(data_set_ish)\n @data_set = data_set_ish.respond_to?(:data_set) && data_set_ish.data_set || data_set_ish\n end",
"title": ""
},
{
"docid": "aad9d75b18a89629e7ac0a2f05733cb9",
"score": "0.47354382",
"text": "def data_set_params\n params.require(:data_set).permit(:name, :production, :data_starts, :data_ends, :data_source_id,:sensitivity_id, data_archetype_ids: [] )\n end",
"title": ""
},
{
"docid": "9ef902df59129dadb026a5567e82b3cc",
"score": "0.47348773",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListGroupsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9ef902df59129dadb026a5567e82b3cc",
"score": "0.47348773",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListGroupsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "132444a19675ebcb6922c2953f2e800e",
"score": "0.472596",
"text": "def index\n @data_sets = DataSet.order(:name).all\n end",
"title": ""
},
{
"docid": "bb09f08ec0e39e4ededd89bdd140cdbc",
"score": "0.47210285",
"text": "def [](dataset_name, sequential = false)\r\n if sequential then SequentialDataset[self, dataset_name]\r\n else PartitionedDataset[self, dataset_name]\r\n end\r\n # And pray to your gods that the dataset exists and it is of the specified\r\n # type.\r\n end",
"title": ""
},
{
"docid": "f4815308ca6dd5a25487879105cc4606",
"score": "0.47136158",
"text": "def each_dataset(&blk)\n metadata[:datasets].each do |name|\n if blk.arity == 1\n blk.call(dataset(name))\n else\n blk.call(name, dataset(name))\n end\n end\n end",
"title": ""
},
{
"docid": "f4815308ca6dd5a25487879105cc4606",
"score": "0.47136158",
"text": "def each_dataset(&blk)\n metadata[:datasets].each do |name|\n if blk.arity == 1\n blk.call(dataset(name))\n else\n blk.call(name, dataset(name))\n end\n end\n end",
"title": ""
},
{
"docid": "91b4b8d989fb19ac1b4ab6971374d633",
"score": "0.4712719",
"text": "def setup_standard\n raise(ArgumentError, \"A list of values must be given\") unless(@group_values)\n @groups = TaliaCore::Source.groups_by_property(@group_property, @group_values, :limit => @group_increment.to_i)\n end",
"title": ""
},
{
"docid": "8f98484cfdc53d9c43a6be361c1f72e6",
"score": "0.47101924",
"text": "def find_data_set_col(data_set)\n unless @axis == :none\n case @axis\n when :row\n # Find the index of the row dimension that contains this column\n @data_set_col = data_set.row_dimensions.index do |dim|\n dim.upcase == @content.upcase\n end\n @dimension = data_set.row_dimensions[@data_set_col] if @data_set_col\n when :column\n # Find the index of the column containing this combination of column members\n content = [@content].flatten.map(&:upcase).sort\n col_headers = data_set.column_headers\n (0...(col_headers.first.size)).each do |col|\n col_mbrs = col_headers.map{ |row| row[col] && row[col].upcase }.sort\n if content == col_mbrs\n @data_set_col = col\n @dimension = data_set.column_dimensions\n break\n end\n end\n if @row_override_dim\n # Locate override dimension column\n @row_override_col = data_set.row_dimensions.index do |dim|\n dim.upcase == @row_override_dim.upcase\n end\n raise \"Cannot locate #{@row_override_dim} in rows of retrieval data set\" unless @row_override_col\n end\n end\n raise \"Cannot locate #{@content} in rows or columns of retrieval data set\" unless @data_set_col\n end\n end",
"title": ""
},
{
"docid": "8718633fb21367f9a47972c57dc9a1db",
"score": "0.47049743",
"text": "def raw_data\n Intake.group_by_data(start_date, end_date, group_by, user_id)\n end",
"title": ""
},
{
"docid": "9da88ad2661e6df497aa0b66a7e600ff",
"score": "0.46863192",
"text": "def group_by=(value)\n @group_by = value\n end",
"title": ""
},
{
"docid": "0f7274a9183e9fb64c0aff63ffcc63ed",
"score": "0.4681122",
"text": "def dataset\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "1824b0d73beea5e6fa0bfd0b8a82e86a",
"score": "0.46784228",
"text": "def set_set_list(yaml_file)\n\n\t\tlist = []\n\n\t\t# get yaml data\n \tYAML.load_file(yaml_file).each{ |i| list.push(Set.new(i))}\n\n\t\t# TODO - figure out how to do one distance the other way\n\t\t@set_list = list.sort_by { |a| \n\t\t\t[ a.total_distance, a.distance ] \n\t\t\t#[a[:gender], a[:name]] <=> [b[:gender], b[:name]]\n\t\t}\n\n\t\t#@set_list.each{ |l|\n\t\t#\tputs l.get_string\n\t\t#}\n\tend",
"title": ""
},
{
"docid": "4662150967b0c6e9afd467d4bbf3ee67",
"score": "0.4677469",
"text": "def _parse_sets doc\n regex = /^(.*?) \\((.*?)\\)$/\n sets_ary = []\n\n current = doc.css('div#ctl00_ctl00_ctl00_MainContent_SubContent_SubContent_setRow')./('img').first['title']\n current =~ regex\n sets_ary << [$1, $2]\n\n others = doc.css('div#ctl00_ctl00_ctl00_MainContent_SubContent_SubContent_otherSetsRow')./('img')\n others.each do |other|\n other['title'] =~ regex\n sets_ary << [$1, $2]\n end\n\n sets_ary\n end",
"title": ""
},
{
"docid": "34843c2c98f8d7154eeaaad9ef2be43b",
"score": "0.4676065",
"text": "def add(sectiondata)\n # Check if this is the first section data loaded\n if getSectionPrefix().eql?(\"na\")\n setSectionName(sectiondata.getSectionName());\n setSectionDescription(sectiondata.getSectionDescription());\n setSectionPrefix(sectiondata.getSectionPrefix());\n end\n \n if @dataset.nil?\n puts \"reportset_data::add - nil @dataset\"\n else\n puts \"reportset_data::add - ok @dataset\"\n end\n if sectiondata.nil?\n puts \"reportset_data::add - nil sectiondata\"\n else\n puts \"reportset_data::add - ok sectiondata\"\n end\n @dataset << sectiondata\n \n if sectiondata.getNumQuestions() > 0\n for idx in 0..sectiondata.getNumQuestions() - 1\n name = sectiondata.getQuestionName(idx)\n desc = sectiondata.getQuestionDesc(idx)\n if !@meta_names.include?(name)\n @meta_names << name\n @meta_descs << desc\n end\n \n qfrows = sectiondata.getQuestionRowNames(idx)\n if !qfrows.nil? && (qfrows.size() > 0)\n if @meta_rownames[idx.to_s].nil?\n @meta_rownames[idx.to_s] = qfrows\n else\n qfrows.each do |name|\n if !@meta_rownames[idx.to_s].include?(name)\n @meta_rownames[idx.to_s] << name\n end\n end\n end\n end\n \n qfcols = sectiondata.getQuestionColNames(idx)\n if !qfcols.nil? && (qfcols.size() > 0)\n if @meta_colnames[idx.to_s].nil?\n @meta_colnames[idx.to_s] = qfcols\n else\n qfcols.each do |name|\n if !@meta_colnames[idx.to_s].include?(name)\n @meta_colnames[idx.to_s] << name\n end\n end\n end\n end\n \n end\n end\n end",
"title": ""
},
{
"docid": "581f5db2c82219a6dbf50850f26f6c3c",
"score": "0.467288",
"text": "def get_project_data_set_data\n @data_set_data =\"\"\n @data_hash = Hash.new()\n sql =\"\"\n parent.managed_repository do\n @data_set_data = Voeis::DataSet.get(params[:data_set_id].to_i).data_values \n if params[:small_data] == 'true'\n if params[:variable_id]\n sql = \"SELECT local_date_time, data_value FROM voeis_data_values WHERE variable_id=#{params[:variable_id]} AND id IN ( #{@data_set_data.map{|k| k.id}.join(',')})\"\n else\n sql = \"SELECT local_date_time, data_value FROM voeis_data_values WHERE id IN ( #{@data_set_data.map{|k| k.id}.join(',')})\"\n end \n @data_hash[:data] = repository.adapter.select(sql)\n else\n @data_hash[:data] = @data_set_data\n end\n @data_hash[:data_set] = Voeis::DataSet.get(params[:data_set_id].to_i)\n end\n respond_to do |format|\n format_response(@data_hash, format)\n end\n end",
"title": ""
},
{
"docid": "8bc9ad9bc8359e15e05a44ff57cb4b46",
"score": "0.46628398",
"text": "def parse_to_sets(file_path,delimiter)\n \tfile = File.open(file_path, \"r\")\n file.each_line do |line|\n user_id = strip_data(line.split(delimiter).first)\n product_id = strip_data(line.split(delimiter).last)\n\n @file_data[user_id] = Set.new if !@file_data.has_key? user_id\n @file_data[user_id].add product_id\n end\n file.close\n @file_data\n end",
"title": ""
},
{
"docid": "619624d7654b731c36e081900402e7f4",
"score": "0.46626937",
"text": "def dataset( ds_name )\n data_service.dataset( ds_name.to_s )\n end",
"title": ""
},
{
"docid": "231e1f195dcefdf6cde83845c5a05256",
"score": "0.46601126",
"text": "def each_raw_explicit_package_set\n return enum_for(__method__) if !block_given?\n (data['package_sets'] || []).map do |spec|\n Autoproj.in_file(self.file) do\n yield(*PackageSet.resolve_definition(self, spec))\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "c3ef5df6b05e44a75973445c37a6e924",
"score": "0.4658112",
"text": "def read_data_set(file)\n raw_data = File.readlines(file)\n training_set = []\n raw_data.each do |x|\n training_set << x.split(/\\s+/).each{|word| word.chomp!; word.downcase!}\n end\n return training_set\nend",
"title": ""
},
{
"docid": "53f0acae19286922856325143228cce0",
"score": "0.4646445",
"text": "def dataset(**options)\n logger = options.fetch(:logger, ::Logger.new(false))\n repo = settings.repository\n if %i(default-graph-uri named-graph-uri).any? {|k| options.key?(k)} \n default_datasets = Array(options[:\"default-graph-uri\"]).map {|u| RDF::URI(u)}\n named_datasets = Array(options[:\"named-graph-uri\"]).map {|u| RDF::URI(u)}\n\n (default_datasets + named_datasets).each do |uri|\n load_opts = {logger: logger, graph_name: uri, base_uri: uri}\n unless repo.has_graph?(uri)\n logger.debug(options) {\"=> load #{uri}\"}\n repo.load(uri.to_s, **load_opts)\n end\n end\n\n # Create an aggregate based on queryable having just the bits we want\n aggregate = RDF::AggregateRepo.new(repo)\n named_datasets.each {|name| aggregate.named(name) if repo.has_graph?(name)}\n aggregate.default(*default_datasets.select {|name| repo.has_graph?(name)})\n aggregate\n end || settings.repository\n end",
"title": ""
},
{
"docid": "9d685f553c01cb67ade5b531d0c34889",
"score": "0.46431428",
"text": "def setup_dataset(params)\n #labels need a min and max the year array and then to print out each one in the range...maybe?\n @dataset_array, @labels = ExtracatMetadata.get_values_by_docid(params[:docids])\n { labels: @labels, datasets: set_dataset_array(@labels) }\n end",
"title": ""
},
{
"docid": "5fcb3bdc749e7a75ad84624947ef85ec",
"score": "0.4640514",
"text": "def get_all(datakey = \"default\")\n if @data == UNSET_VALUE\n @logger.warn \"#get_all has been called before any data has been loaded.\"\n\n @data\n else\n @data[datakey]\n end\n end",
"title": ""
},
{
"docid": "c35273b9b2990cf2a41a64c763b32c80",
"score": "0.46359074",
"text": "def read_groups_string=(groups)\n self.read_groups=groups.split(/[\\s,]+/)\n end",
"title": ""
},
{
"docid": "6773d2a125a2a97ef5930efac99a2425",
"score": "0.46349302",
"text": "def dataset_xml( xml, dataset, args )\n xml.Dataset( :name => dataset.name, :interface => \"default\" ) {\n\n if args[:filters]\n args[:filters].each do |name,value|\n raise Biomart::ArgumentError, \"The filter '#{name}' does not exist\" if dataset.filters[name].nil?\n\n if dataset.filters[name].type == 'boolean'\n value = value.downcase if value.is_a? String\n if [true,'included','only'].include?(value)\n xml.Filter( :name => name, :excluded => '0' )\n elsif [false,'excluded'].include?(value)\n xml.Filter( :name => name, :excluded => '1' )\n else\n raise Biomart::ArgumentError, \"The boolean filter '#{name}' can only accept 'true/included/only' or 'false/excluded' arguments.\"\n end\n else\n value = value.join(\",\") if value.is_a? Array\n xml.Filter( :name => name, :value => value )\n end\n end\n else\n dataset.filters.each do |name,filter|\n if filter.default?\n if filter.type == 'boolean'\n xml.Filter( :name => name, :excluded => filter.default_value )\n else\n xml.Filter( :name => name, :value => filter.default_value )\n end\n end\n end\n end\n\n unless args[:count]\n if args[:attributes]\n args[:attributes].each do |name|\n xml.Attribute( :name => name )\n end\n else\n dataset.attributes.each do |name,attribute|\n if attribute.default?\n xml.Attribute( :name => name )\n end\n end\n end\n end\n\n }\n end",
"title": ""
},
{
"docid": "a4cdd87ccd5cba2570c706da4171cf69",
"score": "0.4625042",
"text": "def read_set(repository, query)\n properties = query.fields\n properties_with_indexes = Hash[*properties.zip((0...properties.size).to_a).flatten]\n\n set = LoadedSet.new(repository, query.resource, properties_with_indexes)\n \n sql = query_read_statement(query)\n \n begin\n connection = create_connection\n command = connection.create_command(sql)\n command.set_types(properties.map { |property| property.type })\n reader = command.execute_reader(query.parameters)\n \n while(reader.next!)\n set.materialize!(reader.values)\n end\n \n reader.close\n rescue StandardError => se\n p se, sql\n raise se\n ensure\n close_connection(connection)\n end\n \n set.entries\n end",
"title": ""
},
{
"docid": "b26a69e23066d86fe2d5706db3f85973",
"score": "0.4620102",
"text": "def to_data_array(data_set)\n case\n when data_set.is_a?(Daru::DataFrame)\n return ArgumentError unless data_set.index.is_a?(Daru::Index)\n\n rows = data_set.access_row_tuples_by_indexs(*data_set.index.to_a)\n convert_to_array_of_array(rows)\n when data_set.is_a?(Daru::Vector)\n rows = []\n data_set.to_a.each { |a| rows << [a] }\n rows\n when data_set.is_a?(Array)\n convert_to_array_of_array(data_set)\n else\n raise ArgumentError, 'Invalid Argument Passed!'\n end\n end",
"title": ""
},
{
"docid": "dfd6298dfc40b11b14ff94fb8fbb68c8",
"score": "0.4614104",
"text": "def full_data_set\n supplier_trait1\n supplier_trait2\n supplier_trait3_no_abn\n end",
"title": ""
},
{
"docid": "c5796c0a4a982e1818108678029b21cd",
"score": "0.46031302",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateGroupResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "c5796c0a4a982e1818108678029b21cd",
"score": "0.46031302",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateGroupResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "50edddca6b39b8323e2051789669d723",
"score": "0.4602529",
"text": "def write_report(data)\n\n groups = data.map { |d| d['group'] }.uniq.sort\n groups.each do |g|\n curr_group_data = data.select { |d| d['group'] == g }\n \n heading = g\n heading = \"<None>\" if heading == \"\"\n puts\n puts \"Group: #{heading}\"\n\n curr_group_data.map { |d| d['file'] }.uniq.sort.each do |f|\n puts \" File: #{f}\"\n curr_group_data.select { |d| d['file'] == f }.each do |d|\n puts \" #{d['line']}\"\n end\n end\n end\n \nend",
"title": ""
},
{
"docid": "53fbf09515c5220493d726ea77c29c35",
"score": "0.46021816",
"text": "def read_data (data_filename, samples_data_filename = \"\")\n data_string = File.open(data_filename).read.split(\"\\n\") # Divido el fichero en string de lineas\n food_array = []\n \n if (samples_data_filename != \"\")\n sample_people_hash = read_samples_data(samples_data_filename)\n end\n \n data_string.each { |data_line|\n data_line = data_line.split(\" \") # La divido en espacios\n name = \"\"\n \n while (data_line[0] != data_line[0].to_f.to_s) # Si el nombre no cambia al pasar de string afloat es que es un float\n name << data_line[0] << \" \"\n data_line = data_line[1..-1] # Quito el primer elemento\n end\n \n food_name = name[0..-2].capitalize\n protein = [data_line[0].to_f, PROTEIN_ENERGY]\n glucid = [data_line[1].to_f, GLUCID_ENERGY]\n lipid = [data_line[2].to_f, LIPID_ENERGY]\n \n data_line = data_line[3..-1] \n \n \n group_name = \"\"\n while (!data_line[0].nil?) # Si el nombre no cambia al pasar de string afloat es que es un float\n group_name << data_line[0] << \" \"\n data_line = data_line[1..-1] # Quito el primer elemento\n end\n \n if (samples_data_filename != \"\")\n food = Food.new(food_name, protein, glucid, lipid, group_name[0..-2], sample_people_hash[food_name])\n else\n food = Food.new(food_name, protein, glucid, lipid, group_name[0..-2])\n end\n \n food_array.push(food)\n }\n \n return food_array\n end",
"title": ""
},
{
"docid": "c992ab1c9be06f029fa8129bf442fdec",
"score": "0.45993638",
"text": "def groups\n data.groups\n end",
"title": ""
},
{
"docid": "2961580b353ea40eddec57c4083a333b",
"score": "0.45980668",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetDemographicsByTypeAndIDResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "daf30a3487f5e0b788b29ecccfeee285",
"score": "0.45927122",
"text": "def combine(name)\n\t#main function\n\tfile = File.new(name,\"r\")\n\n\t#first line is the number of data sets\n\tnumSets = readHeader(name)\n\tfile.gets.to_i #go past the header\n\tputs \"# of sets: #{numSets}\"\n\tcounter = 1\n\tnumSets.downto(1){ \n\t\t|n| \n\t\t\n\t\tprint \"DataSet \", counter\n\t\tnumColors = file.gets.to_i\n\t\tcolors = Array.new(numColors){Array.new(3){0}}\n\t\t0.upto(numColors-1){ |m|\n\t\t\tline = file.gets\n\t\t\tr,g,b = line.split(\" \")\n\t\t\thello = []\n\t\t\tcolors[m][0] = r.to_i\n\t\t\tcolors[m][1] = g.to_i\n\t\t\tcolors[m][2] = b.to_i\n\t\t}\n\t\t\n\t\t#print colors\n\t\tcurrent = makeSet(numColors,colors)\n\t\tanswer = compute(current)\n\t\tprint answer\n\t\tputs\n\t\tcounter += 1\n\t\t}\n\tfile.close()\nend",
"title": ""
},
{
"docid": "e94da6916019f4e91240de9d8c6f145a",
"score": "0.4590414",
"text": "def generate_filter_array_from_data_string(string_data)\n $log.trace(\"SearchFunctionsDSL: #{__method__}\")\n raise Exception.new('Generate filter data was called but no string data is not provided') if string_data == nil\n groups = []\n items = []\n\n string_data.split(\";\").each do |data_val|\n data_val.split(\":\").each_with_index do |f_val, f_i|\n (f_i == 0) ? groups << f_val : items << f_val.split(\",\")\n end\n end\n return groups, items\n end",
"title": ""
},
{
"docid": "e8ccccaf61db2038cfeed57b13b102de",
"score": "0.45873263",
"text": "def load_dataset\n \t\tfile_name = \"public\" + data.url.split(\"?\")[0]\n \t\tcase data_content_type\n \t\twhen FCT_CSV\n \t\t\t@dataset = Roo::CSV.new(file_name, csv_options: {col_sep: \";\"})\n \t\twhen FCT_XLS\n \t\t\t@dataset = Roo::Excel.new(file_name)\n \t\twhen FCT_XLSX\n \t\t\t@dataset = Roo::Excelx.new(file_name)\n \t\twhen FCT_ODS\n \t\t\t@dataset = Roo::OpenOffice.new(file_name)\n \t\tend\n \tend",
"title": ""
},
{
"docid": "7c4f587c1b2eee0588bcad4451b7c65a",
"score": "0.45870915",
"text": "def dataset_from(params)\n dataset_name = params[:dataset].to_sym unless params[:dataset].nil?\n dataset_name ||= nil\n Datasets::Base.dataset_from dataset_name\n end",
"title": ""
},
{
"docid": "8e7e64b0b28dd925324979a7ebe47acd",
"score": "0.45862982",
"text": "def get_sets user_id\n \n # Create an array for holding all the set's information\n sets = Array.new\n \n # Make call to the Flickr API\n sets_call = Curl::Easy.perform(\"http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=8242e922f3c5029f480fe8552f42b457&user_id=#{user_id}\")\n \n # Parse the response\n doc = Nokogiri::XML(sets_call.body_str)\n \n # Get the array of sets\n sets_xml = doc.css('rsp photosets')[0].css('photoset')\n \n # Loop through the results \n sets_xml.each do |set_xml|\n \n # Create hash of this set's data\n set = Hash[ \"id\" => set_xml['id'], \"title\" => set_xml.css('title')[0].content]\n\n # Add that hash to the photos array\n sets << set\n \n end\n \n # Return the sets\n return sets\n \n end",
"title": ""
},
{
"docid": "3e781d3570b4c1510383e1a3ba1bfd68",
"score": "0.45769042",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CouponGroupDataResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "57f194d0299e4c51547403562548f8fe",
"score": "0.45686403",
"text": "def import(dataset)\n meta = dataset[\"meta\"]\n data = dataset[\"data\"]\n \n # remove any traces of an existing dataset with the same name\n remove(meta[\"name\"], true)\n\n # set lookup key and metadata\n #puts \"Importing #{meta['name']}\"\n colnames = data.keys\n\n @search_dw.set to_r(meta[\"name\"]), meta.to_json\n meta[\"depvars\"].each do |nn|\n @search_dw.set to_r(meta[\"name\"] + \"|\" + nn), true\n end\n\n # set data\n for colname,coldata in data do\n for val in coldata do\n key = to_r(meta[\"name\"] + \"|\" + colname)\n @data_dw.rpush key, val\n end\n end\n true\n end",
"title": ""
},
{
"docid": "34f15f5a73f216a32c95e6c664949f2d",
"score": "0.4559548",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetMetadataResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "ad418bbadc02bd8275e20771bdbc31cf",
"score": "0.45559046",
"text": "def get_data_set(champ_name_id, current_version)\n @current_version = current_version\n @champ_name_id = champ_name_id\n \n url = \"http://ddragon.leagueoflegends.com/cdn/#{@current_version}/data/en_US/champion/#{@champ_name_id}.json\"\n response = HTTParty.get(url)\n @data = response.parsed_response\n end",
"title": ""
},
{
"docid": "fb3da906fdb6121aedc6fed67173acc9",
"score": "0.45537192",
"text": "def extract_data_from_param_set(label)\n param_set = LabelExtractor.extract_param_set(label)\n\n parsed = Parser.new.expr_place.parse(param_set)\n tail_offset = parsed[:tail] ? parsed[:tail].offset : label.size\n\n keys = []\n values = []\n\n found = find_all_by_tree_names(parsed, [:key, :value, :separator, :footer])\n found.each_with_index do |item, index|\n if index % 3 == 0\n keys << item.to_s\n end\n\n if index % 3 == 1\n offset = find_head_character_position(item)\n separator_offset = found[index + 1] ? found[index + 1].offset : tail_offset\n values << label[offset, separator_offset - offset]\n end\n end\n\n return Hash[keys.zip(values)]\n end",
"title": ""
}
] |
3258ae052a8f8af3812eb69eaf63e6de
|
def say_hi puts "hey! i was called for the beginning!!" end def say_bye puts "hey!! i was called when method exited" end def say_hellow puts "Hellow!!i need check for both begin and start" end def say_miaow puts "Miaow!! i need only beginning check" end before_filter :say_hi, :only => [:say_miaow, :say_hellow] after_filter :say_bye, :except => [:say_miaow] apply_filter end f = Filter.new f.say_hellow puts f.say_miaow
|
[
{
"docid": "29d07a419023bc9a12bed9c242f8d9d5",
"score": "0.0",
"text": "def greet\n puts \"in greet\"\n end",
"title": ""
}
] |
[
{
"docid": "dcc6749c2270ff875d24ec6eecdfc64f",
"score": "0.66198236",
"text": "def filter\n end",
"title": ""
},
{
"docid": "b1e457646e25a4598ee8139ce7517e71",
"score": "0.65859604",
"text": "def before_filter msg, session, &block\n index = 0\n\n next_p = Proc.new { |err, resp, args|\n if err || index >= @befores.length\n block_given? and yield err, resp, args\n return\n end\n\n handler = @befores[index]\n index += 1\n\n if handler.respond_to? :call\n handler.call msg, session, &next_p\n else\n next_p.call Exception.new 'invalid before filter'\n end\n }\n next_p.call\n end",
"title": ""
},
{
"docid": "1d43c43afb2f64a8dcb37f0a25248529",
"score": "0.6582638",
"text": "def before_perform(*filters, &blk); end",
"title": ""
},
{
"docid": "fee02c3d7f1248b80ed2d261b90b0040",
"score": "0.65392554",
"text": "def before filter\n @befores << filter\n end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.6532161",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.6532161",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.6532161",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.6532161",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.6532161",
"text": "def filter; end",
"title": ""
},
{
"docid": "60d748a318d87749f020b525b0d050cb",
"score": "0.650391",
"text": "def filter!; end",
"title": ""
},
{
"docid": "5192a9745cbeddb2ba2b8a1e88752dcc",
"score": "0.6463259",
"text": "def filter fiter_name, arg=nil\n return if @executed_filters[fiter_name]\n @executed_filters[fiter_name] = true\n\n Object.class_callback fiter_name, self, @controller_action\n end",
"title": ""
},
{
"docid": "ca0738b14101c2d459a2b987cdbf1641",
"score": "0.6419012",
"text": "def process_filter\n # TODO\n end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.6403618",
"text": "def filters; end",
"title": ""
},
{
"docid": "8f5d1894a8cf402b6602e9c192084755",
"score": "0.63801426",
"text": "def after_filters(filtered_args)\n end",
"title": ""
},
{
"docid": "6956141c2e9cd2c95bd9a9ab52b036df",
"score": "0.6362099",
"text": "def filter filter\n @befores << filter\n @afters << filter\n end",
"title": ""
},
{
"docid": "2a5dad9a547cde7d2b7137f7d3853592",
"score": "0.6348608",
"text": "def halted_callback_hook(filter)\n end",
"title": ""
},
{
"docid": "e42ac1fd9ee21a951294b68664ad9ff9",
"score": "0.6294459",
"text": "def test_method_filter__class_and_method_match\n composite_filter = Method_filter\n \n context = { :class_name => \"Hobo::Dryml\", :method_name => \"build_a\"}.context\n \n options = {:filters => composite_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"title": ""
},
{
"docid": "afbc23d963bc6d04bb2b8877f2c7b345",
"score": "0.6282191",
"text": "def call_before_filter_for(method_name)\n @@before_chain.filter_for(method_name).each do |method|\n self.send(method) \n end\n end",
"title": ""
},
{
"docid": "a82926943adb5e5e5df7385df937c4ea",
"score": "0.62798697",
"text": "def auto_filter; end",
"title": ""
},
{
"docid": "f57bc98e9345fdac48f8c81426caf3c9",
"score": "0.6272875",
"text": "def halted_callback_hook(filter, name); end",
"title": ""
},
{
"docid": "554f1ac1cea03e09d57a48efe1d19768",
"score": "0.6244183",
"text": "def halted_callback_hook(filter, _); end",
"title": ""
},
{
"docid": "b3468a7f6c1b6a95065392783aef7dcd",
"score": "0.6243155",
"text": "def post_filters; end",
"title": ""
},
{
"docid": "4087b6a41b936c81a3da596e44442616",
"score": "0.6231117",
"text": "def filtering; end",
"title": ""
},
{
"docid": "4f4754f1ab3b995cc590537879075363",
"score": "0.61703724",
"text": "def filter\n filter_disabled\n filter_repeated\n # filter_silenced\n filter_dependencies\n end",
"title": ""
},
{
"docid": "46c24c2be4ceca522d8026bb12bc7d33",
"score": "0.6139763",
"text": "def named_filter; end",
"title": ""
},
{
"docid": "45aab4b280c6339c0bb541629715f83b",
"score": "0.61337924",
"text": "def filter fiter_name, arg=nil\n Lux.current.once 'lux-controller-filter-%s-%s' % [self.class, fiter_name] do\n run_callback fiter_name, arg\n end\n end",
"title": ""
},
{
"docid": "a0834be700ad2ea9515109a53669ecca",
"score": "0.6131823",
"text": "def apply_filter(name,arg)\n\n return arg if not @code\n if @filters[name.to_sym] then\n @filters[name.to_sym].each do |callback|\n begin\n function_name = callback[:function]\n \n function = get_function_from(@code,function_name)\n \n if not function then\n log_action \"function #{callback[:function]} is not set.\"\n else\n arg = function.methodcall(function,arg)\n end\n \n rescue => e\n log_action \"When Applying Filter\" + e.inspect\n end\n end \n end\n return arg\n\n end",
"title": ""
},
{
"docid": "8c39c2759f1cc71dfaa8784076f81965",
"score": "0.61199445",
"text": "def test_module_filter__module_and_method_match\n _filter = Module_filter\n \n context = { :modules => [\"Hobo\"], :method_name => \"build_a\", :class_name => \"Dryml\" }.context\n \n options = {:filters => _filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"title": ""
},
{
"docid": "ac7ac13706d9c39052e77b10d35c06d1",
"score": "0.6104224",
"text": "def get_filter\n\n end",
"title": ""
},
{
"docid": "6d737e1aeb135a590643570e132e2b08",
"score": "0.6085385",
"text": "def filter_argument; end",
"title": ""
},
{
"docid": "16245956e5c32d671049ad65dcf85cd2",
"score": "0.60812026",
"text": "def halted_callback_hook(filter, name)\n end",
"title": ""
},
{
"docid": "ac0fa705ae76025cc41d3a01533cb63a",
"score": "0.606353",
"text": "def before_filter(&block)\n if block_given?\n @before_filter ||= Proc.new{|response| block.call response.env[:body] }\n else\n @before_filter ||= Proc.new{|response| response.env[:body] }\n end\n @before_filter\n end",
"title": ""
},
{
"docid": "eebcb330818104426150e5d08a824b73",
"score": "0.6030134",
"text": "def before_filters #:nodoc:\n filter_chain.select(&:before?).map(&:method)\n end",
"title": ""
},
{
"docid": "f5d372eabd0d5144de20507eaccc5919",
"score": "0.60284346",
"text": "def add_fake_filter exp\n unless @current_class\n Railroader.debug \"Skipping before_filter outside controller: #{exp}\"\n return exp\n end\n\n filter_name = (\"fake_filter\" + rand.to_s[/\\d+$/]).to_sym\n args = exp.block_call.arglist\n args.insert(1, Sexp.new(:lit, filter_name))\n before_filter_call = make_call(nil, :before_filter, args)\n\n if exp.block_args.length > 1\n block_variable = exp.block_args[1]\n else\n block_variable = :temp\n end\n\n if node_type? exp.block, :block\n block_inner = exp.block[1..-1]\n else\n block_inner = [exp.block]\n end\n\n # Build Sexp for filter method\n body = Sexp.new(:lasgn,\n block_variable,\n Sexp.new(:call, Sexp.new(:const, @current_class.name), :new))\n\n filter_method = Sexp.new(:defn, filter_name, Sexp.new(:args), body).concat(block_inner).line(exp.line)\n\n vis = @visibility\n @visibility = :private\n process_defn filter_method\n @visibility = vis\n process before_filter_call\n exp\n end",
"title": ""
},
{
"docid": "e88e9dd4a1ed6927e44b29a413674989",
"score": "0.6021417",
"text": "def filtering(*)\n end",
"title": ""
},
{
"docid": "84596219c105786b28cbeadf0891b1cf",
"score": "0.6020815",
"text": "def before_filters\n @before_filters\n end",
"title": ""
},
{
"docid": "1d2903c3867d2645d414c16d9b6ff12e",
"score": "0.6013295",
"text": "def before(&b)\n filter :before, &b\n end",
"title": ""
},
{
"docid": "57a91560b9467b4ec9fda09a76f18f6c",
"score": "0.5998487",
"text": "def process_iter exp\n if @current_method.nil? and call? exp.block_call\n block_call_name = exp.block_call.method\n\n if block_call_name == :before_filter or block_call_name == :before_action\n add_fake_filter exp\n else\n super\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "5a7ce324b9467d1e1508f4477cb646f5",
"score": "0.5996921",
"text": "def get_filter\n end",
"title": ""
},
{
"docid": "5a7ce324b9467d1e1508f4477cb646f5",
"score": "0.5996921",
"text": "def get_filter\n end",
"title": ""
},
{
"docid": "ba2531cf2d786d6be6d1830772e9ab36",
"score": "0.59888196",
"text": "def filter(name, &block)\n define_method(\"filter:#{name}\", &block)\n end",
"title": ""
},
{
"docid": "953d2a367141dae00515adcd76492a85",
"score": "0.59790117",
"text": "def after_filters\n @after_filters\n end",
"title": ""
},
{
"docid": "f816e0666f5cb39807214369a03264a6",
"score": "0.5946606",
"text": "def test_composite_module_filter__module_and_method_match\n composite_filter = Module_composite_filter_A\n \n context = {}\n context.set_context :modules => [\"Hobo\", \"Dryml\"], :method_name => \"build_a\" #, :class_name => \"Dryml\" \n \n options = {:filters => composite_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"title": ""
},
{
"docid": "b05c93372bd46c89038b7405e6d32852",
"score": "0.59457654",
"text": "def halted_callback_hook(filter, name = nil)\n @before_callback_halted = true\n end",
"title": ""
},
{
"docid": "88456beda2c2883f43be9e7ad5ffc1c3",
"score": "0.59431285",
"text": "def _filter_name\n respond_to?(:before_action) ? :before_action : :before_filter\n end",
"title": ""
},
{
"docid": "123009679a07df63ce1ca61090294fe9",
"score": "0.59411055",
"text": "def around_perform(*filters, &blk); end",
"title": ""
},
{
"docid": "dbf604514d20dc5238bb1afbb0bb4ffe",
"score": "0.59109503",
"text": "def prepare_example_filtering; end",
"title": ""
},
{
"docid": "9f458274972f2002a07a9749a5089f64",
"score": "0.5910526",
"text": "def before(filter, &block)\n raise \"Filter #{filter.inspect} not supported, available options are: :each, :all\" unless [:each, :all].include?(filter)\n filters[:before][filter] << block\n end",
"title": ""
},
{
"docid": "8c83c3e4dccbf1d8598fdfbba31acb5f",
"score": "0.590134",
"text": "def run_filters(rpc_method)\n run_rescue_filters do\n continue = run_unwrapped_filters(filters[:before], rpc_method, true)\n if continue\n run_around_filters(rpc_method)\n run_unwrapped_filters(filters[:after], rpc_method)\n end\n end\n end",
"title": ""
},
{
"docid": "b6d410b335feb12da25d08f2b5a40f96",
"score": "0.589772",
"text": "def announce_filters; end",
"title": ""
},
{
"docid": "90f6e7d5d3950255c64e027a8db94eeb",
"score": "0.58958805",
"text": "def call_after_filter_for(method_name)\n @@after_chain.filter_for(method_name).each do |method|\n self.send(method) \n end\n end",
"title": ""
},
{
"docid": "421e2bfbb0552463fad8580841840d82",
"score": "0.5888805",
"text": "def before_action #:doc:\n call_filters(self.class.before_filters)\n end",
"title": ""
},
{
"docid": "421e2bfbb0552463fad8580841840d82",
"score": "0.5888805",
"text": "def before_action #:doc:\n call_filters(self.class.before_filters)\n end",
"title": ""
},
{
"docid": "0b396cfb8cb99e38b051176b384608ce",
"score": "0.5887593",
"text": "def apply_filter(scope, value)\n #wip\n end",
"title": ""
},
{
"docid": "6ecfb9ccba5f6b6dc94fdd1491a58f59",
"score": "0.588757",
"text": "def before_filter(&block)\n @before_filter = block\n end",
"title": ""
},
{
"docid": "ce30b678d1ef191325ab8853632861b6",
"score": "0.5885178",
"text": "def filter\n raise NotImplementedError, 'This is an interface'\n end",
"title": ""
},
{
"docid": "f6d5115060b77dced65afd8283328598",
"score": "0.58806443",
"text": "def call_filters(filter_set)\n (filter_set || []).each do |(filter, rule)|\n ok = false\n if rule.has_key?(:only)\n if rule[:only].include?(params[:action].intern)\n ok = true\n end\n elsif rule.has_key?(:exclude)\n if !rule[:exclude].include?(params[:action].intern)\n ok = true\n end \n else\n ok = true\n end \n if ok\n case filter\n when Symbol, String\n send(filter)\n when Proc\n filter.call(self)\n end\n end \n end\n return :filter_chain_completed\n end",
"title": ""
},
{
"docid": "d699018ed6dada655297b9cd5e0cef73",
"score": "0.5873156",
"text": "def inclusion_filter; end",
"title": ""
},
{
"docid": "cc0d7d1c19e115beb8cc64d0648809af",
"score": "0.58720964",
"text": "def before_action_process(controller)\n filter_methods.each do |method_name, hash|\n before_method = hash[:before_action]\n next if before_method.blank?\n action = controller.action_name\n # before_method = before_method.to_s.gsub('[action]', action)\n before_method = :process_params_filters\n inst = hash[:instance]\n raise_error \"Module #{method_name.inspect} instance is blank.\" if inst.blank?\n raise_error \"Module #{method_name.inspect} does not respond to #{before_method.inspect}.\" unless inst.respond_to?(before_method)\n totem_debug_message \"before filter calling '#{method_name}##{before_method}'\" if debug?\n args = controller_args(controller)\n if has_filters?(args)\n inst.setup(args)\n inst.send before_method\n end\n end\n end",
"title": ""
},
{
"docid": "dfb3ac31c06bf02c783a8be44c97bdd0",
"score": "0.58704305",
"text": "def before_call; end",
"title": ""
},
{
"docid": "31b9e6a1f0da75b57ae9316cb2315175",
"score": "0.58700955",
"text": "def run_before_filters_with_response_for(*args)\n @running_before_filters = true\n run_before_filters_without_response_for(*args)\n ensure\n @running_before_filters = nil\n end",
"title": ""
},
{
"docid": "070724126c8013fc7041e3664521d204",
"score": "0.5863159",
"text": "def filter(*args, &block)\n @filters.use(*args, &block)\n end",
"title": ""
},
{
"docid": "c561d9c5e61df6cbb2e4192dd4c685db",
"score": "0.58511347",
"text": "def filter(params); end",
"title": ""
},
{
"docid": "eb932a8ec6aa9cbd5d725a527714d95c",
"score": "0.58499205",
"text": "def after\n\t\treport_after_filter\n\tend",
"title": ""
},
{
"docid": "5657498230d3480c057d2670250cd19a",
"score": "0.5845709",
"text": "def before filter\n if filter.instance_of? Array\n @befores.concat filter\n return\n end\n @befores << filter\n end",
"title": ""
},
{
"docid": "6fa269e9abee5c32fcec167b35f35892",
"score": "0.5837755",
"text": "def after_filter(meth, options = {})\n add_filter(:after, meth, options)\n end",
"title": ""
},
{
"docid": "568878880d3e204a460a92cf05f3ea58",
"score": "0.5828467",
"text": "def filter_generator\n end",
"title": ""
},
{
"docid": "4d45832fdec0a2e0a30fdcae4158c40c",
"score": "0.5827082",
"text": "def before_filter_if_not_already_added(method)\n unless filter_already_added? method\n before_filter method\n end\n end",
"title": ""
},
{
"docid": "4d45832fdec0a2e0a30fdcae4158c40c",
"score": "0.5827082",
"text": "def before_filter_if_not_already_added(method)\n unless filter_already_added? method\n before_filter method\n end\n end",
"title": ""
},
{
"docid": "fe5c6d3992007bdc6f440dc7c60cfee0",
"score": "0.5812145",
"text": "def before_filter_do\n @before_filter_do = 1\n end",
"title": ""
},
{
"docid": "f8349be92e690510b6105b796d9c454a",
"score": "0.5806339",
"text": "def before_filters(&block)\n @_before_filters ||= []\n @_before_filters << block if block_given?\n @_before_filters\n end",
"title": ""
},
{
"docid": "968c5a12dcce8f0e5629736548d6b941",
"score": "0.5793807",
"text": "def skip_filter(*names, &blk)\n skip_before_filter(*names)\n skip_after_filter(*names)\n skip_around_filter(*names)\n end",
"title": ""
},
{
"docid": "231e84458a6d1a2181119cc4e5290e3e",
"score": "0.5791891",
"text": "def after_filter is_global, err, msg, session, resp, args, &block\n if is_global\n fm = @global_filter_service\n else\n fm = @filter_service\n end\n if fm\n if is_global\n fm.after_filter(err, msg, session, resp) {}\n else\n fm.after_filter(err, msg, session, resp) {\n block_given? and yield err, resp, args\n }\n end\n end\n end",
"title": ""
},
{
"docid": "79e14380955dcde0941fc30aa0e8da19",
"score": "0.5787535",
"text": "def before_action(method_name, options = nil)\n\t\t\traise RuntimeError, \"You must assign :only or :except option at minimum to use before_action filter\" if options.nil?\n\t\t callbacks << method_name\n\t\t options.each { |key, value|\n\t\t case key\n\t\t when :only\n\t\t onlys << value\n\t\t when :except\n\t\t excepts << value\n\t\t else\n\t\t puts \"#{key} doesn't support, skipping parameter\"\n\t\t end\n\t\t } unless options.nil?\n\t\tend",
"title": ""
},
{
"docid": "94b612652c3cfd72d198ebde66fe7e94",
"score": "0.5785344",
"text": "def before_filter is_global, msg, session, &block\n if is_global\n fm = @global_filter_service\n else\n fm = @filter_service\n end\n if fm\n fm.before_filter msg, session, &block\n else\n block_given? and yield\n end\n end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.5780671",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "9be1966ed4ab2e5118af7c989e899275",
"score": "0.57768846",
"text": "def before █ end",
"title": ""
},
{
"docid": "5e6e0462be077a5520602f85fe96e63c",
"score": "0.57753074",
"text": "def before_filter(*filters)\n @before_filters += filters\n end",
"title": ""
},
{
"docid": "717ab42f488e6aa6d1e843af780c0c16",
"score": "0.5774892",
"text": "def after_perform(*filters, &blk); end",
"title": ""
},
{
"docid": "5d2e3f705800086f738a9f2ea11041ec",
"score": "0.57693344",
"text": "def filter_continue\n nil\n end",
"title": ""
},
{
"docid": "3e466c7b35e33adb315a6536896550f9",
"score": "0.57627964",
"text": "def filter(param)\n @filter_method.call(param)\n end",
"title": ""
},
{
"docid": "3475b7c2b10c24e8958055625f46f935",
"score": "0.5762058",
"text": "def filters\n @filters ||= {:before => {}, :after => {}}\n end",
"title": ""
},
{
"docid": "4e24461b754fc7eaeb8b99dd506bf94c",
"score": "0.57556224",
"text": "def subfilters; end",
"title": ""
},
{
"docid": "720f10e4b1e560044f3ae3e749b7f03e",
"score": "0.5748336",
"text": "def filter_call(method, args)\n case method\n when :filter_in, :init\n retval = args\n @filters.each do |v|\n retval = v.send(method,retval)\n end\n when :filter_out\n retval = args\n @filters.reverse_each do |v|\n retval = v.send(method,retval)\n end\n else\n log.error \"(#{self.object_id}) ProtocolStack#filter_call unknown method '#{method}',a:#{args.inspect},r:#{retval.inspect}\"\n end\n retval\n end",
"title": ""
},
{
"docid": "1bdadcc2f6d3a6f2bf8d5243ffbe5a48",
"score": "0.5747811",
"text": "def filter\r\n raise NotImplementedError\r\n end",
"title": ""
},
{
"docid": "180ef0a0eff48c71fb7e999703c27cb2",
"score": "0.5738967",
"text": "def test_composite_class_filter__class_and_method_match\n composite_filter = Class_composite_filter_A\n \n context = {:class_name => \"Hobo::Dryml\", :method_name => \"build_a\"}.context\n \n options = {:filters => composite_filter} \n exec = Tracing::Filter::Executor.new(options) \n result = exec.filters_allow?('msg', context)\n assert_equal true, result, \"Filter should allow passage\" \n end",
"title": ""
},
{
"docid": "400c29cd03456b6500fedfd2aac98240",
"score": "0.5726888",
"text": "def filter_critical\n\n end",
"title": ""
},
{
"docid": "d54194c3047d6e5565f7807780e760f2",
"score": "0.5726882",
"text": "def before; end",
"title": ""
},
{
"docid": "d54194c3047d6e5565f7807780e760f2",
"score": "0.5726882",
"text": "def before; end",
"title": ""
},
{
"docid": "d54194c3047d6e5565f7807780e760f2",
"score": "0.5726882",
"text": "def before; end",
"title": ""
},
{
"docid": "d54194c3047d6e5565f7807780e760f2",
"score": "0.5726882",
"text": "def before; end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.5724565",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.5724565",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.5724565",
"text": "def filters=(_arg0); end",
"title": ""
}
] |
c026b67dad8950d10937d3af59d2472d
|
def avg_total_savings (object.avg_total_water_savings_per_resident object.no_residents).round(2) if object.avg_total_water_savings_per_user != nil end
|
[
{
"docid": "39fbea6d27bb3add7e83e782d36859f1",
"score": "0.67440677",
"text": "def total_spent\n object.water_bills.map{|b| b.price}.reduce(0){|s, n| s+ n} if !object.water_bills.empty?\n end",
"title": ""
}
] |
[
{
"docid": "597b36abca560dce36c21721151886d6",
"score": "0.7203522",
"text": "def average_total_carbon_saved_per_resident\n if self.no_residents > 0\n total_carbon_savings_to_date / self.no_residents\n end\n end",
"title": ""
},
{
"docid": "3886068f53644c582f9c95fb15cab62e",
"score": "0.69565743",
"text": "def average_rating\n #self.reviews.average(:rating).round if self.reviews.present?\n if self.reviews.present?\n self.reviews.average(:rating).round\n else\n return 0\n end\nend",
"title": ""
},
{
"docid": "0ae4e7c9b520e24b74598f445d3d8ddf",
"score": "0.6879465",
"text": "def average_rating\n reservation_count = self.reservations.where(\"rating is not null\").count\n rating_sum = self.reservations.sum(:rating)\n if reservation_count > 0 and rating_sum\n return rating_sum/reservation_count\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "6e0e9e5a613661edda8130c74af6d9f0",
"score": "0.6864405",
"text": "def avg_lift_total\n\n end",
"title": ""
},
{
"docid": "a52e2e1ea9a4720ac2592ecbd938e383",
"score": "0.68643147",
"text": "def review_average\n reviews.sum(:rating_out_of_ten)/reviews.size if reviews.size > 0 \n end",
"title": ""
},
{
"docid": "92c93970966513e719251c86deccbebe",
"score": "0.6863045",
"text": "def average_occupancy_rate\n self.dig_for_decimal(\"averageOccupancyRate\")\n end",
"title": ""
},
{
"docid": "a7db33de75a458dac8a2f9f07b987f65",
"score": "0.6862389",
"text": "def average_how_much_wold_pay\n amount_pay = amount_how_much_wold_pay\n amount_supporters = self.supporters.length\n amount_supporters > 0 && amount_pay > 0 ? amount_how_much_wold_pay/self.supporters.length : 0\n end",
"title": ""
},
{
"docid": "4dc35345c90793fafe230980f13be4e6",
"score": "0.6860557",
"text": "def calculate_overall_average\n end",
"title": ""
},
{
"docid": "8fd631eb0f332fbfc289c20870a02fdc",
"score": "0.68414176",
"text": "def avg_rating\n sum_rating = @driver_rides.sum do |ride|\n ((ride[:rating].to_f) / @driver_rides.length).round(2)\n end\n return sum_rating\nend",
"title": ""
},
{
"docid": "2b91af196dbe728b459d143ad9f70192",
"score": "0.6805907",
"text": "def avg_spent\n num_orders = orders.length\n num_orders == 0 ? 0 : spent / num_orders\n end",
"title": ""
},
{
"docid": "72a058c6d912fb1c38e41683fb4dac04",
"score": "0.67981213",
"text": "def calculate_overall_average\n avg = OverallAverage.where(rateable: self).pluck('avg').first\n if avg.nil?\n avg = update_overall_avg\n end\n avg\n end",
"title": ""
},
{
"docid": "4a99749c2d38773e7fe457a69bb09b79",
"score": "0.67922395",
"text": "def avg_selling_price(toyPurchases)\n total_amount_of_sales(toyPurchases)/total_number_of_purchases(toyPurchases)\nend",
"title": ""
},
{
"docid": "30a17a2b0b1b0cba19a9da34d7d87800",
"score": "0.67622334",
"text": "def savings\n return self.total_without_group_discount - self.total\n end",
"title": ""
},
{
"docid": "03fac804bc15f41568ded495f93e17a5",
"score": "0.67431444",
"text": "def savings_balance\r\n\t\treturn @savings\r\n\tend",
"title": ""
},
{
"docid": "e0d7bff5691422a36993fb8c7b4e7874",
"score": "0.673904",
"text": "def avg_rating\n sum = self.diversity_rating\n sum += self.inclusion_rating\n sum += self.culture_rating\n\n if self.overall_average\n sum += self.overall_average.avg * 2\n sum/5\n else\n sum/3\n end\n end",
"title": ""
},
{
"docid": "eb0efcd484d850830f9d4930bee2169f",
"score": "0.6737749",
"text": "def review_average \n if reviews.any?\n reviews.sum(:rating_out_of_ten)/reviews.size\n else\n review_average = \"No reviews yet.\"\n end\n end",
"title": ""
},
{
"docid": "41d06982aad74fa4bc6e9344b3ec6b91",
"score": "0.67092574",
"text": "def household_daily_consumption\n object.household.average_daily_carbon_consumption_per_user.to_f.round(2).to_s if !object.houses.empty?\n end",
"title": ""
},
{
"docid": "cb23ad5af229a8a22bcd0590d025a7e6",
"score": "0.6700819",
"text": "def average_rating\n if reviews.any?\n # reviews.inject(0) { |total, review|\n # total + review.rating\n # } / reviews.count.to_f\n reviews.average(:rating) #this is the rails helper method to achieve the above 3 lines.\n else\n 'N/A'\n end\n end",
"title": ""
},
{
"docid": "2b4fe44bc10b18bfa0c4916245e847d8",
"score": "0.66934365",
"text": "def review_average\n if self.reviews.size > 0 #check if i can use exist method \n self.reviews.sum(:rating_out_of_ten)/reviews.size\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "67545b899ed7a6ba270f1b68048d391c",
"score": "0.66914177",
"text": "def average_total_electricity_consumption_per_resident\n if self.no_residents > 0\n total_electricity_consumption_to_date / self.no_residents\n end\n end",
"title": ""
},
{
"docid": "656d0f68967b6fb61dac1486d5956e3c",
"score": "0.6683699",
"text": "def average_rating\n guest_reviews.count == 0 ? 0 : guest_reviews.average(:star).round(2).to_i\nend",
"title": ""
},
{
"docid": "cc6d5821caa6ab1011d04f6716a8df67",
"score": "0.664976",
"text": "def avg_gross_commission\n self.avg_lead_field_value(:displayed_gross_commission)\n end",
"title": ""
},
{
"docid": "647baf0861c2ff24d350503dc52a2f46",
"score": "0.66409916",
"text": "def inclusion_rating\n if self.gender_average && self.identity_average\n sum = self.gender_average.avg + self.identity_average.avg\n sum / 2\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "a56899343d5c59255b144a0ba073fe61",
"score": "0.662803",
"text": "def get_average_age()\n return @patients_queried > 0 ? (@total_age / @patients_queried * 100).round / 100.0 : \"No information available\"\n end",
"title": ""
},
{
"docid": "d0e0e15140e2abf771ff475172a18833",
"score": "0.6621894",
"text": "def average_rating(user)\n review = user.reviews.to_a\n avg_rating = if review.blank?\n 0\n else\n user.reviews.average(:rating).round(2)\n end\n\n return avg_rating\n end",
"title": ""
},
{
"docid": "06214841a4a868b15dd160665a621352",
"score": "0.66152316",
"text": "def avg_balance()\n total_cash_in_bank()/ number_of_bank_accounts() \nend",
"title": ""
},
{
"docid": "8fd165f41a7d3f6f225ab272f2cc01cb",
"score": "0.66083646",
"text": "def total_spent\n total = []\n self.water_bills.empty? ? nil : self.wbills.each{ |b| total.push(b.price)}\n self.heat_bills.empty? ? nil : self.gbills.each{|b| total.push(b.price)}\n self.electric_bills.empty? ? nil : self.bills.each{|b| total.push(b.price)}\n res_ = total.reject(&:nil?).reduce(0){|s, n| s + n}.to_f.round(2)\n end",
"title": ""
},
{
"docid": "1e42e063e845def7012ceb95587cd346",
"score": "0.6602221",
"text": "def volunteer_avg_score\n \treturn self.event_volunteers.average(:volunteer_score)\n end",
"title": ""
},
{
"docid": "e08b38201f3a091a27a54f9c446a077c",
"score": "0.6589202",
"text": "def calc_avg_discount(retail_price, avg_price)\n avg_discount = (retail_price - avg_price) / retail_price * 100\n avg_discount = avg_discount.round(2)\n avg_discount\nend",
"title": ""
},
{
"docid": "47b60629598114aaae3cb5ab1c3371d5",
"score": "0.65850794",
"text": "def average_rating\n rating && rating.average_rating || 0.0\n end",
"title": ""
},
{
"docid": "1fdf9743a1c5afe2f171f0676922fc9d",
"score": "0.6577652",
"text": "def average_rating_round\n average_rating.round\n end",
"title": ""
},
{
"docid": "6b390a51f0681c6be113e39c0119f201",
"score": "0.6564947",
"text": "def dsum_claimed\n sum_claimed/100.0 rescue 0.0\n end",
"title": ""
},
{
"docid": "54b2a49e2baf3938162457dc4608ca87",
"score": "0.65581816",
"text": "def review_average\n average = 0.0\n sum = 0.0\n count_nils = 0\n\n if object.reviews.count >= 1\n object.reviews.each do |review|\n #do not consider nil review ratings in your average calculation\n if review.rating.nil?\n count_nils += 1\n end\n\n sum += review.rating\n end\n\n average = sum / (object.reviews.count - count_nils)\n end\n #return calculated average; if 0, you know there is no average that could be calculated\n average.round(2)\n end",
"title": ""
},
{
"docid": "7d58b2945af7d50be075c131898618a7",
"score": "0.6554908",
"text": "def average_rating\n (self.reviews.average(:rating) * 2).round / 2.0 \n end",
"title": ""
},
{
"docid": "ce7fc4534be59f9f31fe67d71c2a944d",
"score": "0.65512484",
"text": "def avg_rating\n @avg = self.ratings.average(:stars) \n @avg ? @avg : 0\nend",
"title": ""
},
{
"docid": "65dc09dc3eb61c652ffa82f40fe62408",
"score": "0.65424305",
"text": "def average_rating\n reviews.blank? ? 0 : reviews.average(:stars).round(2)\n end",
"title": ""
},
{
"docid": "399d51e38783c9d608971067449090aa",
"score": "0.65417886",
"text": "def average_rating\n if reviews.count > 0\n reviews.pluck(:wheel).sum / reviews.count\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "8248a227da11d944995bd09231760cfc",
"score": "0.6537203",
"text": "def average_score\n average = 0\n #total_games = total_home_games + total_away_games\n total_baskets = self.totalbaskets\n average = total_baskets/self.total_games\n end",
"title": ""
},
{
"docid": "6a279e85603fb724df22084405813de4",
"score": "0.65337646",
"text": "def reviewer_total_average_score\n # committee_member.application_reviewers.for(offering).collect{|r| r.total_score rescue nil}.compact.average\n committee_member.application_reviewers.find(:all, \n :joins => :scores, \n :select => \"SUM(score) AS summed_score\",\n :group => 'application_for_offering_id').collect{|s| s.summed_score.to_i}.average\n end",
"title": ""
},
{
"docid": "350fdaec33ca049d490ca6cffe2a2218",
"score": "0.65210736",
"text": "def avg_rating\n reviews = bookings.map{|booking| booking.booking_reviews}.flatten\n all_ratings = reviews.map{|review| review.rating} # [3,2,5,0]\n return nil if all_ratings.empty?\n sum_of_ratings = all_ratings.inject(0){|sum, x| sum + x }\n\n (sum_of_ratings.to_f / all_ratings.size.to_f).round(1)\n end",
"title": ""
},
{
"docid": "0b891df7027cacc9f214ad39fdfb7481",
"score": "0.6517733",
"text": "def avg_net_commission\n self.avg_lead_field_value(:displayed_net_commission)\n end",
"title": ""
},
{
"docid": "d110694a65b3dce1fac770517ccfb1b3",
"score": "0.6517221",
"text": "def average_rating\n if self.reviews.count != 0\n ((self.reviews.pluck(:rating).sum).to_f / self.reviews.count).round(2)\n else \n 0 \n end \n end",
"title": ""
},
{
"docid": "4d8fbdc6c9b65a24aff0b95f03aa8050",
"score": "0.6514264",
"text": "def average_tenants_per_floor\n (@tenants.to_f / @floors.to_f).round(2)\n end",
"title": ""
},
{
"docid": "90197101d78566dbc38215907e217d2e",
"score": "0.6506029",
"text": "def average_guests\n if all_trips.length == 0\n return nil\n else\n sum_guests = all_trips.inject(0) do |sum, listing|\n sum += listing.guest\n end\n sum_guests.to_f / all_trips.length\n end\n end",
"title": ""
},
{
"docid": "8b22645abe43ecbad6aba7e61036ac76",
"score": "0.6500727",
"text": "def class_avg\n # this averages the total ratings for the class\n avg = ratings.average :value\n avg.to_f\nend",
"title": ""
},
{
"docid": "e6e3087fd2eb0818455067ade2f64532",
"score": "0.64981574",
"text": "def avg_score \n return 0 unless reviews.count.positive?\n #takes the avg score and rounds it \n reviews.average(:score).round(2).to_f \n end",
"title": ""
},
{
"docid": "0eeb9581343b1f422280c6be0b2245e6",
"score": "0.648144",
"text": "def average_review_rating\n return 0 if reviews.blank?\n reviews.average(:rating)\n end",
"title": ""
},
{
"docid": "430f16d1133b4605144ef56e991901a6",
"score": "0.6480246",
"text": "def review_average\n reviews.sum(:rating_out_of_ten)/(reviews.size == 0 ? 1 : reviews.size)\n end",
"title": ""
},
{
"docid": "5b2486aee234fd1ff3e6a2d50c13c5dd",
"score": "0.6475911",
"text": "def total_savings\n save_money.sum(&:max)\n end",
"title": ""
},
{
"docid": "30aadb90809048e20b1bbf8a3e2a1c3a",
"score": "0.64750886",
"text": "def average_rent\n rents = @units.map {|unit| unit.monthly_rent}\n (rents.sum.to_f / x.length.to_f)\n end",
"title": ""
},
{
"docid": "1aae62bab6d3a5c115153164c691484f",
"score": "0.64672667",
"text": "def average_rating_round\n average_rating.round\n end",
"title": ""
},
{
"docid": "b45cb14ead6106a6ab11c4bf5bc8da83",
"score": "0.6464096",
"text": "def calculate_avg_brand_price(total,items)\n (total / items).round(2)\nend",
"title": ""
},
{
"docid": "6472cc736475ed483585cd5b78830b4c",
"score": "0.64573514",
"text": "def review_average\n if reviews.size > 0\n reviews.sum(:rating_out_of_ten)/reviews.size\n end\n end",
"title": ""
},
{
"docid": "2c69b0f6f29de809bdec51deaa13bab0",
"score": "0.6445644",
"text": "def avg\n @item_sum.to_f / @item_count.to_f\n end",
"title": ""
},
{
"docid": "266da075fbaaf6e096eb8a53a1432d26",
"score": "0.64372706",
"text": "def average_calories\n self.calories/self.desserts\nend",
"title": ""
},
{
"docid": "96ffcd204e43eec73e76e664310c93e1",
"score": "0.6431319",
"text": "def average_rating\n rating && rating.average_rating || 0.0\n end",
"title": ""
},
{
"docid": "fd23decb7d22d319af2516636c5eea7a",
"score": "0.642861",
"text": "def get_average(scope_name = :is_male)\n result_count = @meeting.meeting_individual_results.send(scope_name.to_sym).has_points.count\n if result_count > 0\n standard_points_sum = @meeting.meeting_individual_results.send(scope_name.to_sym).has_points.sum(:standard_points)\n (standard_points_sum / result_count).round(2)\n else\n result_count\n end\n end",
"title": ""
},
{
"docid": "cef33f1d7d012b4f730d441f0d923e07",
"score": "0.6426948",
"text": "def diversity_rating\n if self.leadership_average && self.equal_opportunities_average && self.promotions_average\n sum = self.leadership_average.avg + self.equal_opportunities_average.avg + self.promotions_average.avg\n sum / 3\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "0a8117711d4d5a151af648efc42496f6",
"score": "0.6420149",
"text": "def calc_avg_price(total_sales, num_purchases)\n total_sales / num_purchases\nend",
"title": ""
},
{
"docid": "5b37433bef751ae0a59a97d415c27383",
"score": "0.6416039",
"text": "def rating\n sum = @driver_rides.sum do |rate|\n rate[:rating].to_i\n end\n average = (sum.to_f / @driver_rides.length).round(2)\n return average\nend",
"title": ""
},
{
"docid": "6d394c5cf88acd116a71d5b6afef8dcc",
"score": "0.64114726",
"text": "def average_score\n count = 0.0\n avrg = 0.0\n if self.inspections.empty?\n return 0.0\n else\n self.inspections.each do |insp|\n unless insp.authorized_absent?\n avrg += insp.score.to_f\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0 #Stops problem dividing 0.0 by 0.0 if only authorised absences esist.\n \n end\n end",
"title": ""
},
{
"docid": "f11eab4e071d00cb8131e3a5346e7e2d",
"score": "0.6407335",
"text": "def calculate_ratings_average\n if has_many_ratings?\n self.ratings.average(:rating).to_i\n else\n self.rating_association ? self.rating_association.rating : 0\n end\n end",
"title": ""
},
{
"docid": "f30dfa3b5a2840d1752414c872061d6b",
"score": "0.6402248",
"text": "def culture_rating\n if self.management_average && self.hr_average && self.whole_self_average && self.community_average\n sum = self.management_average.avg + self.hr_average.avg + self.whole_self_average.avg + self.community_average.avg\n sum / 4\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "e0d8e561f59eb907ff194e29b14f6726",
"score": "0.6400585",
"text": "def average_rating\n ((self.google_rating.to_f*2 + self.foursquare_rating.to_f + self.yelp_rating.to_f*2)/((1 if self.google_rating.to_i > 0).to_i + (1 if self.foursquare_rating.to_i > 0).to_i + (1 if self.yelp_rating.to_i > 0).to_i)*10).round\n end",
"title": ""
},
{
"docid": "b3ee57cf0e08546fa40056b5dbbb1ea5",
"score": "0.6398118",
"text": "def average_billed_consumption\n _prev_consumptions = []\n _average_consumption = 0\n if !billing_period.blank? && invoice_type_id == InvoiceType::WATER\n ii = ActiveSupplyInvoice.joins(:billing_period).where('period <= ? AND subscriber_id = ?', billing_period.period, subscriber.id).order('period DESC').first(6)\n if !ii.blank?\n ii.each do |_i|\n _prev_consumptions << _i.invoice.consumption\n _average_consumption += _i.invoice.consumption\n end\n _average_consumption = _average_consumption / ii.count\n end\n end\n return _prev_consumptions, _average_consumption\n end",
"title": ""
},
{
"docid": "227ec277c25e3789fbce31bbfc08e3a2",
"score": "0.63971967",
"text": "def total_avg\n @total_avg = ScoreSumary.common_votes.average(:score)\n end",
"title": ""
},
{
"docid": "bea544d8de65f69fe07c46e89329bd0e",
"score": "0.63964945",
"text": "def avg_rating\n @avg = self.ratings.average(:stars) \n @avg ? @avg : 0\n end",
"title": ""
},
{
"docid": "3ec2be86d77c264f0615677e8d10bac2",
"score": "0.6387683",
"text": "def rating_avg\n if self.ratings.empty?\n \"No ratings yet!\"\n else\n total = self.ratings.reduce(0) { |sum, rating| sum + rating.stars }\n avg = total / self.ratings.length.to_f\n avg.round(2)\n end\n end",
"title": ""
},
{
"docid": "943f873b4b32fa42b362f446d1cba99f",
"score": "0.63847935",
"text": "def avg_beer_rating\n if !(reviewed_beers.empty?)\n total = reviewed_beers.inject(0) do |s, b|\n s + b.average_rating\n end\n total / reviewed_beers.count\n else\n 'No beers have been reviewed'\n end\n end",
"title": ""
},
{
"docid": "d6e1fbbbf3366cba656951d1271c3084",
"score": "0.63839847",
"text": "def average_calories\n \n end",
"title": ""
},
{
"docid": "43be5ffc9b6c60fd9889b9bdb9be72c1",
"score": "0.6376147",
"text": "def avg_discount\n return 0.0 if base_list <= 0.0\n 1-(booking_net.to_f/base_list.to_f)\n end",
"title": ""
},
{
"docid": "e38d262c68e646697d05aff9a44213ec",
"score": "0.63759077",
"text": "def average_rating_round\n \t\t\taverage_rating.round\n \t\tend",
"title": ""
},
{
"docid": "4399db94d56da2554fe3c375dc717ed3",
"score": "0.63736916",
"text": "def average_guest_age\n customer_ages = self.customers.map do |cust|\n cust.age\n end\n\n sum = customer_ages.inject do |acc, age|\n acc + age\n end\n\n sum / customer_ages.length.to_f\n end",
"title": ""
},
{
"docid": "f195700a001b02db08c61665b00e6866",
"score": "0.63704437",
"text": "def get_mean\n res_etc=0\n\n self.wp_actuals.each do |actual_wp|\n res_etc+=actual_wp.wp.pert_average*(actual_wp.status.to_f/100)\n end\n\n return res_etc\n end",
"title": ""
},
{
"docid": "6252a41b50ca5a2c86b301b7013c4b29",
"score": "0.63689804",
"text": "def event_avg_score\n \treturn self.event_volunteers.average(:event_score)\n end",
"title": ""
},
{
"docid": "1639f46330c3607a73e414cc83c1a30e",
"score": "0.6368342",
"text": "def avg_purchase_price_method(total_revenue_amount, total_number_of_sales) \r\n #calculates average of sale price \r\n avg_purchase_price = (total_revenue_amount.to_f / total_number_of_sales.to_f) \r\n #prints the average price the item has sold for \r\n print_to_report \"Average sale price: $#{avg_purchase_price.to_s}\" \r\n #return avg purchase price variable\r\n return avg_purchase_price \r\nend",
"title": ""
},
{
"docid": "c0dffd781dfb574e2934dcd6ed7c7324",
"score": "0.6363329",
"text": "def average_review_rating\n reviews.average(:rating)\nend",
"title": ""
},
{
"docid": "d0e9ebb85de364e9f4aecc7cd73b6515",
"score": "0.6362109",
"text": "def average_score\n score_total = self.grades.reduce(0) {|sum, grade| sum += grade.final_score.to_f; sum}\n\n unless score_total == 0\n (score_total / self.students.count) / 100\n end\n end",
"title": ""
},
{
"docid": "593b662fe3e21054e3427387eb82abcb",
"score": "0.6360001",
"text": "def avg\n average\n end",
"title": ""
},
{
"docid": "05d047ac4391f953e360c9673d9b13dd",
"score": "0.63579",
"text": "def avg_rating\n self.reviews.average(\"rating\").round\n end",
"title": ""
},
{
"docid": "8f2a5d46195c1f4bc904b7bb90b6da95",
"score": "0.6357735",
"text": "def calculate_avg_earnings(bookings)\n result = 0\n if !bookings.blank?\n total = 0\n bookings.each do |booking|\n total = total + booking.amount_in_base_currency\n end\n result = (total * 1.0) / bookings.size\n end\n result\n end",
"title": ""
},
{
"docid": "1c0f7dbc8374fc9ba4d0617ba9e0bcc9",
"score": "0.6356834",
"text": "def compute_overall_avg\n if self.reviews.count == 0\n return 0\n end\n\n (compute_accessibility + compute_condition) / 2\n end",
"title": ""
},
{
"docid": "dc5f0890a69fc18c65c2610ade6757dc",
"score": "0.6355058",
"text": "def get_mean_salary(employees)\n if employees.count != 0\n (get_total_salaries(employees) / employees.count).round(2)\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "00f3fee55ef8ee3d0044257e383019ae",
"score": "0.6351382",
"text": "def gross_total\n gross_total_base.round(2)\n end",
"title": ""
},
{
"docid": "2a95e5fadb12c9fa92502d26874ebedc",
"score": "0.6346258",
"text": "def avg_score\n reviews.average(:score).round(2).to_f\n end",
"title": ""
},
{
"docid": "318c475e9760f569b37109a4a250a024",
"score": "0.63385147",
"text": "def average_rating\n sum_of_ratings = 0.0\n self.reviews.each {|review| sum_of_ratings += review.rating.to_f}\n if self.reviews.count != 0\n average_rating = (sum_of_ratings / self.reviews.count.to_f).round(1)\n else\n average_rating = \"no ratings yet\"\n end\n return average_rating\n end",
"title": ""
},
{
"docid": "738fe9b1751186b530de583f98760953",
"score": "0.63384205",
"text": "def average_rating\n Review.where(:user_id => self.user_id).average(:rating).to_d\n end",
"title": ""
},
{
"docid": "04cb427fc4166781e7c100da7207fcba",
"score": "0.6334445",
"text": "def avg_discount_method(retail_price, avg_purchase_price) \r\n #calucaltes retail price - average price paid to get avg_discounted amount\r\n avg_discount = (retail_price.to_f - avg_purchase_price.to_f) \r\n #prints average avg_discount\r\n print_to_report \"Average discount: $#{avg_discount.round(2)}\" \r\n #returns avg discount amount\r\n return avg_discount \r\nend",
"title": ""
},
{
"docid": "3b30eb4fc820225e20e14fb85d6240fd",
"score": "0.6334436",
"text": "def mean_overall\n sum_overall / hits_overall\n end",
"title": ""
},
{
"docid": "3b30eb4fc820225e20e14fb85d6240fd",
"score": "0.6334436",
"text": "def mean_overall\n sum_overall / hits_overall\n end",
"title": ""
},
{
"docid": "c6b902a77e35cf0d464adb2c7851968f",
"score": "0.63327193",
"text": "def avg_soldiers_per_zone \n if total_zones == 0\n return total_soldiers\n else\n return total_soldiers.to_f / total_zones.to_f\n end\n end",
"title": ""
},
{
"docid": "80a01b07919cb41096f98c02b976b932",
"score": "0.6327938",
"text": "def average_price_of_car\n int_ave = @total_value/(@inventory.count)\n # return int_ave\n end",
"title": ""
},
{
"docid": "ab1a07f9570fbc0fd6cfdd643bfc9ca3",
"score": "0.63257927",
"text": "def avg_rating\n unless self.reviews.empty?\n ratings = self.reviews.map {|review| review.rating}\n ratings.inject(0.0) { |sum, el| sum + el } / ratings.size\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "afc3e54280ee0e8d9d534616c119645d",
"score": "0.6322167",
"text": "def ave_opp_rating\n return @ave_opp_rating if @ave_opp_rating\n ave = 0.0\n num = 0\n results.each do |r|\n if r.rateable\n num+= 1\n ave+= r.opponent.start_rating || 0.0\n end\n end\n @ave_opp_rating = num == 0 ? ave : ave / num\n end",
"title": ""
},
{
"docid": "e09215104364d493246fef53ce93e21e",
"score": "0.63201135",
"text": "def average_rating\n rating = 0\n number = 0\n appointments.each do |appointment|\n unless appointment.rating.nil?\n rating += appointment.rating\n number += 1\n end\n end\n rating = (rating / number).round unless rating.zero?\n return rating\n end",
"title": ""
},
{
"docid": "80bdac34ec15a3a47bedc0acf7561ab5",
"score": "0.63154507",
"text": "def calculate_overall_average\n rating = Rate.where(rateable: self).pluck('stars')\n (rating.reduce(:+).to_f / rating.size).round(1)\n end",
"title": ""
},
{
"docid": "8f1faa67d5832a4dd1a6fc26e825bfd6",
"score": "0.6314319",
"text": "def avg_score\n if reviews.empty?\n 0.0\n else\n reviews.average(:rate).round(1).to_f\n end\n end",
"title": ""
},
{
"docid": "6d7ecabc114cee46050c783f65228801",
"score": "0.6314135",
"text": "def reviews_avarage_score\n if reviews.present?\n review_scores = reviews.pluck(:score)\n (review_scores.sum / review_scores.count.to_f).round(1)\n # reviews.average(:score).to_f.round(1)\n # Review.where(item_id: id).average(:score).to_f.round(1)\n else\n 0.0\n end\n end",
"title": ""
},
{
"docid": "e2f5892828dabc2ee9094a337c6c0776",
"score": "0.6310049",
"text": "def average\n (energy + happiness + productivity + fulfillment + day)/5\n end",
"title": ""
},
{
"docid": "af7ffc6e46c8e7a04e200f8377d7a3d4",
"score": "0.6307999",
"text": "def profile_strength\n profile_picture_score = object.profile_picture.present? ? 20 : 0\n education_score = object.educations.present? ? 20 : 0\n employment_score = object.employments.present? ? 20 : 0\n certification_score = object.certifications.present? ? 40 : 0 \n total_score = profile_picture_score + education_score + employment_score + certification_score\n return total_score\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "30434187625b75b84309632818de55aa",
"score": "0.0",
"text": "def manage_news_params\n param=params.require(:manage_news).permit(:title, :author, :content, :is_draft, :publish_at,:contest_id)\n param[:admin_id] = @admin.id\n if params[:commit] == \"存为草稿\"\n param[:is_draft] = true\n else\n param[:is_draft] = false\n end\n param\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7496729",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.6958585",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69237685",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.6895071",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67869943",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.67445725",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.668381",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6638182",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66302425",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.6627488",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65639997",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.64919555",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6478558",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.6454667",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64012396",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63839936",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.6365647",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.6339444",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6337142",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6326974",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.63207066",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63158226",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63153416",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6307222",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6302766",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.6301276",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.62975216",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.629241",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.629241",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62796533",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6274467",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6267973",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.6257074",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.62556005",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.6253268",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6235937",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6229283",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6228986",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62284905",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.622684",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200802",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61919236",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6184593",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.61810327",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.6164044",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.61617863",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6156518",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.6155467",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61354053",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61343485",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61204326",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61169004",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61169004",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61157626",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.6111809",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104543",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104543",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6098137",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6098137",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6086392",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.6085739",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.6085733",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.60790676",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.607553",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6069313",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60672545",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.6067154",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6067105",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064792",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60634184",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.60632914",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.6058432",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.6048923",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.6048879",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.6048879",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.60472274",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041843",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60351795",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.603075",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6026434",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021914",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6021314",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.60178083",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60156524",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60095096",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6007318",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6007318",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6007018",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60057443",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.6002585",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.60017353",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.60017353",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6001735",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.59996015",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999499",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999499",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59949625",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5994718",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5994533",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59923065",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.5992183",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "d514841a06719997509748f83fc23d96",
"score": "0.0",
"text": "def set_bs_column\n @bs_table = BsTable.find(params[:bs_table_id])\n @bs_column = @bs_table.bs_columns.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60310596",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6014974",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59220976",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5914568",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5914568",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589943",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5888941",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58885634",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58885634",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58885634",
"text": "def actions; end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58782613",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5861314",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.5809542",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.5741235",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57311964",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5716416",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5700531",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56932974",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56695074",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651278",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648787",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5637279",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5625286",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56093556",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.55957067",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5595428",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5587003",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.555788",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.555788",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5509564",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5503485",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.54668134",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5466406",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54484755",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.5445224",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54400647",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54170287",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410386",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410386",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5400231",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5394892",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5394892",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.53915846",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.53883713",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5377769",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53559244",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.53485996",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53475654",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.534689",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.53444993",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5340848",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.532768",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53044224",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5285527",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5283148",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52561116",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5255505",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.5249269",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.52457106",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5239162",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237084",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237084",
"text": "def action; end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52318287",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.5228689",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.5224244",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52220625",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.5220978",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.52146",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5212803",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.520894",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5205112",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5204084",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5203692",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.52036524",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.51995677",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51958364",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51958364",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.51914203",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.51794034",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.5178634",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5173361",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5173361",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5173361",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.51644397",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.51532143",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.51424634",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.5140684",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.5140337",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.5139829",
"text": "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",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.513508",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.51161575",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.511372",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5111875",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.51083213",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.51083213",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.51083213",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51056045",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.51042956",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.5098082",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50948924",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "35b302dd857a031b95bc0072e3daa707",
"score": "0.5091935",
"text": "def config(action, *args); end",
"title": ""
}
] |
44f2a7fbc2650f3866ea2650ebe3f823
|
Returns the maximum coordinate for an area.
|
[
{
"docid": "0b40d5aeada5d3d2a4e1f3b550bfb2fd",
"score": "0.0",
"text": "def dn_position\n return 0 if d_dn <= 0\n\n d + d_dn\n end",
"title": ""
}
] |
[
{
"docid": "6a645f0f10e65daab7efdb291a6314a4",
"score": "0.75360477",
"text": "def sq_area_max(coordinates, matrix_length)\n binding.pry\n area = matrix_length ** 2\n right = (matrix_length-1) - coordinates[0]\n left = (matrix_length - 1) - right\n top= (matrix_length-1) - coordinates[1]\n bottom= (matrix_length -1) - top\n return [top* right, top*left, bottom * right, bottom*left].max\nend",
"title": ""
},
{
"docid": "c35901a2df7d254e02818329f49590b5",
"score": "0.7468448",
"text": "def largest_area_index(input_array)\n max_index = -1\n max = 0\n\n input_array.each_with_index do |item, index| \n area = item[0] * item [1] # 1*2\n if area > max #2 >0\n max = area #max = 2\n max_index = index\n end \n end\n return max_index\n end",
"title": ""
},
{
"docid": "0e9c0bb95d3d7d3a53e1af137ea9bfee",
"score": "0.7466704",
"text": "def max_point\n # generate the bounding box if not already done\n bounding_box\n # return the max\n @max\n end",
"title": ""
},
{
"docid": "a896e7df027c3f07f5cf108ad0ae943c",
"score": "0.74334115",
"text": "def largest_area(input_array)\n max = 0\n \n input_array.each do |item|\n area = item[0] * item[1] # 1 * 2\n if area > max\n max = area\n end\n end\n return max\n end",
"title": ""
},
{
"docid": "4e1a16f961a497954751899c76d6a5ab",
"score": "0.7318427",
"text": "def max_coordinates\n\t\t\tunless @max_coordinates\n\t\t\t\tmax = @matrix.map(&:max).max\n\t\t\t\t@max_coordinates = self.class.new(@matrix.map{|row| row.map{|i| max - i}}).min_coordinates\n\t\t\tend\n\n\t\t\treturn @max_coordinates\n\t\tend",
"title": ""
},
{
"docid": "fd54bb21e8838b4ed3239be3323f0219",
"score": "0.71535355",
"text": "def coordinate_area\n (@x_max.to_f - @x_min.to_f) * (@y_max.to_f - @y_min.to_f)\n end",
"title": ""
},
{
"docid": "1bf30b4e466cf1f921f2983bfdfd5274",
"score": "0.6930644",
"text": "def largest_rectangle\n histogram = Histogram.new(Array.new(@matrix[0].length, 0))\n max_area = 0\n\n @matrix.each do |row|\n histogram.update!(row)\n largest_in_histogram = histogram.largest_area\n max_area = [max_area, largest_in_histogram].max\n end\n\n max_area\n end",
"title": ""
},
{
"docid": "e83b56173226b814e4c11bd54938fa54",
"score": "0.67013645",
"text": "def max_area(height)\n left = 0\n right = height.length - 1\n max = 0\n while left < right\n current = [height[left], height[right]].min * (right - left)\n max = current if current > max\n if height[left] < height[right]\n left += 1\n else\n right -= 1\n end\n end\n max\nend",
"title": ""
},
{
"docid": "1860773074d1021c2bfe965e31664efd",
"score": "0.6681789",
"text": "def largest_area(nums)\n max_area = nums[0][0] * nums[0][1]\n\n nums.each do |num_set|\n if max_area < (num_set[0] * num_set[1])\n max_area = num_set[0] * num_set[1]\n end\n end\n\n return max_area\nend",
"title": ""
},
{
"docid": "ca8957aca396b7244bbf1f19cd1f75a3",
"score": "0.66201794",
"text": "def maxArea(height)\n max = 0\n i = 0\n j = height.length - 1\n while i < j\n if height[i] < height[j]\n tmp = height[i] * (j - i)\n i += 1\n else\n tmp = height[j] * (j - i)\n j -= 1\n end\n if tmp > max\n max = tmp\n end\n end\n return max\nend",
"title": ""
},
{
"docid": "a26e205006d0c4f1bee8dc24db8df2eb",
"score": "0.65869856",
"text": "def max_area(height)\r\n max_area = 0\r\n height.each_with_index do |start, idx1|\r\n height.each_with_index do |finish, idx2|\r\n if idx2 > idx1\r\n area = [start, finish].min * (idx2 - idx1) \r\n max_area = area if area > max_area\r\n end\r\n end\r\n end\r\n max_area\r\nend",
"title": ""
},
{
"docid": "5c3b3790c299075dfa029542ace597bd",
"score": "0.6555587",
"text": "def max_position\n MSPhysics::Newton::Corkscrew.get_max_position(@address)\n end",
"title": ""
},
{
"docid": "fd3b522f9f1456c08563e9026146dcc2",
"score": "0.6547701",
"text": "def coordinate\n x = ((position-1) / area.x_max) + 1\n y = position - (x-1) * area.x_max\n \"(#{x}, #{y})\"\n end",
"title": ""
},
{
"docid": "a0484d9e1a4732fca1b3849759d1f540",
"score": "0.65000653",
"text": "def max_longitude\n query_root_node(\"fao:hasMaxLongitude/text()\", @@NAMESPACES).to_s\n end",
"title": ""
},
{
"docid": "5c6736aabfac1e58b06f44832729abcc",
"score": "0.6499305",
"text": "def max_area_improved(height)\n i = 0\n j = height.length - 1\n area = 0\n while(i < j)\n area = [area, (j-i) * [height[i], height[j]].min].max\n height[i] < height[j] ? (i+= 1) : (j-=1)\n end\n area\nend",
"title": ""
},
{
"docid": "f6d3baec061ba448bbf2fe09899985de",
"score": "0.6467153",
"text": "def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end",
"title": ""
},
{
"docid": "e656d7c10b058b048f618c79f002b29d",
"score": "0.6440145",
"text": "def max_area_of_island(grid)\n area = 0\n (0...grid.size).each do |i|\n (0...grid[0].size).each do |j|\n area = [area, island_area(grid, i, j)].max if grid[i][j] == 1\n end\n end\n area\nend",
"title": ""
},
{
"docid": "6713a82fb92cb3d894f229eb5e1a9e9d",
"score": "0.6410544",
"text": "def max_area(height)\n left = 0\n right = height.size - 1\n max_area = 0\n while left < right do \n max_area = [max_area, ([height[left], height[right]].min) * (right - left)].max\n if height[left] < height[right]\n left += 1\n else\n right -= 1\n end\n end\n max_area\nend",
"title": ""
},
{
"docid": "08a3f9b8bf21ee1296a7d1740fc1a4ac",
"score": "0.6389177",
"text": "def maximum\n return @maximum\n end",
"title": ""
},
{
"docid": "01294d2c9f4de5f718eaa58f05814751",
"score": "0.6357704",
"text": "def find_max\n loc = find_max_locator and loc.value\n end",
"title": ""
},
{
"docid": "2a493482efa8eedbb9e9da0a8b57787f",
"score": "0.6325306",
"text": "def max_area(height)\n max_area = 0\n left = 0\n right = height.length - 1\n while right > left\n min_height = [height[left], height[right]].min\n area = find_area(min_height, left, right)\n if area > max_area\n max_area = area\n end\n \n if height[left] >= height[right]\n right -= 1\n else\n left += 1\n end\n \n end\n \n max_area\n \n \nend",
"title": ""
},
{
"docid": "4407982e5ff73086852ce92443437179",
"score": "0.63189816",
"text": "def maximum\n sides.map(&:value).max\n end",
"title": ""
},
{
"docid": "71aa567efbc51959fc2f470699e8bade",
"score": "0.62851226",
"text": "def max_area_of_island(grid)\n return 0 if grid.empty?\n w, h = grid[0].length, grid.length\n max = 0\n (0...h).each do |i|\n (0...w).each do |j|\n if grid[i][j] == 1\n max = [max, search(grid, i, j)].max\n end\n end\n end\n max\nend",
"title": ""
},
{
"docid": "6ebc24b6880fb5d2b6d4ec24f40fcdba",
"score": "0.6239991",
"text": "def area(x=$game_player.x, y=$game_player.y)\n new_area = @areas.reverse.detect {|area| x >= area.x && y >= area.y }\n @area = new_area if @area != new_area\n @area\n end",
"title": ""
},
{
"docid": "5b8b9ff140aee298ea06386c120c162a",
"score": "0.6181056",
"text": "def largest_rectangle_area(heights)\n return 0 if heights.empty?\n largest(MinSpTable.new(heights), 0, heights.size-1)\nend",
"title": ""
},
{
"docid": "b34b2a043aca27f7d147f7186b080950",
"score": "0.616458",
"text": "def largest_area_pair(input_array)\n max_pair = nil\n max = 0\n #loop through input_array\n #calculate area at each item \n #compare to max\n #when you find max value, need to pair that matches this value\n #check if input_array is empty\n if input_array.length == 0\n return nil\n end\n \n input_array.each do |item|\n #check if any values in pair are negative\n if (item[0] > 0) && (item[1] > 0)\n area = item[0] * item [1] # 1*2\n if area > max\n max = area\n max_pair = item\n end\n end\n end\n return max_pair\n end",
"title": ""
},
{
"docid": "329595d81be80ed299518e8cf4caa43e",
"score": "0.61615115",
"text": "def max_area(height)\n max_area = 0\n seen = {}\n\n (0...height.length).each do |idx|\n next if seen[idx]\n seen[idx] = true\n\n (idx + 1...height.length).each do |idx2|\n h = [height[idx], height[idx2]].min\n area = h * (idx2 - idx)\n max_area = area > max_area ? area : max_area\n end\n end\n \n max_area\nend",
"title": ""
},
{
"docid": "7a501843b6231d7289859a1b5b717a25",
"score": "0.61455065",
"text": "def get_area\n return Engine::Area.new(calculate_top_point_internal, @area_width, @area_height)\n end",
"title": ""
},
{
"docid": "50a943d456bd44039b823600952da542",
"score": "0.6143396",
"text": "def largest_rectangle_area(heights)\n n, ans = heights.size, -Float::INFINITY\n (0..n-1).each do |i|\n min = heights[i]\n (i..n-1).each do |j|\n min = [min, heights[j]].min\n ans = [ans, min*(j-i+1)].max\n end\n end\n ans\nend",
"title": ""
},
{
"docid": "f1c5e88a6cf4e011a48e6ace3e59a92f",
"score": "0.61432666",
"text": "def max\n if valid?\n max_value\n end\n end",
"title": ""
},
{
"docid": "3f311dee5d0786899cad6727593b3c9f",
"score": "0.6125225",
"text": "def biggest_area\n max_post = 0\n max_post = $postings.max {|a,b| a[1][/\\d+(?=ft)/].to_i <=> b[1][/\\d+(?=ft)/].to_i}\n max_area = max_post[1][/\\d+(?=ft)/].to_i\n max_ads = $postings.select{|p| p[1][/\\d+(?=ft)/].to_i == max_area}\n list_apt(max_ads)\nend",
"title": ""
},
{
"docid": "4a673de3ebae43d61bd813dba68fe424",
"score": "0.6101038",
"text": "def largest_rectangle_area(heights)\n return 0 if heights.empty?\n largest(MinSegTree.new(heights), 0, heights.size-1)\nend",
"title": ""
},
{
"docid": "de901adccdfc0b1f24a438ec18ae8ce2",
"score": "0.61007446",
"text": "def maximum_elevation(ride)\n ride.points.map(&:elevation).max || 0\n end",
"title": ""
},
{
"docid": "15b763d5fc41d6acfa0476d88e810fa5",
"score": "0.6086827",
"text": "def maximum_value\n @maximum_value || store.max\n end",
"title": ""
},
{
"docid": "2ccec278f9345660428132345049449b",
"score": "0.6059915",
"text": "def max\n @n[0]\n end",
"title": ""
},
{
"docid": "e6cbd196445e073a58d01e79801ea443",
"score": "0.6029964",
"text": "def largestRectangle(h)\n stack = [0]; length = h.length; h << 0; area = 0; index = 1\n\n while index <= length do\n if stack.empty? || h[index] > h[stack[-1]]\n stack << index\n index += 1\n else\n element_index = stack.pop\n t_area = h[element_index] * (stack.empty? ? index : (index - stack[-1] -1))\n area = [area, t_area].max\n end\n end\n\n return area\nend",
"title": ""
},
{
"docid": "00a6388afa5494bf51808cdf6dd29781",
"score": "0.6029243",
"text": "def max\n move(180)\n end",
"title": ""
},
{
"docid": "1829d6b3a7a0936c080551eea5edda6a",
"score": "0.60261405",
"text": "def get_area()\n unless check_keyword?(\"HEIGHT\") and check_keyword?(\"WIDTH\")\n raise \"Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\\n #{output}\"\n end\n return get_keyword_value(\"WIDTH\").to_f * get_keyword_value(\"HEIGHT\").to_f\n end",
"title": ""
},
{
"docid": "67141e4a976b6292f81ff5100e7746d5",
"score": "0.60233825",
"text": "def max x,y\n\t\treturn x if x > y\n\t\treturn y\n\tend",
"title": ""
},
{
"docid": "9c91ccd2dec892323e7d13850673e561",
"score": "0.60159683",
"text": "def coordinate_delta_max\n one_side_terms(:left).map { |term| term.conc / term.count }.min\n end",
"title": ""
},
{
"docid": "c8bdce0ddf509837d8716ab5de3dbc70",
"score": "0.60016036",
"text": "def max\r\n @range.max\r\n end",
"title": ""
},
{
"docid": "8d2595efdfdefe473050d885a977596a",
"score": "0.5999792",
"text": "def max\n return -1 if @count == 0\n return @array[0]\n end",
"title": ""
},
{
"docid": "2feb44391c262c84973dbfae71755374",
"score": "0.5994831",
"text": "def largest_area\n @heights = []\n @positions = []\n @max_size = 0\n\n @temp_pos = nil\n @temp_height = nil\n @temp_size = nil\n\n @store.each_with_index do |height, index|\n if @heights.empty? || height > @heights.last\n @heights.push(height)\n @positions.push(index)\n elsif height < @heights.last\n while !@heights.empty? && height < @heights.last\n pop_stacks(index)\n end\n\n @heights.push(height)\n @positions.push(@temp_pos)\n end\n end\n\n while !@heights.empty?\n pop_stacks(@store.length)\n end\n\n @max_size\n end",
"title": ""
},
{
"docid": "d31669a15daa8fab45ba0b42eaea31ae",
"score": "0.5992609",
"text": "def get_area\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n \n if height == nil || width == nil\n raise \"Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\\n #{output}\"\n end\n \n height = height.to_f\n width = width.to_f\n \n return height * width\n end",
"title": ""
},
{
"docid": "920abec33213978f1492fbbaa13c0bcb",
"score": "0.59880334",
"text": "def get_max_from_neighbours(index)\n get_neighbours(index).max || 0\n end",
"title": ""
},
{
"docid": "9dbcd3647d8ae319d1cbb1a61ee4a1c2",
"score": "0.5984317",
"text": "def max\n max = get(0,0)\n for i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) > max)\n max = get(i,j)\n end\n end\n end\n max\n end",
"title": ""
},
{
"docid": "30ccf716323df4895f28cb3c8950b085",
"score": "0.5975415",
"text": "def max\n node = @root\n while node.right\n node = node.right\n end\n node\n end",
"title": ""
},
{
"docid": "e8e933e9dc3d58bab61196ff832032ec",
"score": "0.59746015",
"text": "def max\n MSPhysics::Newton::Hinge.get_max(@address)\n end",
"title": ""
},
{
"docid": "fd4fa4d46e7dbd99a29271d7dfff1db2",
"score": "0.59738755",
"text": "def max_polygons\n max = \"\\0\" * SIZEOF_INT\n FMOD.invoke(:Geometry_GetMaxPolygons, self, max, nil)\n max.unpack1('l')\n end",
"title": ""
},
{
"docid": "45da35e73d8d7da438ea80af1070b387",
"score": "0.5971813",
"text": "def find_max()\r\n self.max\r\n end",
"title": ""
},
{
"docid": "d3be266e845883ed3b1f35585a148ea6",
"score": "0.5964262",
"text": "def maximum(node = @root)\n maximus = node\n maximus = maximus.right until maximus.right.nil?\n maximus\n end",
"title": ""
},
{
"docid": "a46969d5585df1810a4b64626b89cf0a",
"score": "0.59558564",
"text": "def highest_hexagon_number\n return hn_from_hcl(maxcol - 1, maxlin - 1)\n end",
"title": ""
},
{
"docid": "0e0938654a0a01376abb306f3f2622be",
"score": "0.59553033",
"text": "def maximum(tree_node = @root)\n return maximum(tree_node.right) if tree_node.right\n return tree_node\n end",
"title": ""
},
{
"docid": "db8cb174c626e3c9f29620df6a0c1aae",
"score": "0.59526944",
"text": "def find_max_locator\n return nil if empty?\n use_max\n mode_call(:find_max_loc)\n end",
"title": ""
},
{
"docid": "a0ff71f42ab439db37708c6e1c03d875",
"score": "0.59522164",
"text": "def get_area()\n @space.get_area()\n end",
"title": ""
},
{
"docid": "3f1d3e6e6871ce7de385c5b9684f4bb5",
"score": "0.59505236",
"text": "def maxpos\n v, opts = max x: true, y: true\n x = opts[\"x\"]\n y = opts[\"y\"]\n [v, x, y]\n end",
"title": ""
},
{
"docid": "b906b5dd3e9453a2000ec371a7910291",
"score": "0.5939846",
"text": "def max \n if max_element.kind_of? Array\n max_element.first\n else\n max_element\n end\n end",
"title": ""
},
{
"docid": "a2e5c3ffcfcbdfb0d3c114238469963d",
"score": "0.59277314",
"text": "def get_area\n\n # get the keyword value of shape\n shape = get_keyword_value(\"SHAPE\")\n\n # if the shape value is nil, or it is defined as \"NO-SHAPE\", the get_area value\n # would be defined, and would represent the get_area of the space\n if ( shape == nil || shape == \"NO-SHAPE\")\n area = get_keyword_value(\"AREA\")\n area = area.to_f\n return area\n\n # if the shape value is \"BOX\", the height and width key values are given,\n # and the get_area would be defined as their product\n elsif ( shape == \"BOX\" )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n\n # if the shape value is defined as a polygon , the get_area of the polygon would\n # represent the get_area of the space\n elsif ( shape == \"POLYGON\")\n return @polygon.get_area\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n\n end\n end",
"title": ""
},
{
"docid": "0c19864d4267b719cebc5c3c8e470f6f",
"score": "0.5927635",
"text": "def max_latitude\n query_root_node(\"fao:hasMaxLatitude/text()\", @@NAMESPACES).to_s\n end",
"title": ""
},
{
"docid": "aa6917a9f4522b41692979209eef8d9f",
"score": "0.59141713",
"text": "def get_max()\n end",
"title": ""
},
{
"docid": "17399d1e92161b3c21283da11f1460c6",
"score": "0.5911008",
"text": "def maxvalue\n MAXVALUE\n end",
"title": ""
},
{
"docid": "f605c36a09c3e59dc2e588ee459a2289",
"score": "0.59012055",
"text": "def get_area()\n OpenStudio::getArea(self.get_3d_polygon())\n end",
"title": ""
},
{
"docid": "0823fa2e66606e65045effd3595570d8",
"score": "0.58744884",
"text": "def odb_max\n \"max(#{to_s})\"\n end",
"title": ""
},
{
"docid": "5b5cf25ebdc045f1b644fc5a424c7cb5",
"score": "0.58738065",
"text": "def get_max\n @max ||= calculate_max\n end",
"title": ""
},
{
"docid": "60c52ab33ae8cf1d92f1b84efda0f99d",
"score": "0.5873718",
"text": "def maximum(tree_node = @root)\n\t\t\t\t\treturn tree_node.right ? maximum(tree_node.right) : tree_node\n end",
"title": ""
},
{
"docid": "5ed0798eb1baf71b3dd57196a63cbd08",
"score": "0.5872613",
"text": "def get_max\n @max\n end",
"title": ""
},
{
"docid": "4ede869fdf050c4a742f6f86ac0126a2",
"score": "0.58720815",
"text": "def max\n @max ||= define_min_and_max && @max\n end",
"title": ""
},
{
"docid": "dd94f69bb70d8c94b11b4336ba6b432b",
"score": "0.5870777",
"text": "def maximum(tree_node = @root)\n max_node = tree_node\n while max_node.right != nil\n max_node = max_node.right\n end\n max_node\n end",
"title": ""
},
{
"docid": "0ec95057738a1c2b85f0e8d5f0073157",
"score": "0.5870056",
"text": "def max_index(*x, &block)\n x.index(max(*x, &block))\n end",
"title": ""
},
{
"docid": "d4f045ba7d10d6bdd2ffaca96081a438",
"score": "0.5869614",
"text": "def maxy\n main.maxy\n end",
"title": ""
},
{
"docid": "26e694b27d5a3d5ec99fb10d493aae22",
"score": "0.585778",
"text": "def maxValuePosition(arr)\n return max_value_position_helper(arr, 0, max_index = 0)\nend",
"title": ""
},
{
"docid": "06f3658a3a770a47caecd569f21776d0",
"score": "0.5857077",
"text": "def max\n @data[0]\n end",
"title": ""
},
{
"docid": "8f4287df74972fd11008966c33fdd7de",
"score": "0.5856044",
"text": "def max\n data.max\n end",
"title": ""
},
{
"docid": "b45fba45d5521787e11806a842bdd180",
"score": "0.58559245",
"text": "def area\n GeographicItem.where(id:).select(\"ST_Area(#{GeographicItem::GEOGRAPHY_SQL}, false) as area_in_meters\").first['area_in_meters']\n end",
"title": ""
},
{
"docid": "66850c51b1cba5255e6ffc02150c7af1",
"score": "0.5855124",
"text": "def find_max_value(array)\n array.max \nend",
"title": ""
},
{
"docid": "f380f759bf8f12ddcedf914e3d613300",
"score": "0.5850871",
"text": "def find_max_value(array)\n return array.max\nend",
"title": ""
},
{
"docid": "ad4572a0e45a28fbde4c1c91e3f1d77e",
"score": "0.58506083",
"text": "def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend",
"title": ""
},
{
"docid": "1ee090bf58b2f323015c619d611f9c4e",
"score": "0.58430773",
"text": "def maximum(node = @root)\n if node.right\n max_node = maximum(node.right)\n else\n max_node = node\n end\n\n max_node\n end",
"title": ""
},
{
"docid": "0a858927d309d23ea8ced0db42aac4e3",
"score": "0.5840275",
"text": "def find_max_value (array)\n array.max # Add your solution here\nend",
"title": ""
},
{
"docid": "6dc2ce7f950df485190e0171d236b70b",
"score": "0.58297974",
"text": "def area\n popolo.areas.find_by(id: area_id)\n end",
"title": ""
},
{
"docid": "03f2392ecea406c95511b4cba81d1895",
"score": "0.58290374",
"text": "def maximum(tree_node = @root)\n BinarySearchTree.max(tree_node)\n end",
"title": ""
},
{
"docid": "ddca7a89c26e4d0c9a23eff83e66f054",
"score": "0.58234555",
"text": "def max_level\n\t\t\t[to_level(@raw_width), to_level(@raw_height)].max\n\t\tend",
"title": ""
},
{
"docid": "db0749c7f25f7adad52a0da15c248955",
"score": "0.5821681",
"text": "def find_max_upper_dia(matrix, x, y, count)\n if count > 4\n return 1\n end\n\n return safe_access(x, y, matrix) * find_max_upper_dia(matrix, x+1, y-1, count+1)\nend",
"title": ""
},
{
"docid": "99c81c3e1054be378664796d0ba4fc78",
"score": "0.5817753",
"text": "def largest_value\n values.max\n end",
"title": ""
},
{
"docid": "541eb6882483b0f834d5ecbad0914930",
"score": "0.5795479",
"text": "def max_area_brute(heights)\n max_area = 0\n\n (0..heights.length - 1).each do |i|\n ((i + 1)..heights.length - 1).each do |j|\n min_height = [heights[i], heights[j]].min\n\n local_area = min_height * (j - i)\n max_area = [max_area, local_area].max\n end\n end\n\n max_area\nend",
"title": ""
},
{
"docid": "84184007f25fd7527e26152942412105",
"score": "0.5793339",
"text": "def maximum(tree_node = @root)\n tree_node.right ? maximum(tree_node.right) : tree_node\n end",
"title": ""
},
{
"docid": "84184007f25fd7527e26152942412105",
"score": "0.5793339",
"text": "def maximum(tree_node = @root)\n tree_node.right ? maximum(tree_node.right) : tree_node\n end",
"title": ""
},
{
"docid": "ac3a30f8e6f2f001565bc0634d6a2909",
"score": "0.57901394",
"text": "def max\n @range.end\n end",
"title": ""
},
{
"docid": "f1b7163f4a98d9ceaca24973e2633741",
"score": "0.5784317",
"text": "def maximum(tree_node = @root)\n return tree_node unless tree_node.right\n return maximum(tree_node.right) if tree_node.right\n end",
"title": ""
},
{
"docid": "eef100a1543202a0404aa7085781db9d",
"score": "0.57800865",
"text": "def get_area\n openstudio::getArea(@points_list)\n end",
"title": ""
},
{
"docid": "685dc628d46badb06d86afa22fd0a91a",
"score": "0.57756376",
"text": "def get_max\n return if is_empty?\n return @root.val\n end",
"title": ""
},
{
"docid": "2f08799264c3e9d1441ed58a086c7af5",
"score": "0.5775441",
"text": "def greatest(aofa, dx, dy)\n\t\n\tylen = aofa.length - 3\n\txlen = aofa[0].length - 3\n\t\n\tif((dx == 1) and (dy == 0)) \n\t\txmin = 0\n\t\txmax = xlen - 3\n\t\tymin = 0\n\t\tymax = ylen\n\telsif ((dx == 0) and (dy == 1))\n\t\txmin = 0\n\t\txmax = xlen \n\t\tymin = 0\n\t\tymax = ylen-3\n\telse \n\t\txmin = 0\n\t\txmax = xlen -3\n\t\tymin = 3\n\t\tymax = ylen\n\tend\n\t\n\tgreatest = 0\n\ti = ymin\n\t\n\twhile i < ymax\n\t\tj = xmin\n\t\twhile j < xmax\n\t\t\tif greatest < aofa[i][j]*aofa[i+dy][j+dx]*aofa[i+2*dy][j+2*dx]*aofa[i+3*dy][j+3*dx] then\n\t\t\t\tgreatest = aofa[i][j]*aofa[i+dy][j+dx]*aofa[i+2*dy][j+2*dx]*aofa[i+3*dy][j+3*dx]\n\t\t\t\t#puts greatest\n\t\t\tend\n #print \"i = \",i,\", j = \",j,\"\\n\"\n\t\tj = j + 1\n\t\tend\n\t\ti = i + 1\n\tend\n\t\t\n\treturn greatest\n\t\nend",
"title": ""
},
{
"docid": "0e4e880994eb6fcb7aab55bc077a306d",
"score": "0.57730955",
"text": "def max(x, y)\n if x > y\n return x\n else\n return y\n end\nend",
"title": ""
},
{
"docid": "5d1ccbbd71fa2418fc836367fa63d3f2",
"score": "0.57714677",
"text": "def maximum(tree_node = @root)\n return nil if tree_node.nil?\n return maximum(tree_node.right) if tree_node.right\n tree_node\n end",
"title": ""
},
{
"docid": "4915c8b14aafca1a3018fea0e798f20c",
"score": "0.5769929",
"text": "def max\n cells.compact.max\n end",
"title": ""
},
{
"docid": "b609e88f0c0ebd95db2a9635acf69e04",
"score": "0.5768201",
"text": "def max; end",
"title": ""
},
{
"docid": "b609e88f0c0ebd95db2a9635acf69e04",
"score": "0.5768201",
"text": "def max; end",
"title": ""
},
{
"docid": "9ad546901746f59d73cea5ce92f9d474",
"score": "0.57650554",
"text": "def max\n [self.begin, self.end].max\n end",
"title": ""
},
{
"docid": "aa011e61f5a2b41c0c7f27d6d7516f85",
"score": "0.5764917",
"text": "def maximal_square(a)\n\treturn 0 if a.size == 0 || a == nil\n\trows = a.size\n\tcols = a[0].size\n\tlargest = 0\n\tdp = Array.new(rows+1) { Array.new(cols+1) }\n\tfor i in 0..rows do\n\t\tfor j in 0..cols do\n\t\t\t# Initialize first row and column of matrix with 0\n\t\t\tif i==0 || j==0\n\t\t\t\tdp[i][j] = 0 \n\t\t\t# If matrix cell value for specific row and cell is 1, take minimum of left, right, diagonal and add 1.\n\t\t\t# As all these 3 directions should be checked and must contain 1. Store it to dp corresponding cell.\n\t\t\t# Keep track of largest matrix by comparing with dp cell value.\n\t\t\telsif a[i-1][j-1] == '1'\n\t\t\t\tdp[i][j] = [ dp[i-1][j], dp[i][j-1], dp[i-1][j-1] ].min + 1\n\t\t\t\tlargest = dp[i][j] if dp[i][j] > largest\n\t\t\t# If element equals 0 then put 0 in dp corresponding cell\n\t\t\telse\n\t\t\t\tdp[i][j] = 0\n\t\t\tend\t\n\t\tend\t\n\tend\t\n\treturn (largest*largest) # Return area by multiplying largest element to itself.\nend",
"title": ""
},
{
"docid": "c87f0cad1f556758dec6c0e72d563e98",
"score": "0.5760058",
"text": "def max_index\n self.to_a.index(max_element)\n end",
"title": ""
},
{
"docid": "2fe86914c11f098f5bcc871c702af511",
"score": "0.57562196",
"text": "def maximum(tree_node = @root)\n max = tree_node\n until max.right.nil?\n max = max.right\n end\n max\n end",
"title": ""
}
] |
3d1863134f58e683356e76e45a3e0828
|
Adds support for one or more aspects for the given simple function Example: Compass::BrowserSupport.add_support("image", "moz", "webkit") => Adds support for moz and webkit to the image() function. This function can be called one or more times in a compass configuration file in order to add support for new, simple browser functions without waiting for a new compass release.
|
[
{
"docid": "ea7f87dff14fa8e4af2d7182da0bb99d",
"score": "0.81435853",
"text": "def add_support(function, *aspects)\n aspects.each do |aspect|\n unless ASPECTS.include?(aspect)\n Compass::Util.compass_warn \"Unknown support aspect: #{aspect}\"\n next\n end\n unless supports?(function, aspect)\n SIMPLE_FUNCTIONS[function.to_s] ||= []\n SIMPLE_FUNCTIONS[function.to_s] << aspect.to_s\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "14327bdc3c0988b20debe4589207fa8e",
"score": "0.5662177",
"text": "def add_supports\n if !self.supports.empty?\n Railspress::PostsHelper.add_post_type_support(self.name, self.supports)\n self.supports = nil\n elsif false != self.supports\n # Add default features.\n Railspress::PostsHelper.add_post_type_support(self.name, [ 'title', 'editor' ])\n end\n end",
"title": ""
},
{
"docid": "476b0be7733cfafdc3ae5723457db807",
"score": "0.5611265",
"text": "def enable_feature(*features)\n PluginFeatures.enable_feature_for @_plugin_name, *features\n end",
"title": ""
},
{
"docid": "7db0727baf89eb76beac27c515d7fe32",
"score": "0.53755516",
"text": "def support; end",
"title": ""
},
{
"docid": "489f8ad45d932530ad61b5f7e241bd79",
"score": "0.5366644",
"text": "def supports?(feature)\n method_name = \"supports_#{feature}?\"\n if respond_to?(method_name)\n public_send(method_name)\n else\n unsupported_reason_add(feature)\n false\n end\n end",
"title": ""
},
{
"docid": "a7e87d09a7dda3cec8a39bad1abc0f14",
"score": "0.52597857",
"text": "def enable_feature(feature_name)\n feature(feature_name, true)\n end",
"title": ""
},
{
"docid": "987b2188badfb1052a7a86cd6d170854",
"score": "0.5254524",
"text": "def add_active_feature(feature)\n add_feature(feature, true)\n end",
"title": ""
},
{
"docid": "f0340177f712fde179e6ca4ab7afbad7",
"score": "0.52492243",
"text": "def supports(nm, ver=nil) @all_supports << nm ; @all_supports.uniq! ; @all_supports ; end",
"title": ""
},
{
"docid": "333771c9ff74ac70e69f643199a19496",
"score": "0.5244461",
"text": "def enable(name, *args)\n feature(name).enable(*args)\n end",
"title": ""
},
{
"docid": "86266cf07846f7585b0f72cc87af6abc",
"score": "0.5242612",
"text": "def remove_support(function, *aspects)\n aspects.each do |aspect|\n unless ASPECTS.include?(aspect)\n Compass::Util.compass_warn \"Unknown support aspect: #{aspect}\"\n next\n end\n SIMPLE_FUNCTIONS[function.to_s].reject!{|a| a == aspect.to_s}\n end\n end",
"title": ""
},
{
"docid": "938aec0d836b5da6f0f94c24bc851de2",
"score": "0.52346444",
"text": "def must_support(*args)\n\t\targs.each do |method|\n\t\t\tunless respond_to? method\n\t\t\t\traise ArgumentError, %{Must support \"#{method}\"}\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "80de82d79c6f360b7244c27a884d03af",
"score": "0.5234447",
"text": "def supports?(feature)\n method_name = \"supports_#{feature}?\"\n if respond_to?(method_name)\n public_send(method_name)\n else\n unsupported_reason_add(feature)\n false\n end\n end",
"title": ""
},
{
"docid": "9887d1a91f89cc66462156d1faf43c21",
"score": "0.523312",
"text": "def supports?(feature)\n self.class.included_modules.first.supports? feature\n end",
"title": ""
},
{
"docid": "3c7473f11b35f6cc16add9b3d2c57952",
"score": "0.5192489",
"text": "def enable(thing)\n add_feature_to_set\n end",
"title": ""
},
{
"docid": "e35db4994a26d164a3f511e9f1f02177",
"score": "0.51649624",
"text": "def supports?(feature)\n adapter.supports? feature\n end",
"title": ""
},
{
"docid": "f2f9c8fd169c697f9aa05420e748ad2c",
"score": "0.51312864",
"text": "def has_feature?(feature_name); end",
"title": ""
},
{
"docid": "4e13730a2023c01a12d9a254eb29ccc2",
"score": "0.5100002",
"text": "def append_features(mod)\n `Red.donateMethodsToSingleton(this,mod)`\n `Red.donateMethodsToClass(this.prototype,mod.prototype)`\n return `mod`\n end",
"title": ""
},
{
"docid": "89b61d1d42362492df57aa63b5924fe3",
"score": "0.50940275",
"text": "def add_feature(feature_name)\n unless feature_name[0] == ?-\n raise ArgumentError.new(\"Plugin feature names must begin with a dash\")\n end\n KNOWN_FEATURES << feature_name\n end",
"title": ""
},
{
"docid": "43e7a93ea1cfddf2c1687e916d2aa699",
"score": "0.50740856",
"text": "def add(feature)\n verbose_info \"Adding #{feature.inspect}\"\n aixm.features << feature\n end",
"title": ""
},
{
"docid": "672613ee3ce6cdd40653a745438f331a",
"score": "0.50315034",
"text": "def support(functions)\n\t\t\tlist_profiles(:actuator).merge(list_profiles(:sensor)).select { |name, profile|\n\t\t\t\tfunctions.include? profile[:function]\n\t\t\t}.keys\n\t\tend",
"title": ""
},
{
"docid": "093f4aea8f6918a8e2398c1e8905badd",
"score": "0.5015864",
"text": "def enable\n feature_name = args.shift.downcase rescue nil\n fail(\"Usage: heroku labs:enable feature\") if feature_name.to_s.strip.empty?\n action(\"Enabling #{feature_name} for #{app}\") do\n heroku.enable_feature(app, feature_name)\n end\n end",
"title": ""
},
{
"docid": "66aa8d6a1775ddd4afb04ded12594c7b",
"score": "0.49714768",
"text": "def supports\n @supports ||= {}\n end",
"title": ""
},
{
"docid": "85624a474d8cb26d6b6231710d21c1f6",
"score": "0.49693555",
"text": "def enable\n feature_name = shift_argument\n error \"Usage: heroku labs:enable FEATURE\\nMust specify FEATURE to enable.\" unless feature_name\n validate_arguments!\n\n feature = api.get_features.body.detect { |f| f[\"name\"] == feature_name }\n message = \"Enabling #{feature_name} \"\n\n error \"No such feature: #{feature_name}\" unless feature\n\n if feature[\"kind\"] == \"user\"\n message += \"for #{Heroku::Auth.user}\"\n else\n error \"Must specify an app\" unless app\n message += \"for #{app}\"\n end\n\n feature_data = action(message) do\n api.post_feature(feature_name, app).body\n end\n\n display \"WARNING: This feature is experimental and may change or be removed without notice.\"\n display \"For more information see: #{feature_data[\"docs\"]}\" if feature_data[\"docs\"]\n end",
"title": ""
},
{
"docid": "2de4717a08390c0be7210b261237bd57",
"score": "0.49426496",
"text": "def enable\n unless feature_name = shift_argument\n error(\"Usage: heroku labs:enable FEATURE\\nMust specify FEATURE to enable.\")\n end\n validate_arguments!\n\n message = \"Enabling #{feature_name}\"\n message += \" for #{app}\" if app\n feature_data = nil\n action(message) do\n feature_data = api.post_feature(feature_name, app).body\n end\n display(\"WARNING: This feature is experimental and may change or be removed without notice.\")\n display(\"For more information see: #{feature_data['docs']}\")\n end",
"title": ""
},
{
"docid": "258a76671a6673d29a309d0f7e86764e",
"score": "0.49355647",
"text": "def supports?\n raise \"Method 'supports?' must be defined\"\n end",
"title": ""
},
{
"docid": "258a76671a6673d29a309d0f7e86764e",
"score": "0.49355647",
"text": "def supports?\n raise \"Method 'supports?' must be defined\"\n end",
"title": ""
},
{
"docid": "46a33ef85448900e1292a7e3a40bacc0",
"score": "0.4932753",
"text": "def include_additions\n #the following looks like could have performance issues, but the tests don't take any longer to execute...\n potential_addition = Bewildr::ControlTypeAdditions.submodules.select {|mod| mod.name.bewildr_demodulize == \"#{@control_type.to_s.bewildr_classify}Additions\"}.first\n extend potential_addition unless potential_addition.nil?\n\n #non-standards - move this to another method in the near future\n extend Bewildr::ControlTypeAdditions::TextAdditions if @control_type == :hyperlink\n\n #add scrolling capability if relevant - TODO: this ugliness will be fixed later\n if @automation_element.get_supported_patterns.collect {|pattern| pattern.programmatic_name.to_s }.include?(\"ScrollPatternIdentifiers.Pattern\")\n extend Bewildr::ControlTypeAdditions::ScrollAdditions\n end\n end",
"title": ""
},
{
"docid": "2a3af3671c36505b3f3b4f3ecef3aced",
"score": "0.4917392",
"text": "def add_specs(*gem_specs); end",
"title": ""
},
{
"docid": "bddb10924f3da67bde82596cb864797a",
"score": "0.49145812",
"text": "def supports?(feature)\n self.send(:class_variable_get, :@@features)[feature] == true\n end",
"title": ""
},
{
"docid": "bddb10924f3da67bde82596cb864797a",
"score": "0.49145812",
"text": "def supports?(feature)\n self.send(:class_variable_get, :@@features)[feature] == true\n end",
"title": ""
},
{
"docid": "ab7ccbef99b0b5b977507c9fb383f111",
"score": "0.4906522",
"text": "def supports?(feature)\n singleton_class.included_modules.first.supports? feature\n end",
"title": ""
},
{
"docid": "a964e07175c3bc72b8e782c168239b18",
"score": "0.49056253",
"text": "def allow_registration method\n @dynamic_capabilities.add method\n end",
"title": ""
},
{
"docid": "029ebe6bd57b1297795b0569b91204ab",
"score": "0.48784554",
"text": "def supports?(feature)\n case feature.to_sym\n when :list_terms then true\n when :rdfstar then true\n when :snapshots then false\n else super\n end\n end",
"title": ""
},
{
"docid": "6c45d8134cf1061873ba6569f7782235",
"score": "0.48750582",
"text": "def supports?(feature)\n class_variable_get(:@@features)[feature] == true\n end",
"title": ""
},
{
"docid": "dd53e5a665b984d4e77577073b273368",
"score": "0.48688266",
"text": "def add(_feature, _matching_value)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "586b97d7f70d5742b09b3931140bea2d",
"score": "0.48646167",
"text": "def enable\n feature_name = shift_argument\n error \"Usage: heroku features:enable FEATURE\\nMust specify FEATURE to enable.\" unless feature_name\n validate_arguments!\n\n feature = api.get_features.body.detect { |f| f[\"name\"] == feature_name }\n message = \"Enabling #{feature_name} \"\n\n error \"No such feature: #{feature_name}\" unless feature\n\n if feature[\"kind\"] == \"user\"\n message += \"for #{Heroku::Auth.user}\"\n else\n error \"Must specify an app\" unless app\n message += \"for #{app}\"\n end\n\n feature_data = action(message) do\n api.post_feature(feature_name, app).body\n end\n\n display \"For more information see: #{feature_data[\"docs\"]}\" if feature_data[\"docs\"]\n end",
"title": ""
},
{
"docid": "5d00136f65ff0259a296ddce80a9d06a",
"score": "0.484358",
"text": "def enabled_features(_value = true)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5d30bd3bbecf5de00ee2846d92e28fc6",
"score": "0.48266646",
"text": "def register(_feature, _matching_value = true)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b027a0e4aba7aec676b4c51d0c10144b",
"score": "0.4798165",
"text": "def add_feature(file)\n full_path = File.expand_path(file)\n\n if find_in_load_path(full_path) || File.exist?(full_path)\n add_extra_feature(full_path)\n end\n end",
"title": ""
},
{
"docid": "1a0d597c3723089899f9ffdaa31bf8ec",
"score": "0.4742521",
"text": "def supports?(name)\n @capabilities.synchronize { @capabilities.include?(name) }\n end",
"title": ""
},
{
"docid": "5bcf2c0c83ef2468642336396b02ddf8",
"score": "0.4739812",
"text": "def enable_feature_for(plugin, *raw_features)\n PluginList.find_plugin! plugin\n _resolve_features(plugin, raw_features).each do |feature|\n f = self.features[plugin][feature]\n next if f.enabled?\n f.enable\n end\n end",
"title": ""
},
{
"docid": "c0d64d1c3e3d2d87e3556608e47a642c",
"score": "0.47226515",
"text": "def before_features(*args);end",
"title": ""
},
{
"docid": "890be291d2ad6927bb72d904a708046e",
"score": "0.47172785",
"text": "def prefixed(prefix, *args)\n aspect = prefix.value.sub(/^-/,\"\")\n needed = args.any?{|a| a.respond_to?(:supports?) && a.supports?(aspect)}\n Sass::Script::Bool.new(needed)\n end",
"title": ""
},
{
"docid": "d612fb48206a15c3f7ee9beb8940b397",
"score": "0.47101215",
"text": "def apply_define(magick, options); end",
"title": ""
},
{
"docid": "0b7fd19582ea6ece95280fa94a2f624e",
"score": "0.4707566",
"text": "def supports?(feature)\n case feature.to_sym\n when :context then true\n else super\n end\n end",
"title": ""
},
{
"docid": "0fbebfe8d27f8fd26b638bacba706b4d",
"score": "0.47029766",
"text": "def feature(feature_name, enabled = true) \n @features[feature_name.to_sym] = enabled\n end",
"title": ""
},
{
"docid": "190f2eb4b433f4462ad93dd965b76df4",
"score": "0.469014",
"text": "def enable(feature)\n create_or_update_feature_flags(feature.to_sym => true)\n end",
"title": ""
},
{
"docid": "a334c301cab725435194773692f4bdec",
"score": "0.46817657",
"text": "def supports\n [String]\n end",
"title": ""
},
{
"docid": "b682fdfa02c3074d19a06f39e5a88476",
"score": "0.46757105",
"text": "def add_gesture_recognizer_helper(recognizer, enableInteraction, proc)\n setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled\n self.addGestureRecognizer(recognizer)\n\n @recognizers = {} unless @recognizers\n @recognizers[recognizer] = proc\n\n recognizer\n end",
"title": ""
},
{
"docid": "e8222c6d61dbcb19f910acc8aa71d44f",
"score": "0.46719733",
"text": "def offer_feature?(name) # :doc:\n respond_to?(name)\n end",
"title": ""
},
{
"docid": "775f0e69e78c117bff323ca54fa14572",
"score": "0.46568376",
"text": "def addGestureRecognizerHelper(proc, enableInteraction, recognizer)\n setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled\n self.addGestureRecognizer(recognizer)\n @recognizers = {} unless @recognizers\n @recognizers[\"#{proc}\"] = proc\n end",
"title": ""
},
{
"docid": "775f0e69e78c117bff323ca54fa14572",
"score": "0.46568376",
"text": "def addGestureRecognizerHelper(proc, enableInteraction, recognizer)\n setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled\n self.addGestureRecognizer(recognizer)\n @recognizers = {} unless @recognizers\n @recognizers[\"#{proc}\"] = proc\n end",
"title": ""
},
{
"docid": "32766b1e2990959769e46f80ffae5a10",
"score": "0.4653744",
"text": "def add_active_feature(feature)\n check_feature_is_not_symbol(feature)\n check_feature_already_in_list(feature)\n @active_features << feature\n end",
"title": ""
},
{
"docid": "94e4f587a0e44a134342ff8052d50569",
"score": "0.4648064",
"text": "def add_feature(feature)\n if feature.kind_of? Feature\n @features << feature\n else\n @features << Feature.new(feature.to_s)\n end\n end",
"title": ""
},
{
"docid": "528eebf8bf87323672e22450e03ad41e",
"score": "0.46440122",
"text": "def prepare_support; end",
"title": ""
},
{
"docid": "9c49824b03d936b85e7ab420c2e55a6d",
"score": "0.4636195",
"text": "def extension_strategy\n mixin? ? '@include ' : '@extend %'\n end",
"title": ""
},
{
"docid": "9bb2901126f2329efc39f76c6a45c429",
"score": "0.46337265",
"text": "def extension_elidable?(feature); end",
"title": ""
},
{
"docid": "a86fafc1b112612569e66a614bbb2d86",
"score": "0.4626495",
"text": "def add(options = {})\n self.options = options\n\n raise(ArgumentError, 'Mandatory param :name missing') unless options[:name]\n\n if options[:feature]\n features << options\n SafetyCone::ViewHelpers.add_method(options[:feature])\n else\n paths[make_key] = options\n end\n end",
"title": ""
},
{
"docid": "d2b34f5ae6e4f6e791e7c09548f79a62",
"score": "0.462367",
"text": "def enable(capability)\n\t\t\t@caps[:effective].add(capability)\n\t\t\t@caps[:permitted].add(capability)\n\t\t\t@caps[:inheritable].add(capability)\n\t\t\tsave\n\t\tend",
"title": ""
},
{
"docid": "540a377973aa4a6fbaa6923153484928",
"score": "0.4617003",
"text": "def add_features(features)\n features.each { |feature|\n add_feature(feature)\n }\n end",
"title": ""
},
{
"docid": "4334613dfe05b14652250e1152fa0e30",
"score": "0.4613125",
"text": "def set_feature!(name, enabled)\n if enabled\n enable_feature!(name)\n else\n disable_feature!(name)\n end\n end",
"title": ""
},
{
"docid": "259b43e0456c2a8398da87ab84a877ca",
"score": "0.46128464",
"text": "def add_gesture_recognizer_helper(recognizer, enableInteraction, proc)\n setUserInteractionEnabled true if enableInteraction && !isUserInteractionEnabled\n self.addGestureRecognizer(recognizer)\n\n @recognizers = {} unless @recognizers\n @recognizers[recognizer] = proc\n\n recognizer\n end",
"title": ""
},
{
"docid": "1936c57cd08a2b750d6a4e766b5df351",
"score": "0.46034622",
"text": "def test_isSupported12\n features = []\n features << \"Core\"\n features << \"XML\"\n features << \"HTML\"\n features << \"Views\"\n features << \"StyleSheets\"\n features << \"CSS\"\n features << \"CSS2\"\n features << \"Events\"\n features << \"UIEvents\"\n features << \"MouseEvents\"\n features << \"MutationEvents\"\n features << \"HTMLEvents\"\n features << \"Range\"\n features << \"Traversal\"\n features << \"bogus.bogus.bogus\"\n \n doc = nil\n rootNode = nil\n featureElement = nil\n state = nil\n doc = load_document(\"staff\", false)\n rootNode = doc.documentElement()\n state = rootNode.isSupported(\"Core\", \"2.0\")\n assertTrue(\"Core2\", state)\n indexid35967357 = 0\n while (indexid35967357 < features.size())\n featureElement = features.get(indexid35967357)\n state = rootNode.isSupported(featureElement, \"1.0\")\n indexid35967357 += 1\n end\n indexid36022572 = 0\n while (indexid36022572 < features.size())\n featureElement = features.get(indexid36022572)\n state = rootNode.isSupported(featureElement, \"2.0\")\n indexid36022572 += 1\n end\n \n end",
"title": ""
},
{
"docid": "0d1917c3885ff17f930fa01336cf3e71",
"score": "0.45996594",
"text": "def add_extensions(*extensions); end",
"title": ""
},
{
"docid": "9a24dc39d7ecff21baf6686d9a2a8ba4",
"score": "0.45933262",
"text": "def add_support_load_paths\n end",
"title": ""
},
{
"docid": "b4eb84f3b0fa18666936d5968fce8231",
"score": "0.45923978",
"text": "def add_user_abilities!; end",
"title": ""
},
{
"docid": "9a24dc39d7ecff21baf6686d9a2a8ba4",
"score": "0.4591076",
"text": "def add_support_load_paths\n end",
"title": ""
},
{
"docid": "15a1aaea616d05a60b3a1ee94d0d032d",
"score": "0.458598",
"text": "def support param, default = nil\n param.upcase!\n\n @isupport.has_key?(param) ? @isupport[param] : default\n end",
"title": ""
},
{
"docid": "c9ff3f3f86b30e82b2299a03535591a8",
"score": "0.45784333",
"text": "def rech_bonus?; has_feature?(:esper_recharger); end",
"title": ""
},
{
"docid": "7ff034c6177c8d5c8f122f90522b77f4",
"score": "0.4577832",
"text": "def supports!(key, value)\n unless supports?(key) == value\n Chef::Log.info \"#{self} changing support value #{key} to #{value}\"\n new_resource.send(\"support_#{key}\", value)\n end\n end",
"title": ""
},
{
"docid": "d8b085cce423e424293c2fa4fcece96a",
"score": "0.45668393",
"text": "def apply_feature(name)\n applied_features << name.to_sym\n end",
"title": ""
},
{
"docid": "d7d03511cb98e563256467e0e16e2287",
"score": "0.45610633",
"text": "def append_features(base)\n if base.instance_variable_defined?(\"@_dependencies\")\n base.instance_variable_get(\"@_dependencies\") << self\n return false\n else\n return false if base < self\n @_dependencies.each { |dep| base.send(:include, dep) }\n super\n base.extend const_get(\"ClassMethods\") if const_defined?(\"ClassMethods\")\n base.send :include, const_get(\"InstanceMethods\") if const_defined?(\"InstanceMethods\")\n base.class_eval(&@_included_block) if instance_variable_defined?(\"@_included_block\")\n end\n end",
"title": ""
},
{
"docid": "12ae908b64aa1cfc65f83ddffabb0bf2",
"score": "0.45515907",
"text": "def add_developer_abilities!; end",
"title": ""
},
{
"docid": "797fea1304bb2a9e6fe32178b9928265",
"score": "0.45488358",
"text": "def save_supports(supports)\n if @supports[supports.name]\n @supports[supports.name].merge(supports)\n else\n @supports[supports.name] = supports\n end\n end",
"title": ""
},
{
"docid": "0bbcb66007cee1291154c78becf0cb09",
"score": "0.45445955",
"text": "def switch!(feature, enabled)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "43466eb75b0354fe4df37b3d261ad19a",
"score": "0.45390025",
"text": "def supports_extensions?; end",
"title": ""
},
{
"docid": "9c6d38cb17220adc17de54607e84d44d",
"score": "0.4538367",
"text": "def capable_of(provider, opts = {})\n @capabilities << GitCapability.new(self, provider, @options.merge(opts))\n end",
"title": ""
},
{
"docid": "416ccd38049ff457b6a28ba22666aba6",
"score": "0.45379254",
"text": "def def_add_method(opts)\n association_module_def(opts.add_method){|o| add_associated_object(opts, o)}\n end",
"title": ""
},
{
"docid": "e28a538071404a090edbaee28b521184",
"score": "0.45368385",
"text": "def add_capabilities(capabilities)\n capabilities.each do | c |\n Log.debug(\"Processing #{c[0]}\")\n e = find(:xpath, \"//label[text() = '#{c[0]}']\")\n e.child[0].check\n end\n save_btn = all(:xpath, \"//input[contains(@value, 'Save Changes')]\")[-1]\n save_btn.click\n end",
"title": ""
},
{
"docid": "c98e4c3b4c575b94e6311854f3f50b86",
"score": "0.45322767",
"text": "def enabled_by_feature?(name = nil)\n if !name\n !!feature\n else\n if feature.class == Array\n feature.each do |f|\n if f == name\n return true\n end\n end\n false\n else\n feature == name\n end\n end\n end",
"title": ""
},
{
"docid": "4bec1f4b89508fabacf39ca1f905b079",
"score": "0.45251924",
"text": "def needs?(feature)\n needs.include?(feature)\n end",
"title": ""
},
{
"docid": "11e8f2500ab88ed540c0875ac5223027",
"score": "0.452119",
"text": "def register_helpers *helpers\n @helpers |= helpers.flatten\n end",
"title": ""
},
{
"docid": "aeac8b4e1cef62c6c7fd476ad4e1ac56",
"score": "0.4518802",
"text": "def add_element(value)\n add_element_support(value)\n end",
"title": ""
},
{
"docid": "dc5187520e2396eeea0d13216488c80f",
"score": "0.4518728",
"text": "def on?(_feature, _value = true)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "0dabcae0ce6b0ddf678195db44cd5c0b",
"score": "0.45184454",
"text": "def enable_by_default(name)\n @default_features << name\n end",
"title": ""
},
{
"docid": "a46a5ab4554058b6b07dc3552a2a7087",
"score": "0.45152065",
"text": "def utility_enable(utility, *packages)\n utility_config = get(utility_key(utility), Hash.new)\n packages.each do |pkg_name|\n utility_config[pkg_name] = true\n end\n set(utility_key(utility), utility_config)\n end",
"title": ""
},
{
"docid": "a46a5ab4554058b6b07dc3552a2a7087",
"score": "0.45152065",
"text": "def utility_enable(utility, *packages)\n utility_config = get(utility_key(utility), Hash.new)\n packages.each do |pkg_name|\n utility_config[pkg_name] = true\n end\n set(utility_key(utility), utility_config)\n end",
"title": ""
},
{
"docid": "e0ccd434067c204de8909cb83569deeb",
"score": "0.45032108",
"text": "def capabilities; end",
"title": ""
},
{
"docid": "e0ccd434067c204de8909cb83569deeb",
"score": "0.45032108",
"text": "def capabilities; end",
"title": ""
},
{
"docid": "e0ccd434067c204de8909cb83569deeb",
"score": "0.45032108",
"text": "def capabilities; end",
"title": ""
},
{
"docid": "bddae70b79f63788b7ad2f8c22f0dfe5",
"score": "0.4503015",
"text": "def append_features(klass)\n unless klass.is_a? Class\n raise IncludingInModuleError, klass\n end\n\n klass.extend(KonstructorMethod)\n end",
"title": ""
},
{
"docid": "e816b5c03a725f0747217ad5359900b2",
"score": "0.45014566",
"text": "def support_require(file)\n require \"support/#{file}\"\nend",
"title": ""
},
{
"docid": "e816b5c03a725f0747217ad5359900b2",
"score": "0.45014566",
"text": "def support_require(file)\n require \"support/#{file}\"\nend",
"title": ""
},
{
"docid": "dd2729ed33eff12b70159253fc6a4a77",
"score": "0.449689",
"text": "def register_callable(modes: {}, header:, verbose: nil, interactive: nil, section: :default, &b)\n modes = modes.map { |m| [m, true] }.to_h if modes.is_a? Array\n super(modes: modes.merge(verbose: verbose, interactive: interactive),\n header: header,\n section: section,\n &b)\n end",
"title": ""
},
{
"docid": "c38e95e18b273e6824e0d4c4314e1df8",
"score": "0.4487958",
"text": "def something(needs, three, arguments)\n 'Yay!'\nend",
"title": ""
},
{
"docid": "4daaa6221572a48289c17c0504255e3a",
"score": "0.4487205",
"text": "def enabled?(name, *args)\n feature(name).enabled?(*args)\n end",
"title": ""
},
{
"docid": "9cc35087e09a0a90a559bec5f8cd289d",
"score": "0.44841745",
"text": "def enable_extension(name); end",
"title": ""
},
{
"docid": "ad87c5643a3ad785e92a126b7017d5aa",
"score": "0.44782203",
"text": "def resolve_with_support(**args); end",
"title": ""
},
{
"docid": "2e5fcc0a73b3a40e8a8a63a1271f33b9",
"score": "0.44754994",
"text": "def supports?(key)\n new_resource.send(\"support_#{key}\")\n end",
"title": ""
},
{
"docid": "7adf92c3205ed574162c2855b867b32b",
"score": "0.4468186",
"text": "def enabled?(feature)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "0b408052efeadc2e6a8eeab2a10db3ad",
"score": "0.44657278",
"text": "def include(mixin)\n if Featurette === mixin\n @_feature.update(mixin)\n end\n super(mixin)\n end",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102
|
Update properties of this object
|
[
{
"docid": "500cd9628bcc2f608f24217b541e4cb7",
"score": "0.0",
"text": "def update!(**args)\n @object_definitions = args[:object_definitions] if args.key?(:object_definitions)\n @operation_ids = args[:operation_ids] if args.key?(:operation_ids)\n end",
"title": ""
}
] |
[
{
"docid": "184b1b1ed771473d3eb9f338c0734c38",
"score": "0.73066413",
"text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end",
"title": ""
},
{
"docid": "5076c5a88404ae72986f958710f5687a",
"score": "0.72631145",
"text": "def update(properties)\n @__hash__.update(properties)\n end",
"title": ""
},
{
"docid": "60506d5995c168a570c84bcbafd6d01b",
"score": "0.7164913",
"text": "def update props\n # not an alias because doc\n put props\n end",
"title": ""
},
{
"docid": "ec25850e7b3d73876b69868b5e566a7a",
"score": "0.71243227",
"text": "def update_properties(hash)\n hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "22938231f10efd60d4530259d1ab7161",
"score": "0.7061904",
"text": "def update_props(properties)\n fail 'not implemented'\n end",
"title": ""
},
{
"docid": "22938231f10efd60d4530259d1ab7161",
"score": "0.7061904",
"text": "def update_props(properties)\n fail 'not implemented'\n end",
"title": ""
},
{
"docid": "150fa2bdc1fc43d28ac45e2278a1f797",
"score": "0.7012263",
"text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"title": ""
},
{
"docid": "b46342a57789464175130c5171865a4f",
"score": "0.69842774",
"text": "def update_properties(props)\n load_properties(force: true)\n\n deep_merge = proc do |_, old_value, new_value|\n if old_value.is_a?(Hash) && new_value.is_a?(Hash)\n old_value.merge(new_value, &deep_merge)\n else\n new_value\n end\n end\n\n props = properties.merge(props || {}, &deep_merge)\n save_properties(properties.merge(props || {}))\n self\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "4aa62f56c7ec71b9c7d914558501001b",
"score": "0.67206186",
"text": "def update\n update_obj\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "b0508d605628b9b1ec78fe5f0697a746",
"score": "0.67057854",
"text": "def update_properties(hash)\n hash.each_pair do |k, v|\n self.set_property_value(k.to_s, v)\n end\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "d9b090f93fdffad34c5489c4c437c6f3",
"score": "0.6662612",
"text": "def update_properties(properties_element)\n end",
"title": ""
},
{
"docid": "b7ed68c679d7eaccf546a282fab6e985",
"score": "0.66259164",
"text": "def apply\n update_keys\n update_columns\n update_properties\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6571848",
"text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6571848",
"text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "862f7aa179e3e1751693f78772c09a99",
"score": "0.65159345",
"text": "def assign_properties(properties); end",
"title": ""
},
{
"docid": "328c68b6c30673dac05ca930f5da533c",
"score": "0.6458067",
"text": "def update_attributes(attrs)\n self.update(attrs)\n end",
"title": ""
},
{
"docid": "328c68b6c30673dac05ca930f5da533c",
"score": "0.6458067",
"text": "def update_attributes(attrs)\n self.update(attrs)\n end",
"title": ""
},
{
"docid": "d8b3bf9ec121e23dad3af2edca6e6094",
"score": "0.6421526",
"text": "def update(attributes); end",
"title": ""
},
{
"docid": "63cce5e99d8dc677403b00708afc27c9",
"score": "0.641709",
"text": "def update\n @prop.update_attributes(prop_params)\n respond_with @prop, location: backstage_scene_props_path\n end",
"title": ""
},
{
"docid": "3dc790e8b6e9e65eb288c97798a4c7f2",
"score": "0.64154994",
"text": "def set_properties inst\n model.properties.find_all { |p| model.updatable?(p.name) }.each do |p|\n inst.send(\"#{p.name}=\".to_sym, params[p.name.to_s]) if params.has_key?(p.name.to_s)\n end\n inst\n end",
"title": ""
},
{
"docid": "9373755ebb61f1f274f6c8504a5acace",
"score": "0.64146614",
"text": "def reload(props = {})\n reset_changes\n super\n assign_attributes(props)\n self\n end",
"title": ""
},
{
"docid": "fb68247cb1373a6c71a42a2aa69f1dcb",
"score": "0.64143723",
"text": "def update(attrs)\n @attrs = attrs\n self\n end",
"title": ""
},
{
"docid": "fb68247cb1373a6c71a42a2aa69f1dcb",
"score": "0.64143723",
"text": "def update(attrs)\n @attrs = attrs\n self\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.6389745",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"title": ""
},
{
"docid": "71d6a0160cffce28db4d0a25d6dbda13",
"score": "0.6385747",
"text": "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "9b95f8bc66f32e7ebbe7e63224d1ebaf",
"score": "0.6364864",
"text": "def update(attributes)\n attributes.each do |name, value|\n self[name] = value\n end\n end",
"title": ""
},
{
"docid": "575f3d0c94f466263e302883e13868a6",
"score": "0.6330631",
"text": "def _update\n update!\n end",
"title": ""
},
{
"docid": "7c6d5966289f9347f75aa7b24903a328",
"score": "0.6327251",
"text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type]))) unless attribute_get(property).nil?\n end\n end\n @attributes[:original][property] = attribute_get(property)\n @dirty[property] = nil\n @attributes[:copied][property] = NOT_SET\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"title": ""
},
{
"docid": "210886bcfd68fae88847f8b3464d4058",
"score": "0.6325362",
"text": "def update_properties!(scraper)\n log \"Updating assets for #{self.slug}\"\n# only update active properties\n Property.where(source_id: self.id, status: 1).find_each do |prop|\n begin\n scraper.update_property(prop)\n rescue Exception => e\n log \"there was a connection error #{e.message} - #{e.class}\"\n end\n end\n end",
"title": ""
},
{
"docid": "da63345424fc9aecef032928485bd149",
"score": "0.6319025",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "749afa4ff068e21c7d78bbad94c19d6c",
"score": "0.6313444",
"text": "def update!(attributes); end",
"title": ""
},
{
"docid": "e8639be61ed6393bc612a8aef27789d3",
"score": "0.6312355",
"text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fields = args[:fields] if args.key?(:fields)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n end",
"title": ""
},
{
"docid": "6284f332cbe8c998b16d5e816c5d21ed",
"score": "0.6291622",
"text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end",
"title": ""
},
{
"docid": "6284f332cbe8c998b16d5e816c5d21ed",
"score": "0.6291622",
"text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end",
"title": ""
},
{
"docid": "5a8e82caac01cee661bc875a5b0cf723",
"score": "0.6283673",
"text": "def refresh\n set_attributes\n end",
"title": ""
},
{
"docid": "9e076ce17f1607b2a6248469b63b9c05",
"score": "0.62797445",
"text": "def training_updated_properties=(value)\n @training_updated_properties = value\n end",
"title": ""
},
{
"docid": "309d8f89c45737b781ca7c15a61b00a5",
"score": "0.6273536",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end",
"title": ""
},
{
"docid": "309d8f89c45737b781ca7c15a61b00a5",
"score": "0.6273536",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "7a41bc9d5a07220fb8626d1fa90d2d79",
"score": "0.62639254",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "afd53a32bf51a2ff3c438cbf011b1ee6",
"score": "0.6261246",
"text": "def update!\n saved = false\n retries = RETRIES\n while !saved\n begin\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n saved = true\n rescue Exception => ex\n raise ex if ex.http_code != 409\n if(retries > 0)\n @new_properties = Persistence::Setup.db.get(@properties['_id'])\n @properties.each_pair do |k,v|\n if k != \"_rev\" && k != \"_id\"\n @new_properties[k] = v\n end\n end\n @properties = @new_properties\n else\n raise ex\n end\n end\n end\n :ok\n end",
"title": ""
},
{
"docid": "118090da310d688caa13dea348732f3c",
"score": "0.62579167",
"text": "def update(attributes={})\n self.class.update(self, attributes)\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.62170374",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.62170374",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "6249943d1eeff63f8f611fcf73254058",
"score": "0.62152076",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "1c12f310aca206a2cefff8c291007668",
"score": "0.6210263",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "3dfb66c3e13f181393bb4510e9fcd51f",
"score": "0.62083745",
"text": "def set_update(attrs = {})\n @movement.attributes = attrs.slice(*attributes_for_update)\n set_details\n\n @movement.balance = get_updated_balance\n @movement.gross_total = original_total\n @movement.set_state_by_balance!\n @movement.discounted = ( discount > 0 )\n\n @movement.balance_inventory = balance_inventory\n @movement.delivered = @movement.details.all? {|v| v.balance <= 0}\n\n @errors.new(movement).set_errors\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6204041",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "5d229ea224b1dfa7ac9ce6808ca63fc4",
"score": "0.62017816",
"text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"title": ""
},
{
"docid": "6992c0833b982296b329ec1d8c7289de",
"score": "0.6201711",
"text": "def update(attributes = {})\n self.attributes = attributes\n _update\n end",
"title": ""
},
{
"docid": "2beb42793217599eea1dac4b91640e41",
"score": "0.6196084",
"text": "def update_attributes\n server_update_data.each_pair do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"title": ""
},
{
"docid": "67f76e6622d1021031437ad609613c63",
"score": "0.6192824",
"text": "def update(obj)\n obj.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n self\n end",
"title": ""
},
{
"docid": "30aa07725af2114280d6e8f916ab079f",
"score": "0.6183338",
"text": "def update!\n\t\t\tconstruct!(self, &@update)\n\t\t\t@update = nil\n\t\t\t\n\t\t\treturn self\n\t\tend",
"title": ""
},
{
"docid": "f1f71f298690a3bd1f5832b15038d8bb",
"score": "0.6174291",
"text": "def updated_properties\n @updated_properties ||= ActiveSupport::HashWithIndifferentAccess.new\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "ed1b58af16fd466e308ffc9229115e36",
"score": "0.6145399",
"text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end",
"title": ""
},
{
"docid": "ed1b58af16fd466e308ffc9229115e36",
"score": "0.6145399",
"text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "7f11aed7030229ef429116ccba78c00f",
"score": "0.61400205",
"text": "def update_properties\n # t_init = 0, t_mod = 0, t_formula = 0, t_formula_mod = 0, t_post_init = 0\n # t_update_properties = Benchmark.measure do\n # Reset values for everything except formulas\n # t_init = Benchmark.measure do\n character_properties.reject { |p| p.is_a?(CharacterFormula) }.each do |p|\n p.init(self)\n end\n # end\n\n # Apply modifiers to attributes, skills and resistances (formulas later)\n mods = []\n # t_mod = Benchmark.measure do\n mods << race.property_modifiers if race\n mods << birthsign.property_modifiers if birthsign\n mods.flatten!\n mods.reject { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # Now start to process formulas\n # t_formula = Benchmark.measure do\n character_properties.select { |p| p.is_a?(CharacterFormula) }.each do |f|\n f.init(self)\n end\n # end\n\n # Apply modifiers to formulas\n # t_formula_mod = Benchmark.measure do\n mods.select { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # t_post_init = Benchmark.measure do\n character_properties.each do |prop|\n prop.post_init(self)\n end\n # end\n # end\n\n # logger.warn(\"## Init: #{(t_init.real*1000).to_i}ms\")\n # logger.warn(\"## Mofifiers: #{(t_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Formula: #{(t_formula.real*1000).to_i}ms\")\n # logger.warn(\"## Formula Modifiers: #{(t_formula_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Post Init: #{(t_post_init.real*1000).to_i}ms\")\n # logger.warn(\"### Update Properties: #{(t_update_properties.real*1000).to_i}ms\")\n end",
"title": ""
},
{
"docid": "22a21a1959eeb926dfe475d8878239d7",
"score": "0.6127356",
"text": "def update\n connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end",
"title": ""
}
] |
03351ededcd1c725301ef793e7dca16f
|
same as task.start in ruby run scripts
|
[
{
"docid": "5d886bc5a7e661b38c6946cd8f0e0209",
"score": "0.6488434",
"text": "def start(task)\n @tasks[task].start\n end",
"title": ""
}
] |
[
{
"docid": "55e60e9378af6047a7ac03c6d784996a",
"score": "0.6991436",
"text": "def startcmd\n [initscript, :start]\n end",
"title": ""
},
{
"docid": "f22e5a1c8afa8b9194cad554d3c30aa2",
"score": "0.6978421",
"text": "def start\n runner.run if options[:all_on_start]\n rescue\n throw :task_has_failed\n end",
"title": ""
},
{
"docid": "524553e5e3dedfc846024527dad311d9",
"score": "0.69467026",
"text": "def start\n _cmd('start')\n end",
"title": ""
},
{
"docid": "dd449a84b67dc381d0962779dba76eba",
"score": "0.6936148",
"text": "def raketask\n task name do\n @script.run\n end\n end",
"title": ""
},
{
"docid": "ce123ef9d6ea87583eb69782164fba12",
"score": "0.688625",
"text": "def run\n name = local_name\n\n notice \"this is a #{name} task\"\n\n services = PowerMitten::Configuration.services_for name\n\n start_services services\n\n trap 'INT' do stop_services end\n trap 'TERM' do stop_services end\n\n @threads.each do |thread|\n thread.join\n end\n end",
"title": ""
},
{
"docid": "0d748a6f68e1878f093cf53d325f4b04",
"score": "0.6882344",
"text": "def start_task(group_t, node_t, opts)\n script_path = opts[:script_path]\n unless package_dir = opts[:package_dir]\n package_dir = File.dirname(script_path)\n script_path = File.basename(script_path)\n end\n unless File.exist?(rake_file = File.join(package_dir, 'Rakefile'))\n error_msg \"Can't find 'Rakefile' in '#{package_dir}'\"\n end\n output = `cd #{package_dir}; env -i rake package 2>&1`\n unless $?.success?\n o = output.split(\"\\n\").join(\"\\n==>\\t\")\n error_msg \"While executing 'rake' \\n==>\\t#{o}\"\n exit(-1)\n end\n unless File.exist?(tar_file = File.join(package_dir, 'build/package.tgz'))\n error_msg \"Can't find '#{tar_file}'\"\n exit(-1)\n end\n pkg_id = \"#{node_t.id}/package\"\n pkg_addr = OmfCommon.comm.broadcast_file(tar_file)\n\n copts = {\n package: pkg_addr,\n script_path: script_path,\n script_args: opts[:args],\n #membership: group_t.address\n membership: group_t.id\n }\n copts[:ruby_version] = opts[:ruby_version] if opts[:ruby_version]\n copts[:automatic_restart] = {active: true} if opts[:automatic_restart]\n node_t.create(:tuhura_task, copts)\nend",
"title": ""
},
{
"docid": "df49e5e18a55b3c3747407ae5736055b",
"score": "0.680377",
"text": "def start_tasks\n end",
"title": ""
},
{
"docid": "df49e5e18a55b3c3747407ae5736055b",
"score": "0.680377",
"text": "def start_tasks\n end",
"title": ""
},
{
"docid": "4b8edbbd47d227a38d15ea3745b1b89d",
"score": "0.68019444",
"text": "def script_start_run(out)\n out.write <<START_RUN\n\n\n # start run and wait until it is finished\n run.start\n run.wait(:progress => true)\n\nSTART_RUN\n end",
"title": ""
},
{
"docid": "f79d059914471adf23ea254eb6d3e21d",
"score": "0.67890006",
"text": "def launch!\n run!\n end",
"title": ""
},
{
"docid": "6b719bacab1059476f6c8db03e139d40",
"score": "0.67518777",
"text": "def start!\n invoke [:start]\n end",
"title": ""
},
{
"docid": "27c132f2aea0901751dd7f207936473a",
"score": "0.6687613",
"text": "def run\n validation\n setup_default\n running!\n process\n rescue => e\n Astute.logger.warn(\"Fail to run task #{@task['type']} #{task_name}\" \\\n \" with error #{e.message} trace: #{e.format_backtrace}\")\n failed!\n end",
"title": ""
},
{
"docid": "a3a42c3ea9d41eadc34b240383802702",
"score": "0.6664201",
"text": "def run\n validation\n setup_default\n running!\n process\n rescue => e\n Astute.logger.warn(\"Fail to run task #{task['type']} #{task_name}\" \\\n \" with error #{e.message} trace: #{e.format_backtrace}\")\n failed!\n end",
"title": ""
},
{
"docid": "dfbf023f8144b026304beabacae8c8c0",
"score": "0.66330224",
"text": "def run\n program :name, 'Jumpstarter'\n program :version, '0.0.1'\n program :description, 'Helps maintain dependencies'\n\n command :start do |c|\n c.syntax = 'Jumpstarter start [options]'\n c.summary = ''\n c.description = ''\n c.example 'description', 'command example'\n c.option '--some-switch', 'Some switch that does something'\n c.action do |args, options|\n Jumpstarter::Runner.setup\n end\n end\n run!\n end",
"title": ""
},
{
"docid": "70e93f0731aab72ebb07ab48bb13a00f",
"score": "0.6616048",
"text": "def start\n descriptor['starts'].each do |task_name|\n create_task(nil, task_name, payload)\n end\n end",
"title": ""
},
{
"docid": "d98c92ecba40cd241b308570eedbfe07",
"score": "0.65809286",
"text": "def run\n handle_options\n\n begin\n here = Dir.pwd\n while ! have_rakefile\n Dir.chdir(\"..\")\n if Dir.pwd == here || @nosearch\n raise \"No Rakefile found (looking for: #{RAKEFILES.join(', ')})\"\n end\n here = Dir.pwd\n $conf[:chdir] = true\n end\n tasks = []\n ARGV.each do |task_name|\n if /^(\\w+)=(.*)/.match(task_name)\n ENV[$1] = $2\n else\n tasks << task_name\n end\n end\n puts \"(in #{Dir.pwd})\" if $conf[:chdir]\n\n load_fileutils\n\n # Execute rakefile code\n #\n # TODO: write load_with_context(file, ctx) mrbgem\n load File.realpath @rakefile\n\n if @show_tasks\n display_tasks\n elsif @show_desc\n display_desc\n elsif @printvar.size != 0\n printvar\n else\n tasks.push(\"default\") if tasks.size == 0\n tasks.each do |task_name|\n MiniRake::Task[task_name].invoke\n end\n end\n rescue Exception => ex\n puts \"#{MiniRake::Meta::NAME} aborted!\"\n puts ex.inspect\n puts ex.backtrace.join(\"\\n\") if $conf[:trace]\n exit 1\n end\n end",
"title": ""
},
{
"docid": "b92fc7c229cb5d0bddbfb6414de659a1",
"score": "0.65576667",
"text": "def start\n bootstrap if bootstrap_neccessary?\n execute( start_command )\n end",
"title": ""
},
{
"docid": "0a01e79bd0489276062888e1c0ffd275",
"score": "0.65315694",
"text": "def start\n puts \"I started!\"\n run_all\n end",
"title": ""
},
{
"docid": "57b8d904dec73a9dfc610ac9609af27e",
"score": "0.6503144",
"text": "def start\n @machine.start\n rescue => e\n Formatter.error e.message\n throw :task_has_failed\n end",
"title": ""
},
{
"docid": "67730d64c3af425da0064010354bba2e",
"score": "0.64990264",
"text": "def java(args, &block)\n RunJavaTask.define_task(args, &block)\nend",
"title": ""
},
{
"docid": "257e581e630d9d68d9bc212cc351f4c0",
"score": "0.6486695",
"text": "def run\n start_subtasks\n end",
"title": ""
},
{
"docid": "3dcada407a82740d04a4d2e98cecc935",
"score": "0.64679754",
"text": "def start\n parse!\n create_paths\n\n execute_command\n end",
"title": ""
},
{
"docid": "60017734e18b2eeb25b0a236a5385538",
"score": "0.6467964",
"text": "def start\n @pid = execute.command :start\n end",
"title": ""
},
{
"docid": "35954d0e7a21cdc23eb4ea98463286d4",
"score": "0.6462652",
"text": "def run\n check_for_active_task\n @task.run(nil)\n end",
"title": ""
},
{
"docid": "35954d0e7a21cdc23eb4ea98463286d4",
"score": "0.6462652",
"text": "def run\n check_for_active_task\n @task.run(nil)\n end",
"title": ""
},
{
"docid": "34580942ae67add42543bd4ce4e32155",
"score": "0.6455075",
"text": "def invoke_task(command, *args); end",
"title": ""
},
{
"docid": "406be5708f97ed27d101795ed8c4beae",
"score": "0.6454721",
"text": "def start(options={})\n self.runner = Runner.run(START, options)\n end",
"title": ""
},
{
"docid": "abe5d13e6ca43be949c4458be432ea4d",
"score": "0.6443201",
"text": "def run\n super\n #\n @logger.info('Running...')\n raise CommandLineError.new('Cannot execute - SingleMode expects a task id') if @task_id.nil?\n # Load the task and execute it!.\n task = load_component(Automation::Component::TaskType, @task_id)\n task.start\n # Update the result of the mode to match the task it executed.\n update_result(task.result)\n end",
"title": ""
},
{
"docid": "9812821dbfa5dac7b2e2fba747a3261f",
"score": "0.6415453",
"text": "def start\n @running = true\n run\n end",
"title": ""
},
{
"docid": "1e6a1aa3f192173ddb9332a18f6354ae",
"score": "0.641361",
"text": "def start\n prepare\n loop { work_one_job }\n end",
"title": ""
},
{
"docid": "253d347b30ec438b578d6a3a1a2fe81d",
"score": "0.64040315",
"text": "def run\n do_run do\n test_script\n end\n end",
"title": ""
},
{
"docid": "ccc46d1b525baec59123a9319e84dcf3",
"score": "0.639186",
"text": "def script\n run do |item|\n script = yield\n script.start item\n script.await\n end\n end",
"title": ""
},
{
"docid": "22435117599ae984d331d8e9396be3a0",
"score": "0.63744086",
"text": "def start\n run_all\n end",
"title": ""
},
{
"docid": "22435117599ae984d331d8e9396be3a0",
"score": "0.63744086",
"text": "def start\n run_all\n end",
"title": ""
},
{
"docid": "22435117599ae984d331d8e9396be3a0",
"score": "0.63744086",
"text": "def start\n run_all\n end",
"title": ""
},
{
"docid": "9ba535532ca3d1e8b9d68532e0f1b205",
"score": "0.6365339",
"text": "def run\n handle_options\n begin\n here = Dir.pwd\n while ! have_rakefile\n Dir.chdir(\"..\")\n if Dir.pwd == here || @nosearch\n fail \"No Rakefile found (looking for: #{RAKEFILES.join(', ')})\"\n end\n here = Dir.pwd\n end\n tasks = []\n ARGV.each do |task_name|\n if /^(\\w+)=(.*)/.match(task_name)\n ENV[$1] = $2\n else\n tasks << task_name\n end\n end\n puts \"(in #{Dir.pwd})\"\n $rakefile = @rakefile\n load @rakefile\n if $show_tasks\n display_tasks\n else\n tasks.push(\"default\") if tasks.size == 0\n tasks.each do |task_name|\n MiniRake::Task[task_name].invoke\n end\n end\n rescue Exception => ex\n puts \"rake aborted!\"\n puts ex.message\n if $trace\n puts ex.backtrace.join(\"\\n\")\n else\n puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || \"\"\n end\n exit 1\n end\n end",
"title": ""
},
{
"docid": "89ba3ee9fc6726f64c70c4811f1dd908",
"score": "0.6363044",
"text": "def start_task(text)\n @output.left(text)\n end",
"title": ""
},
{
"docid": "89ba3ee9fc6726f64c70c4811f1dd908",
"score": "0.6363044",
"text": "def start_task(text)\n @output.left(text)\n end",
"title": ""
},
{
"docid": "803a1863587eb60369683b63532d645c",
"score": "0.63584113",
"text": "def start!; end",
"title": ""
},
{
"docid": "803a1863587eb60369683b63532d645c",
"score": "0.63584113",
"text": "def start!; end",
"title": ""
},
{
"docid": "803a1863587eb60369683b63532d645c",
"score": "0.63584113",
"text": "def start!; end",
"title": ""
},
{
"docid": "803a1863587eb60369683b63532d645c",
"score": "0.63584113",
"text": "def start!; end",
"title": ""
},
{
"docid": "803a1863587eb60369683b63532d645c",
"score": "0.63584113",
"text": "def start!; end",
"title": ""
},
{
"docid": "3f888d99fea5901b22d10b104d7a9fac",
"score": "0.6351396",
"text": "def start\n work while @running\n end",
"title": ""
},
{
"docid": "3f888d99fea5901b22d10b104d7a9fac",
"score": "0.6351396",
"text": "def start\n work while @running\n end",
"title": ""
},
{
"docid": "a96e6055b54402ec0de5b213ceaaa178",
"score": "0.63416886",
"text": "def start\n run if @options[:all_on_start]\n end",
"title": ""
},
{
"docid": "d499b5add4d454100a1bb2d78d9f6b13",
"score": "0.63353276",
"text": "def run(*arguments)\n\t\t\tif @status == :initialized\n\t\t\t\t@status = :running\n\t\t\t\t\n\t\t\t\tschedule(arguments)\n\t\t\telse\n\t\t\t\traise RuntimeError, \"Task already running!\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "61dae7422b8048520f35839ed04c3a79",
"score": "0.6331265",
"text": "def start_task\n @dynflow = ProxyAPI::ForemanDynflow::DynflowProxy.new(:url => @smart_proxy.url)\n # https://github.com/theforeman/smart_proxy_remote_execution_ssh#usage\n action_input = {\n \"task_id\" => \"ssh #{@host.name} #{@command}\",\n \"script\" => \"#{@command}\",\n \"hostname\" => \"#{@host.name}\"\n }\n @task = @dynflow.trigger_task(\n \"ForemanRemoteExecutionCore::Actions::RunScript\",\n action_input)\n end",
"title": ""
},
{
"docid": "1cf0eab7b32e22b859c7426cb34bdfc3",
"score": "0.6297677",
"text": "def startcmd\n [self.initscript, :onestart]\n end",
"title": ""
},
{
"docid": "66fe586e2441ef0bf6826e32a33e51d1",
"score": "0.62918025",
"text": "def run_rake(task)\n run \"cd #{current_path} && bundle exec rake #{task} RAILS_ENV=#{environment}\"\nend",
"title": ""
},
{
"docid": "173400830b80c668fd5d11b82b61fe4d",
"score": "0.62832963",
"text": "def script_start(script)\n end",
"title": ""
},
{
"docid": "33acaf3ab7c9250a56cc5bfe0631751a",
"score": "0.62801033",
"text": "def start\n return if self.pid\n\n cmd = [\n gem_env(),\n Conf.ruby_command,\n script_path,\n \"--port\", self.port.to_s,\n \"--data-dir\", data_dir,\n ].join(\" \")\n\n Ramaze::Log.info \"starting app: #{cmd}\"\n\n self.pid = Servant.watch(cmd){\n stopped\n }\n self.save\n end",
"title": ""
},
{
"docid": "3ebd5f886dc0179d8dff72f6c62cc828",
"score": "0.6272745",
"text": "def run\n puts \"Hey i'm running\"\n end",
"title": ""
},
{
"docid": "86aea559383067cb2925f4141d4f441d",
"score": "0.6270515",
"text": "def task(*args, &block); end",
"title": ""
},
{
"docid": "8cc95e551eca8ba05e4e02cf0b9e3fe9",
"score": "0.6264321",
"text": "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend",
"title": ""
},
{
"docid": "8cc95e551eca8ba05e4e02cf0b9e3fe9",
"score": "0.6264321",
"text": "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend",
"title": ""
},
{
"docid": "8cc95e551eca8ba05e4e02cf0b9e3fe9",
"score": "0.6264321",
"text": "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend",
"title": ""
},
{
"docid": "262151a2b44ff234c77731c49b20b9e9",
"score": "0.62598616",
"text": "def run_all\n start\n end",
"title": ""
},
{
"docid": "262151a2b44ff234c77731c49b20b9e9",
"score": "0.62598616",
"text": "def run_all\n start\n end",
"title": ""
},
{
"docid": "0c54577a8576c2501c30d90332d4347f",
"score": "0.6253833",
"text": "def work\n # Start an external process and monitor its output etc.\n end",
"title": ""
},
{
"docid": "37cb9054b76803db1ad02b27659609e8",
"score": "0.6253059",
"text": "def start\n run_step(:prepare)\n run_step(:start)\n end",
"title": ""
},
{
"docid": "41a0a3b53e721d6ee12e038bf45ec423",
"score": "0.62527364",
"text": "def run\n setup\n main\n ensure\n shutdown\n end",
"title": ""
},
{
"docid": "3cc138b18820a3dd5eaa76fb04a295c0",
"score": "0.6249958",
"text": "def run(argv)\n load_tasks\n\n return build_task(argv).run unless argv.empty?\n\n print_help_header\n print_help_body\n end",
"title": ""
},
{
"docid": "87ca0a97a8073430588300a122664470",
"score": "0.6247174",
"text": "def start\n prepare\n loop { work_one_job }\n end",
"title": ""
},
{
"docid": "8b4a379e6ba6fd302d8d3121619233e6",
"score": "0.62439",
"text": "def define\n task name do\n sh \"#{@path_to_console} #{xml} #{config} #{library}\"\n end\n self\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "822d294123c87fce4a464c1734781992",
"score": "0.6242706",
"text": "def start\n end",
"title": ""
},
{
"docid": "68850eb648c4216aa7545e670f7e7484",
"score": "0.6241791",
"text": "def start(task_name = nil)\n current_task.stop if current_task.present? && task_name.present?\n Task::task(task_name).start\n end",
"title": ""
},
{
"docid": "613a8e040a7596af8348364440cde65c",
"score": "0.62403446",
"text": "def launch\n end",
"title": ""
},
{
"docid": "d41df262e17457fc4ff785d0642c5fe7",
"score": "0.6239237",
"text": "def start\n\n cmd_help\n \n until @exit\n print \"\\n\\n> \"\n exec_command gets \n end\n \n end",
"title": ""
},
{
"docid": "512577e9a2e82d51d2617bee86e195a1",
"score": "0.6234139",
"text": "def start\n throw :task_has_failed unless server.start\n run_all if options[:all_on_start]\n Pry::Commands.block_command \"j\", \"Update Jest snapshots\" do | cmd |\n server = Guard.state.session.plugins.all(:jest).first.runner.server\n case cmd\n when 'u' then server.update_snapshots\n else\n Formatter.error(\"unknown command #{cmd}\")\n end\n\n end\n end",
"title": ""
},
{
"docid": "bf6d6ae6c7893ce5f6b6d6d5052413cc",
"score": "0.6232109",
"text": "def define_task(*args, &block); end",
"title": ""
},
{
"docid": "be425ddcae6d48e845535aa71413e830",
"score": "0.62306976",
"text": "def start(options = {})\n setup options\n run!\n end",
"title": ""
},
{
"docid": "be425ddcae6d48e845535aa71413e830",
"score": "0.62306976",
"text": "def start(options = {})\n setup options\n run!\n end",
"title": ""
},
{
"docid": "970f3611de14cfc4377a1e1d95698be2",
"score": "0.6225458",
"text": "def start\n end",
"title": ""
},
{
"docid": "970f3611de14cfc4377a1e1d95698be2",
"score": "0.6225458",
"text": "def start\n end",
"title": ""
},
{
"docid": "970f3611de14cfc4377a1e1d95698be2",
"score": "0.6225458",
"text": "def start\n end",
"title": ""
},
{
"docid": "970f3611de14cfc4377a1e1d95698be2",
"score": "0.6225458",
"text": "def start\n end",
"title": ""
},
{
"docid": "970f3611de14cfc4377a1e1d95698be2",
"score": "0.6225458",
"text": "def start\n end",
"title": ""
},
{
"docid": "970f3611de14cfc4377a1e1d95698be2",
"score": "0.6225458",
"text": "def start\n end",
"title": ""
},
{
"docid": "6b5feb1da4631f5c4d88061398866a02",
"score": "0.6223285",
"text": "def run_task(verbose)\n puts \"Running task\"\n\n check_for_beaker_type_config\n command = beaker_command\n puts command if verbose\n success = system(command)\n return unless fail_mode == \"fast\" && !success\n\n $stderr.puts \"#{command} failed\"\n exit $?.exitstatus\n end",
"title": ""
},
{
"docid": "74a68bff875f851e236e9114c70e78ed",
"score": "0.6215998",
"text": "def run(cmd,args)\n case cmd\n when 'start','in','s'\n task = args.shift\n notes = args.join(' ')\n # switch tasks if config says so\n if @config['single_task'] && @trackr.current != task\n @trackr.current.each { |t|\n @trackr.stop(t) unless t == task\n }\n puts \"Switched to task '#{task}'\" if @config['verbose']\n else\n puts \"Started task '#{task}'\" if @config['verbose']\n end\n @trackr.start(task, notes)\n\n when 'stop','out','kill','k'\n get_tasks(args).each do |task|\n @trackr.stop(task)\n puts \"Stopped task '#{task}'\" if @config['verbose']\n end\n\n when 'switch','sw'\n task = args.shift\n notes = args.join(' ')\n @trackr.current.each do |t|\n @trackr.stop(t) unless t == task\n end\n @trackr.start(task, notes)\n puts \"Switched to task '#{task}'\" if @config['verbose']\n\n when 'time','status',nil\n tasks = get_tasks(args)\n puts create_log(tasks,'t')\n\n when 'log'\n group = args.shift[1] if ['-d','-t','-s'].include?(args[0])\n\n tasks = get_tasks(args)\n puts create_log(tasks,group)\n\n when 'clear','delete','del'\n get_tasks(args).each do |task|\n @trackr.clear(task)\n puts \"Task '#{task}' cleared\" if @config['verbose']\n end\n\n when 'rename','mv'\n from = args.shift\n to = args.shift\n @trackr.rename(from,to)\n puts \"Renamed '#{from}' to '#{to}'\" if @config['verbose']\n\n when 'mark','note','n'\n notes = args.join(' ')\n @trackr.current.each do |t|\n @trackr.stop(t)\n @trackr.start(t, notes)\n end\n puts \"Annotated task(s) '#{@trackr.current.join(' ')}'\" if @config['verbose']\n\n when 'help'\n show_help\n\n when 'config'\n puts @config.to_yaml\n\n else\n puts \"'#{cmd}' is not a valid command\"\n show_help\n end\n\n @trackr.close\n end",
"title": ""
},
{
"docid": "eebf7111358931115c02cd98f01f71ab",
"score": "0.6215656",
"text": "def start\n\t\tself.start_executor\n\t\tself.start_timer_task\n\tend",
"title": ""
},
{
"docid": "5c5ebdca6aa67f954b6c2315828ff9ba",
"score": "0.62011045",
"text": "def run_command; end",
"title": ""
},
{
"docid": "5c5ebdca6aa67f954b6c2315828ff9ba",
"score": "0.62011045",
"text": "def run_command; end",
"title": ""
},
{
"docid": "399a618fd04286682bd3721f0e44cffc",
"score": "0.6198497",
"text": "def start\n # TODO\n end",
"title": ""
},
{
"docid": "312e3401fd1dcda62b5017b3450bc6ef",
"score": "0.6196635",
"text": "def start\n\n end",
"title": ""
},
{
"docid": "312e3401fd1dcda62b5017b3450bc6ef",
"score": "0.6196635",
"text": "def start\n\n end",
"title": ""
},
{
"docid": "0a8ed606abf01b249c591aae313dfef9",
"score": "0.61936015",
"text": "def call\n setup_shell unless shell\n in_root do\n create_file 'ing.rb', <<_____\n# Ing tasks\n# Store your tasks in ./tasks and they will be available to `ing`.\n# Or simply overwrite this file.\n\nDir[File.expand_path(\"tasks/**/*.rb\", File.dirname(__FILE__))].each do |rb|\n require rb\nend\n\n_____\n empty_directory 'tasks'\n end\n end",
"title": ""
},
{
"docid": "4b176a611522f23d41625b6683826958",
"score": "0.619347",
"text": "def start!\n\tend",
"title": ""
},
{
"docid": "8860a6301d99f13d1f81af63213c90e9",
"score": "0.6191385",
"text": "def runner(task_file, args)\n Store.set(:debug, args.verbose == 2)\n Store.set(:wide, args.wide)\n\n full_path = File.expand_path(task_file)\n\n begin\n load full_path\n rescue LoadError\n exit\n end\n end",
"title": ""
}
] |
40af467d61736635bf9d3746ec4f3d9c
|
open temp YAML file(s) for editing, return edited contents
|
[
{
"docid": "9a9b23fbd705cf4dff93f2e13a0d04ac",
"score": "0.76237047",
"text": "def edit_tmp_yaml num = nil\n name = File.basename($0, File.extname($0))\n temps = Array.new(num || 1) { Tempfile.new([name, '.yaml']) }\n\n if num\n yield temps\n else\n yield temps[0]\n end\n\n temps.each(&:flush)\n system(ENV['EDITOR'] || 'vim', *temps.map(&:path))\n temps.each(&:rewind)\n\n if num\n return temps.map(&:read)\n else\n return temps[0].read\n end\nensure\n temps.each(&:close)\nend",
"title": ""
}
] |
[
{
"docid": "b86bbddee0a1e026747521870ffd12b7",
"score": "0.7000562",
"text": "def edit_in_yaml( object )\n\t\t\tyaml = object.to_yaml\n\n\t\t\tfn = Digest::SHA1.hexdigest( yaml )\n\t\t\ttf = Tempfile.new( fn )\n\n\t\t\ttf.print( yaml )\n\t\t\ttf.close\n\n\t\t\tnew_yaml = edit( tf.path )\n\n\t\t\tif new_yaml == yaml\n\t\t\t\treturn nil\n\t\t\telse\n\t\t\t\treturn YAML.load( new_yaml )\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "b6592c2724dc13706f4f5f5f1e6f3576",
"score": "0.6542839",
"text": "def edit_multiple files\n strs = files.map do |file|\n str = StringIO.new\n\n str.puts \"# #{file.name}\"\n str.puts \"#\"\n file.readonly_props.each { |k, v| str.puts \"# #{k}: #{v}\" }\n str.puts YAML.dump(file.props)\n\n str.string\n end\n\n new_strs = edit_tmp_yaml(files.size) do |tmps|\n strs.zip(tmps).each { |str, tmp| tmp.write str }\n end\n\n files.zip(strs, new_strs).each do |file, str, new_str|\n # TODO more robust check for changes?\n if str == new_str\n next\n end\n file.props = YAML.load(new_str)\n end\nend",
"title": ""
},
{
"docid": "4f2e8f79ad19d78f4c7537c1718e2773",
"score": "0.6337759",
"text": "def edit_in_yaml( object, object_classes=[] )\n\t\tyaml = branch_as_yaml( object, false, object_classes )\n\t\tfilename = Digest::SHA1.hexdigest( yaml )\n\t\ttempfile = Tempfile.new( filename )\n\n\t\tself.log.debug \"Object as YAML is: %p\" % [ yaml ]\n\t\ttempfile.print( yaml )\n\t\ttempfile.close\n\n\t\tnew_yaml = edit( tempfile.path )\n\n\t\tif new_yaml == yaml\n\t\t\tmessage \"Unchanged.\"\n\t\t\treturn nil\n\t\telse\n\t\t\treturn YAML.load( new_yaml )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b268e53afc20ddc971ed637aa869599b",
"score": "0.62534654",
"text": "def update\n File.open(yaml_file, File::RDWR|File::CREAT, 0644) do |file|\n file.flock(File::LOCK_EX)\n mbox = YAML.load(file.read) || {} rescue {}\n yield mbox\n file.rewind\n file.write YAML.dump(mbox)\n file.truncate(file.pos)\n end\n end",
"title": ""
},
{
"docid": "3b5739c566fc883c33eed09da957857c",
"score": "0.60689986",
"text": "def sync_from_files\n # File read YAML load\n end",
"title": ""
},
{
"docid": "4b566c7c725ba9998f721b0e61df44e7",
"score": "0.6068178",
"text": "def edit_all files\n hashes = files.map(&:props)\n\n # find which tag fields are common among the files\n keys = hashes.flat_map { |hash| hash.keys }.uniq\n common = keys.select { |key| hashes.map { |hash| hash[key] }.uniq.compact.size <= 1 }\n leftover = AudioFile::WRITE_KEYS - common\n\n new_str = edit_tmp_yaml do |temp|\n # print common tags\n ck = common.map do |key|\n [key, hashes.map { |hash| hash[key] }.uniq.compact[0]]\n end.to_h\n temp.puts YAML.dump(ck)\n\n # print other tags in comments\n leftover.each do |key|\n temp.puts \"##{key}:\"\n end\n temp.puts\n\n files.each do |file|\n temp.puts \"# #{file.name}\"\n end\n end\n\n # save changes\n props = YAML.load(new_str)\n files.each do |file|\n file.props = props\n end\nend",
"title": ""
},
{
"docid": "f33efd7576dc7c26002533ea6aff0fd5",
"score": "0.6045638",
"text": "def create\n Puppet.debug \"Editfile::Yaml: Creating hash #{pretty_value} on key #{pretty_key}.\"\n eval( \"read_file.#{key} = #{pretty_value}\")\n myflush\n end",
"title": ""
},
{
"docid": "a68992d2537880b7b31cb0c5e63862ac",
"score": "0.5983073",
"text": "def call(file_or_dir)\n if File.directory?(file_or_dir)\n data0 = Console.slurp(file_or_dir)\n File.open(TMP_FILE, 'w'){ |f| f << data0.to_yaml }\n edit_file(tmpfile)\n data1 = YAML.load_file(TMP_FILE)\n Console.splat(file_or_dir, :data=>data1)\n elsif File.file?(file_or_dir)\n edit_file(file_or_dir)\n else\n abort \"does not exist\"\n end\n end",
"title": ""
},
{
"docid": "e0cb1a7b30076013b668ed7a667d8784",
"score": "0.59423137",
"text": "def edit\n save\n editor.open(file_path)\n create_tasks\n true\n end",
"title": ""
},
{
"docid": "f0af9b160f55fdbc514fe95bf96892bb",
"score": "0.58977497",
"text": "def cli_helper_process_yaml(file_contents='')\n a_hash = YAML.load file_contents\n return a_hash\n end",
"title": ""
},
{
"docid": "7371b85991de31ceb6fb09cf54a7f635",
"score": "0.57518053",
"text": "def update\n begin\n tmp = {}\n sb = File.stat(@filename)\n return if @stat and @stat.ino == sb.ino and @stat.mtime == sb.mtime\n File.open(@filename) do |f|\n tmp = YAML::load(f.read)\n @stat = f.stat\n end\n rescue Errno::ENOENT\n end\n @data = tmp\n end",
"title": ""
},
{
"docid": "7da7753593bade4a0d9e2fb5f836341e",
"score": "0.5738891",
"text": "def create_reset_config_file_function(yaml_file_path)\n original_contents = File.open(yaml_file_path, 'r').read\n -> {\n File.open(yaml_file_path, 'w') { |yaml_file|\n yaml_file.puts(original_contents)\n }\n }\nend",
"title": ""
},
{
"docid": "cca1cffb4d41a7557c5257671d0baa9b",
"score": "0.57089853",
"text": "def aorta( obj )\n tempfile = File.join('/tmp',\"yobj_#{ Time.now.to_i }\")\n File.open( tempfile, 'w' ) { |f| f << obj.to_yaml }\n system( \"#{ ENV['EDITOR'] || 'vi' } #{ tempfile }\" )\n return obj unless File.exists?( tempfile )\n content = YAML::load( File.open( tempfile ) )\n File.delete( tempfile )\n content\n end",
"title": ""
},
{
"docid": "eefd72dcf64fa4e6e36b78a7a5b7808e",
"score": "0.56630725",
"text": "def replace_yaml_file(old_yaml_name)\n new_yaml_name = \"yaml/#{random_filename}.yaml\"\n begin\n FileUtils.cp(old_yaml_name, new_yaml_name)\n rescue\n FileUtils.cp(@blank_yaml_path, new_yaml_name)\n end\n session[:yaml_name] = new_yaml_name\nend",
"title": ""
},
{
"docid": "d149a61f0057ec8499d133de9cad91a4",
"score": "0.56605345",
"text": "def fetch_yaml(name='working_data')\n system \"touch #{yaml_path(name)}\"\n result = YAML.load_file(yaml_path(name))\n result ||= {}\n result\nend",
"title": ""
},
{
"docid": "2782b47d85d87ada4cff507a892dab7d",
"score": "0.5654205",
"text": "def yaml\n File.read(@name)\n end",
"title": ""
},
{
"docid": "1e2fb33c31898701b33009fddbddb5fb",
"score": "0.5650122",
"text": "def update\n begin\n tmp = {}\n sb = File.stat(@filename)\n return if @stat and @stat.ino == sb.ino and @stat.mtime == sb.mtime\n File.open(@filename) do |f|\n tmp = YAML::load(f.read)\n @stat = f.stat\n end\n rescue Errno::ENOENT\n end\n @data = tmp\n end",
"title": ""
},
{
"docid": "da6907891483a6b751cce1dcd37ed4f4",
"score": "0.5642103",
"text": "def original_data\n return @original_data if @original_data\n if target_yaml_file?\n @original_data = read_from_file resource[:path]\n return @original_data if @original_data\n end\n if original_data_file?\n @original_data = read_from_file resource[:original_data]\n return @original_data if @original_data\n end\n unless resource[:original_data].is_a? Hash or resource[:original_data].is_a? Array\n fail \"The original_data should be either a path to the YAML file or the data structure! Got: #{resource[:original_data]}\"\n end\n @original_data = resource[:original_data]\n end",
"title": ""
},
{
"docid": "117c125e4b1cd25dabaeea3ba2554d01",
"score": "0.5607458",
"text": "def read_yaml; read.from_yaml; end",
"title": ""
},
{
"docid": "31ff61e5865b50110a22b12e06bc986b",
"score": "0.55752575",
"text": "def edit\n options_path = File.expand_path('~/.budik/options.yml')\n open_file(options_path)\n end",
"title": ""
},
{
"docid": "33694c9254754fb1499193f53d439304",
"score": "0.5573189",
"text": "def gets_tmp(name, content = '')\n f = Tempfile.new name\n f.write content.to_s\n f.rewind\n system \"#{Punch.config.text_editor} #{f.path}\"\n f.rewind\n f.read\n ensure\n f.close\n end",
"title": ""
},
{
"docid": "3f76fd27f41c7ec9bedcc2382406f954",
"score": "0.5565511",
"text": "def open_tags_config\n tag_file_path = File.join(SETTINGS_DIR, TAG_FILE)\n Dir.mkdir(SETTINGS_DIR) unless File.exists?(SETTINGS_DIR)\n FileUtils.touch(tag_file_path)\n YAML.load_file(tag_file_path) || {:tags => [\"master\"], :current => \"master\"}\n end",
"title": ""
},
{
"docid": "c2aeb92855ce1ad99110f046f9b50a1b",
"score": "0.55487436",
"text": "def recall\n if not File.exists? path_to_file\n {}\n else\n YAML.load File.read( path_to_file)\n end\n end",
"title": ""
},
{
"docid": "7efd2f80a87070576bee8100a54cea4d",
"score": "0.55484116",
"text": "def test_open\n file1 = create_template_file\n fpath = file1.path\n f1 = FO.new(fpath)\n s = 'tekito'\n\n # Testing non-block\n assert_raises(ArgumentError){ f1.modify }\n\n # Testing open \n f1.open{|ior, iow|\n # Line 1\n line = ior.gets\n assert_equal 1, line.count(\"\\n\")\n assert_equal '1', line[0,1]\n iow.print line\n\n # Line 2\n line = ior.gets\n assert_equal 1, line.count(\"\\n\")\n assert_equal '2', line[0,1]\n iow.print line\n\n # Line 3\n line = ior.gets\n assert_equal 1, line.count(\"\\n\")\n assert_equal '3', line[0,1]\n iow.print line\n iow.print s\n }\n assert_equal @orig_content+s, f1.dump\n\n # Testing open \n bkupfile = f1.temporary_filename # instance_eval{@iotmp.path}\n assert File.exist?(bkupfile)\n f1.reset\n assert f1.reset?\n refute File.exist?(bkupfile)\n assert_nil f1.temporary_filename\n\n # .modify\n f1.modify{|ior, iow|\n iow.print s+s\n }\n assert_equal s+s, f1.dump\n\n # Testing warning issued if changing to String-manipulation mode\n bkupfile = f1.temporary_filename # instance_eval{@iotmp.path}\n assert File.exist?(bkupfile)\n \n assert_output('', /WARNING\\b.+\\breread/i){ f1.read{|i| s} }\n refute File.exist?(bkupfile)\n assert_nil f1.temporary_filename\n end",
"title": ""
},
{
"docid": "4df5deb4549d2cf583563d94d9c49eea",
"score": "0.5541336",
"text": "def recall\n YAML.load(File.read(yaml_path))\n end",
"title": ""
},
{
"docid": "c3ad94e7ae5bb6587c194585434d1fc5",
"score": "0.5534362",
"text": "def recall\n YAML.load_file(yaml_path)\n end",
"title": ""
},
{
"docid": "cfc670999e8247514843ed64cf5a0b78",
"score": "0.55319834",
"text": "def read_templatable_file(r = File.join(File.dirname(__FILE__), 'support', 'templatable.yml'))\n @templatables = YAML.load_file(r)\n end",
"title": ""
},
{
"docid": "007a470b95a806b6f10251a9cd7ec3ab",
"score": "0.55278283",
"text": "def remember state\n File.open path_to_file, \"w\" do |file|\n file.write state.to_yaml\n end\n end",
"title": ""
},
{
"docid": "eb5867e8370472e4e20f17c9de5757ad",
"score": "0.55201495",
"text": "def edit(file, options={})\n end",
"title": ""
},
{
"docid": "20d4545e754c5f08648d463588b7c44b",
"score": "0.5518557",
"text": "def restore_from_yml_file(fname)\n i_fn = \"#{Rails.root}/controlled/#{fname}.yml\"\n YAML::load( IO.read(i_fn) )\n end",
"title": ""
},
{
"docid": "57c579f8256c433dc333d317eacc0b58",
"score": "0.5505106",
"text": "def repair_yaml(filename, env_ref_sect = 'default', ensure_default = true, ensure_env = true, realign = true) # :doc:\n dirty = false\n stat = :updated\n\n # ensure the file exists.\n unless File.exist?(filename)\n File.write filename, \"# File created by Incline v#{Incline::VERSION}.\\n\"\n stat = :created\n dirty = true\n end\n\n orig_contents = File.read(filename)\n\n contents = YamlContents.new(orig_contents)\n\n if ensure_default\n contents.set_key %w(default), '&default', false\n end\n\n yield contents if block_given?\n\n if ensure_env\n %w(development test production).each do |sect|\n contents.add_key [ sect ], nil\n end\n end\n\n # Potential bug, and I'm not even sure if it would be or not.\n # But since we use relatively simple regular expressions to perform the set action,\n # the << \"key\" can only exist once and would be overridden.\n # That means that a section would not be able to include multiple anchors.\n # Like I said before, I'm not sure if that would actually be a bug or not.\n #\n # Luckily, the YAML files aren't meant to be overly complex so this shouldn't show\n # up regularly if at all.\n unless env_ref_sect.to_s.strip == ''\n %w(development test production).each do |sect|\n contents.set_key [ sect, '<<' ], '*' + env_ref_sect\n end\n end\n\n contents.realign! if realign\n\n unless dirty\n dirty = (orig_contents != contents.to_s)\n end\n\n if dirty\n File.write filename, contents.to_s\n say_status stat, filename, :green\n else\n say_status :unchanged, filename, :blue\n end\n end",
"title": ""
},
{
"docid": "4c6b844d453a058b5afb3c6aba8a668a",
"score": "0.55039054",
"text": "def read_yaml_file(filename)\n string_contents = File.read(Rails.root.join('db', 'seed_data', filename))\n YAML.load(string_contents).with_indifferent_access\nend",
"title": ""
},
{
"docid": "22d8b64fb1b518936d8925b1a89d4d87",
"score": "0.5498058",
"text": "def replace_recipe_original(file_name)\n file_content_array = open_file(file_name)\n\n @title = file_content_array[0].chomp\n r = Recipe.find_by_name(@title)\n s = IO.read(file_name)\n r.original = s\n r.save! \nend",
"title": ""
},
{
"docid": "0c004e976d1bf5131d1ba93e6bbe9cbf",
"score": "0.5494555",
"text": "def read_config\n\n config_file=File.join(File.expand_path(DEFAULT_CONFIG_PATH),CONFIG_FILENAME)\n store=YAML::Store.new config_file\n store.transaction do \n $config[:notes_path] = store[\"notes_path\"]\n $config[:jekyll_path] = store[\"jekyll_path\"]\n end\nend",
"title": ""
},
{
"docid": "11219ce0840fdaa86ae6801a63631024",
"score": "0.54868954",
"text": "def content\n return unless present?\n @content ||= YAML.load(File.open(path))\n end",
"title": ""
},
{
"docid": "0dca907c86cf500dc5f62dff29b73527",
"score": "0.5480979",
"text": "def reload\n @data = YAML::load(File.open(@file_name, (File.exists?(@file_name) ? \"r+\" : \"w+\")))\n @data ||= {}\n end",
"title": ""
},
{
"docid": "05c7ed7ccb018a8187c349ade842e30a",
"score": "0.5457333",
"text": "def edit(file, options={})\r\n end",
"title": ""
},
{
"docid": "7c2e2ff29ce7d7b3eb48739355eb6168",
"score": "0.54566777",
"text": "def open(*args)\n @name = args.shift\n FileUtils.mkdir_p(root_dir+\"scripts\")\n config_path = \"#{root_dir}#{@name}.yml\"\n unless File.exists?(config_path)\n template = File.exists?(user_config) ? user_config : \"#{File.dirname(__FILE__)}/assets/sample.yml\"\n erb = ERB.new(File.read(template)).result(binding)\n tmp = File.open(config_path, 'w') {|f| f.write(erb) }\n end\n\n system(\"$EDITOR #{config_path}\")\n update(@name)\n end",
"title": ""
},
{
"docid": "05f543cb227cd547b93c6c3b63feea86",
"score": "0.5447314",
"text": "def write_temporary_decrypted_config\n @temp_config ||= \"settings/#{options[:config_dir]}/.#{SecureRandom.urlsafe_base64}.yml\"\n File.open(@temp_config, 'w') do |file|\n file.write(ansible_yml)\n end\n end",
"title": ""
},
{
"docid": "1f2873b1acf84f09f10faf8b1cf09458",
"score": "0.5446169",
"text": "def save_yaml(spec_dir = @spec_dir)\n save_data = {\n \"inv_data\": @file_inv,\n \"new_data\": @new_files,\n \"edited_data\": @edited_files,\n \"del_data\": @del_files\n }\n begin\n # If it doesnt exist, Errno::ENOENT is cast\n File.read(spec_dir + \"/data/data.yaml\")\n # Write vars to data.yaml\n File.open(spec_dir + \"/data/data.yaml\", \"w\") { |file| file.write(save_data.to_yaml) }\n rescue Errno::ENOENT => e\n puts e\n puts \"No such file: #{spec_dir}!\"\n return false\n end\n return true\n end",
"title": ""
},
{
"docid": "7625cf1c887f87f30db4c1b13c61e7ed",
"score": "0.5438253",
"text": "def read_yaml\n self.content = File.read(self.file)\n\n begin\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n :autolink => true,\n :fenced_code_blocks => true\n ).render($POSTMATCH)\n self.data = YAML.load($1)\n end\n rescue => e\n puts \"YAML Exception reading #{self.file}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"title": ""
},
{
"docid": "01c54d8fb1dcf49e8f96db66f59816a6",
"score": "0.5433367",
"text": "def slurp_file(f)\n f = File.expand_path(f)\n tmp = {}\n\n if File.exist?(f)\n File.open( f ) { |yf| \n tmp = YAML::load( yf ) \n }\n end\n tmp.symbolize_keys! unless tmp == false\n end",
"title": ""
},
{
"docid": "2a2874b04fbc62cf0596c03f766e643b",
"score": "0.5431151",
"text": "def edit file=nil\n raise \"Must set $EDITOR to use `edit` method!\" unless ENV[\"EDITOR\"]\n raise \"Readline not in use!\" unless defined?(Readline)\n\n require 'shellwords'\n\n @__tmp_edit_files__ ||= []\n\n edit_data = nil\n file_name = file\n file_name = @__tmp_edit_files__.last if file.nil? && @__tmp_edit_files__.last\n\n if file_name == :last || file_name.nil?\n edit_data = IRB.CurrentContext.code_chunks[-2].to_s\n end\n\n if edit_data\n result = nil\n __with_tmp_file__(edit_data, false) do |file_path|\n @__tmp_edit_files__ << file_path\n\n result = __edit_and_execute file_path\n end\n result\n else\n __edit_and_execute file_name\n end\nend",
"title": ""
},
{
"docid": "2a2874b04fbc62cf0596c03f766e643b",
"score": "0.5431151",
"text": "def edit file=nil\n raise \"Must set $EDITOR to use `edit` method!\" unless ENV[\"EDITOR\"]\n raise \"Readline not in use!\" unless defined?(Readline)\n\n require 'shellwords'\n\n @__tmp_edit_files__ ||= []\n\n edit_data = nil\n file_name = file\n file_name = @__tmp_edit_files__.last if file.nil? && @__tmp_edit_files__.last\n\n if file_name == :last || file_name.nil?\n edit_data = IRB.CurrentContext.code_chunks[-2].to_s\n end\n\n if edit_data\n result = nil\n __with_tmp_file__(edit_data, false) do |file_path|\n @__tmp_edit_files__ << file_path\n\n result = __edit_and_execute file_path\n end\n result\n else\n __edit_and_execute file_name\n end\nend",
"title": ""
},
{
"docid": "baaaa7ad885951ee3332e39558db7d61",
"score": "0.5422824",
"text": "def manage_file(path, contents)\n if contents.is_a?(Hash) && !contents.empty?\n file = Chef::Resource::Template.new(path, run_context)\n file.cookbook('cerner_splunk')\n file.source('generic.conf.erb')\n file.variables(stanzas: contents)\n else\n file = Chef::Resource::File.new(path, run_context)\n file.content(contents) unless contents.empty?\n end\n file.path(path)\n file.owner(node['splunk']['user'])\n file.group(node['splunk']['group'])\n file.mode('0600')\n if contents.empty?\n file.run_action(:delete)\n else\n file.run_action(:create)\n end\n new_resource.updated_by_last_action(true) if file.updated_by_last_action?\n end",
"title": ""
},
{
"docid": "7b3b90fd0c43cde99cd16403819b7aa8",
"score": "0.54204774",
"text": "def temp_file(name, content)\n editor = File.exists?('/usr/bin/editor') ? '/usr/bin/editor' : 'vi'\n\n temp = Tempfile.new(\"cloudflock_#{name}\")\n temp.write(content)\n temp.close\n\n system(\"#{editor} #{temp.path}\")\n temp.open\n result = temp.read\n temp.close\n temp.unlink\n\n result\n end",
"title": ""
},
{
"docid": "35e710a747c8c9b5256f79547cf052e3",
"score": "0.5407801",
"text": "def test_yaml_persistence\n fes = OpenWFE::YamlFileExpressionStorage.new(\"yaml\", ac)\n test_persistence(fes)\n end",
"title": ""
},
{
"docid": "9290b92b237cb68471b81ff5dc9359bb",
"score": "0.5400796",
"text": "def updateyaml(pkginfo)\n if File.exists?(@pkgyaml)\n pkginfo2yaml = File.open(@pkgyaml, 'w')\n \n unless pkginfo.include?(:creator)\n pkginfo[:creator] = Etc.getlogin\n end\n unless pkginfo.include?(:created) \n pkginfo[:created] = Time.now.xmlschema\n end\n\n pkginfo[:edited_by] = Etc.getlogin\n pkginfo[:lastedit] = Time.now.xmlschema\n \n # puts \"\\n**************************************************************************\"\n puts \"Changes written to YAML configuration...\"\n \n pkginfo2yaml.puts pkginfo.to_yaml\n pkginfo2yaml.close\n end\n end",
"title": ""
},
{
"docid": "cbe4d2ab1b53c5b19bce058fabfe26db",
"score": "0.5398313",
"text": "def update\n yaml_file = File.open(File.join(Dir.pwd, '/kymera_config.yaml'), 'w+')\n @config_options.to_yaml.split('\\n').each do |line|\n yaml_file.write(line)\n end\n yaml_file.rewind\n str = yaml_file.read\n yaml_file.close\n str\n end",
"title": ""
},
{
"docid": "5ec21796e21fff9cb56ba168d54510b8",
"score": "0.539312",
"text": "def flush\n File.open(@file, 'w') {|fd| YAML.dump(@current, fd) }\n end",
"title": ""
},
{
"docid": "4e07add4c711b81c3bda045242dfbc46",
"score": "0.53916466",
"text": "def copy_yaml\n template \"custom_words.yml\", \"config/custom_words.yml\"\n end",
"title": ""
},
{
"docid": "b3c7baff7cb7746c543dcf07d5611133",
"score": "0.538139",
"text": "def read_yaml(settings)\n settings_instance = Soryo::FileInstance.new(settings)\n if settings_instance.existance?\n self.merge_with(settings_instance.to_hash)\n else\n raise 'NoFileFound'\n end\n end",
"title": ""
},
{
"docid": "448827dbe6e4122689698726cd2c9796",
"score": "0.5381194",
"text": "def construct_and_write_yaml(filepath)\n data = YAML::load(File.open(filepath))\n\n yield data\n\n File.open(filepath, \"w\") do |f|\n f.write(YAML::dump(data))\n end\nend",
"title": ""
},
{
"docid": "752cba078f5d040f8aaae17f01ee1a5e",
"score": "0.5378264",
"text": "def process_source_docker_compose_file\n docker_file = File.open(File.join(ENV['WORKSPACE'], 'dot-futureadvisor/docker/docker-compose.yml'), 'r')\n out_file = File.open(File.join(ENV['TMPDIR'], 'temp-docker-compose.yml'), 'w')\n\n state = 'seeking'\n File.readlines(docker_file).each do |line|\n state = process_a_line(state, line, out_file)\n end\n\n docker_file.close\n out_file.close\nend",
"title": ""
},
{
"docid": "dba7d8106c13ae594515aba899437277",
"score": "0.53634655",
"text": "def fix_YAML_file(file)\n lines=File.readlines(file)\n shift = false\n File.open(file, 'w') do |out|\n lines.each do |line|\n if shift\n next if line[/^---/]\n out.print line \n end\n shift = true \n end\n end\nend",
"title": ""
},
{
"docid": "57b7839e6c5ea15c4573d6f2bf51a2d6",
"score": "0.53624684",
"text": "def reload\n load_yaml\n end",
"title": ""
},
{
"docid": "8706f8f218e266845fbb0d073ae55da3",
"score": "0.53568363",
"text": "def process_config_file_template(template_filename)\n log.info(\"Processing #{template_filename}\")\n\n test_filename = File.basename( # Get just file name w/o path\n template_filename, '.yaml') \n test_file = Tempfile.new(test_filename) # Create empty temp file\n test_file.write(\"# Original template #{template_filename}\")\n test_file.close # Close temp file for now\n begin\n process_config_template( # Process template and\n template_filename, test_file.path) # write result to the temp file\n process_config_file(test_file.path) # Process the file\n ensure\n test_file.close # Close the temp file\n test_file.unlink # Delete the temp file\n end\n\n end",
"title": ""
},
{
"docid": "bcf05c268b85177d4a3ace3ce09a310d",
"score": "0.53446054",
"text": "def update_tokens(template_file)\n template = \"\"\n open(template_file) {|f|\n template = f.to_a.join\n }\n updated = ERB.new(template, 0, \"%<>\").result\n\n return updated\nend",
"title": ""
},
{
"docid": "bcf05c268b85177d4a3ace3ce09a310d",
"score": "0.53446054",
"text": "def update_tokens(template_file)\n template = \"\"\n open(template_file) {|f|\n template = f.to_a.join\n }\n updated = ERB.new(template, 0, \"%<>\").result\n\n return updated\nend",
"title": ""
},
{
"docid": "2cf091bfd464b9e9c36654341f11f867",
"score": "0.532521",
"text": "def config_yml\n template = File.read(find_config_yml_file)\n ERB.new(template).result(binding)\n end",
"title": ""
},
{
"docid": "c0e09f2671be7b22c7c8018463a4d7d6",
"score": "0.53236574",
"text": "def read_yaml(path)\n return unless File.exist?(path)\n source = YAML.load_file(path)\n return unless source.is_a?(Hash)\n\n update_with { |config| read_yaml_key(source, config[:key]) }\n end",
"title": ""
},
{
"docid": "31a9c014ae66f11404f8ea40a26f24af",
"score": "0.53151447",
"text": "def edit(text)\n digest = Digest::MD5.hexdigest(\"#{rand(2**30)}\")\n filename = \"/tmp/bp-#{digest}\"\n tmp_file = File.new(filename, \"w\")\n tmp_file.write(text)\n tmp_file.close\n editor = ENV[\"EDITOR\"] || \"vim\"\n system(editor, filename)\n tmp_file = File.new(filename, \"r\")\n edited_text = tmp_file.read\n # We're intentionally not deleting files for now\nend",
"title": ""
},
{
"docid": "bf9b6cfe8e2ac5f5198118ed213ab798",
"score": "0.52932006",
"text": "def interactive_edit(fileName)\n file_list = []\n tags = [ \"title\",\"album\", \"artist\", \"track\", \"genre\"]\n\n quit = \"n\"\n until quit == \"q\"\n puts \"Current metadata for file:\"\n print_metadata(fileName, tags)\n\n print \"What tag would you like to change? (#{tags.join(\", \")}): \"\n tag_name = gets.chomp\n if tags.include?(tag_name)\n print \"What would you like to set it to? \"\n tag_value = gets.chomp\n set_metadata(fileName, {tag_name =>tag_value})\n\n puts \"Current metadata for file is now: \"\n print_metadata(fileName, tags)\n else\n puts \"That's not a valid tag.\"\n end\n\n print \"Quit [q], or continue [c]? \"\n quit = gets.chomp\n end\n\n end",
"title": ""
},
{
"docid": "590364872e3efd367926a8566fcf07f1",
"score": "0.52917236",
"text": "def db_yml_contents\n return File.open(SETTINGS[:rails_db_yml], 'r')\n end",
"title": ""
},
{
"docid": "40dc568ba3bfb960453760ee3bbb22b4",
"score": "0.52890784",
"text": "def secure_save_yml_file!(filename, content)\n begin\n File.open(filename, \"w\") do |f|\n f.puts content.to_yaml\n end\n rescue\n raise \"Error writting file : #{filename}\"\n end\n end",
"title": ""
},
{
"docid": "dcd7331dd9fc4e5d6aef9b4afd8eadcc",
"score": "0.52885664",
"text": "def travis_yml_edit path\n loop do\n editor = ENV['EDITOR'] || 'vi'\n\n system \"#{editor} #{path}\"\n\n break true if travis_yml_check path\n\n abort unless $stdout.tty?\n\n print \"\\nRetry edit? [Yn]\\n> \"\n $stdout.flush\n\n break false if $stdin.gets =~ /\\An/i\n end\n end",
"title": ""
},
{
"docid": "79853cd3fd85b72520c3b9967199a201",
"score": "0.5285585",
"text": "def test_read\n file1 = create_template_file\n fpath = file1.path\n f1 = FO.new(fpath, verbose: true)\n\n s = 'tekito'\n f1.read{|i| s}\n assert_equal s, f1.dump\n\n # Test of replace_with()\n f1.replace_with(s+s)\n assert_equal s+s, f1.dump\n assert_equal String, f1.state\n\n # Test of reset()\n f1.reset\n assert_equal @orig_content, f1.dump\n assert f1.fresh?\n assert f1.reset?\n assert_nil f1.state\n\n assert_output('', / not opened,/){ f1.run!(verbose: true) }\n assert_equal @orig_content, File.read(fpath)\n assert_in_delta(@orig_mtime, File.mtime(fpath), 1) # 1 sec allowance\n \n # Test of invalid returns from the block\n f1.reset\n assert_raises(FileOverwriteError){ f1.read{} }\n f1.reset\n assert_raises(FileOverwriteError){ f1.read{nil} }\n f1.reset\n assert_raises(FileOverwriteError){ f1.read{5} }\n f1.reset\n assert_output('', /Empty string[^\\n]*\\n.*File .+updated.+Size.* => 0 bytes/im){ f1.read!(){''} }\n # Warning is issued if an empty string is returned, but it is saved nonetheless.\n assert_equal 0, f1.sizes[:new] # The new size is zero.\n\n assert_raises(FrozenError){ f1.reset } # Prohibited to reset, once saved.\n end",
"title": ""
},
{
"docid": "64f2042977e9ebfb8561d5622c8679f8",
"score": "0.52827734",
"text": "def load_yaml(filename); end",
"title": ""
},
{
"docid": "fb9aeb6edd5ff20604bc09964438682e",
"score": "0.52754635",
"text": "def loadYaml(path); f = open(path, 'r'); x = YAML::load(f); f.close; x end",
"title": ""
},
{
"docid": "6c3ebc12dd624ca295b89b5e6f88908d",
"score": "0.5270346",
"text": "def modify_and_load_yamlfile(filepath)\n content = File.read(filepath).split(/[\\r\\n]+/)\n first_line = content.shift\n unless first_line == '--- !ruby/object:Puppet::Node::Facts'\n raise HieraSimulator::FactSourceError, \"#{filepath} was not in expected Puppet::Node::Facts format\"\n end\n content.unshift '---'\n fixed_yaml = content.map { |line| line.sub(/^ /, '') }\n data = YAML.load(fixed_yaml.join(\"\\n\"))\n raise HieraSimulator::FactLookupError, \"Invalid content in node fact file #{filepath}\" unless data.key?('values')\n result = {}\n data['values'].each { |k, v| result['::' + k] = v }\n result\n end",
"title": ""
},
{
"docid": "56c6d7760afd7acbcdf42317b182da90",
"score": "0.5264529",
"text": "def load_raw_yaml(filepath)\n return nil unless filepath && File.readable?(filepath)\n YAML.load_file(filepath).each_with_object({}) do |(k, v), h|\n h[k.to_sym] = v\n end\n end",
"title": ""
},
{
"docid": "199cb3a0e8eafc7c77d98881ed37d1a4",
"score": "0.52640146",
"text": "def edit(options)\n require_provider unless options[:provider]\n provider = options[:provider]\n config_file = File.expand_path(options[:config])\n config = if File.exist?(config_file)\n YAML.load_file(config_file)\n else\n {}\n end\n config[provider] ||= {}\n config[provider]['authentication'] = options[:authentication] || {}\n config[provider]['project'] = options[:project] if options[:project]\n File.open(config_file, 'w') do |out|\n YAML.dump(config, out)\n end\n puts \"Wrote #{provider} to #{config_file}\"\n exit\nend",
"title": ""
},
{
"docid": "2d6fefcec1457297536990af2a5b2b23",
"score": "0.5263633",
"text": "def replace_yaml_tag(key, new_value, file_info)\n return unless file_info[:content].keys.include?(key)\n\n File.open(file_info[:filename], 'w') do |file|\n file.puts(file_info[:preamble].join(\"\\n\")) unless file_info[:preamble].empty?\n file.puts('---')\n file_info[:content].each do |k, info|\n # use write + \\n to eliminate puts dedup of \\n\n file.write(info[:comments].join(\"\\n\") + \"\\n\") unless info[:comments].empty?\n yaml_str = ''\n if k == key\n yaml_str = pair_to_yaml_tag(k, new_value)\n else\n yaml_str = pair_to_yaml_tag(k, info[:value])\n end\n\n file.puts(yaml_str)\n end\n end\n end",
"title": ""
},
{
"docid": "95200615121b20918db99666ae822d5d",
"score": "0.52633685",
"text": "def readFile( file )\n\t\t\tcontent = File.read( file )\n\t\t\tcontent = YAML.load( content )\n\t\t\tcontent\n\t\tend",
"title": ""
},
{
"docid": "1c22a3d5ac2cab028cce1d4a33cc00fe",
"score": "0.5263282",
"text": "def edit_external\n require 'canis/core/include/appmethods'\n require 'tempfile'\n f = Tempfile.new(\"canis\")\n l = self.text\n l.each { |line| f.puts line }\n fp = f.path\n f.flush\n\n editor = ENV['EDITOR'] || 'vi'\n vimp = %x[which #{editor}].chomp\n ret = shell_out \"#{vimp} #{fp}\"\n if ret\n lines = File.open(f,'r').readlines\n if @document\n @document.text = lines\n @document.parse_required\n self.text(@document)\n # next line works\n #self.text(lines, :content_type => :tmux)\n else\n set_content(lines)\n end\n end\n end",
"title": ""
},
{
"docid": "eaa7e2209b9eff91d56f6d52303279b8",
"score": "0.5262797",
"text": "def edit_template_file(file)\n editor = Howzit.options.fetch(:editor, ENV['EDITOR'])\n\n raise 'No editor defined' if editor.nil?\n\n raise \"Invalid editor (#{editor})\" unless Util.valid_command?(editor)\n\n create_template_file(file, prompt: true) unless File.exist?(file)\n `#{editor} \"#{file}\"`\n end",
"title": ""
},
{
"docid": "933765d9d17bb679c2eb0c992fafe4b9",
"score": "0.52531135",
"text": "def with_databaseyml(password = nil)\n temp = Tempfile.new([\"database\", \".yml\"], Rails.root.join(\"tmp\").to_s)\n temp.write(YAML.dump(settings(password)))\n temp.close\n\n yield temp.path\n ensure\n temp.delete\n end",
"title": ""
},
{
"docid": "3827d53cda34063898864b22bca83118",
"score": "0.524932",
"text": "def load_raw_yaml(filepath)\n return nil unless filepath && ::File.readable?(filepath)\n YAML.load_file(filepath).each_with_object({}) do |(k, v), h|\n h[k.to_sym] = v\n end\n end",
"title": ""
},
{
"docid": "9d9adb5850e3012b508876e2137bead7",
"score": "0.524549",
"text": "def edit_file(path)\n if editor\n as_app \"touch #{path} && chmod g+rw #{path}\"\n local_path = Tempfile.new('deploy-edit').path\n get(path, local_path)\n Recap::Support::ShellCommand.execute_interactive(\"#{editor} #{local_path}\")\n File.read(local_path)\n else\n abort \"To edit a remote file, either the EDITOR or DEPLOY_EDITOR environment variables must be set\"\n end\n end",
"title": ""
},
{
"docid": "48c872fe5e618618713174ccb117a947",
"score": "0.52400386",
"text": "def save_settings\n File.open(SETTINGS_FILE, File::TRUNC|File::WRONLY|File::CREAT) do |file|\n file.write @settings.to_yaml\n end\n end",
"title": ""
},
{
"docid": "aebba05b9711c8882cfe5f95acf012c7",
"score": "0.52338016",
"text": "def read_config (config_file, opts = {}) \n \n unless config_file.grep(/^\\//).empty?\n config_file_path = config_file\n else \n config_file_path = File.join(File.dirname(__FILE__), \"/../../config/\", config_file) \n end\n\n data = begin \n data = File.read(config_file_path)\n if opts[:erb]\n result = ERB.new(data).result(binding)\n # This is to take care of the inclusion of other\n # yml files...\n while !result.grep(/<\\%/).empty? \n result = ERB.new(result).result(binding)\n end\n else \n result = data\n end\n YAML.load(result)\n rescue Exception => e\n puts \"Error! Unable to read the file. \" + e\n end \n #puts data.inspect\n data \nend",
"title": ""
},
{
"docid": "bc4022c908e51cea892e9897a8bbd17d",
"score": "0.52283615",
"text": "def _test_against_yaml file_path\n\t\tyaml = YAML.load_file file_path\n\t\t$logger.debug yaml.to_yaml\n\t\tDBManager.insert yaml\n\tend",
"title": ""
},
{
"docid": "dad8443ec8291d151e8fedad8bb628e9",
"score": "0.5219687",
"text": "def yaml_entries\n yaml_entries = YAML.load(automatic_filename.read)\n if future_filename.exist?\n yaml_entries += YAML.load(future_filename.read)\n end\n yaml_entries\n end",
"title": ""
},
{
"docid": "6a614a873ea2fb3b4be1f6ff8103f797",
"score": "0.5214243",
"text": "def parrotize_yaml(file, lgdest, options = {})\n @lgdest = lgdest\n @file = file\n save_to = options[:save_to] || \"result_#{@lgstart}_#{@lgdest}.yaml\"\n\n yp = secure_load_yml_file( @file )\n\n yp.each do |k|\n klg = k.keys.first\n if klg != @lgdest\n @lgstart = klg\n newyaml = {}\n browse_hash k[klg], newyaml\n\n @allyaml = { @lgdest => newyaml }\n secure_save_yml_file(save_to, @allyaml)\n end\n end\n end",
"title": ""
},
{
"docid": "831bba093b913df339927e706f48a71d",
"score": "0.5207312",
"text": "def from_yaml(filename); end",
"title": ""
},
{
"docid": "6aa718152b350e91dec111823f0da23d",
"score": "0.5206034",
"text": "def read_yaml(spec_dir = @spec_dir)\n begin\n @yaml_data = YAML.load(File.read(spec_dir + \"/data/data.yaml\"))\n\n @file_inv = @yaml_data[:inv_data]\n @new_files = @yaml_data[:new_data]\n @edited_files = @yaml_data[:edited_data]\n @del_files = @yaml_data[:del_data]\n # NoMethodError if theres nothing in data.yaml\n rescue NoMethodError => e\n puts \"No data to read\"\n return false\n rescue => e\n puts e\n end\n return true\n end",
"title": ""
},
{
"docid": "37e22f127dca84cfc9c8bd778d79d4f4",
"score": "0.5203788",
"text": "def read_yaml(base, name)\n begin\n content = File.read(File.join(base, name))\n\n if content =~ /\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.data = YAML.safe_load($1)\n self.content = $' # everything after the last match\n end\n rescue => e\n puts \"Error reading file #{File.join(base, name)}: #{e.message}\"\n rescue SyntaxError => e\n puts \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"title": ""
},
{
"docid": "6a387e342cde01cd65b58adf7c6ee8b1",
"score": "0.51983154",
"text": "def readConfigFile( file )\n ## Loads the given file in as YAML and converts it into Ruby objects.\n config = Psych.load(IO.read(file, {\"open_args\"=>\"r:utf-8\"}))\n\n ## Replace file name with absolute paths.\n if config.has_key? \"files\"\n config[\"files\"].each do |key,f|\n config[\"files\"][key] = File.expand_path(f, File.dirname(file))\n end\n end\n\n config\nend",
"title": ""
},
{
"docid": "ec5c11c8954a2c6d4809b327fd05fecb",
"score": "0.51973766",
"text": "def read\n File.open(@path) do |file|\n YAML::load(file)\n end\n rescue Errno::ENOENT\n Claret::TaskList.new\n end",
"title": ""
},
{
"docid": "fb194cc23a22028b6353e8d946143864",
"score": "0.51929677",
"text": "def internals_interpolated_yaml\n @internals_interpolated_yaml ||= ::YAML.safe_load(\n replace_dollar_dollars(\n interpolate(\n raw_content,\n use_opto: false,\n substitutions: default_envs,\n warnings: false\n )\n ), [], [], true, file\n )\n rescue Psych::SyntaxError => ex\n raise ex, \"Error while parsing #{file} : #{ex.message}\"\n end",
"title": ""
},
{
"docid": "3c0a6602ba9e8f3c6307a1f4e16a8786",
"score": "0.51827496",
"text": "def temp_configuration_file\n @temp_configuration_file ||= begin\n tempfile = Tempfile.new(\"kplay-#{name}\")\n tempfile.write(configuration_yaml)\n tempfile.close\n tempfile\n end\n end",
"title": ""
},
{
"docid": "d7ba5ac2f5e40060aa9d297a1ea6a742",
"score": "0.517735",
"text": "def reload_file\n parse=YAML::parse(File.open('config_sms.yml'))\n @config=parse.transform\n end",
"title": ""
},
{
"docid": "b1b56f80c387853f342145c5ceb93a3f",
"score": "0.5176363",
"text": "def edit_external\n require 'canis/core/include/appmethods'\n require 'tempfile'\n f = Tempfile.new(\"canis\")\n l = self.text\n l.each { |line| f.puts line }\n fp = f.path\n f.flush\n\n editor = ENV['EDITOR'] || 'vi'\n vimp = %x[which #{editor}].chomp\n ret = shell_out \"#{vimp} #{fp}\"\n if ret\n lines = File.open(f,'r').readlines\n set_content(lines, :content_type => @old_content_type)\n end\n end",
"title": ""
},
{
"docid": "46c4787b9395746d6827c7ea9352f6e0",
"score": "0.5176212",
"text": "def koha_yaml(filepath)\n output = capture :cat, filepath\n YAML.load(output)\n end",
"title": ""
},
{
"docid": "6e3406b32286227928739199858db378",
"score": "0.5173918",
"text": "def call()\n documents = []\n if file && File.exists?(file)\n YAML.load_stream(File.open(file)) do |document|\n if document[\"kind\"] == \"Secret\"\n if document[\"data\"]\n document[\"data\"].each do |k,v|\n if decode?\n document[\"data\"][k] = Base64.strict_decode64(v)\n else\n document[\"data\"][k] = Base64.strict_encode64(v)\n end\n end\n end\n end\n documents << document\n end\n yaml = documents.map{|d| d.to_yaml}.join\n\n puts yaml\n if yes?\n File.open(file, 'w') { |file| file.write(yaml) }\n end\n else\n cli.show_help\n end\n exit\n end",
"title": ""
},
{
"docid": "98d7fcb1b7dfe118570ba5b1e2012aa2",
"score": "0.5173551",
"text": "def read_yaml filename\n YAML.load_file filename\nend",
"title": ""
},
{
"docid": "137215b8868a8373eb69d826ebb62daf",
"score": "0.5163637",
"text": "def custom_yml_content(reload: false)\n return @yaml if @yaml.present? && !reload\n\n @yaml = YAML.load(openshift_object.data['custom.yml'])\n end",
"title": ""
},
{
"docid": "929b59bbb654272c5100832a81aa0fb4",
"score": "0.51636183",
"text": "def save_yaml\n File.open(@yaml_path, 'w') {|f|\n f.write(@yaml.to_yaml)\n }\n end",
"title": ""
},
{
"docid": "b19516e1228e294002b5a70c74ec8e2b",
"score": "0.51621497",
"text": "def load_yml(filename); end",
"title": ""
},
{
"docid": "6b7fc336f5064bb630f9dc28a2966d5c",
"score": "0.51572037",
"text": "def do_templating\n tmpl = @vars[:template]\n raise 'No template file provided' if tmpl.nil?\n # Find what directory the source file is located in\n filepath = @args[:path] ? get_file_dir(@args[:path]) : ''\n @template = read_file(filepath + tmpl)\n passable_args = @vars.dup\n passable_args.delete(:template)\n passable_args[:content] = @content.join(\"\\n\")\n merge_with_template(@template, passable_args)\n end",
"title": ""
}
] |
a69d1fb338daf33f39abdeb0b1e045e1
|
helper function that puts blinds in pot upon dealing cards in first round of game sets first player to person after big blind
|
[
{
"docid": "97f36d539c0924ceed7cb9b6d6837e01",
"score": "0.71772695",
"text": "def addBlinds()\n s_blind_loc = get_next_player(self.dealer) # location of small blind player\n b_blind_loc = get_next_player(s_blind_loc) # location of big blind player\n # get player data for small and big blind locations\n s_blind_player = get_player(s_blind_loc) # actual players to change money\n b_blind_player = get_player(b_blind_loc)\n # put money from small and big blind players into pot\n put_money(self.small_blind, s_blind_player)\n put_money(self.big_blind, b_blind_player)\n self.current_player = get_next_player(b_blind_loc)\n b_blind_player.save\n s_blind_player.save\n self.save\n end",
"title": ""
}
] |
[
{
"docid": "633cf5403077a81055a70cf6867f6a00",
"score": "0.701084",
"text": "def set_blinds\n @active_players[0].current_bet = @small_blind_value\n @active_players[1].current_bet = @big_blind_value\n @table_current_bet = @active_players[1].current_bet\n @pot_size += @active_players[0].current_bet + @active_players[1].current_bet\n @committed += @pot_size\n @active_players.rotate!(2)\nend",
"title": ""
},
{
"docid": "014d0d804660280665e1ae2344986ddf",
"score": "0.6637581",
"text": "def fold_hand\n @active_players[0].folded = true\n pot_adjustment\n @active_players[0].current_bet = 0\n @active_players[0].acted = false\n system 'clear'\n puts 'You have folded your hand.'\n sleep(3)\nend",
"title": ""
},
{
"docid": "88f9863c28a6b54fdc091e8086238136",
"score": "0.6633257",
"text": "def pot_adjustment\n @committed += @active_players[0].current_bet unless @active_players[0].folded\n @pot_size += @active_players[0].current_bet\n @active_players[0].chip_stack -= @active_players[0].current_bet\n @active_players[0].acted = true\nend",
"title": ""
},
{
"docid": "187f83d32ac5fd2963749b52289af589",
"score": "0.6584967",
"text": "def play\n 2.times {deal}\n blind_score\n if player_hand.collect{|x| x.value}.inject(:+) == 21\n bjwin\n elsif computer_hand.collect{|x| x.value}.inject(:+) == 21\n bjlose\n else\n action\n end\n end",
"title": ""
},
{
"docid": "035478f7a7f559f5e41448a36c19a30f",
"score": "0.65105426",
"text": "def first_deal\n @printer = []\n if session[:player].chips == 0\n @printer << \"#{session[:player].gender}. #{session[:player].name} is all in!\"\n session[:player].make_reckless\n end \n deal_dealer\n de_total\n 2.times {deal_player}\n pl_total\n if session[:player].hand_total == 21\n @action = :end\n run_dealer\n else\n @action = :choice\n end\n chat\n end",
"title": ""
},
{
"docid": "97b658314b5c7b4afaa72eb017ffe498",
"score": "0.64788836",
"text": "def call_bet\n # Before we can adjust things we need to take away the player's (original) current bet from a few places.\n # This is so we don't add chips into the pot that don't exist!\n @pot_size -= @active_players[0].current_bet\n @committed -= @active_players[0].current_bet\n\n # If the current bet is more than the player's chip stack it means they need to go all in.\n if @active_players[0].chip_stack <= @table_current_bet\n all_in\n\n # If not, they can call the current bet as normal!\n else\n @active_players[0].current_bet = @table_current_bet\n pot_adjustment\n system 'clear'\n puts 'You have called the current bet.'\n sleep(3)\n end\nend",
"title": ""
},
{
"docid": "fe8635bc3562532fec1e71ffcfd28055",
"score": "0.64692295",
"text": "def tie_with_bj\n self.chips += self.bet_chips\n self.is_complete = true\n \"#{name} hit Blackjack! Dealer hit Blackjack too. Push for #{name}.\"\n end",
"title": ""
},
{
"docid": "bf17677efe3062e48cdc777750f4b147",
"score": "0.63921356",
"text": "def place_bet(player, amount)\n raise Exceptions::NotEnoughChips if player.chips < amount\n @pot += amount\n player.chips -= amount\n end",
"title": ""
},
{
"docid": "5eb21bb7c64c0264ef562905fcc2932c",
"score": "0.63853705",
"text": "def place_your_bets\n # Check to see if we need to ask for bet sizes\n if @num_rounds == 0 or need_bet_change or @io.change_bet_sizes\n @io.get_players_bet_sizes(@players, @min_bet, @max_bet, @bet_increment)\n end\n\n for player in @players\n player.start_hand\n end\n end",
"title": ""
},
{
"docid": "7b709ff8409dd95225295b593cb7b835",
"score": "0.63699895",
"text": "def win_jackpot\n @credits += @jackpot\n @jackpot = STARTING_JACKPOT\n puts self.class.message(:jackpot).colorize :green\n end",
"title": ""
},
{
"docid": "27f931d5b7ba0c9f80107b7c2ed10639",
"score": "0.63523096",
"text": "def pass_out_characters_and_coins\n if self.players.size == 2 && @settings.include?(:twoplayer)\n side_decks = [[], []]\n # Uh this is kinda wonky.\n # Oh Well YOLT (You only live twice) in Coup.\n 5.times {\n side_decks[0] << self.draw_cards(1)[0]\n side_decks[1] << self.draw_cards(1)[0]\n self.deck.rotate!\n }\n end\n\n self.deck.shuffle!\n\n # assign loyalties\n self.players.each_with_index do |player, index|\n if self.players.size == 2\n if @settings.include?(:twoplayer)\n player.receive_characters(self.draw_cards(1))\n player.receive_side_characters(*side_decks[index].shuffle)\n else\n player.receive_characters(self.draw_cards(2))\n end\n # first player gets 1 coin and second gets 2.\n player.give_coins(index + 1)\n else\n player.receive_characters(self.draw_cards(2))\n player.give_coins(2)\n end\n end\n end",
"title": ""
},
{
"docid": "d637d5eae6ab570349166736c54af910",
"score": "0.6343097",
"text": "def reset_game()\n # If money in pot, distribute\n while (self.pot > 0)\n winners = []\n # In case where everyone has folded, set the winner to whoever is left\n if self.players.where(:in_hand => true).length <= 1\n winners = self.players.where(:in_hand => true)\n else\n #gets people with highest score\n winners = get_winners()\n end\n winners.each do |winner|\n #TO IMPLEMENT: more advanced side pots\n winner.money += self.pot / winners.length()\n winner.save\n end\n self.pot = 0\n end\n # reset deck of cards\n self.cards.where.not(:location => -1).each do |card|\n card.location = -1\n card.save\n end\n # reset amount each player has in the pot to 0\n self.players.each do |player|\n player.in_hand = true\n player.in_pot_hand = 0\n player.in_pot_current = 0\n player.hand = ''\n player.save\n end\n # reset pot to empty, increment dealer if not first hand\n if self.round != -1\n self.dealer = (self.dealer + 1)%10 + 10\n end\n # makes sure a player exists where the dealer is set\n while self.players.where(:location => self.dealer).length == 0\n self.dealer = (self.dealer + 1)%10 + 10\n end\n self.round = 0\n self.high_bet = 0\n self.high_better = get_next_player(self.dealer)\n self.save\n deal(self.round)\n end",
"title": ""
},
{
"docid": "fd4cb8eea3c26f8b445a4b411b3445a3",
"score": "0.6318612",
"text": "def settle_round\n @io.prep_round_results\n for player in @players\n for hand in player.hands\n if player.is_dealer\n @io.show_hands(player)\n else\n # This shouldn't happen unless we quit in the middle of a hand\n # or we're playing god.\n if @dealer.hand.total < 17 and not @play_god\n @dealer.hand.play(@shoe)\n end\n \n # Use total_high in case our hand is soft\n if (hand.total_high > @dealer.hand.total and \\\n not hand.is_bust) or (@dealer.hand.is_bust and \\\n not hand.is_bust)\n if hand.is_bj and not hand.is_even_money\n player.win_bet((hand.bet * BLACKJACK_PAYS) + \\\n hand.bet)\n @dealer.pay(hand.bet * BLACKJACK_PAYS)\n else\n player.win_bet(hand.bet * 2)\n @dealer.pay(hand.bet)\n end\n @io.player_wins(player, hand)\n elsif hand.total_high == @dealer.hand.total\n if hand.is_bj and hand.is_even_money\n player.win_bet(hand.bet * 2)\n @dealer.pay(hand.bet)\n @io.player_wins(player, hand)\n else\n player.win_bet(hand.bet)\n @io.player_pushes(player, hand)\n end\n else\n @dealer.win_bet(hand.bet)\n @io.player_loses(player, hand)\n end\n end\n end\n player.finish_round\n end\n\n # Check to see if player is out of money, or doesn't have min_bet\n for player in @players\n unless player.is_dealer\n if player.bankroll == 0 or player.bankroll < @min_bet\n @io.player_out_of_money(player, @min_bet)\n @broke_players[@broke_players.length] = player\n @players.delete(player)\n throw :quit if @players.length == 1\n end\n end\n end\n end",
"title": ""
},
{
"docid": "18207cb8489d92d269d5a5438d5290d3",
"score": "0.6316715",
"text": "def betting_round()\n puts \"\\n\\n\\n#### THERE WE BEGIN ####\\n\\n\"\n\n # Dealer gets 2 cards, we could do dealing cards in round-robin, but thats just additional work, doesnt really matter, just an extra block of code\n @dealer.push_card(0,get_card)\n @dealer.push_card(0,get_card)\n puts \"*************** DEALER CARDS [#{@dealer.hands[0].get_card(0)}] [__] *********************\" # {@dealer.hands[0].cards[1]}\n\n # get players bets & then give them 2 cards\n # TODO if player bets 0 or less, maybe exit them from the game? code is short, just puts \"PLAYER exiting\" and delete it from the @players array\n @players.each do | player|\n #player.hands[0].cards = [get_card, get_card] # give player 2 cards\n player.push_card(0,get_card)\n player.push_card(0,get_card)\n player.print_hand(0)\n while (player.get_bet(0) <= 0 or player.get_bet(0) > player.amount)\n print \"Player #{player.player_number}, enter bet amount between 1 & #{player.amount} : \"\n player.set_bet(0,gets.to_i) # get a bet from player which he can afford\n end\n #player.amount = player.amount - player.hands[0].bet # reduce player's available amount by bet amount\n player.modify_account(player.get_bet(0),-1)\n player.print_Player # print player\n puts \"\"\n end # end for each player\n puts \"=================================================================\"\n end",
"title": ""
},
{
"docid": "ad829a4048a7644d989deae60b0ac7b4",
"score": "0.626034",
"text": "def place_bet(hand)\n hand.bet = @bet\n @bankroll -= @bet\n @@bankroll -= @bet\n end",
"title": ""
},
{
"docid": "a6f6318763f2c1724fa1a9a1711f9b47",
"score": "0.62582505",
"text": "def double_player(player)\n player.bet *= 2\n end",
"title": ""
},
{
"docid": "28da0ffb9975b288cbca45e4cbb080ca",
"score": "0.62524056",
"text": "def place_double_bet(amount)\n hand = @hands[@current_hand]\n hand.bet += amount\n @total_money -= amount\n end",
"title": ""
},
{
"docid": "71017b4f6efa5970ae4d927d1bc4064c",
"score": "0.62491536",
"text": "def switch_player\n\t\tputs \"\\n\"\n\t\tif @player == @player1\n\t\t\t@player = @player2\n\t\t\t@other_player = @player1\n\t\telse\n\t\t\t@player = @player1\n\t\t\t@other_player = @player2\n\t\tend\n\t\t\n\t\t#Matt easter egg\n\t\tif @player.name.downcase == 'matt'\n\t\t\tdescriptors = [' the Amazing', ' the Hero', ' the Incroyable', \n\t\t\t\t\t\t ' the Handsome', ' the Clever', ' the Wonderful', ' the Indominable']\n\t\t\t@player.name = @player.name + descriptors.sample\n\t\tend\n\n\t\t@player.stench -= 1\n\t\t@player.stench = 4 if @player.location == :Rubbisher\n\t\t@player.beans -= 1\n\t\t@player.pills += 1 if @player.pills > 0\n\t\tif @player.location == :free && @other_player.location == :free\n\t\t\t@escape_artists = @escape_artists.upcase\n\t\t\tif @player.stench > 0 || @player.beans > 0 || @other_player.stench > 0 || @other_player.beans > 0\n\t\t\t\t@stinky = @stinky.upcase\n\t\t\tend\n\t\t\tif (@player.stench > 0 && @other_player.beans > 0) || (@player.beans > 0 && @other_player.stench > 0)\n\t\t\t\t@double_stink = @double_stink.upcase\n\t\t\tend\n\t\t\tputs \"\\nYou've both escaped! Congratulations!\"\n\t\t\tif @player.dead\n\t\t\t\tputs @player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0 && @player.location != :Rubbisher\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\t\tif @other_player.dead\n\t\t\t\tputs @other_player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @other_player.beans > 0\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @other_player.stench > 0\n\t\t\tshow_achievements\n\t\t\t@game = false\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\tputs \"\\nYou've escaped, but you've left your friend behind to rot.\\n\"\\\n\t\t\t\t \"Way to go, hero.\"\n\t\t\t@game = false\n\t\tend\n\t\tif @player.location == :free\n\t\t\tputs \"\\n\" + @player.name + \" is free!\"\n\t\tend\n\t\tif @player.dead\n\t\t\tputs \"\\n\" + @player.name + \" is dead.\"\n\t\tend\n\t\tshow_current_description unless @player.location == :free\n\t\tputs \"\\nThe world swims before your eyes.\" if @player.pills == 2\n\t\tputs \"\\nIn the corners of your vision, colorful phantasms\\nflicker in and out of being.\" if @player.pills == 3\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour stomach hurts.\" if @player.pills == 4\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour entire body is starting to hurt.\" if @player.pills == 5\n\t\tif [4, 5].include?(@player.pills) && @player.location == :Lair && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature's image in the spirit world is far stronger than\\n\"\\\n\t\t\t\t \"in the real. In the spirit world, you can see the ideas holding\\n\"\\\n\t\t\t\t \"the creature together... you reach out your hand and you can\\n\"\\\n\t\t\t\t \"feel them, too. You twist your fingers and those ideas shift.\\n\"\\\n\t\t\t\t \"The creature blurs and disappears. In it's place, a mouse falls\\n\"\\\n\t\t\t\t \"to the floor and scampers away. Without the creature there, you\\n\"\\\n\t\t\t\t \"can see an exit to the north.\" \n\t\t\twin_door(:Lair, :north)\n\t\tend\t\n\t\tif @player.pills == 6\n\t\t\tputs \"\\nYour entire body feels like tiny rats are eating you from inside your veins,\\n\"\\\n\t\t\t\"and the rats are on fire. You can't do anything but lie on the floor and moan.\"\n\t\t\t@player.dead = true\n\t\t\t@overdose = @overdose.upcase\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0\n\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\tif @player.location == :Lair && (@player.stench > 0 || @player.beans > 0) && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature takes a step back, and wrinkles its already wrinkly nose. As it\\n\"\\\n\t\t\t\"glides to the side and disappears through the wall, you think you hear it\\n\"\\\n\t\t\t\"mutter something about the disadvantages of an enhanced sense of smell.\\n\"\\\n\t\t\t\"Without the creature there, you can see an exit to the north.\"\n\t\t\twin_door(:Lair, :north)\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tif @player.dead\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\n\t\t#Matt easter egg\n\t\tif ['matt the amazing', 'matt the hero', 'matt the incroyable', \n\t\t\t'matt the handsome', 'matt the clever', 'matt the wonderful', \n\t\t\t'matt the indominable'].include?(@player.name.downcase)\n\t\t\t@player.name = @player.name.slice(0, 4)\n\t\tend\n\t\n\tend",
"title": ""
},
{
"docid": "efaff604689a5b51e9dbb24824be3846",
"score": "0.62368166",
"text": "def tie_with_bj_insurance\n self.chips += 3 * self.bet_chips\n self.is_complete = true\n \"Dealer hit Blackjack. #{name} hit Blackjack too! A push for #{name}.\n #{name} bought an insurance. Pay 2 times of insurance.\"\n end",
"title": ""
},
{
"docid": "7905108c6c70547705ae9aed72a79e5b",
"score": "0.62310296",
"text": "def individual_bet(player)\n if $Counting_Mode\n print counting_recommended_bet(player)\n print \"You have $#{player.wallet}. \"\n else\n print \"#{player.name}, you have $#{player.wallet}. \"\n end\n\n bet = get_int_input \"How much would you like to wager? $\"\n\n if bet < @table_minimum\n linebreak\n puts \"You must bet at least the minimum bid of $#{@table_minimum}.\"\n individual_bet(player)\n elsif bet > player.wallet\n linebreak\n puts \"You cannot bet more than you have left in your wallet.\"\n individual_bet(player)\n else\n player.wallet -= bet\n player.current_bet = bet\n end\n end",
"title": ""
},
{
"docid": "95b3176336f4c6d9580a1d751e57b0b3",
"score": "0.6218956",
"text": "def play_as_master_first\r\n @pending_points = 0\r\n w_cards = []\r\n curr_points_me = @team_mates.inject(0){ |result, name_pl| result + @points_segno[name_pl] }\r\n @cards_on_hand.each do |card_lbl|\r\n card_s = card_lbl.to_s # something like '_Ab'\r\n segno = card_s[2,1] # character with index 2 and string len 1\r\n is_card_lbl_briscola = card_s[2] == @briscola.to_s[2] \r\n curr_w = 0\r\n curr_w += 70 if is_card_lbl_briscola\r\n # check if it is an asso or 3\r\n curr_w += 220 if card_s[1] == \"A\"[0]\r\n curr_w += 200 if card_s[1] == \"3\"[0] \r\n if card_s =~ /[24567]/\r\n # liscio value\r\n lisc_val = (card_s[1] - '0'[0]).to_i\r\n curr_w += 50 + lisc_val\r\n end\r\n curr_w += 60 if card_s[1] == \"F\"[0]\r\n # check horse and king cards\r\n if card_s[1] == \"C\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 90 + 70\r\n else\r\n curr_w += 30\r\n end\r\n end \r\n if card_s[1] == \"R\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 100 + 70\r\n else\r\n curr_w += 20\r\n end\r\n end\r\n # penalty for cards wich are not stroz free\r\n curr_w += 10 * @strozzi_on_suite[segno].size\r\n if (curr_points_me + @deck_info.get_card_info(card_lbl)[:points]) > @target_points\r\n curr_w -= (@deck_info.get_card_info(card_lbl)[:points] + 100)\r\n curr_w -= 200 if is_card_lbl_briscola\r\n curr_w -= 1000 if is_card_lbl_briscola and card_s[1] == \"A\"[0]\r\n end\r\n \r\n w_cards << [card_lbl, curr_w ] \r\n end\r\n # find a minimum\r\n #p w_cards\r\n min_list = w_cards.min{|a,b| a[1]<=>b[1]}\r\n @log.debug(\"Play as first: best card#{min_list[0]}, (w_cards = #{w_cards.inspect})\")\r\n return min_list[0]\r\n end",
"title": ""
},
{
"docid": "516105195e0a3679a66f0cf4146683be",
"score": "0.6218187",
"text": "def human_player_and_ai(size)\n\tif first?()\n @player1 = \"player\"\n @player2 = difficulty(size,\"o\")\n else\n @player1 = difficulty(size,\"x\")\n @player2 = \"player\"\n end\nend",
"title": ""
},
{
"docid": "559b6d2bae09451b418ea2c0ce3a6b4c",
"score": "0.6214163",
"text": "def deal(round)\n round_int = round.to_i\n case round_int\n when 0\n self.players.each do |player|\n move_card(get_random_card, player.location) # moves cards to users\n move_card(get_random_card, player.location)\n # player.in_hand = true\n player.save\n end\n addBlinds()\n when 1\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0) #moves cards to table\n move_card(get_random_card, 0)\n move_card(get_random_card, 0)\n when 2\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0)\n when 3\n self.current_player = get_next_player(self.dealer)\n move_card(get_random_card, 0)\n when 4\n get_winners()\n else\n p 'deal case > 4 or < 0, error'\n end\n\n self.players.each do |player|\n player.in_pot_current = 0\n player.save\n end\n if round_int > 0 && round_int < 4\n self.high_bet = 0\n self.high_better = self.current_player\n end\n self.save\n end",
"title": ""
},
{
"docid": "5fd7748350d0d5fd716bf0d003a2efbf",
"score": "0.62088937",
"text": "def pay_blinds\n @dealer.pay(@game.small_blind)\n @under_the_gun.pay(@game.big_blind)\n end",
"title": ""
},
{
"docid": "45591f67f7030150e5a60e638bdbfd87",
"score": "0.6181216",
"text": "def double\n @printer = []\n @printer << \"You double your bet and take one more card.\"\n session[:player].make_reckless if session[:player].hand_total > 12\n session[:player].chips -= session[:bet]\n session[:bet] += session[:bet]\n deal_player\n pl_total\n @action = :end\n run_dealer\n chat\n end",
"title": ""
},
{
"docid": "9b8b1cafc6421cbcb45bedc71d1a2191",
"score": "0.6180611",
"text": "def dealer_bust\n puts \"The dealer busted. You win\"\n player_win\n end",
"title": ""
},
{
"docid": "d4fdb4f542319bcfe5a0c46ea2364380",
"score": "0.6171526",
"text": "def new_round\n take_bets\n set_hands\n show_hands\n if @player.chip_pool >= @player_bet\n hit_or_stay\n else\n hit_or_stay_cont\n end\n @dealer.hit_til_stay unless @player.hand.bust\n show_dealer_hand\n if !(@dealer.hand.bust)\n winning_hand\n else\n dealer_bust\n end\n end",
"title": ""
},
{
"docid": "5919ed2f1e768026ee531ce5929b15d0",
"score": "0.6171155",
"text": "def bust\n if player.score > 21 || dealer.score > 21\n puts \"---------------BUST!---------------\"\n show_hand\n play_again\n end\n end",
"title": ""
},
{
"docid": "c6f833bcc9b6e1a31ff19464cc52d93d",
"score": "0.617106",
"text": "def dealer\n if @hand\n (@hand.dealer == @player1) ? @player2 : @player1\n else\n # coin toss\n (rand(2) == 0) @player1 : @player2\n end\n end",
"title": ""
},
{
"docid": "a6b34b6507561af595ef8cddd6e2d7e8",
"score": "0.61558694",
"text": "def award_spoils\n if @turn_winner\n @turn_winner.deck.cards << @spoils_of_war.shuffle \n @turn_winner.deck.cards = @turn_winner.deck.cards.flatten\n end\n end",
"title": ""
},
{
"docid": "3298524f030d7160d41ba46b8d67a018",
"score": "0.6113196",
"text": "def bookkeeping_before_betting()\n @dealer.reset() ## very important to reset dealer\n @players.delete_if{|player| player.amount <= 0} ## remove broke players\n if @players.size == 0\n puts \"**********WE NEED MORE PLAYERS**************\"\n exit() # exit if no more players left\n end\n @players.each do | player|\n player.reset() ## reset remaining players\n end # end reset\n end",
"title": ""
},
{
"docid": "6e6b901c142581d2d59094dc3397d7f8",
"score": "0.610542",
"text": "def set_bets\n\n if player.chips == 0\n puts \"I'm sorry you run out of chips, maybe next time\"\n exit\n end\n\n puts \"#{player.name} you have a total of #{player.chips} chips\"\n puts \"how many would you like to bet\"\n answer = gets.chomp.to_i\n while answer < 0 || answer > player.chips\n set_bets\n end\n player.chips -= answer\n player.bet = answer\n\n end",
"title": ""
},
{
"docid": "2ff69b5f4822148372d1f7795ffe4578",
"score": "0.6105102",
"text": "def player_turn\n puts \"It's #{player.name}'s turn.\"\n\n blackjack_or_bust?(player)\n\n while !player.is_busted?\n puts \"What do you want to do? 1) Hit 2) Stay\"\n response = gets.chomp\n\n if ![\"1\", \"2\"].include?(response)\n puts \"Error, you must enter 1 or 2.\"\n next\n end\n\n if response == \"2\"\n puts \"#{player.name} choses to stay.\"\n break\n end\n\n new_card = deck.deal_one\n puts \"Dealing card to #{player.name}: #{new_card}\"\n player.add_card(new_card)\n puts \"#{player.name}'s total is now: #{player.total}\"\n\n blackjack_or_bust?(player)\n\n end\n end",
"title": ""
},
{
"docid": "21a8941a3d8d4cbb86668eff76749db0",
"score": "0.6104985",
"text": "def take_bets\n @players.each do |p|\n @events.handle(:pre_player_bet, p)\n\n p.hand.bet = p.place_bet\n\n @events.handle(:post_player_bet, p, p.hand.bet)\n end\n end",
"title": ""
},
{
"docid": "2f48981b2a0d8d7f2e0f1c87cfe72ffd",
"score": "0.60932434",
"text": "def summon_part2(battler)\n $game_party.refresh\n action_anime(battler)\n unless $game_party.summonable?(battler.summoning)\n if battler.summon_item != 0\n $game_party.lose_item(battler.summon_item, 1) if $data_items[battler.summon_item].consumable\n else\n battler.consume_skill_cost($data_skills[battler.summoning])\n end\n battler.current_phase = 'Phase 6-1'\n else\n battler.current_phase = 'Summon 3'\n end\n end",
"title": ""
},
{
"docid": "e5a21f0ed601de95c620873562110d70",
"score": "0.6091896",
"text": "def first_hand\n @player_hand = deck.cards.pop(2)\n @dealer_hand = deck.cards.pop(2)\n puts \"House will now deal you two cards..Press any key.\"\n #Dumb speech, might take out.\n %x(say 'to lose')\n gets\n #Shows the first two cards you receive\n puts \"Dealer showing #{dealer_hand[0].face} of #{dealer_hand[0].suit}.\"\n puts \"You have a #{player_hand[0].face} of #{player_hand[0].suit} and a #{player_hand[1].face} of #{player_hand[1].suit}. \"\n two_aces\n if dealer_score == 21\n puts \"Well you lost, I got #{dealer_score} already. That was quick huh.\"\n dealer_win\n play_again\n elsif player1_score == 21\n puts \"You win. with a total of #{player1_score}. I didn't even get to deal :(\"\n player_win\n play_again\n else\n play\n end\n end",
"title": ""
},
{
"docid": "8e04d197ae322dfac2bbe8d75cf33f5a",
"score": "0.60859734",
"text": "def award_spoils(winner)\n if winner == @player1\n @spoils_of_war.each do |card|\n @player1.deck.add_card(card)\n end\n elsif winner == @player2\n @spoils_of_war.each do |card|\n @player2.deck.add_card(card)\n end\n else\n p \"NO WINNER. ALL SPOILS.\"\n end\n @spoils_of_war = []\n end",
"title": ""
},
{
"docid": "3dc182125b31c34ff72800b8409c1f7a",
"score": "0.6072561",
"text": "def defeat\n @current_player = @players[\"plyr2\"]\n if @it == 12\n puts \" \"\n puts \" Code-breaker #{@current_player} loses!!\"\n puts \" \"\n puts \"Solution is #{@result}\"\n puts \" \"\n end\n end",
"title": ""
},
{
"docid": "6fddf9d9ab88efd0910c7a695c319eb5",
"score": "0.6063699",
"text": "def take_turn(\n active_pot: nil,\n previous_player: nil\n )\n puts \"--------------------\\n#{self} #{__method__}\" if Chooglin.debug?\n\n steal_attempt = false\n previous_player_debug_name = previous_player&.to_s || 'previous_player'\n\n if active_pot\n if steal_proc.call(active_pot)\n puts \"\\033[0;36mSTEAL ATTEMPT\\033[0;0m (for #{active_pot.points} points)\"\n steal_attempt = true\n else\n puts \"\\033[0;36mNO STEAL\\033[0;0m (leaving behind #{active_pot.points} points for #{previous_player_debug_name})\"\n\n previous_player&.add_pot!(active_pot, state: :earned_undefended)\n\n active_pot = Chooglin::Pot.new\n end\n else\n active_pot = Chooglin::Pot.new\n end\n\n dice_remaining = active_pot.dice_remaining\n\n loop do\n puts \"\\033[0;34mROLLING\\033[0;0m (with #{dice_remaining} dice at #{active_pot.points} points)\" if Chooglin.debug?\n\n roll = Chooglin::Roll.random(dice_remaining)\n puts roll if Chooglin.debug?\n\n chosen_subset = subset_to_take_on_roll.call(roll, @total_points)\n\n if chosen_subset.nil?\n if steal_attempt\n puts \"\\033[0;36mSTEAL FAILED\\033[0;0m (#{active_pot.points} points awarded to #{previous_player_debug_name})\" if Chooglin.debug?\n previous_player&.add_pot!(active_pot, state: :earned_defended)\n return nil\n else\n puts \"\\033[0;33mBUSTED\\033[0;0m (lost #{active_pot.points} points)\" if Chooglin.debug?\n add_pot!(active_pot, state: :lost_busted)\n return nil\n end\n end\n\n puts chosen_subset if Chooglin.debug?\n\n if steal_attempt\n puts \"\\033[0;36mSTEAL SUCCESSFUL\\033[0;0m (#{active_pot.points} points from #{previous_player_debug_name})\" if Chooglin.debug?\n previous_player&.add_pot!(active_pot, state: :lost_stolen)\n active_pot.add_subset(chosen_subset)\n active_pot.mark_unmarked_subsets_as(:unearned_stolen)\n steal_attempt = false\n else\n active_pot.add_subset(chosen_subset)\n end\n\n dice_remaining = roll.size - chosen_subset.size\n\n if dice_remaining > 0 && !keep_rolling.call(roll, chosen_subset, active_pot.points)\n puts \"\\033[0;32mQUITTING\\033[0;0m (with #{active_pot.points} points at #{dice_remaining} dice remaining)\" if Chooglin.debug?\n return active_pot\n elsif dice_remaining == 0\n puts \"\\033[0;31mHOT DICE\\033[0;0m (with #{active_pot.points} points)\" if Chooglin.debug?\n dice_remaining = 6\n end\n end\n end",
"title": ""
},
{
"docid": "cdf6d27b1333b77226e6a667c0a79084",
"score": "0.6062627",
"text": "def give_cards_to_winner(winner, loser)\n lost_cards = loser.give_hand\n winner.receive_cards(lost_cards)\n end",
"title": ""
},
{
"docid": "4a6e0fd2eeb4086156b2f279767b4ba7",
"score": "0.6060999",
"text": "def play_like_a_dummy\r\n # very brutal algorithm , always play the first card\r\n card = @cards_on_hand.pop\r\n return card\r\n end",
"title": ""
},
{
"docid": "bb5d539a55a6539bf9b23d57b6ae377a",
"score": "0.60449487",
"text": "def start_game\n @deck_current = @deck_default\n @hand_dealer = []\n @hand_player = []\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"player\")\n get_card_and_put_in_hand(\"player\")\n\n display_board_screen(true)\n\n result_player = turn_player\n\n if result_player === \"over\"\n puts \"player is over 21, press enter to continue\"\n gets\n bet_attribution(\"lose\")\n display_betting_screen(false)\n elsif result_player === \"stay\"\n result_dealer = turn_dealer\n end\n \n if result_dealer === \"over21\"\n puts \"Dealer over 21, press enter to continue\"\n gets\n bet_attribution(\"win\")\n display_betting_screen(false)\n elsif result_dealer === \"over17\"\n final_result = check_who_wins(calculate_hand_total_value(@hand_dealer), calculate_hand_total_value(@hand_player))\n if final_result === \"draw\"\n puts \"It's a draw, press enter to continue\"\n bet_attribution(\"push\")\n elsif final_result === \"player\"\n puts \"Player wins, press enter to continue\"\n bet_attribution(\"win\")\n elsif final_result === \"dealer\"\n puts \"Dealer wins, press enter to continue\"\n bet_attribution(\"lose\")\n end\n \n gets\n display_betting_screen(false)\n end\n\nend",
"title": ""
},
{
"docid": "76b7c9d1fca49534055f372bd67532e4",
"score": "0.60401773",
"text": "def startBetting\r\n\t#1 -- Tell user their odds\r\n\tgetUserOdds\r\n\t@new_round = true #Flag for user to determine if its a new round\r\n\t@bet_made = false\r\n\tuser_bet = false\r\n\tloop = 0\r\n\tbet = 0\r\n\t\r\n\tbegin \r\n\t\tloop += 1\r\n\t\t@table.each_with_index do |player, index|\r\n\t\t#-- Calculate computer decisions\r\n\r\n\t\t\t#Check table\r\n\t\t\tif @table.length == 1\r\n\t\t\t\tprintLine\r\n\t\t\t\tputs \"Everyone has folded!\" \r\n\t\t\t\tputs \"Congratulations #{player.name} you won $#{@table.pot_size}!\"\r\n\t\t\t\tplayer.deposit(@table.pot_size)\r\n\t\t\t\t@hand_finished = true\r\n\t\t\t\treturn\r\n\t\t\tend\r\n\r\n\r\n\t\t\t# -- Compute Computer decision\r\n\t\t\tif player != @user\r\n\t\t\t\t#Fill style requirements to decide\r\n\t\t\t\tplayer.style.odds = player.odds\r\n\t\t\t\tplayer.style.starting_chip = @starting_chip\r\n\t\t\t\tplayer.style.bankroll = player.bankroll\r\n\t\t\t\tplayer.style.pot_size = @table.pot_size\r\n\t\t\t\tplayer.style.bet_made = true if @bet_made\r\n\t\t\t\tplayer.style.bet_made = false if !@bet_made\r\n\r\n\t\t\t\t@decision = player.style.decide\r\n\t\t\t\tif @decision == \"bet\"\r\n\t\t\t\t\tputs \"#{player.name} bet $2!\"\r\n\t\t\t\t\t@table.bet(2,player)\r\n\t\t\t\t\t@bet_made = true\r\n\t\t\t\telsif @decision == \"fold\"\r\n\t\t\t\t\tputs \"#{player.name} folded!\"\r\n\t\t\t\t\t@table.fold(player)\r\n\t\t\t\t\tplayer.folds += 1\r\n\t\t\t\t\tbreak if index == @num_players - 1\r\n\t\t\t\telsif @decision == \"check\"\r\n\t\t\t\t\tputs \"#{player.name} checked!\"\r\n\t\t\t\t\tputs index\r\n\t\t\t\t\tbreak if index == @num_players - 1\r\n\t\t\t\telsif @decision == \"call\"\r\n\t\t\t\t\tputs \"#{player.name} called!\"\r\n\t\t\t\t\t@table.bet(2,player)\r\n\t\t\t\t\tif index == @table.length - 1 && loop == 2\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\t# -- Compute User decision if user hasn't folded\r\n\t\t\telsif !@table.folded.include? @user\r\n\t\t\t\t# 2 -- Ask for User input\r\n\t\t\t\tputs \"\"\r\n\t\t\t\tif @table.pot_size == 0 || new_round\r\n\t\t\t\t\tputs \"Your turn! Would you like to check, bet or fold?\" \r\n\t\t\t\telsif user_bet\r\n\t\t\t\t\tputs \"Your turn! Would you like to check or fold?\"\r\n\t\t\t\telse \r\n\t\t\t\t\tputs \"Your turn! Would you like to call or fold?\"\r\n\t\t\t\tend\r\n\t\t\t\tprint\"--> \"\r\n\t\t\t\t@choice = gets.chomp\r\n\t\t\t\tif @choice.include? 'bet' \r\n\t\t\t\t\t@table.bet(2,player)\r\n\t\t\t\t\t@bet_made = true\r\n\t\t\t\t\tuser_bet = true\r\n\t\t\t\t\tputs \"#{player.name} bet $2\"\r\n\t\t\t\telsif @choice.include? 'fold'\r\n\t\t\t\t\tputs \"\"\r\n\t\t\t\t\tputs \"#{player.name} folded!\"\r\n\t\t\t\t\t@table.fold(player)\r\n\t\t\t\t\tplayer.folds += 1\r\n\t\t\t\telsif @choice.include? 'check' \r\n\t\t\t\t\tputs \"#{player.name} checked!\"\r\n\t\t\t\t\tbreak if index == @table.length - 1\r\n\t\t\t\telsif @choice.include? 'call'\r\n\t\t\t\t\t@table.bet(2,player) \r\n\t\t\t\t\tputs \"#{player.name} called!\"\r\n\t\t\t\t\tif index == @table.length - 1 && loop == 2\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\t\t\r\n\t\t\t#Evaluate if round should continue after full loop\r\n\t\t\tif index == @table.length - 1 && loop == 1\r\n\t\t\t\tloop += 1\r\n\t\t\t\tif @choice.include? 'bet'\r\n\t\t\t\t\tstartBetting\r\n\t\t\t\telsif @choice.include? 'call' \r\n\t\t\t\t\tbreak\r\n\t\t\t\telsif @decision.include? 'bet'\r\n\t\t\t\t\tstartBetting\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend until loop == 2 \r\n\t\r\n\t#If River hand and \r\n\tif @betting_round == 4\r\n\t\t#2 -- Showdown\r\n\t\tprintLine\r\n\t\tputs \" \t SHOWDOWN ROUND!\"\r\n\t\tprintLine\r\n\r\n\t\t#1 -- Call API to get winning hand \r\n\t\tproxy = PokerOddsProxy.new(URL_ODDS)\r\n\t\thand = []\r\n\t\t@table.each {|player| hand += player.cards}\r\n\t\twinners = proxy.getWinners(hand,@table.length,@table.board)\r\n\t\twinner = winners[0,4]\r\n\r\n\t\t@table.each do |player|\r\n\t\t\tplayer.losses += 1 \r\n\t\t\tif winner == player.cards.join\r\n\t\t\t\tputs \"Congratulations #{player.name} you won $#{@table.pot_size}!\" \r\n\t\t\t\tplayer.deposit(@table.pot_size)\r\n\t\t\t\tplayer.wins += 1\r\n\t\t\t\tplayer.losses -= 1\r\n\t\t\tend\t\t\r\n\t\t\t@hand_finished = true\t\r\n\t\tend\r\n\tend\t\r\n\r\n\t@table.removeFolded\r\n\tprintLine\r\n\tputs \"Pot Total = $#{@table.pot_size}\"\r\n\t\r\nend",
"title": ""
},
{
"docid": "1b207652ccf66061a69058f6b19615b4",
"score": "0.6039803",
"text": "def kick_player(player=@players.first)\n @turn_timer = nil\n announce \"#{Bold}#{player.user}#{Bold}: You have been \" +\n \"dropped from #{DOS} ...#{REMARK.sample}\"\n if @players.length >= 3\n next_turn if player == @players.first\n debug @stock.length\n while player.cards.length > 0\n @stock.insert(rand(@stock.length), player.cards.shift)\n end\n debug @stock.length\n @dropouts << @players.delete_one(player)\n else\n # Don't dump the kicked player's cards. We\n # need those to count the winner's earnings.\n debug @stock.length\n while @players.last.cards.length > 0\n @stock.insert(rand(@stock.length), @players.last.cards.shift)\n end\n debug @stock.length\n next_turn\n end_game\n end\n end",
"title": ""
},
{
"docid": "d09a73fa964109e23b88dd01cde931bc",
"score": "0.6036328",
"text": "def take_all_bets\n\t\tno_raises = false\n\t\tplayer_seats = players.dup.select do |p| \n\t\t\tp.bankroll > 0 && !p.folded?\n\t\tend.shuffle\n\t\t\n\t\t# first in player_seats bets\n\t\tcurr_high_bet = get_opening_bet(player_seats)\n\t\t\n\t\t#A betting round ends when all active players have bet an equal amount or everyone folds to a player's bet or raise\n\t\tuntil no_raises\n\t\t\tno_raises = true\n\t\t\tplayer_seats = player_seats.rotate\n\t\t\n\t\t\tplayer_seats.each_with_index do |player, i| \n\t\t\t\tnext if player.folded?\n\t\t\t\tnext if player.raised? || player.betted?\n\t\t\t\tputs \"\\nPlayer #{i+1}, #{player.name}'s turn. Current high bet: #{curr_high_bet}. Current pot: #{@pot}.\"\n\t\t\t\tmove = player.get_move\n\t\t\t\t\n\t\t\t\tcase move\n\t\t\t\twhen :fold\n\t\t\t\t\tplayer.folded = true \n\t\t\t\twhen :see\n\t\t\t\t\tbegin\n\t\t\t\t\t\tplayer.take_bet(curr_high_bet)\n\t\t\t\t\trescue PokerError # move on to next player \n\t\t\t\t\t\tputs \"You cannot afford this bet.\".red\n\t\t\t\t\t\tplayer.folded = true\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"#{player.name}'s bankroll is now: #{player.bankroll}.\"\n\t\t\t\t\t\t@pot += curr_high_bet\n\t\t\t\t\t\tplayer.betted = true\n\t\t\t\t\tend\n\t\t\t\twhen :raise\n\t\t\t\t\tbegin\n\t\t\t\t\t\traise PokerError if curr_high_bet > player.bankroll\n\t\t\t\t\t\traise_bet = player.get_bet\n\t\t\t\t\t\traise BadInputError unless raise_bet > curr_high_bet\n\t\t\t\t\trescue BadInputError\n\t\t\t\t\t\tputs \"You must raise higher than the current bet.\".red\n\t\t\t\t\t\tretry \n\t\t\t\t\trescue PokerError\n\t\t\t\t\t\tputs \"You cannot afford this bet.\".red\n\t\t\t\t\t\tplayer.folded = true\n\t\t\t\t\telse # successful raise\n\t\t\t\t\t\tno_raises = false\n\t\t\t\t\t\tplayer.take_bet(raise_bet + curr_high_bet)\n\t\t\t\t\t\tputs \"#{player.name}'s bankroll is now: #{player.bankroll}.\"\n\t\t\t\t\t\tcurr_high_bet = raise_bet\n\t\t\t\t\t\t@pot += curr_high_bet\n\t\t\t\t\t\tplayer.raised = true\n\t\t\t\t\t\t# other players must now match raise\n\t\t\t\t\t\tplayer_seats.reject{|p| p == player}.each do |p|\n\t\t\t\t\t\t\tp.raised = false\n\t\t\t\t\t\t\tp.betted = false\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\tbreak if round_over?\n\t\tend\n\tend",
"title": ""
},
{
"docid": "8ccdb90b7707f4b83a43b30bc8c53325",
"score": "0.6021812",
"text": "def play_dealer(hand, shoe, odds, upcard_result)\n case decide(hand)\n when :stand\n upcard_result[result(hand)] += odds\n when :hit\n CARDS.each do |card|\n next unless shoe.any?(card)\n card_odds = shoe.odds_of(card)\n\n hand.push(card)\n shoe.consume(card)\n\n play_dealer(hand, shoe, odds * card_odds , upcard_result)\n\n shoe.replace(card)\n hand.pop\n end\n else\n raise \"error, illegal hand action\"\n end\nend",
"title": ""
},
{
"docid": "4ad9a04507d7133eefafd55e6d56c1d2",
"score": "0.6020022",
"text": "def start\n if first_game == true\n puts \"Welcome to Blackjack!\"\n end\n self.money -= 10\n puts money\n 2.times do\n player_hand << game_deck.draw\n dealer_hand << game_deck.draw\n end\n puts \"Player hand is:\"\n puts player_hand\n puts \"Dealer hand is:\"\n puts dealer_hand\n end",
"title": ""
},
{
"docid": "e0bda581087c35b2367fae5bcbaa2514",
"score": "0.6019994",
"text": "def put_money(amount, player)\n if amount > player.money\n amount = player.money\n end\n if amount + player.in_pot_current > self.high_bet # if player is new high bet (bets more than current highest)\n self.high_bet = amount + player.in_pot_current\n self.high_better = player.location\n end\n player.money -= amount # puts money in correct places and takes from player's pot\n player.in_pot_current += amount\n player.in_pot_hand += amount\n self.pot += amount\n player.save\n self.save\n end",
"title": ""
},
{
"docid": "588702be876ab6d4032572e53e99df5f",
"score": "0.60171616",
"text": "def double_bet(hand)\n hand.bet += @bet\n @bankroll -= @bet\n @@bankroll -= @bet\n end",
"title": ""
},
{
"docid": "e2e4d02492d5663973bd97579d4bb22e",
"score": "0.60108256",
"text": "def won_with_points\n self.chips += 2 * self.bet_chips\n self.is_complete = true\n \"#{name}'s point is bigger than dealer! #{name} get extra one bet. Win for #{name}\"\n end",
"title": ""
},
{
"docid": "7da4ca720f44a49dbe8e04caf50fa158",
"score": "0.600856",
"text": "def matchmaker\n puts \"#{(game.loser).name} is eliminated!\"\n if game.winner == game.player1\n @players.slice!(1)\n else @players.slice!(0) #can use @players.slice to cut the loser into a losers bracked\n end\n @champion = @players[0] if @players.count == 1\n @players.rotate!\n puts \"Press enter to play next game\"\n move_on = gets.chomp\n end",
"title": ""
},
{
"docid": "1993727765bfd148643bc71a6cc8a215",
"score": "0.59983593",
"text": "def initial_deal(deck, player, dealer)\n puts \"\\nDealing..\"\n sleep(1)\n 2.times do\n player << deck.shift\n dealer << deck.shift\n end\n puts \"Cards Dealt!\"\nend",
"title": ""
},
{
"docid": "2868e65357b3e111b2720d6c63437a04",
"score": "0.59950936",
"text": "def credit_player(p, blackjack = false)\n if blackjack\n p.money += p.bet*1.5\n else\n p.money += p.bet\n end\n end",
"title": ""
},
{
"docid": "a07fb2f4f754e7d272ad492669856287",
"score": "0.5976163",
"text": "def beginBetting\r\n\tprintLine\r\n\tstartBetRound\r\n\tprintLine\r\n\tstartBetting\r\n\t@new_round = false\r\nend",
"title": ""
},
{
"docid": "6cb34ce24da8bf59c42a161b315c2dbd",
"score": "0.5974305",
"text": "def stand\n dealer.auto_dealer(deck)\n determine_winner\n puts \"Dealer had [#{dealer.dealt.join(\"][\")}]\"\n play_again\n end",
"title": ""
},
{
"docid": "b7d2701d45e0f831f86d204e58390502",
"score": "0.59742564",
"text": "def game\n horse_playing = true\n while horse_playing == true\n selecting = TTY::Prompt.new\n horses = ['PinkLightning', 'WildCat', 'Eclipse', 'Delphi', 'TheDaringDrunk', 'CrazySisterSeline', 'JackSparrow', 'RunningBull', \"RazMaTazz\"]\n racers = []\n selector = 0\n 4.times{\n racer = horses.sample\n horses.delete(racer)\n racers.push(racer)\n }\n puts \"The following horses are racing\"\n puts racers\n choice = selecting.select(\"Who do you think will win\", racers)\n bet = gamble()\n winner = racers.sample\n case winner == choice\n when true\n if choice != \"RazMaTazz\"\n puts \"#{winner} comes thundering over the line, you have won this time\"\n @balance = bet + @balance\n else\n puts \"#{winner} comes in last, better luck next time!\"\n @balance = @balance - bet\n end\n when false\n puts \"#{winner} comes in first, better luck next time!\"\n @balance = @balance - bet\n end\n horse_playing = selecting.select(\"Would you like to bet on the next race\" , [\"Yes\",\"No\"]) == \"Yes\"\n end\n puts \"Returning to Game Menu\"\n end",
"title": ""
},
{
"docid": "26d81ba96cdda26919ca1b459ece193a",
"score": "0.59650403",
"text": "def return_part1(battler)\n hide_all = (Summon_Skill[battler.summoned_id] != nil and Summon_Skill[battler.summoned_id][0][4])\n for actor in $game_party.actors \n next if not hide_all and not battler.summoned_actors.include?(actor)\n unless actor.dead? and not check_include(actor, 'NOCOLLAPSE')\n actor.invisible = true\n actor.invisible_action = true if battler == actor\n end\n end\n battler.wait_time = 16\n battler.current_phase = 'Return 2'\n end",
"title": ""
},
{
"docid": "d141b1dfabaca20da83592b6d8169a61",
"score": "0.5952821",
"text": "def play_for_trick \n if @player1.deal == true && @player2.deal == false && !@player1.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player1.lead_card\n @player1.remove_card_from_hand(leading_card)\n puts @player1.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player2.respond(leading_card)\n @player2.remove_card_from_hand(response_card)\n puts @player1.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player2.name + \" plays the \" + response_card.card_to_string\n \n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n if winning_card == leading_card \n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n else\n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n\n if @player1.deal == false && @player2.deal == true && !@player2.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player2.lead_card\n @player2.remove_card_from_hand(leading_card)\n puts @player2.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player1.respond(leading_card)\n @player1.remove_card_from_hand(response_card)\n puts @player2.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player1.name + \" plays the \" + response_card.card_to_string\n\n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n\n if winning_card == leading_card \n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n else\n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n end",
"title": ""
},
{
"docid": "d22cbd6f630187204ad89591857ad4e3",
"score": "0.59524965",
"text": "def computerTurn(marbles)\r\n\tputs \"\\nMarbles left (#{marbles}) #{\" o\"*marbles}\\n\\n\"\r\n\tif marbles % 4 == 0\r\n\t\ttake = 1\r\n\telse \r\n\t\ttake = marbles % 4\r\n\tend \r\n\tputs \"The computer took #{take} marble(s)\\n\\n\"\r\n\t$turn = 1\r\n\treturn marbles - take\r\nend",
"title": ""
},
{
"docid": "7ee7fe4a382fd5a16ce95c4713834f84",
"score": "0.5941774",
"text": "def return_part2(battler)\n $game_system.bgm_play($game_temp.bgm_memorize)\n hide_all = (Summon_Skill[battler.summoned_id] != nil and Summon_Skill[battler.summoned_id][0][4])\n for actor in battler.summoned_actors\n actor.summon_turn = 0\n actor.summoned_turn = 0\n actor.summoned_id = 0\n $game_party.summoned.delete(actor)\n $game_party.remove_actor(actor.id)\n end\n for actor in battler.removed_actors\n $game_party.add_summon_actor_by_index(actor[0].id, actor[1])\n end\n @spriteset.update\n if $atoa_script['Atoa ATB']\n reset_bars\n elsif $atoa_script['Atoa CTB']\n update_all_ctb\n @ctb_window.refresh \n end\n $game_temp.summon_active = !$game_party.summoned.empty?\n battler.summoned_actors.clear\n battler.removed_actors.clear\n for actor in $game_party.actors\n $game_party.removed_actors.delete(actor)\n unless actor.dead? and not check_include(actor, 'NOCOLLAPSE')\n actor.invisible = false\n end\n end\n for actor in $game_party.actors\n actor.pose_id = 0\n end\n reset_actors_position(hide_all)\n @status_window.refresh\n end_summoning(battler)\n @action_battlers.delete(battler)\n @active_battlers.delete(battler)\n update_summoned_party\n battler.wait_time = 8\n end",
"title": ""
},
{
"docid": "7fa90e9e395e35e155dc48ffb565ea9d",
"score": "0.59359455",
"text": "def bust_or_win?\n if player.total == BLACKJACK\n puts \"#{player.name} hit backjack!! #{player.name} lost, dealer lost.\"\n play_again?\n elsif player.total > BLACKJACK\n puts \"#{player.name} busted! #{player.name} lost, dealer won.\"\n play_again?\n elsif dealer.total == BLACKJACK\n puts \"Dealer hit blackjack!! #{player.name} lost.\" \n play_again?\n elsif dealer.total > BLACKJACK\n puts \"Dealer busted! #{player.name} won.\"\n play_again?\n else\n \"continue\"\n end\n end",
"title": ""
},
{
"docid": "dd03c0ac60b11c9775a35cb63075248d",
"score": "0.5926639",
"text": "def play_as_master_second\r\n card_avv_s = @card_played[0].to_s\r\n card_avv_info = @deck_info.get_card_info(@card_played[0])\r\n max_points_take = 0\r\n max_card_take = @cards_on_hand[0]\r\n min_card_leave = @cards_on_hand[0]\r\n min_points_leave = @deck_info.get_card_info(min_card_leave)[:points] + card_avv_info[:points]\r\n take_it = []\r\n leave_it = []\r\n # build takeit leaveit arrays\r\n @cards_on_hand.each do |card_lbl|\r\n card_s = card_lbl.to_s\r\n bcurr_card_take = false\r\n card_curr_info = @deck_info.get_card_info(card_lbl)\r\n if card_s[2] == card_avv_s[2]\r\n # same suit\r\n if card_curr_info[:rank] > card_avv_info[:rank]\r\n # current card take\r\n bcurr_card_take = true\r\n take_it << card_lbl\r\n else\r\n leave_it << card_lbl\r\n end\r\n elsif card_s[2] == @briscola.to_s[2]\r\n # this card is a briscola \r\n bcurr_card_take = true\r\n take_it << card_lbl\r\n else\r\n leave_it << card_lbl\r\n end\r\n # check how many points make the card if it take\r\n points = card_curr_info[:points] + card_avv_info[:points]\r\n if bcurr_card_take\r\n if points > max_points_take\r\n max_card_take = card_lbl\r\n max_points_take = points\r\n end\r\n else\r\n # leave it as minimum\r\n if points < min_points_leave or (points == min_points_leave and\r\n card_curr_info[:rank] < @deck_info.get_card_info(min_card_leave)[:rank] )\r\n min_card_leave = card_lbl\r\n min_points_leave = points\r\n end\r\n end\r\n end\r\n #p min_points_leave\r\n #p min_card_leave\r\n curr_points_me = 0\r\n @team_mates.each{ |name_pl| curr_points_me += @points_segno[name_pl] }\r\n tot_points_if_take = curr_points_me + max_points_take\r\n curr_points_opp = 0\r\n @opp_names.each{ |name_pl| curr_points_opp += @points_segno[name_pl] }\r\n \r\n #p take_it\r\n #p leave_it\r\n #p max_points_take\r\n #p min_points_leave\r\n if take_it.size == 0\r\n #take_it is not possibile, use leave it\r\n @log.debug(\"play_as_master_second, apply R1 #{min_card_leave}\")\r\n return min_card_leave \r\n end\r\n max_card_take_s = max_card_take.to_s\r\n if tot_points_if_take >= @target_points\r\n # take it, we win\r\n @log.debug(\"play_as_master_second, apply R2 #{max_card_take}\")\r\n return max_card_take\r\n end\r\n if @pending_points > 0\r\n card_to_play = best_taken_card(take_it)[0]\r\n @log.debug(\"play_as_master_second, apply R2-decl #{card_to_play}\")\r\n return card_to_play \r\n end\r\n if max_card_take_s[2] == @briscola.to_s[2]\r\n # card that take is briscola, pay attention to play it\r\n if max_points_take >= 20\r\n @log.debug(\"play_as_master_second, apply R3 #{max_card_take}\")\r\n return max_card_take\r\n end\r\n elsif max_points_take >= 10\r\n # take it, strosa!\r\n @log.debug(\"play_as_master_second, apply R4 #{max_card_take}\")\r\n return max_card_take\r\n end\r\n best_leave_it = nil\r\n if leave_it.size > 0\r\n best_leave_it = best_leaveit_card(leave_it)\r\n end\r\n if best_leave_it == nil\r\n card_to_play = best_taken_card(take_it)[0]\r\n @log.debug(\"play_as_master_second, apply R9 #{card_to_play} - force taken\")\r\n return card_to_play\r\n end\r\n points_best_leave = @deck_info.get_card_info(best_leave_it)[:points]\r\n if card_avv_info[:points] == 0 and points_best_leave == 0\r\n @log.debug(\"play_as_master_second, apply R10 #{best_leave_it} \")\r\n return best_leave_it\r\n end\r\n if take_it.size > 0\r\n w_and_best = best_taken_card(take_it)\r\n # we can take it\r\n if curr_points_opp > 29 and max_points_take > 0 and take_it.size > 1\r\n # try to take it\r\n card_to_play = w_and_best[0]\r\n @log.debug(\"play_as_master_second, apply R5 #{card_to_play}\")\r\n return card_to_play\r\n end\r\n if curr_points_opp > 36 and (card_avv_info[:points] > 0 or points_best_leave > 0)\r\n # try to take it\r\n card_to_play = w_and_best[0]\r\n @log.debug(\"play_as_master_second, apply R11 #{card_to_play}\")\r\n return card_to_play\r\n end\r\n if points_best_leave > 2 or min_points_leave > 3 and w_and_best[1] < 320\r\n # I am loosing too many points?\r\n card_to_play = w_and_best[0]\r\n @log.debug(\"play_as_master_second, apply R6 #{card_to_play}\")\r\n return card_to_play\r\n end\r\n end \r\n # leave it\r\n if best_leave_it\r\n @log.debug(\"play_as_master_second, apply R7 #{best_leave_it}\")\r\n return best_leave_it\r\n end\r\n \r\n @log.debug(\"play_as_master_second, apply R8 #{min_card_leave}\")\r\n return min_card_leave \r\n #crash\r\n end",
"title": ""
},
{
"docid": "acb7d1c315d5d3282f9e8282af79f08c",
"score": "0.59249794",
"text": "def award_spoils(winner)\n while !@spoils_of_war.empty?\n card = @spoils_of_war.pop\n winner.deck.add_card(card)\n end\n end",
"title": ""
},
{
"docid": "df44c9c4000322687dceed811b243a99",
"score": "0.5921058",
"text": "def play\n SHELL.confirm(\"Let's play some blackjack!\")\n loop do\n collect_bets\n give_initial_cards\n # ask if player would like to split here\n @players.each { |player| action_cycle(player, :player) }\n action_cycle(@dealer, :dealer)\n decide_scores\n break if done_playing?\n reset\n end\n end",
"title": ""
},
{
"docid": "3a66a76bd308e5657b4481163e152e9a",
"score": "0.59124374",
"text": "def summon_part4(battler)\n for summon_id in Summon_Skill[battler.summoning][1]\n case battler.summon_config[0]\n when 0\n for actor in $game_party.actors\n next if actor == battler\n add_removed_actors(actor, summon_id)\n end\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon(summon_id)\n when 1\n for actor in $game_party.actors\n next if actor.summon?\n add_removed_actors(actor, summon_id)\n end\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon(summon_id)\n when 2\n $game_actors[summon_id].removed_actors << [battler, battler.index]\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon_by_index($game_party.actors.index(battler), summon_id)\n when 3\n set_summoned_actors(battler, summon_id)\n set_summon_commands(summon_id, battler.summon_config[3])\n $game_party.add_summon(summon_id)\n end\n reset_action($game_actors[summon_id])\n $game_actors[summon_id].summoned_id = battler.summoning\n end\n for actor in $game_party.removed_actors\n $game_party.summoned.delete(actor) if actor.summon?\n $game_party.remove_actor(actor.id)\n end\n $game_party.refresh\n for actor in $game_party.actors\n if Summon_Skill[battler.summoning][0][4] or Summon_Skill[battler.summoning][1].include?(actor.id)\n actor.battler_position_setup\n else\n actor.retunt_to_original_position\n end\n actor.pose_id = 0\n end\n if $atoa_script['Atoa ATB']\n reset_bars\n elsif $atoa_script['Atoa CTB']\n update_all_ctb\n @ctb_window.refresh \n end\n battler.current_phase = 'Summon 5'\n end",
"title": ""
},
{
"docid": "c5bac8c06a6c91aba6633df1694888e4",
"score": "0.5902816",
"text": "def chase_preceding_character\r\r\n return if self.command_holding?\r\r\n unless moving? && !@force_chase\r\r\n dist = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE / 32.0\r\r\n mrgn = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE_MARGIN / 32.0\r\r\n \r\r\n far_dist = distance_preceding_character\r\r\n \r\r\n if far_dist > 3\r\r\n type = 1\r\r\n prevent_bug_cnt = 0\r\r\n else\r\r\n type = 2\r\r\n end\r\r\n \r\r\n if !move_poll.empty? && distance_preceding_leader < 0.8\r\r\n move_poll.clear\r\r\n end\r\r\n \r\r\n \r\r\n if type == 1 && move_poll.empty?\r\r\n reachable = false\r\r\n \r\r\n $game_player.followers.each do |follower|\r\r\n follower.move_poll.clear\r\r\n if follower.move_poll.empty? && follower.distance_preceding_leader > 3\r\r\n reachable = follower.move_to_position($game_player.x,$game_player.y)\r\r\n if move_poll.empty? || !reachable\r\r\n follower.moveto($game_player.x,$game_player.y) \r\r\n end\r\r\n \r\r\n end\r\r\n end\r\r\n elsif type == 2\r\r\n \r\r\n goal = @preceding_character\r\r\n sx = distance_x_from(goal.x)\r\r\n sy = distance_y_from(goal.y)\r\r\n sd = Math.hypot(sx, sy)\r\r\n if @board\r\r\n @x = goal.x\r\r\n @y = goal.y\r\r\n @board = false\r\r\n elsif(sd > dist && sx.abs > mrgn && sy.abs > mrgn)\r\r\n @move_poll += [[(sx > 0 ? -1 : 1) + (sy > 0 ? 8 : 2), true]]\r\r\n elsif sx.abs > dist && sx.abs > sy.abs\r\r\n @move_poll+=[[sx > 0 ? 4 : 6, true]]\r\r\n elsif sy.abs > dist && sx.abs < sy.abs\r\r\n @move_poll+=[[sy > 0 ? 8 : 2, true]]\r\r\n end\r\r\n end\r\r\n \r\r\n end\r\r\n end",
"title": ""
},
{
"docid": "6d1471374056d9bf16b6e5a8c86d1934",
"score": "0.5901342",
"text": "def one_game_loop()\n\n # Initial loop to go through players and get their choices\n @players.each do |pl|\n playing = true\n\n while (playing)\n print_state()\n\n # Check if player has a blackjack at the very beginning\n if blackjack(pl.cards)\n puts \"Player #{pl.index} has a blackjack!\"\n credit_player(pl,blackjack=true)\n playing = false\n pl.cur_playing = false # Player has already won, don't include in final round\n next\n end\n\n print \"Player #{pl.index}, what would you like to do: \"\n action = gets.chomp\n\n case action\n when \"hit\"\n new_card = @cards.pop \n pl.cards << new_card\n when \"split\"\n puts \"not implemented, I have to go do homework!\"\n when \"double\"\n new_card = @cards.pop\n pl.cards << new_card\n playing = false\n when \"stand\"\n playing = false\n else\n puts \"no such action, try again...\"\n end\n\n if value(pl.cards) > 21 # Lost :(\n puts \"Player #{pl.index}, you lost...\"\n debit_player(pl)\n playing = false\n pl.cur_playing = false # Player has already lost, don't inlude in final round\n elsif value(pl.cards) == 21 # 21, but not blackjack, so maybe we draw with the dealer, we check later\n puts \"Player #{pl.index} has 21 points - we await for the final round to compare with the dealer\"\n playing = false\n end\n end\n end\n\n # By this point, the first round is finished. Dealer starts revealing cards...\n \n dealer_reveal_cards()\n final_round()\n\n end",
"title": ""
},
{
"docid": "0c10e2583413b5678761ba18e222e402",
"score": "0.58941114",
"text": "def who_wins\n\n bj = false\n bust = false\n #//Check for dealer status after the showing hands\n if @dealer.busted?\n @ui.message(\"dealer loses\")\n bust=true\n else\n if @dealer.get_value == 21 && @dealer.num_cards == 2\n bj=true\n end\n end\n\n #//Check for player status after showing hands\n\n for player in @players\n hand_index = 0\n while hand_index < player.num_hands\n if player.busted?(hand_index)\n ui.message(player.name+\"loses on hand\"+ (hand_index+1).to_s)\n else\n if player.get_value(hand_index) == 21 && player.num_cards(hand_index) == 2 && !player.split?\n if BJ == true\n @ui.message(player.name+\" and dealer has a black jack!!! its a push on hand\"+ (hand_index+1).to_s)\n @ui.message(player.name+\"gets back \"+ player.push(hand_index).to_s)\n else\n @ui.message(\" its a black jack!!!\"+player.name+\" wins on hand\"+ (hand_index+1).to_s)\n @ui.message(player.name+\"gets \"+player.win(hand_index,true).to_s)\n end\n else\n if !bust\n if player.get_value(hand_index) > @dealer.get_value\n @ui.message(player.name+\" wins on hand\"+ (hand_index+1).to_s+\"!!!\")\n @ui.message(player.name+\"gets \"+player.win(hand_index,false).to_s)\n elsif player.get_value(hand_index) == dealer.get_value\n @ui.message(\"Its a push on hand\"+ (hand_index+1).to_s+\"!!!\"+player.name+\" and dealer has same value.\")\n @ui.message(player.name+\"gets back \"+ player.push(hand_index).to_s)\n else\n @ui.message(player.name+\" loses on hand\"+ (hand_index+1).to_s)\n end\n else\n @ui.message(player.name+\" wins on hand\"+ (hand_index+1).to_s+\"!!!\")\n @ui.message(player.name+\"gets \"+player.win(hand_index,false).to_s)\n end\n end\n end\n hand_index+=1\n end\n end\n end",
"title": ""
},
{
"docid": "35fdefa810fc00ded49c503896777ff9",
"score": "0.5890086",
"text": "def deal_and_check\n get_bet\n deal_hands\n blackjack_winner\n check_winner_else_do(\"player_loop\")\n end",
"title": ""
},
{
"docid": "22ba0b76001234459aad3036e697e4e7",
"score": "0.5886194",
"text": "def punch(player_name)\n\t # we change the life (hp) of our adversary, and we can because of the hp accessor ! \n\t player_name.hp = player_name.hp - 10\n\n\tend",
"title": ""
},
{
"docid": "2fce1b7e55526de04542d2e1317687ec",
"score": "0.58760756",
"text": "def award_spoils(winner_of_turn)\n return if winner_of_turn == \"No Winner\"\n @spoils_of_war.each do |card|\n winner_of_turn.deck.cards << card\n end\n end",
"title": ""
},
{
"docid": "c03e39880a9eac15a8bab7186b20ef1f",
"score": "0.58756864",
"text": "def play_round()\n # Deal hand to all players\n for p in @players\n hand = Hand.new\n hand.deal_hand()\n p.hands << hand\n end\n\n # Dealer deals his own hand\n @dealers_hand.deal_hand()\n\n # Gather bets from all players\n for p in @players\n game_state()\n puts \"Player #{p.player}, how much would you like to bet?\"\n bet_amount = gets.chomp.to_i\n while !(p.can_bet(bet_amount))\n game_state()\n puts \"Player #{p.player}, that's an invalid bet! Try again.\"\n bet_amount = gets.chomp.to_i\n end\n p.bet(bet_amount)\n\n for h in p.hands\n p.place_bet(h)\n end\n end\n\n # Allow players to finalize their bet(s) and hand(s)\n for player in @players\n for hand in player.hands\n while !(hand.is_stand())\n valid_moves = ['h']\n if hand.is_split and player.can_bet_double()\n valid_moves += ['s', 'd', 'e']\n elsif player.can_bet_double()\n valid_moves += ['d', 'e']\n else\n valid_moves += ['e']\n end\n\n game_state()\n puts \"Player #{player.player}, what would you like to do for your #{hand} hand? Your valid moves: #{valid_moves}\"\n puts \"Legend: ['h' -> hit, 's' -> split, 'd' -> double down, 'e' -> end turn]\"\n\n move = gets.chomp\n while !(valid_moves.include? move)\n game_state()\n puts \"Player #{player.player}, that is not a valid move! Try again. Your valid moves: #{valid_moves}\"\n puts \"Legend: ['h' -> hit, 's' -> split, 'd' -> double down, 'e' -> end turn]\"\n move = gets.chomp\n end\n\n case move\n when 'h'\n hand.hit()\n when 's'\n new_hand = hand.split()\n player.place_bet(new_hand)\n\n hand.hit()\n new_hand.hit()\n player.hands << new_hand\n when 'd'\n player.place_bet(hand)\n hand.hit()\n hand.stand()\n when 'e'\n hand.stand()\n end\n\n if hand.is_bust()\n puts \"You busted!\"\n hand.stand()\n end\n end\n end\n end\n\n # Determine dealer's ending hand\n while @dealers_hand.value() < 17\n @dealers_hand.hit()\n end\n\n puts \"-=-=-=- Resulting Hands For This Round -=-=-=-\"\n game_state()\n\n # Determine winnings of each player and their hand(s)\n for player in @players\n for hand in player.hands\n if (!hand.is_bust() and @dealers_hand.is_bust()) or (!hand.is_bust() and !@dealers_hand.is_bust and hand.value() > @dealers_hand.value())\n player.win_hand(hand)\n puts \"Player #{player.player}'s #{hand} beat the dealer's #{@dealers_hand} hand!\"\n elsif (hand.is_bust() and @dealers_hand.is_bust()) or (hand.value() == @dealers_hand.value())\n player.tie_hand(hand)\n puts \"Player #{player.player}'s #{hand} tied with the dealer's #{@dealers_hand} hand!\"\n else\n player.lose_hand(hand)\n puts \"Player #{player.player}'s #{hand} lost to the dealer's #{@dealers_hand} hand! :(\"\n end\n end\n end\n\n # Determine who can continue playing\n continuing_players = []\n for player in @players\n if player.money != 0\n continuing_players << player\n else\n puts \"Player #{player.player} has no money and is eliminated!\"\n end\n end\n @players = continuing_players\n\n # Clear all playing hands.\n for player in @players\n player.hands = []\n player.bet = 0\n end\n end",
"title": ""
},
{
"docid": "f334404d86cf5615106cd47762dae422",
"score": "0.58731705",
"text": "def winner_take_hand\n from_war = @state == 'war'\n\n #save this for use in the stats display later\n @hand_played.freeze \n\n @winning_player = get_player_by_name @hand_played.try(:first).try(:owner)\n # @hand_played.each{|x| cards_played.push(x)}\n\n unless @winning_player.blank? \n # first calculate the loser's lost cards and metadata\n @cards_on_table.each do |c|\n get_player_by_name( c.try(:owner) ).in_battle\n get_player_by_name( c.try(:owner) ).lose_cards [c]\n end\n\n # winner puts all cards on table at the end of their deck, change ownership\n @winning_player.gain_cards(@cards_on_table)\n @winning_player.won_battle\n\n # reset var to empty array\n @cards_on_table = []\n end\n\n # check if all players can continue\n players.each do |p|\n player_leaves_game(p) if p.try(:cards).try(:count) < 1\n end\n\n display_battle_results\n set_game_state 'play'\n end",
"title": ""
},
{
"docid": "2a65d5df65c125aec3fde25229d890d3",
"score": "0.5872494",
"text": "def dealer_turn\n if win_state == CHECK\n do_hit_or_stay(players[0])\n end\n end",
"title": ""
},
{
"docid": "2c05962a7bf5a93d0c4906be1501fbb3",
"score": "0.58722425",
"text": "def get_bets(bet)\n\t\t#loop through ai players\n\t\t#random numbers generated in if statements create\n\t\t#the illusion of free will\n\t\tfor i in 1...@num_players\n\t\t\t#check if player has enough money and has not folded\n\t\t\tif bet <= @players[i].bank and !@players[i].folded then\n\t\t\t\t#if player has a high rank\n\t\t\t\tif @players[i].ranks[0] < 8 or rand(0..1) == 1 then\n\t\t\t\t\t@players[i].set_bet(bet)\n\t\t\t\t#if player has a pair of quite high value\n\t\t\t\telsif (@players[i].ranks[0] == 8 and @players[i].subranks[0] > 9) or rand(0..1) == 1 then\n\t\t\t\t\t@players[i].set_bet(bet)\n\t\t\t\t#bluff\n\t\t\t\telsif rand(0...10) == 1 then\n\t\t\t\t\t@players[i].set_bet(bet)\n\t\t\t\telse\n\t\t\t\t\t@players[i].fold\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t#puts \"fold #{i}\"\n\t\t\t\t@players[i].fold\n\t\t\tend \n\t\tend\n\tend",
"title": ""
},
{
"docid": "e0be3b4c533cea5e6ad9d8aba774758f",
"score": "0.5867582",
"text": "def slot_game\n def welcome_slots\n puts `clear`\n puts \"Welcome to slots, #{@player_name}\".light_cyan\n puts \"Bankroll = $#{@player_bankroll}\".light_blue\n puts '************************************************************'.light_black\n puts 'The object of this game is to bet on two or three of a kind.'.light_cyan\n puts ''\n puts ''\n end\n\n @arr_1 = %w[1 2 3 4 5 6 7 8 9]\n @arr_2 = %w[1 2 3 4 5 6 7 8 9]\n @arr_3 = %w[1 2 3 4 5 6 7 8 9]\n\n\n welcome_slots\n \n\n\n\n def barrels\n puts 'How much would you like to bet?'.light_cyan\n @player_bet = gets.to_i\n puts ''\n puts \"Your bet is $#{@player_bet}.\".light_blue\n puts ''\n if @player_bet > @player_bankroll\n puts \"You currently have #{@player_bankroll}, let's bet it all then!\".light_red\n @player_bet = @player_bankroll\n end\n\n one_barrel = @arr_1.sample\n two_barrel = @arr_2.sample\n three_barrel = @arr_3.sample\n\n print one_barrel.light_cyan\n sleep(0.5)\n print \" \", two_barrel.light_cyan\n sleep(0.5)\n print \" \", three_barrel.light_cyan, \"\\n\\n\"\n\n if one_barrel == two_barrel && one_barrel == three_barrel\n @player_bankroll += (@player_bet * 3)\n puts \"all three match . . . your new bankroll is $#{@player_bankroll}\".green\n elsif one_barrel == two_barrel || two_barrel == three_barrel || one_barrel == three_barrel\n @player_bankroll += (@player_bet * 2)\n puts \"two of them match . . . your new bankroll is $#{@player_bankroll}\".light_green\n else \n @player_bankroll = @player_bankroll - @player_bet\n puts \"nothing matches . . . you lost, your new bankroll is $#{@player_bankroll}\".light_red \n end\n puts ''\n\n end\n\n while true\n barrels\n if @player_bankroll == 0\n puts \"You're out money you loser\".red\n puts 'Taking you to the main menu - type 3 to add more money'.green\n sleep(5)\n game_menu\n end\n puts'Do you want to pull again? (y/n)'.light_cyan\n again = gets.strip.downcase\n if again == 'n'\n puts 'Would you like to play a different game? (y/n)'.light_green\n if gets.strip.downcase == 'y'\n game_menu\n else\n puts `clear`\n puts '***********************************'.light_black\n puts \"Thank you for playing! Come again!\".red\n puts '***********************************'.light_black\n exit 0\n end\n end\n end\nend",
"title": ""
},
{
"docid": "dab7bd12d9d00159d058b5131925b2f3",
"score": "0.58660364",
"text": "def reset_bets()\n\t@playerbet.text = \"$#{$game.players[0].bet}\"\n\t@playerbank.text = \"$#{$game.players[0].bank}\"\n\t@totalbets.text = \"$#{$game.sum_bets()}\"\n\tfor i in 0..3\n\t\t@computersbets[i].text = \"$#{$game.players[i + 1].bet}\"\n\t\t@computerbanks[i].text = \"$#{$game.players[i + 1].bank}\"\n\t\tif $game.players[i + 1].folded then\t\n\t\t\t@fflag[i].text = \" FOLDED\"\n\t\tend\n\tend\n\t\nend",
"title": ""
},
{
"docid": "ab8a0cac24beb031ba7bc12a5edb289e",
"score": "0.5864482",
"text": "def fold_hand\r\n @folded = true\r\n (padding,pronoun) = self.is_a?(User) ? [28,\"You\"] : [32,\"Player ##{player_id+1}\"]\r\n puts \"\\n%#{padding}s\\n\" % \"#{pronoun} folded.\"\r\n @bet = \"---\"\r\n end",
"title": ""
},
{
"docid": "3d5c481f93cb3837b88947a559ba1e54",
"score": "0.58642775",
"text": "def first_spin\n puts \"Welcome to the Slots!\".magenta\n puts \"You currently have $#{$wallet}\".green\n puts \"How much money would you like to bet today?\".magenta\n puts \" \"\n @bet_amount = gets.to_i\n puts \" \"\n# if user tries to bet anything less than $1, it will spit them back to the welcome text\n if @bet_amount < 1\n puts \"Come on! You have to at least bet $1...\"\n puts \" \"\n first_spin\n end\n modify_wallet(@bet_amount)\n spin_it\n end",
"title": ""
},
{
"docid": "a55481226edee9562ff6bea71180719e",
"score": "0.58638257",
"text": "def first_place(jackpot)\n \tfirst_place = jackpot\n \treturn (first_place * 0.55).round(2)\n end",
"title": ""
},
{
"docid": "000df1faa1e041f249e9cc06fb936073",
"score": "0.5853989",
"text": "def award_player(multiplier)\n if session['doubled']\n session['money'] += session['bet'] * multiplier * 2\n session['doubled'] = nil\n else\n session['money'] += session['bet'] * multiplier\n end\n end",
"title": ""
},
{
"docid": "ea0094bcfae76b1f1b3a6a927e78442e",
"score": "0.584823",
"text": "def play_trick(trump)\n winning_player = nil\n trick = []\n until trick.count == @players.count do\n winning_card, winning_player, first_card = nil, nil, nil\n @players.each.with_index do |player, i|\n card_laid = player.lay_card(trump, first_card)\n card_laid.set_value(trump, trick[0]) if card_laid[:value].nil?\n trick << card_laid\n print_move(player, card_laid, i)\n \n first_card ||= card_laid\n winning_card ||= card_laid\n winning_player ||= player\n if card_laid[:value] > winning_card[:value]\n winning_card = card_laid \n winning_player = player\n end\n end\n end\n return winning_player, trick_points(trick)\n end",
"title": ""
},
{
"docid": "4c1541f85e3a8e9abd4f57b91296551f",
"score": "0.58466905",
"text": "def player_hit\n player_hand << deck.cards.pop\n puts \"you drew a #{player_hand.last.face} of #{player_hand.last.suit}.\"\n end",
"title": ""
},
{
"docid": "d7dd72d5c06b3a014f0037d6aa10f522",
"score": "0.5843462",
"text": "def action\n if player_hand.collect{|x| x.value}.inject(:+) < 21 && player_hand.length == 6\n lengthwin\n else\n puts \"Would you like to 'hit' or 'stay'?\"\n answer = STDIN.gets.chomp.downcase\n until answer == \"hit\" || answer == \"stay\"\n puts \"Simply let me know if you would like to 'hit' or 'stay', sir.\"\n answer = STDIN.gets.chomp\n end\n if answer == \"hit\"\n hit = bjdeck.draw\n player_hand << hit\n blind_score\n if player_hand.collect{|x| x.value}.inject(:+) > 21\n puts \"It appears you have busted.\"\n lose\n else\n action\n end\n else\n computer_turn\n end\n end\n end",
"title": ""
},
{
"docid": "e83ee3b5548844691bd0d475b95e62af",
"score": "0.5842967",
"text": "def play_game\n\t\t\n\t\t2.times do \n\t\t\t\n\t\t\tputs to_s\n\t\t\t@players.each do |player|\n\n\t\t\t\tif player.is_fold\n\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tputs player.to_s\n\t\t\t\todds = @pokeroddsproxy.get_odds(player.get_cards, get_cards, @playernumber)\n\t\t\t\t#puts player.get_cards\n\t\t\t\tif player.get_user\n\t\t\t\t\tinput = get_input\n\t\t\t\t\tamount = 0\n\t\t\t\t\tif input == 1\n\t\t\t\t\t\tamount = 100 + @bet\n\t\t\t\t\telsif input == 2\n\t\t\t\t\t\tamount = @bet\n\t\t\t\t\telse\n\t\t\t\t\t\tamount = 0\n\t\t\t\t\t\tplayer.fold\n\t\t\t\t\tend\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\telse\n\t\t\t\t\tamount = player.set_move(odds, 200, 200)\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\tend\n\t\t\t\t#puts get_cards\n\t\t\t\tputs odds\n\t\t\t\tputs\n\t\t\tend\n\t\t\t\n\t\t\tputs \"pot: #{@pot}\"\n\n\t\t\t@board << @deck.deal\n\t\tend\n\n\t\tfind_winner\n\tend",
"title": ""
},
{
"docid": "eeb3e34497c48da4d2cad69f297a65c2",
"score": "0.5838678",
"text": "def coin_toss_intro\n self.player_turn_number = 0\n coin_toss_result = toss_coin\n player_coin_guess = human_player.intro_coin_guess\n player_coin_guess == coin_toss_result ? who_goes_first = \"Player\" : who_goes_first = \"Computer\"\n self.player_turn_number = 1 if who_goes_first == \"Player\"\n puts \"The result of the toss was #{coin_toss_result}, and you guessed #{player_coin_guess}.\"\n puts who_goes_first == \"Player\" ? \"The Player goes first!\" : \"The Computer goes first!\"\n end",
"title": ""
},
{
"docid": "121478810c3e4ae5c093df337589238c",
"score": "0.583559",
"text": "def winner\n if finished?\n if fold = @hand_history.all_actions.find(&:fold?)\n winner = (fold.player == small_blind) ? big_blind : small_blind\n else\n winner = if PokerHand.new( small_blind.hole_cards + @community_cards ) > PokerHand.new( big_blind.hole_cards + @community_cards )\n small_blind\n else\n big_blind\n end\n end\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "fd5feafb8648ffd26484727462f36a5c",
"score": "0.5834458",
"text": "def go_to_war\n # for use in battle/war results\n set_game_state 'war'\n # clear previous hand..\n reset_hand\n @num_cards_per_war.times do |w|\n all_play_a_card\n end\n # clear previous hand also, as it's the face-down card or cards\n reset_hand\n\n # populate hand_played array again\n all_play_a_card\n # score it...\n score_battle @hand_played\n\n # after scoring, update war metadata for players \n @winning_player.won_war\n players.each{|x| x.in_war }\n nil\n end",
"title": ""
},
{
"docid": "87c3db298257cfa15a8ded0a5a90cb61",
"score": "0.58309853",
"text": "def user_bury_prompt(hand, blind_count)\n blind_count.times do\n next_card_prompt(hand)\n puts \"Which card would you like to bury?\"\n card_number = get_valid_card_number(hand)\n hand.delete_at(card_number - 1)\n end\n\n hand\n end",
"title": ""
},
{
"docid": "1cb36993f706d8e19e75485f18f287cf",
"score": "0.5830578",
"text": "def play\n return nil if player.blackjack? && dealer.blackjack?\n if player.blackjack?\n puts \"Blackjack!\" unless silent?\n return player\n end\n\n if player.blackjack?\n puts \"Blackjack!\" unless silent?\n return dealer\n end\n \n #player goes first\n play_hand(player)\n if (player.busted?)\n return dealer\n end\n\n play_hand(dealer) \n if dealer.busted? || player.total > dealer.total\n return player\n end\n\n if (player.total == dealer.total)\n return nil #push\n end\n\n return dealer\n end",
"title": ""
},
{
"docid": "6c4b60feeb45410333a521225ecbd1e6",
"score": "0.5827512",
"text": "def round\n show_guess\n show_lives\n show_bank\n puts ''\n set_letter(ask_letter)\n add_to_bank\n add_to_guess\n take_life unless check_choice\n end",
"title": ""
},
{
"docid": "5a60d5fb1f83fdadaf96ad9e503701f9",
"score": "0.58144486",
"text": "def deal_initial_hands\n INITIAL_CARDS.times do\n @players_in_round.each do |player|\n @deck.deal_to player\n end\n end\n end",
"title": ""
},
{
"docid": "c8d47f4c8f51e67c241c245356adb107",
"score": "0.58087856",
"text": "def summon_part1(battler)\n skill = $data_skills[battler.summoning]\n @help_window.set_text(skill.name, 1) unless check_include(skill, 'HELPHIDE')\n battler.current_phase = 'Summon 2'\n end",
"title": ""
},
{
"docid": "8434089c081d406b16ad9c802eab1106",
"score": "0.58043593",
"text": "def player_turn!(brd)\n square = ''\n loop do\n prompt(\"Make your move: #{joinor(empty_squares(brd))}\")\n square = gets.chomp.to_i\n break if empty_squares(brd).include?(square)\n puts \"Choice not available...\"\n end\n brd[square] = PLAYER_MARKER\nend",
"title": ""
},
{
"docid": "4142e7bfeb69c530b7c2bb1eb6616796",
"score": "0.5803625",
"text": "def dealer_turn\r\n dealer.reveal_hand\r\n if dealer.total_for_hand < 17\r\n loop do\r\n dealer.add_to_hand(deck)\r\n break if dealer.total_for_hand > 16\r\n end\r\n puts \"#{dealer.name} has #{dealer.total_for_hand}\"\r\n end\r\n end",
"title": ""
},
{
"docid": "9d8ca9188306a132bf7bc677dc530ebc",
"score": "0.5800656",
"text": "def villain_battle_sequence(hero, villain)\n Battle.start_a_battle(hero, villain)\n battle = Battle.all.last\n hero_hp = hero.hp\n villain_hp = villain.hp\n while villain.hp > 0 && hero.hp > 0 do\n attack(hero, villain)\n line\n puts \"The hero's health is #{hero.hp}\"\n puts \"The villain's health is #{villain.hp}\"\n end\n #if villain and hero looses battle, hero dies and villain gets sent to insane asylum\n if villain.hp <= 0 && hero.hp <= 0\n battle.villain_lost(villain)\n line\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n line\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n puts \"GAME OVER\"\n line\n elsif villain.hp <=0 \n battle.villain_lost(villain)\n battle.update(hero_win: true)\n hero.update(hp: hero_hp)\n villain.update(hp: villain_hp)\n line\n puts \"#{hero.alter_ego} has won the battle\"\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n puts \"GAME OVER\"\n line\n #destroys the hero, the hero lost and died, sends villain to the main menu\n elsif hero.hp <= 0\n line\n puts \"#{villain.alter_ego} has won the battle\"\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n line\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n battle.destruction\n villain_main_menu(villain)\n end\n end",
"title": ""
},
{
"docid": "5c0580fabec8cb745e0ed6e7cf738fd1",
"score": "0.5798544",
"text": "def payout\n until @pot_size.zero?\n\n # If the winning player has gone all in this round, they are only paid out the maximum amount they could possibly win from the pot.\n if @active_players[0].max_winnings < @pot_size && @active_players[0].max_winnings != 0\n puts \"#{@active_players[0].player_name} won #{@active_players[0].max_winnings} with high hand: #{@active_players[0].strongest_hand}.\"\n @active_players[0].chip_stack += @active_players[0].max_winnings\n @pot_size -= @active_players[0].max_winnings\n @active_players[0].max_winnings = 0\n\n # Deletes the player who has been paid out from the array so that they do not get paid out twice.\n @active_players.shift\n\n # If the winning player didn't need to go all in, they simply win the whole pot.\n else\n if @active_players.length > 1\n puts \"#{@active_players[0].player_name} won #{@pot_size} chips with high hand: #{@active_players[0].strongest_hand}.\"\n else\n puts \"#{@active_players[0].player_name} won #{@pot_size} chips.\"\n end\n @active_players[0].chip_stack += @pot_size\n @pot_size = 0\n puts \"#{@active_players[0].player_name} now has #{@active_players[0].chip_stack} chips.\"\n end\n end\n sleep(5)\nend",
"title": ""
},
{
"docid": "f9bb85d15358470c0a51e17ff763f56d",
"score": "0.5798485",
"text": "def kick(player_name)\n\t\n\t player_name.hp = player_name.hp - 20\n\n\t end",
"title": ""
},
{
"docid": "2b7a7976eae4ae359227d45bcd988402",
"score": "0.57933086",
"text": "def play\r\n\tputs \"Press 'Enter' or 'Return' to continue..\"\r\n\tgets\r\n\tputs \"\\n\\n\\n\\n\"\r\n\tputs \"-NEW GAME-\"\r\n\t\t\"------------------------------------\\n\\n\"\r\n\tmarbles_left = rand(6..15)\r\n\t#0 is copmuter's turn, 1 is player's turn\r\n\tputs $turn == 0 ? \"The computer won the coin toss, it will go first\": \r\n\t\t\"You won the coin toss, you will go first\"\r\n\t$turn = rand(0..1)\r\n\twhile $playing == true\r\n\t\tif $turn == 0\r\n\t\t\tmarbles_left = computerTurn(marbles_left)\r\n\t\telsif $turn == 1\r\n\t\t\tmarbles_left = playerTurn(marbles_left)\r\n\t\telse \r\n\t\t\tputs \"\\n\\n\\n##############################\"\r\n\t\t\t\t\"Something went horribly wrong!\" +\r\n\t\t\t\t\"The game has ended. You probably\" +\r\n\t\t\t\t\"would have won anyway.\"\r\n\t\t\trestart()\r\n\t\tend\r\n\t\tif marbles_left <= 0\r\n\t\t\tputs \"\\n---No marbles remaining:---\\n\\n\\n\"\r\n\t\t\tputs $turn == 1 ? \"\\tThe computer won.\": \"\\tYou won!!\"\r\n\t\t\trestart()\r\n\t\tend\r\n\tend\r\n\r\nend",
"title": ""
},
{
"docid": "a5e4eaa2f6dfbfafe9a36be1e20fe7bc",
"score": "0.5792135",
"text": "def one_round\n player1_weapon = get_player_one_weapon\n player2_weapon = get_player_two_weapon\n return winner?(player1_weapon,player2_weapon)\nend",
"title": ""
}
] |
ce86eed889efd605f9f1d3ee4a5d480c
|
GET /items/1 GET /items/1.json
|
[
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] |
[
{
"docid": "41699dd17c12d7e8d1afd1406f087302",
"score": "0.80987954",
"text": "def item(id)\n get(\"/item/#{id}.json\")\n end",
"title": ""
},
{
"docid": "eb354ffc8205e277e16c339add996ccd",
"score": "0.74948645",
"text": "def show\n item = Item.find(params[:id])\n render json: item\n end",
"title": ""
},
{
"docid": "f1082b9d415682dd50c0a3cf4f8b12f4",
"score": "0.7464442",
"text": "def item(id)\r\n get(\"item/#{id}\")\r\n end",
"title": ""
},
{
"docid": "0e3175d07666b24339a1d901013f3a1a",
"score": "0.7434085",
"text": "def show\n @item = Item.find(params[:id])\n render json: @item\n end",
"title": ""
},
{
"docid": "edbe3615c4166ab04bd6dd52d48ceb7c",
"score": "0.73644024",
"text": "def show\n @item = Item.find(params[:id])\n render :json => @item\n end",
"title": ""
},
{
"docid": "f576fd7e2180ebbcb2d149e2ebbb2954",
"score": "0.7332334",
"text": "def item(id)\n connection.get(\"/items/#{id}\").body\n end",
"title": ""
},
{
"docid": "fe476c10c46410f64947d209d6bdcb4c",
"score": "0.7328169",
"text": "def show\n render json: Item.find(params[:id])\n end",
"title": ""
},
{
"docid": "c4bd8be3a67efe7a0c112b82ddcda747",
"score": "0.7306718",
"text": "def show\n render :json => Item.find(params[:id])\n end",
"title": ""
},
{
"docid": "d09a877d0e3428805f7c5fec0322f980",
"score": "0.7250233",
"text": "def get_item\n\t\t@item = Item.find_by_id(params[:id])\n\t\tif item.nil?\n\t\t\trender json:{message:\"Item not found\"},status: :bad_request\n\t\tend\n\tend",
"title": ""
},
{
"docid": "005225439f5ef107aba338963dfc8a47",
"score": "0.71928537",
"text": "def get_items\n render json: { items: @list.items }\n end",
"title": ""
},
{
"docid": "9dc115545e6bb0551e65698eff4d5b1b",
"score": "0.7192717",
"text": "def get_item(id, params = nil, headers = nil)\n get(\"/api/v1/items/#{id}\", params, headers)\n end",
"title": ""
},
{
"docid": "5ede2cea1287a945d66a8c422ba7b9aa",
"score": "0.7178193",
"text": "def show\n allow :get, :delete, :put; vary_on :accept\n expires_in 60.seconds\n\n item = find_item(params[:id])\n item.links = links_for_item(item)\n\n respond_to do |format|\n format.g5kitemjson { render :json => item }\n format.json { render :json => item }\n end\n end",
"title": ""
},
{
"docid": "d57502db186679bf451e04276f7c18d6",
"score": "0.715229",
"text": "def items\n get_request configure_payload('/items')\n end",
"title": ""
},
{
"docid": "88c1b397fc24459dbdba67d35d6139f5",
"score": "0.7132092",
"text": "def getItemById\n if params[:id].present?\n code, @item = Item.getItemById(params[:id])\n if response.code == 404\n render(json: {messages: 'Item not found'}, status: code)\n else\n \n render(json: @item, status: 200)\n end\n\n end\n end",
"title": ""
},
{
"docid": "96514c3b8b6ff3d706a8b807a9ddb7b6",
"score": "0.71262914",
"text": "def item\n if @item = Item.find_by(id: params[:item])\n render :json => @item.to_json(:include => :subitem)\n else\n error_message(\"Item not found\")\n end\n end",
"title": ""
},
{
"docid": "d06395a832434cae30e0a4840496efd6",
"score": "0.71216583",
"text": "def index\n @items = Item.all\n render json: @items\n end",
"title": ""
},
{
"docid": "d06395a832434cae30e0a4840496efd6",
"score": "0.71216583",
"text": "def index\n @items = Item.all\n render json: @items\n end",
"title": ""
},
{
"docid": "d06395a832434cae30e0a4840496efd6",
"score": "0.71216583",
"text": "def index\n @items = Item.all\n render json: @items\n end",
"title": ""
},
{
"docid": "d06395a832434cae30e0a4840496efd6",
"score": "0.71216583",
"text": "def index\n @items = Item.all\n render json: @items\n end",
"title": ""
},
{
"docid": "31426dc34e7a79de5ad52afb0f0aa7a3",
"score": "0.709872",
"text": "def show\n @item = Item.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "4b9070e111efed469a61ba12e22b9b57",
"score": "0.7095125",
"text": "def show\n item = find_item\n render json: item\n end",
"title": ""
},
{
"docid": "31b95ddab946add5853ef0d1cefc48cc",
"score": "0.7094538",
"text": "def show\n @item = Item.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "5878d4f1f70b169a1f061bd55da51cc4",
"score": "0.7090274",
"text": "def get_item(id)\n get_request(id, 'item', {})\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "ffb36908180b80ee27642822e5bf66cd",
"score": "0.70882183",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "aed6803dbc293d9e5c8c86be51598799",
"score": "0.7084647",
"text": "def show\n item = Item.find(params[:id])\n render json: ItemSerializer.new(item)\n end",
"title": ""
},
{
"docid": "e375ef145b85b12e90007aa4b12e9989",
"score": "0.7081034",
"text": "def item_from_id(id)\n HTTParty.get('http://localhost:8082/items', query: {id: id}) \n end",
"title": ""
},
{
"docid": "a21ed1a1286295bbd7e0a89f2739f783",
"score": "0.70776224",
"text": "def show\n render json: { item: @item }, status: 200\n end",
"title": ""
},
{
"docid": "2f46eb23f11918c0915826435fbd96d2",
"score": "0.7072849",
"text": "def query_items(options={})\n path = \"/api/v2/items\"\n get(path, options)\n end",
"title": ""
},
{
"docid": "ee565a3dfa18b60e61033f07f1521271",
"score": "0.7072146",
"text": "def show\n item_id = params[:id]\n item = ensure_item_exists(item_id)\n render json: { item: item }, status: :ok\n end",
"title": ""
},
{
"docid": "7e485a9bc462611fb829e18167ccff73",
"score": "0.70636535",
"text": "def show\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "adf21e2ab8f07f97ad0b854b02591c78",
"score": "0.7060505",
"text": "def show\n render :json => Item.find(params[:id]).to_json\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "339d4a59bd552cbebac7f4f729655f4f",
"score": "0.7046805",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "c605fe186ec65c158041e521bd6a041d",
"score": "0.7039193",
"text": "def my_items\n signed_in?(:member)\n @items = Item.where(\"user_id = ?\", current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end",
"title": ""
},
{
"docid": "3a0732595227f14402f28c9e28e72726",
"score": "0.70361876",
"text": "def details\n item = Item.find(params[:item_id])\n respond_to do |format|\n format.json { render :json => item.to_json }\n end\n end",
"title": ""
},
{
"docid": "82a042d2e44f45dbd13a611a4db6327b",
"score": "0.7036061",
"text": "def show\n respond_to do |format|\n if Item.exists?(id: params[:id])\n @item = Item.find(params[:id])\n format.json { render :show, status: :ok, location: @item }\n else\n format.json { render plain: \"Couldn't get item with id = #{params[:id]}\", status: :bad_request }\n end\n end\n end",
"title": ""
},
{
"docid": "a1364aa6a9e719e6521b1277f23d2914",
"score": "0.70162416",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"title": ""
},
{
"docid": "a1364aa6a9e719e6521b1277f23d2914",
"score": "0.70162416",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"title": ""
},
{
"docid": "a1364aa6a9e719e6521b1277f23d2914",
"score": "0.70162416",
"text": "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"title": ""
},
{
"docid": "67f554854bf96ea6bc955cf0bc7ca29c",
"score": "0.70065445",
"text": "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end",
"title": ""
},
{
"docid": "a58fafbbe35446a2e4b7c1bd27ce02cf",
"score": "0.7001984",
"text": "def get_item(item_id, params = nil, headers = nil)\n get(\"/api/v2/items/#{item_id}\", params, headers)\n end",
"title": ""
},
{
"docid": "edc0e1af142514b6e8119e373814139f",
"score": "0.6994673",
"text": "def index\n @items = Item.all\n render json: @items, status: :ok\n end",
"title": ""
},
{
"docid": "28c2ce19ba7f786f89e84ccbdb12290e",
"score": "0.6980104",
"text": "def index\n @items = Item.order('created_at desc').page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "1f50986d73a8382860e494b9790926e7",
"score": "0.69800204",
"text": "def show\n\t\t@item = Item.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @item }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1f50986d73a8382860e494b9790926e7",
"score": "0.69800204",
"text": "def show\n\t\t@item = Item.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @item }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4ae697f5de62a69b63794587d53f2838",
"score": "0.6966086",
"text": "def index\n @items = Item.all\n\n if (params[:count])\n @items = Item.first(params[:count])\n end\n\n render json: @items\n end",
"title": ""
},
{
"docid": "2c82d8ffdd1c1f19c39676161a076283",
"score": "0.6953608",
"text": "def index\n @items = Item.paginate(:page => params[:page])\n respond_to do |format|\n format.json { render json: @items, status: 200}\n end\n end",
"title": ""
},
{
"docid": "a1478921e265613c39293ac1baeb287d",
"score": "0.69382423",
"text": "def index\n @items = Item.all.order(:id)\n\n render json: @items\n end",
"title": ""
},
{
"docid": "d86b428b56ec0ce9192f68e8f0629d6b",
"score": "0.69247025",
"text": "def show\n @items_list = ItemsList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @items_list }\n end\n end",
"title": ""
},
{
"docid": "5cf88c246c59a555b593493e4faf248b",
"score": "0.6916605",
"text": "def show\n @item = Item.get!(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end",
"title": ""
},
{
"docid": "0b22e52878d630fa68a577913bfdc48e",
"score": "0.69029725",
"text": "def show\n @item = @package.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "593230fe462e75b61ef5507bdcf3d9cd",
"score": "0.68975806",
"text": "def index\n @specific_items = SpecificItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @specific_items }\n end\n end",
"title": ""
},
{
"docid": "2f2c4b7f3ce1843b9c28fc14f6927a45",
"score": "0.68948185",
"text": "def index\n get_items\n end",
"title": ""
},
{
"docid": "0a40620ec295b12e0ca0fa0030c222f2",
"score": "0.6890917",
"text": "def show\n respond_to do |format|\n format.json { render json: @item, status: 200}\n end\n end",
"title": ""
},
{
"docid": "844bdab91dd38c84aa4f08ed77d30fca",
"score": "0.68834007",
"text": "def index\n items = Item.alphabetical_order\n if item_type = params[:item_type]\n items = items.where(item_type: item_type)\n end\n render json: items: { items }, status: 200\n end",
"title": ""
},
{
"docid": "e23f50ea6cf78c4df30f185b642dbcbb",
"score": "0.68681824",
"text": "def get_items\n call \"get_items\"\n end",
"title": ""
},
{
"docid": "4f1f1e3dd07489a84d454bde41410c7a",
"score": "0.6866145",
"text": "def get_item(id, params={})\n url = \"/#{HackernewsRuby.api_version}/item/#{id}.json\"\n get(url, params)\n end",
"title": ""
},
{
"docid": "6384614efdbcc61a72ea0823ac490fb6",
"score": "0.68371415",
"text": "def show\n render json: @item\n end",
"title": ""
},
{
"docid": "6384614efdbcc61a72ea0823ac490fb6",
"score": "0.68371415",
"text": "def show\n render json: @item\n end",
"title": ""
},
{
"docid": "4e5f73dbd5f31fcd1437e2e67a109d0e",
"score": "0.6834874",
"text": "def find_item(id)\n self.class.get(\"/items/#{id}.json?apikey=#{apikey}\")\n end",
"title": ""
},
{
"docid": "84b5dd160d7f64399677579bf959789b",
"score": "0.6830043",
"text": "def get\n\t\titems = Item.where(category_id: params[:category_id])\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => items }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7a9bfe33bf05b3d7de49e210292fc728",
"score": "0.6824448",
"text": "def show\n render json: @item\n end",
"title": ""
},
{
"docid": "7a9bfe33bf05b3d7de49e210292fc728",
"score": "0.6824448",
"text": "def show\n render json: @item\n end",
"title": ""
},
{
"docid": "7a9bfe33bf05b3d7de49e210292fc728",
"score": "0.6824448",
"text": "def show\n render json: @item\n end",
"title": ""
},
{
"docid": "7a9bfe33bf05b3d7de49e210292fc728",
"score": "0.6824448",
"text": "def show\n render json: @item\n end",
"title": ""
},
{
"docid": "951206923d53dd5f7fa4cc6970c8cbb7",
"score": "0.68243325",
"text": "def show\n @item = @model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "dfb48c310100e20586e991c2ca9af85b",
"score": "0.68183917",
"text": "def show\r\n respond_to do |format|\r\n format.html { # show.html.erb\r\n @item_info = ItemInfo.find(params[:id])\r\n }\r\n format.json {\r\n render json: getitem(params[:id])\r\n }\r\n end\r\n end",
"title": ""
},
{
"docid": "57312a19f9fdaeef92ed46ed5d009db1",
"score": "0.68135643",
"text": "def item(id)\n result = get('/' + id.to_s)\n Item.new(result[:item])\n end",
"title": ""
}
] |
df9f2f57cccd5255b4a142cf0822a36c
|
Select the near servers from a list of provided candidates, taking the local threshold into account.
|
[
{
"docid": "123f8b2909bad7743486cccce5b038e0",
"score": "0.79037696",
"text": "def near_servers(candidates = [], local_threshold = nil)\n return candidates if candidates.empty?\n\n # Average RTT on any server may change at any time by the server\n # monitor's background thread. ARTT may also become nil if the\n # server is marked unknown. Take a snapshot of ARTTs for the duration\n # of this method.\n\n candidates = candidates.map do |server|\n {server: server, artt: server.average_round_trip_time}\n end.reject do |candidate|\n candidate[:artt].nil?\n end\n\n return candidates if candidates.empty?\n\n nearest_candidate = candidates.min_by do |candidate|\n candidate[:artt]\n end\n\n # Default for legacy signarure\n local_threshold ||= self.local_threshold\n\n threshold = nearest_candidate[:artt] + local_threshold\n\n candidates.select do |candidate|\n candidate[:artt] <= threshold\n end.map do |candidate|\n candidate[:server]\n end.shuffle!\n end",
"title": ""
}
] |
[
{
"docid": "de9aa73875ca6239db09b1e37546c02d",
"score": "0.79165083",
"text": "def near_servers(candidates = [])\n return candidates if candidates.empty?\n nearest_server = candidates.min_by(&:average_round_trip_time)\n threshold = nearest_server.average_round_trip_time + (local_threshold * 1000)\n candidates.select { |server| server.average_round_trip_time <= threshold }.shuffle!\n end",
"title": ""
},
{
"docid": "92c0f2e95d288ce3edbb3435e04eadba",
"score": "0.78603727",
"text": "def near_servers(candidates = [])\n return candidates if candidates.empty?\n nearest_server = candidates.min_by(&:ping_time)\n max_latency = nearest_server.ping_time + acceptable_latency\n near_servers = candidates.select { |server| server.ping_time <= max_latency }\n near_servers.shuffle!\n end",
"title": ""
},
{
"docid": "d7704c52bd85b90c169bac2773740769",
"score": "0.7450952",
"text": "def select_in_replica_set(candidates)\n near_servers(secondaries(candidates)) + primary(candidates)\n end",
"title": ""
},
{
"docid": "47b00bdb20adc8c1a190d207e607f468",
"score": "0.65454715",
"text": "def candidates(cluster)\n servers = cluster.servers\n servers.each do |server|\n validate_max_staleness_support!(server)\n end\n if cluster.single?\n servers\n elsif cluster.sharded?\n servers\n elsif cluster.replica_set?\n select_in_replica_set(servers)\n else\n # Unknown cluster - no servers\n []\n end\n end",
"title": ""
},
{
"docid": "5259e65496c42e0da5aeab55eb4f6261",
"score": "0.65386933",
"text": "def near_nodes(candidates = [])\n return candidates if candidates.empty?\n nearest_node = candidates.min_by(&:ping_time)\n max_latency = nearest_node.ping_time + acceptable_latency\n near_nodes = candidates.select { |node| node.ping_time <= max_latency }\n near_nodes.shuffle!\n end",
"title": ""
},
{
"docid": "24bdc04b59280000041a7c99654ea86e",
"score": "0.6485963",
"text": "def suitable_servers(cluster)\n if cluster.single?\n candidates(cluster)\n elsif cluster.sharded?\n local_threshold = local_threshold_with_cluster(cluster)\n servers = candidates(cluster)\n near_servers(servers, local_threshold)\n elsif cluster.replica_set?\n validate_max_staleness_value!(cluster)\n candidates(cluster)\n else\n # Unknown cluster - no servers\n []\n end\n end",
"title": ""
},
{
"docid": "e42739b14b1fa0d077a14a2947ae55cf",
"score": "0.6462867",
"text": "def secondaries(candidates)\n matching_servers = candidates.select(&:secondary?)\n matching_servers = filter_stale_servers(matching_servers, primary(candidates).first)\n matching_servers = match_tag_sets(matching_servers) unless tag_sets.empty?\n # Per server selection spec the server selected MUST be a random\n # one matching staleness and latency requirements.\n # Selectors always pass the output of #secondaries to #nearest\n # which shuffles the server list, fulfilling this requirement.\n matching_servers\n end",
"title": ""
},
{
"docid": "9ca6fc01526b218008e934cc0db2eca3",
"score": "0.62217444",
"text": "def candidates\n fork_child :candidates do\n @services[:candidates] = 3.upto Float::INFINITY\n\n DRb.thread.join\n end\n end",
"title": ""
},
{
"docid": "0ae8491a67699251d74a3758bba3b6fd",
"score": "0.5932855",
"text": "def primary(candidates)\n candidates.select do |server|\n server.primary?\n end\n end",
"title": ""
},
{
"docid": "0ae8491a67699251d74a3758bba3b6fd",
"score": "0.5932855",
"text": "def primary(candidates)\n candidates.select do |server|\n server.primary?\n end\n end",
"title": ""
},
{
"docid": "7d947a415549ad3c23557f79d8f662be",
"score": "0.5930245",
"text": "def qualified_candidates(candidates)\n candidates.select do |candidate|\n criteria(candidate)\n end\nend",
"title": ""
},
{
"docid": "7d947a415549ad3c23557f79d8f662be",
"score": "0.5930245",
"text": "def qualified_candidates(candidates)\n candidates.select do |candidate|\n criteria(candidate)\n end\nend",
"title": ""
},
{
"docid": "9dfe154bfc4ff5a6567b8ea4f5c82c12",
"score": "0.5888691",
"text": "def secondaries(candidates)\n matching_servers = candidates.select(&:secondary?)\n matching_servers = match_tag_sets(matching_servers) unless tag_sets.empty?\n matching_servers\n end",
"title": ""
},
{
"docid": "9dfe154bfc4ff5a6567b8ea4f5c82c12",
"score": "0.5888691",
"text": "def secondaries(candidates)\n matching_servers = candidates.select(&:secondary?)\n matching_servers = match_tag_sets(matching_servers) unless tag_sets.empty?\n matching_servers\n end",
"title": ""
},
{
"docid": "393f9b7c12c1954ee92672fe2a93e413",
"score": "0.5713437",
"text": "def compare_to_candidates(candidates)\n candidates.each do |candidate|\n similarity = similarity_to(candidate)\n\n if similarity >= Settings::CONFIG.similarity\n add_similar_file(candidate, similarity)\n end\n end \n end",
"title": ""
},
{
"docid": "ba9dbbdbb2824cd2bbe6d6c2032c8a26",
"score": "0.5693108",
"text": "def elect(opts)\n scores = []\n @remotes.iterate(@log, farm: @farm, threads: opts['threads']) do |r|\n uri = '/'\n res = r.http(uri).get\n r.assert_code(200, res)\n json = JsonPage.new(res.body, uri).to_hash\n score = Score.parse_json(json['score'])\n r.assert_valid_score(score)\n r.assert_score_ownership(score)\n r.assert_score_strength(score) unless opts['ignore-score-weakness']\n r.assert_score_value(score, opts['min-score']) unless opts['ignore-score-value']\n if r.master? && opts['--ignore-masters']\n @log.debug(\"#{r} ignored, it's a master node\")\n next\n end\n scores << score\n end\n scores = scores.sample(opts['max-winners'])\n if scores.empty?\n @log.info(\"No winners elected out of #{@remotes.all.count} remotes\")\n else\n scores.each { |s| @log.info(\"Elected: #{s.reduced(4)}\") }\n end\n scores.sort_by(&:value).reverse\n end",
"title": ""
},
{
"docid": "a6601042f39369ca9a30e9805610c3e5",
"score": "0.5667844",
"text": "def build_candidates(candidates)\n candidates.to_a.map do |object, preferences|\n candidate(object).tap do |c|\n c.prefer(*preferences.map { |t| target(t) })\n end\n end\n end",
"title": ""
},
{
"docid": "3b29f51cbfe9c27cd5b95cf90ed0de27",
"score": "0.56670386",
"text": "def qualified_candidates(candidate_list)\n candidate_list.select {|candidate| experienced?(candidate)}\nend",
"title": ""
},
{
"docid": "f33f1a34eb84a618cca8415935eb5b90",
"score": "0.5663542",
"text": "def match_tag_sets(candidates)\n matches = []\n tag_sets.find do |tag_set|\n matches = candidates.select { |server| server.matches_tags?(tag_set) }\n !matches.empty?\n end\n matches || []\n end",
"title": ""
},
{
"docid": "30b4b1b3c2deac23b1e161853b745b9d",
"score": "0.5615705",
"text": "def candidate_servers\n @candidate_servers\n end",
"title": ""
},
{
"docid": "3f40f5b880435b6be75202b13f9737b4",
"score": "0.5595447",
"text": "def qualified_candidates(candidates)\n candidates.select do |candidate|\n experienced?(candidate)\n end.select do |candidate|\n github_points?(candidate)\n end.select do |candidate|\n languages?(candidate)\n end.select do |candidate|\n age?(candidate)\n end.select do |candidate|\n application_date?(candidate)\n end\nend",
"title": ""
},
{
"docid": "cf487317fab6943bce9e2fc6ccedcf78",
"score": "0.55926925",
"text": "def match_tag_sets(candidates)\n matches = []\n tag_sets.find do |tag_set|\n matches = candidates.select { |server| server.matches_tag_set?(tag_set) }\n !matches.empty?\n end\n matches || []\n end",
"title": ""
},
{
"docid": "cf487317fab6943bce9e2fc6ccedcf78",
"score": "0.55926925",
"text": "def match_tag_sets(candidates)\n matches = []\n tag_sets.find do |tag_set|\n matches = candidates.select { |server| server.matches_tag_set?(tag_set) }\n !matches.empty?\n end\n matches || []\n end",
"title": ""
},
{
"docid": "e60f7315ba9f5beef8f18423f049333c",
"score": "0.5580966",
"text": "def qualified_candidates(candidates)\n candidates.select do |x|\n experienced?(x) && github_100?(x) && knowRnP?(x) && applied?(x) && adult?(x) \n end\nend",
"title": ""
},
{
"docid": "07a6fe7699ee168b397c867c73c80042",
"score": "0.5555825",
"text": "def qualified_candidates(candidates)\n result = []\n candidates.each do |candidate|\n if experienced?(candidate) && (candidate[:github_points] > 100) && (candidate[:age] >= 18) && ruby_python?(candidate) && fresh_application?(candidate)\n result << candidate\n end\n end\n result\nend",
"title": ""
},
{
"docid": "33a78ac5f8c8364f75968b5b139d417b",
"score": "0.55471927",
"text": "def candidate_partner\n t0 = Time.now\n partner_pool = potential_partners\n elapsed = Time.now - t0\n chosen_candidate = partner_pool.detect do |c|\n !related_to?(c)\n end\n\n elapsed = Time.now - t0\n if elapsed > 0.5\n puts \"--- Choose candidate took #{elapsed} (#{partner_pool.count} potential partners)\"\n end\n chosen_candidate\n end",
"title": ""
},
{
"docid": "b70da59bd6b571faccc7500ac0345605",
"score": "0.5453015",
"text": "def generate_matches_list(identity_attrs, candidates)\n \tcandidates.select do |candidate|\n \t\tevaluate_match_score(identity_attrs, candidate) >= THRESHOLD_MATCH_SCORE\n \tend\n end",
"title": ""
},
{
"docid": "029b6cf060fde091da8cedc20991a86f",
"score": "0.5432972",
"text": "def qualified_candidates(candidates)\n result = []\n @candidates.each do |candidate|\n if (experienced?(candidate) &&\n has_points?(candidate, 100) &&\n (has_lang?(candidate, \"Ruby\") || has_lang?(candidate, \"Python\")) &&\n applied_within?(candidate, 15) &&\n candidate[:age] >= 18)\n result.push(candidate)\n end\n end\n return result\nend",
"title": ""
},
{
"docid": "8efd5faf17350283d58085c8cf9df22e",
"score": "0.5378275",
"text": "def qualified_candidates(candidates)\n qualified = candidates.find_all{ |candidate|\n experienced?(candidate) &&\n candidate[:github_points] >= 100 &&\n knows_of_these_lngs?(candidate, ['Python', 'Ruby']) &&\n candidate[:age] > 17 &&\n (Date.today - candidate[:date_applied]).to_i <= 15\n }\nend",
"title": ""
},
{
"docid": "6ca4da187a3b7bb450d009a5bc5389c0",
"score": "0.5375733",
"text": "def qualified_candidates(candidates)\n qualified = []\n candidates.each do |candidate|\n if experienced?(candidate) &&\n github_points(candidate)\n qualified << candidate\n end\n end\n qualified\nend",
"title": ""
},
{
"docid": "ff4c87f63f15021657420db7ec766370",
"score": "0.53407323",
"text": "def candidates(options = {})\n return size if !options || options.empty?\n filter = filter_for_options(options)\n return size unless filter\n entries.select {|entry| filter.call(entry) }\n end",
"title": ""
},
{
"docid": "3246b63628b0803c50be1e36ac4c5808",
"score": "0.52936935",
"text": "def qualified_candidates(candidates)\n qualified = candidates.find_all do |candidate|\n experienced?(candidate) &&\n candidate[:github_points] >= 100 &&\n knows_of_these_lngs?(candidate, %w(Python Ruby)) &&\n candidate[:age] > 17 &&\n (Date.today - candidate[:date_applied]).to_i <= 15\n end\nend",
"title": ""
},
{
"docid": "b9fe0937284e6490bb9e785bf164c195",
"score": "0.5289434",
"text": "def evaluate!\n @servers ||= Array(callback[options]).map do |server|\n case server\n when String then Net::SSH::Multi::Server.new(master, server, options)\n else server\n end\n end\n end",
"title": ""
},
{
"docid": "659aabf7ffe0f5dea6d05997a410d4ba",
"score": "0.528742",
"text": "def optimal_candidate(candidates)\n candidates.max(&method(:compare))\n end",
"title": ""
},
{
"docid": "58d1bdc1e3e755a3ebfe1870777e6ed4",
"score": "0.5270692",
"text": "def choose_best_responder_group(selections)\n current_minimum = 999\n current_count = 999\n result = nil\n selections.each do |x|\n cap = total_capacity_from_array(x)\n num = x.size\n result << x if cap == current_minimum || num == current_count\n next if cap >= current_minimum || num >= current_minimum\n result = x\n current_minimum = cap\n current_count = num\n end\n\n result\n end",
"title": ""
},
{
"docid": "f876d60fdd04634646ced39810b5ecec",
"score": "0.5265394",
"text": "def find_matching_partners(options={})\n list = self.want_expertise_list\n Person.find_tagged_with(list, {\n :on => 'have_expertises',\n :conditions => [\"people.id <> ?\", self.id]\n }.merge_finder_options(options.merge_finder_options(Person.find_options_for_partner_status)))\n end",
"title": ""
},
{
"docid": "34d32cc7d5c0e4539d2449a5d7f788fb",
"score": "0.52630335",
"text": "def qualified_candidates(candidates)\n candidates.select { |candidate| qualified?(candidate) }\nend",
"title": ""
},
{
"docid": "f1713de154da09f808a78e0bd697852b",
"score": "0.52584743",
"text": "def select(actor, targets)\n targets.find_all {|target| Utility.find_distance(actor.location, target.location) <= @distance}\n end",
"title": ""
},
{
"docid": "af0a05d67942601c3a98af378c7e0c5b",
"score": "0.5253982",
"text": "def specific_endorsed_candidates\n endorsed_users = self.endorsements.map { |endorsement| endorsement }\n endorsed_candidates = endorsed_users.map { |endorsement| endorsement.candidate }\n endorsed_candidate_users = endorsed_candidates.compact.map { |candidate| candidate.user }\n #sorts candidates according to organization score (should be candidate score)\n endorsed_candidate_users_sorted = endorsed_candidate_users.sort_by {|user| user.cand_score}\n endorsed_users_twitter = endorsed_candidate_users_sorted.reverse.map { |user| user.twitteruser }\n # cut_off_twitteruser_array = endorsed_users_twitter[0..10]\n end",
"title": ""
},
{
"docid": "ae10dd28d18ab1f67ce9bdaac8996fc5",
"score": "0.52084786",
"text": "def find_available_reduce_servers(count)\n case count\n when 1\n [[\"127.0.0.1\", 9091]]\n when 2\n [[\"127.0.0.1\", 9091], [\"127.0.0.1\", 9092]]\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "fd565ed50dedd56e3dbb307a88654259",
"score": "0.5204904",
"text": "def execute_find_neighbors\n # Gather some system info\n num_cpus = @cpu_info.num_processors\n free_cpus = @cpu_info.num_free_processors\n limit = num_cpus / 2\n\n limit = free_cpus if free_cpus < limit\n\n num_cmds = @values_at.length\n\n # To use recursion or not to use recursion?\n if num_cmds > limit\n @increment = limit # spwan_threads_in_batch increment value.\n spawn_threads_in_batch(0, limit, @values_at)\n else\n spawn_threads(@values_at)\n end\n end",
"title": ""
},
{
"docid": "64b9282aa25dc5bfdc45f92bf099baff",
"score": "0.5200718",
"text": "def find_available_map_servers(count)\n case count\n when 1\n [[\"127.0.0.1\", 9081]]\n when 2\n [[\"127.0.0.1\", 9082], [\"127.0.0.1\", 9083]]\n when 3\n [[\"127.0.0.1\", 9081], [\"127.0.0.1\", 9082], [\"127.0.0.1\", 9083]]\n when 4\n [[\"127.0.0.1\", 9081], [\"127.0.0.1\", 9082], [\"127.0.0.1\", 9083], [\"127.0.0.1\", 9084]]\n when 5\n [[\"127.0.0.1\", 9081], [\"127.0.0.1\", 9082], [\"127.0.0.1\", 9083], [\"127.0.0.1\", 9084], [\"127.0.0.1\", 9085]]\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "33dc8c9eb5d6f14f54107f027e662acd",
"score": "0.5186412",
"text": "def natural_selection\n # Clear the ArrayList\n @mating_pool.clear\n\n max_fitness = @population.max{|a, b| a.fitness(@target) <=> b.fitness(@target)}.fitness(@target)\n\n # Based on fitness, each member will get added to the mating pool a certain number of times\n # a higher fitness = more entries to mating pool = more likely to be picked as a parent\n # a lower fitness = fewer entries to mating pool = less likely to be picked as a parent\n @population.each do |p|\n fitness = map(p.fitness(@target), 0, max_fitness, 0, 1)\n n = (fitness * 100).to_i # Arbitrary multiplier, we can also use monte carlo method\n n.times{ @mating_pool << p } # and pick two random numbers\n end\n end",
"title": ""
},
{
"docid": "20bdfd751b6a87175e7db1846a08ecac",
"score": "0.51781535",
"text": "def candidates(options = {})\n opts = {:supported_language_tags => nil, :current => current,\n :type => :common}.merge(options)\n\n if Thread.current[:candidates_caches]\n cache = Thread.current[:candidates_caches][opts.hash]\n return cache if cache\n else\n Thread.current[:candidates_caches] = {} \n end\n Thread.current[:candidates_caches][opts.hash] =\n collect_candidates(opts[:type], opts[:current],\n opts[:supported_language_tags])\n end",
"title": ""
},
{
"docid": "dcb371554fabbf8413adf7da9b7b4ebc",
"score": "0.516033",
"text": "def find_matching_partners_for(kase, options={})\n kase ? (@find_matching_partners_for_cache ||= kase.find_matching_partners(options)) : []\n end",
"title": ""
},
{
"docid": "b0ee7ae74b7a079f9bfc33e861c71eed",
"score": "0.5151835",
"text": "def candidates_for(position)\n candidates = Candidate.all.select do |candidate|\n candidate.position == position\n end\nend",
"title": ""
},
{
"docid": "a9dbe94f580eb3d6cdb315892f3ebc71",
"score": "0.5150173",
"text": "def select(candidates, &block)\n candidates.select { |candidate| open(false, candidate, &block) }\n end",
"title": ""
},
{
"docid": "c4d20309976a17b69816d5806976fdcf",
"score": "0.5143536",
"text": "def possible_candidates\n @possible_candidates ||= (1..@side_size)\n end",
"title": ""
},
{
"docid": "55101fb182120ac83d8baa5bfb1daa15",
"score": "0.5143348",
"text": "def qualified_candidates(candidates)\n\n\tqualified = []\n\n\tcandidates.each do |i|\n\t\tif i[:years_of_experience] >= 1 &&\n\t\t i[:github_points] >= 100 && \n\t\t i[:languages].include?('Ruby' || 'Python') && \n\t\t i[:date_applied] >= Date.today - 15 && \n\t\t i[:age] >= 18\n\t\t\tqualified << i\n\n\t\tend\n\tend\n\n\treturn qualified\n\nend",
"title": ""
},
{
"docid": "b5da3987c413b5ccb3654465bf4d52a7",
"score": "0.513296",
"text": "def listening_hosts(target_hosts=installed_hosts)\n host_entries = BACH::ClusterDef.new(repo_dir: BACH::ClusterData::repo_dir).fetch_cluster_def.select do |entry|\n target_hosts.include?(entry[:hostname]) ||\n target_hosts.include?(entry[:fqdn])\n end\n\n host_entries.select do |entry|\n look_for_ssh_banner(entry[:ip_address])\n end.map do |entry|\n entry[:hostname]\n end\nend",
"title": ""
},
{
"docid": "c1270aea5b375edc5dbded5094d0064b",
"score": "0.5130253",
"text": "def choose_victim(candidates)\n min_value = @access_time + 1\n min_node = 0\n candidates.each do |node|\n if @cache_infos[node].access_time < min_value\n min_value, min_node = @cache_infos[node].access_time, node\n end\n end\n min_node\n end",
"title": ""
},
{
"docid": "59e0c0d50766b925e16274037399b172",
"score": "0.51278764",
"text": "def selection\n # Clear the ArrayList\n mating_pool.clear\n # Calculate total fitness of whole population\n max = max_fitness\n # Fitness for each member of the population (scaled to between 0 and 1)\n # Members get added to the mating pool a number of times based on fitness\n # A higher fitness = more entries to mating pool\n # A lower fitness = fewer entries to mating pool\n population.each do |pop|\n fitness_normal = map1d(pop.fitness, (0..max), (0..1.0))\n n = (fitness_normal * 100).to_i # Arbitrary multiplier\n (n - 1).times do\n mating_pool << pop\n end\n end\n end",
"title": ""
},
{
"docid": "e2c921cf1f46f78b488ef2acbf9e07a6",
"score": "0.5127719",
"text": "def suitable_server(servers, deprioritized)\n preferred = servers - deprioritized\n if preferred.empty?\n servers.first\n else\n preferred.first\n end\n end",
"title": ""
},
{
"docid": "ac5b2f8add5364aca1550b889ff09dd8",
"score": "0.5117707",
"text": "def my_top_five_candidates\n\t\treturn self.offre_for_candidates.where(accepted_postule:true)\n\tend",
"title": ""
},
{
"docid": "4730d15da25924189a57f4d55088e446",
"score": "0.511687",
"text": "def collect_comrades server\n\t\tcomrade_suggestions = {}\n\t\tcomrade_suggestions.default =\t0\t\n candidates = server.users\n\n\t\tcandidates.each do |u|\n\t\t\tif u != self and !self.has_friend?(u)\tand !self.wait_for?(u) and !u.wait_for?(self)\n\t\t\t\tcomrade_suggestions[u.id] += 20 * u.common_friends_with(self).count\n\t\t\t\tcomrade_suggestions[u.id] += 10 * u.common_events_with(self).count\n\t\t\t\tcomrade_suggestions[u.id] += 10 * u.common_guilds_with(self).count\n\t\t\tend\n\t\tend\n\n # sort by score\n\t\tcomrade_suggestions.sort{|a,b| b[1] <=> a[1]}[0..(COMRADE_SUGGESTION_SET_SIZE - 1)].map{|info| info[0]}\n\t\t\t\t\t\n\tend",
"title": ""
},
{
"docid": "4e1176160d3cea250457ffc330610562",
"score": "0.5098355",
"text": "def selection\n max_fitness = @population.max_by(&:fitness).fitness\n min_fitness = @population.min_by(&:fitness).fitness\n accumulate_normalized_fitness = 0\n if max_fitness - min_fitness > 0\n offset_fitness = max_fitness - min_fitness\n @population.each do | chromosome |\n chromosome.normalized_fitness = (chromosome.fitness - min_fitness) / offset_fitness\n accumulate_normalized_fitness += chromosome.normalized_fitness\n end\n else\n @population.each { | chromosome | chromosome.normalized_fitness = 1} \n end\n\n mating_pool = []\n @population.each do | chromosome |\n if accumulate_normalized_fitness == 0\n num_select = 1\n else\n num_select = (chromosome.normalized_fitness / accumulate_normalized_fitness * @population_size).round\n end\n num_select.times do\n mating_pool << chromosome\n end\n end\n\n mating_pool\n end",
"title": ""
},
{
"docid": "1260b02843e330e9320e905b76d147f0",
"score": "0.5092336",
"text": "def launch_servers(find_opts = {})\n # By default, we'll launch all allocated servers.\n find_opts = find_opts.merge({\n 'ec2_id' => 'create'\n })\n\n # Retrieve the servers that will be launched.\n to_launch = fields_xmlrpc.call2('acquia.fields.find', 'server', find_opts)\n to_launch_names = to_launch.map{|id,s| s['name']}.join(',')\n Log.logger.info(\"Launching servers: \" + to_launch_names)\n\n arg = \"--launcher --region #{self.region} --parallel --server #{to_launch_names} --dns-wait-time 3600\"\n launch_cmd = fields_provision_cmd + arg\n Log.logger.info(\"Launch command: [#{launch_cmd}]\")\n\n curr_try = 0\n max_tries = 3\n launched = false\n while (!launched && curr_try < max_tries)\n curr_try += 1\n (ec, result) = self.attempt launch_cmd\n puts result\n launched = (result !~ /Launch\\s+failure/i && ec == 0)\n if (!launched)\n Log.logger.warn(\"Launch servers #{to_launch_names} failed on try #{curr_try} retrying\")\n end\n end\n if (!launched)\n raise \"Could not launch servers #{to_launch_names} in #{max_tries} tries\"\n end\n\n Log.logger.info(\"Servers #{to_launch_names} successfully launched on try #{curr_try}\")\n\n # Return the launched server records\n fields_xmlrpc.call2('acquia.fields.find', 'server',\n { 'id' => { 'op' => 'IN', 'value' => to_launch.map { |id,s| s['id'] }}})\n end",
"title": ""
},
{
"docid": "923ec2383e8db1a50ac06797f9c06181",
"score": "0.5090458",
"text": "def select_subjects_closest( candidates_list, me, num_subjects )\n # puts \"select_subjects: called with #{candidates_list.count} candidates, me=#{me}, #{num_subjects} subjects\"\n\n candidates = Array.new\n distance = Array.new\n candidates_list.each_with_index do |dot, i|\n #puts \"dot=#{dot}, i=#{i}\"\n #range = Math.sqrt( ( me.x - dot.x )**2 + ( me.y - dot.y )**2 ).to_int\n # In theory, shouldn't need the expensive sqrt op if all I want is relative distance\n range = ( me.x - dot.x )**2 + ( me.y - dot.y )**2\n # to prevent observing self and to prevent throwing off coordinated indexes, set 'me' to furthest possible\n range = 99999999 if me == dot\n candidates << dot\n distance << [ range, i ]\n end\n distance.sort!\n topRanges = distance.take( num_subjects )\n subjects = Array.new\n topRanges.each do | k, v |\n subjects << candidates[v]\n end\n return subjects\n end",
"title": ""
},
{
"docid": "7d7c913f0f8fa3d601700d20a97f78cc",
"score": "0.5061685",
"text": "def candidates\n possible_candidates = []\n @neighbour_cells.flatten.each{ |cell|\n possible_candidates << cell.value \n }\n existing_candidates = (1..9).to_a - possible_candidates.uniq\n end",
"title": ""
},
{
"docid": "2ef64812db092f64402a5a9d096316c1",
"score": "0.50405806",
"text": "def minimum_responders(responders, need)\n return nil if need < 1\n return responders[0] if responders.size == 1\n\n selections = []\n responders.each do |x|\n list = responders.select { |responder| responder != x }\n temp = [x]\n minimum = minimum_responders(list, need - x.capacity)\n temp << minimum if minimum.present?\n selections << temp.flatten\n end\n\n return nil if selections.size == 0\n choose_best_responder_group(selections)\n end",
"title": ""
},
{
"docid": "139fb1638ea443dc57ba76d7a3fe6732",
"score": "0.5039804",
"text": "def candidates\n end",
"title": ""
},
{
"docid": "91b2ebe6139722ae2d572be0ffb36bba",
"score": "0.5015614",
"text": "def query_spare_assets(count, options={})\n # Intentionally no remoteLookup=true here. We only want to grab spare nodes\n # from the datacenter that Jetpants is running in.\n selector = {\n operation: 'and',\n details: true,\n type: 'SERVER_NODE',\n status: 'Allocated',\n state: 'SPARE',\n primary_role: 'DATABASE',\n size: 100,\n }\n selector = process_spare_selector_options(selector, options)\n \n nodes = Plugin::JetCollins.find(selector)\n keep_nodes = []\n \n # Probe concurrently for speed reasons\n nodes.map(&:to_db).concurrent_each {|db| db.probe rescue nil}\n \n # Now iterate in a single-threaded way for simplicity\n nodes.each do |node|\n db = node.to_db\n if db.usable_spare?\n keep_nodes << node\n break if keep_nodes.size >= count\n end\n end\n keep_nodes.slice(0,count)\n end",
"title": ""
},
{
"docid": "9b4564b47692681f89a082d16e2f0bcf",
"score": "0.5013266",
"text": "def find_server_by(criteria = {})\n servers.find{|s| criteria.none? {|k,v| v != s[k]}}\n end",
"title": ""
},
{
"docid": "6fccd06672654f5320a8d0f26413f628",
"score": "0.49990168",
"text": "def candidate_matches\n @jobs = Job.job_matched_list(current_candidate).page(params[:page])\n tracker = Mixpanel::Tracker.new(ENV['NT_MIXPANEL_TOKEN'])\n tracker.track('candidate-' + current_candidate.email, 'viewed matches')\n end",
"title": ""
},
{
"docid": "a1c606268e0d8e18a0f3801538a101c9",
"score": "0.49909002",
"text": "def pick_dispatchers( dispatchers )\n dispatchers = dispatchers.sort_by { |d| d['node']['score'] }\n @opts.max_slaves > 0 ? dispatchers[0...@opts.max_slaves] : dispatchers\n end",
"title": ""
},
{
"docid": "d231d4aa727dea54310e9fec8698e9f6",
"score": "0.4972634",
"text": "def optimal_candidate(candidates, coupon_types)\n candidates.max do |coupons_0, coupons_1|\n total_values = [\n total_value(coupons_0, coupon_types),\n total_value(coupons_1, coupon_types)\n ]\n\n if total_values[0] != total_values[1]\n # If total values of the coupons are different, the coupons of higher value are better.\n total_values[0] <=> total_values[1]\n\n else\n # Otherwise, the coupons of smaller number are better.\n n_of_coupons(coupons_1) <=> n_of_coupons(coupons_0)\n end\n end\n end",
"title": ""
},
{
"docid": "2c36531e66af718f479bbacfdfc9d82e",
"score": "0.49479038",
"text": "def retrieveBestCandidatesInVector()\n if(@candidateHashLocal!=nil)\n @candidateHashLocal.each_pair do |k, v| \n #puts \"Key: #{k}, Value: #{v}\" \n key = \"#{k}\"\n value= \"#{v}\"\n \n if(value.to_i>=@countMatchs)\n insertCandidate(key.to_i)\n end \n end\n end \nend",
"title": ""
},
{
"docid": "0e2e4ee7f62db682b578aa6ca065920c",
"score": "0.4942267",
"text": "def selection\n # Clear the ArrayList\n mating_pool.clear\n\n # Calculate total fitness of whole population\n max_fit = max_fitness\n\n # Calculate fitness for each member of the population (scaled to value between 0 and 1)\n # Based on fitness, each member will get added to the mating pool a certain number of times\n # A higher fitness = more entries to mating pool = more likely to be picked as a parent\n # A lower fitness = fewer entries to mating pool = less likely to be picked as a parent\n population.length.times do |i|\n fitness_normal = map1d(population[i].fitness, (0..max_fit), (0..1))\n n = (fitness_normal * 100).to_i # Arbitrary multiplier\n n.times { mating_pool << population[i] }\n end\n end",
"title": ""
},
{
"docid": "f735f7aa1352d57b34d3794afd7df033",
"score": "0.49419576",
"text": "def qualified_candidates(candidates)\n qualified=[]\n candidates.each do |index|\n exp=experienced?(index)\n points=index[:github_points]\n lang=index[:languages].include? ('Ruby' || 'Python')\n date= (Date.today - index[:date_applied]).to_i\n age = index[:age]\n if (exp && (points > 99) && (lang==true) && (age > 17) && date<15)\n qualified << index\n end\n end\n return qualified\nend",
"title": ""
},
{
"docid": "ec3fe21cae4432eaf32daf89df1e3229",
"score": "0.49220267",
"text": "def select\n subset = @list.select { |i| yield i }\n ServerList.new(subset)\n end",
"title": ""
},
{
"docid": "f4512757ffcb89776293cc6b6c47e63f",
"score": "0.49216402",
"text": "def trim_candidates( current_selections, wanted_distribution )\n multipliers = self.needed_multipliers( current_selections, wanted_distribution ).to_a\n multipliers.select do |bucket_name, multiplier|\n # Can't trim empty buckets\n @buckets[bucket_name].count != 0\n end\n return multipliers if multipliers.empty?\n multipliers.sort! { |a, b| a[1] <=> b[1] } # Sort on multiplier ascending\n multipliers.map{ |bucket_name, multiplier| bucket_name }\n end",
"title": ""
},
{
"docid": "3faba76eb75711e102a5c62bd71a8689",
"score": "0.49192393",
"text": "def get_candidates(player = @player, b = @board)\n debug = false\n @timing[:get_candidates] ||= 0\n start_time = Time.now\n candidates = []\n\n [player, opponent(player)].each do |role|\n candidates += b.poses_for(role).map do |pos|\n b.valid_win_pathsets(pos, role)\n end.flatten\n end\n\n if debug\n puts \"candidates:\"\n puts b.picture_for_mask b.pos_to_mask candidates\n end\n @timing[:get_candidates] += Time.now - start_time\n\n # TODO\n fail \"nil candidate: #{candidates}\" if candidates.any? {|c| c.nil?}\n\n candidates.uniq\n end",
"title": ""
},
{
"docid": "29e2715cbc1fe6a25f3e4619ea8de6ed",
"score": "0.491553",
"text": "def select_players_for_slytherin(full_list_of_players, already_used_players)\n players = []\n while(players.size < 5) do\n player = full_list_of_players[rand(full_list_of_players.size)]\n if !already_used_players.include?(player) && !players.include?(player)\n players << player\n end\n end\n players\nend",
"title": ""
},
{
"docid": "88e222f6f9d55287b5762e2a2231c2ab",
"score": "0.49073696",
"text": "def choose_one_spoofer_target_per_site(bad_targets_ips)\n raise \"not ips! #{bad_targets_ips.find { |ip| !ip.matches_ip? }}\" if bad_targets_ips.find { |ip| !ip.matches_ip? }\n\n # prefer spoofers that are already chosen\n # for all sites that don't have a spoofer target or a monitor, add one that hasn't been\n # blacklisted\n site2chosen_node_ip_tuple = {}\n\n all_sites = FailureIsolation.Site2Hosts.keys\n\n # all controllable\n all_controllable = @db.controllable_isolation_vantage_points.values\n site2controllable_nodes = Hash.new { |h,k| h[k] = [] }\n all_controllable.each do |host|\n site2controllable_nodes[FailureIsolation.Host2Site[host]] << host\n end\n\n # currently probed\n site2current_spoofer = {}\n FailureIsolation.SpooferTargets.each do |spoofer_ip|\n spoofer = @db.ip2hostname[spoofer_ip]\n site2current_spoofer[FailureIsolation.Host2Site[spoofer]] = spoofer\n end\n\n # already have a monitoring node\n site2monitoring_node = {}\n FailureIsolation.CurrentNodes.each do |spoofer|\n site2monitoring_node[FailureIsolation.Host2Site[spoofer]] = spoofer\n end\n\n all_sites.each do |site|\n if site2monitoring_node.include? site\n next\n end\n\n if site2current_spoofer.include? site and !FailureIsolation.TargetBlacklist.include? site2current_spoofer[site] and \n !bad_targets_ips.include? @db.hostname2ip[site2current_spoofer[site]]\n node = site2current_spoofer[site]\n ip = @db.hostname2ip[node]\n site2chosen_node_ip_tuple[site] = [node, ip]\n next\n end\n\n site2controllable_nodes[site].delete_if { |hop| FailureIsolation.TargetBlacklist.include? host or \\\n bad_targets_ips.include? @db.hostname2ip[host] }\n if !site2controllable_nodes[site].empty?\n node = site2controllable_nodes[site].shift\n ip = @db.hostname2ip[node]\n site2chosen_node_ip_tuple[site] = [node, ip]\n end\n end\n\n site2chosen_node_ip_tuple\n end",
"title": ""
},
{
"docid": "784761c950bd7dc8673e6e4dda8590f2",
"score": "0.490502",
"text": "def top(max, list)\n selected = []\n selected_ids = []\n @leaderboard.each { |player| selected << player if list.include?(player.id) }\n sorted = selected.sort { |player_a, player_b| player_b.avg_score <=> player_a.avg_score }\n sorted[0..max].each { |player| selected_ids << player.id }\n selected_ids\n end",
"title": ""
},
{
"docid": "e68be9349b362b8c4a6821e02ffe9af0",
"score": "0.48878092",
"text": "def candidates(mine, lifetime)\n rows = @pgsql.exec('SELECT * FROM address WHERE login != $1 ORDER BY assigned', [mine]).select do |r|\n age = Time.now - Time.parse(r['assigned'])\n r['arrived'] ? age > lifetime * 10 : age > lifetime\n end\n rows.map { |r| r['login'] }\n end",
"title": ""
},
{
"docid": "cb5f297e0958ba0f49ba628528affaca",
"score": "0.48791355",
"text": "def narrow_down_candidates(candidate_array)\n # pp candidate_array\n results = Regextest::Back::Result.new\n candidate_array.each do | elem |\n command = elem.command\n case command\n when :CMD_SELECT\n results.push_body elem\n when :CMD_LOOK_AHEAD, :CMD_NOT_LOOK_AHEAD\n if(sub_results = narrow_down_candidates(elem.param[:result]))\n results.add_look_ahead(command, sub_results)\n else\n return nil\n end\n when :CMD_LOOK_BEHIND, :CMD_NOT_LOOK_BEHIND\n if(sub_results = narrow_down_candidates(elem.param[:result]))\n results.add_look_behind(command, sub_results)\n else\n return nil\n end\n when :CMD_ANC_LINE_BEGIN, :CMD_ANC_LINE_END, :CMD_ANC_WORD_BOUND, :CMD_ANC_WORD_UNBOUND,\n :CMD_ANC_STRING_BEGIN, :CMD_ANC_STRING_END, :CMD_ANC_STRING_END2, :CMD_ANC_MATCH_START,\n :CMD_ANC_LOOK_BEHIND2\n results.add_anchor(command)\n when :CMD_ANC_RELUCTANT_BEGIN, :CMD_ANC_RELUCTANT_END,\n :CMD_ANC_POSSESSIVE_BEGIN, :CMD_ANC_POSSESSIVE_END\n results.add_reluctant_repeat(elem)\n else\n raise \"inner error, invalid command at checking anchors: #{command}\"\n end\n end\n if !results.merge\n return nil\n end\n results\n end",
"title": ""
},
{
"docid": "f2ca4877e36484cd1c1085be9090b866",
"score": "0.4873373",
"text": "def candidates(x, y)\n f = Hash.new\n Values.each do |v|\n f[v] = @neighbors[[x,y]].map{|n|\n cs = n.placeable(v, self)\n if cs.include?([x,y])\n cs.size\n else\n 0\n end\n }.min\n end\n return f\n end",
"title": ""
},
{
"docid": "8005b67057ddee3a315ab06a376e6f33",
"score": "0.48657537",
"text": "def evaluate_candidates\n candidates = find_candidates\n change_parents_if_necessary(candidates)\n instantiate_waiting_cells(candidates)\n end",
"title": ""
},
{
"docid": "8dc056f6833244effed9250435b75f25",
"score": "0.48439014",
"text": "def secondaries(candidates)\n matching_nodes = candidates.select(&:secondary?)\n matching_nodes = match_tag_sets(matching_nodes) unless tag_sets.empty?\n matching_nodes\n end",
"title": ""
},
{
"docid": "0760f8c46bb6230914be7dd2206b5e19",
"score": "0.48424807",
"text": "def candidates(x,y,puzzle)\n\tif puzzle[x][y] > 0 then Array.new\n\telse (neighbors(x,y,puzzle).to_set ^ (0..9).to_set).to_a end\nend",
"title": ""
},
{
"docid": "ac12ad988d8863429c00391de4da6f80",
"score": "0.4841027",
"text": "def select_players_for_gryffindor(full_list_of_players, already_used_players)\n players = []\n while(players.size < 5) do\n player = full_list_of_players[rand(full_list_of_players.size)]\n if !players.include?(player)\n players << player\n end\n end\n players\nend",
"title": ""
},
{
"docid": "d4dcc52ae25ef50e1d3438b5b5beebe0",
"score": "0.4836105",
"text": "def choose_nearest(door, plan, passengers)\n occupied, unoccupied = occupied_and_not(plan, passengers)\n \n unoccupied.min_by { |s| manhattan_distance(door, s) }\nend",
"title": ""
},
{
"docid": "13f7fdc07d2d565e76b3bcf8e7169eb9",
"score": "0.48285297",
"text": "def get_candidate_list\n [@@candidates]\n end",
"title": ""
},
{
"docid": "7950f6570d9c3adcb40276e8494f3211",
"score": "0.48278093",
"text": "def get_partner_from(players)\n candidates = players.reject{|player| player == self}\n return nil if candidates.empty?\n distances = UniqLattice.instance.distances_between(self, candidates)\n selected_index = Selector.pick_small_one(distances)\n candidates[selected_index]\n end",
"title": ""
},
{
"docid": "84afbecf115224b3df7ed16a22cf6c74",
"score": "0.48261902",
"text": "def possible_candidates_for(file)\n @locality\n .candidates_of(file)\n .subtract(file.similar_files.map(&:file))\n end",
"title": ""
},
{
"docid": "33143ff7582c0b2f3cbff74686765369",
"score": "0.48256773",
"text": "def find_all_candidates\n @single_candidates_found = 0\n loop_xy do |x,y|\n find_candidates_for(x,y)\n end\n end",
"title": ""
},
{
"docid": "89c8df001ce7d1bdace88f2347418ceb",
"score": "0.48243657",
"text": "def find_subs_for_spoofers(dataset2unresponsive_targets, dataset2substitute_targets)\n # should only be probing one per site\n unresponsive_spoofers = dataset2unresponsive_targets[DataSets::SpooferTargets] \n site2chosen_node_ip_tuple = choose_one_spoofer_target_per_site(unresponsive_spoofers)\n update_pl_pl_meta_data(site2chosen_node_ip_tuple)\n\n dataset2substitute_targets[DataSets::SpooferTargets] = site2chosen_node_ip_tuple.values.map { |tuple| tuple[1] }\n end",
"title": ""
},
{
"docid": "13c72c26c985f6c104e118e34aa0afb4",
"score": "0.48196033",
"text": "def select_replicas_from_update_domains(update_domain_details_map, replica_count)\n update_domain_index = 0\n selected_ip_list = []\n for replica_index in 1..replica_count\n update_domain_numbers = update_domain_details_map.keys\n ip_list = update_domain_details_map[update_domain_numbers[update_domain_index]]\n ip_list.flatten!\n\n #sort by used ips, in ascending order of less used to more\n ip_list = ip_list.sort_by {|x, y| selected_ip_list.count(x) }\n\n # Always select the 0th ip as it has least no. of cores hosted.\n # If this ip was already selected in prev. iteration then it should have removed from the list\n ip = ip_list.fetch(0)\n selected_ip_list.push ip\n\n update_domain_index = update_domain_index + 1\n\n #If its last update domain, then start over from first update domain\n if replica_index % update_domain_details_map.size == 0\n update_domain_index = 0\n end\n end\n return selected_ip_list\n end",
"title": ""
},
{
"docid": "b76c2db42384d7f7d39fb19635bff943",
"score": "0.48190984",
"text": "def evaluate!(candidates, opts = {})\n\n # If there are more candidate solutions than there are remaining\n # evaluations, then shuffle the list of candidates and evaluate\n # as many as possible.\n\tevals_remaining = opts[:evaluation_limit] - opts[:num_evaluations]\n\tif evals_remaining > candidates.length\n\t\tcandidates = candidates.shuffle[0...evals_remaining]\n\tend\n\n # Extract the samples and variable set for the benchmark.\n samples = opts[:samples][opts[:benchmark]]\n variables = samples[0].length == 3 ? ['x', 'y'] : ['x']\n\n # Split the list of candidates across each of the available threads.\n # If there is an error during the evaluation of a candidate then\n # set the fitness of that candidate to infinity (the worst possible).\n candidates.peach(opts[:evaluation_threads]) do |c|\n begin\n lm = compile(c.chromosome,\n opts[:grammar],\n variables: variables,\n measure: opts[:measure])\n c.fitness = samples.reduce(0) do |sum, sample|\n sum += (lm[*sample[0...-1]] - sample[-1])**2\n end\n rescue StandardError => e\n c.fitness = Float::INFINITY\n end\n end\n\n # Return the number of evaluated candidates.\n return candidates.length\n\nend",
"title": ""
},
{
"docid": "14fcc1b53fd3615cdb1f933c96d39040",
"score": "0.48122305",
"text": "def winner(remaining_option_ids = options.pluck(:id))\n counts = vote_counts(remaining_option_ids)\n total = counts.values.flatten.count\n top, top_count = counts.max_by { |k, v| v }\n # if the option is a majority, it wins.\n # otherwise, recurse, dropping the last place option\n (top_count.to_f / total) > 0.5 ?\n Option.find(top) :\n winner(counts.sort_by { |k, v| v }.map(&:first).first(counts.length - 1))\n end",
"title": ""
},
{
"docid": "5d2b5da75cb1b3a71d68594b53554250",
"score": "0.48072523",
"text": "def best_match(target, candidates)\n confidence = 0\n best_url = nil\n jarow = FuzzyStringMatch::JaroWinkler.create( :native )\n candidates.each do |candidate|\n title = candidate.text\n distance = jarow.getDistance(target, title)\n if distance > confidence\n confidence = distance\n best_url = candidate['href']\n end\n end\n return best_url\n end",
"title": ""
},
{
"docid": "601f335661502b157b152180c5708f30",
"score": "0.48045403",
"text": "def choose_by_primary_criteria(first_node, second_node, next_pick)\n if next_pick.is_a? Node\n enlargement_of_first = first_node.enlargement_needed_to_consume_bounding_box(next_pick.bounding_box, @space)\n enlargement_of_second = second_node.enlargement_needed_to_consume_bounding_box(next_pick.bounding_box, @space)\n else\n enlargement_of_first = first_node.enlargement_needed(next_pick)\n enlargement_of_second = second_node.enlargement_needed(next_pick)\n end\n\n if enlargement_of_first < enlargement_of_second\n first_node\n elsif enlargement_of_first > enlargement_of_second\n second_node\n else\n choose_by_secondary_criteria(first_node, second_node)\n end\n end",
"title": ""
},
{
"docid": "25ea637d882296161be3f94769b7b67d",
"score": "0.47944462",
"text": "def select_players_for_slytherin(full_list_of_players, already_used_players)\n slytherin = the_players.keep_if {the_players != gryffindor}\n puts \"#{name} will play for slytherin!\"\nend",
"title": ""
},
{
"docid": "5c90164c196960585af19b0de244b04e",
"score": "0.47773835",
"text": "def check_nearest(nearest, node, target)\r\n d = distance2(node, target) \r\n if nearest.size < 4 || d < nearest.last[0]\r\n nearest.pop if nearest.size >= 4\r\n nearest << [d, node.id]\r\n nearest.sort! { |a, b| a[0] <=> b[0] }\r\n end\r\n nearest\r\nend",
"title": ""
},
{
"docid": "846f7e9834357b359d1f9584a19702c3",
"score": "0.4769523",
"text": "def selected_virtual_machines\n case\n when config[:all] && config[:exclude]\n VirtualMachine.select { |vm| !given_virtual_machines.include?(vm) }\n when config[:all]\n VirtualMachine.all\n else\n given_virtual_machines\n end\n end",
"title": ""
},
{
"docid": "19da114a3fe7588cc776ad81a4e59c78",
"score": "0.47684488",
"text": "def home_candidates_to_endorse\n #takes all candidates\n candidates_array = candidates_users.map {|user| user}\n #sorts candidates by their candidate score\n candidates_array_sort = candidates_array.sort_by {|user| user.cand_score}\n #selects only the candidates of relevant districts\n filtered_district_candidate_array = candidates_array_sort.select {|user| user_specific_districts.include?(user.district_id)}\n #this filters out all candidates that you are endorsing already\n filtered_district_and_watched_candidate_array = filtered_district_candidate_array.reverse.select {|user|\n unless already_endorsed_candidates.include?(user.id)\n user\n end }\n #returns the twitteruser data for the users\n twitterusers = filtered_district_and_watched_candidate_array.map {|user| user.twitteruser}\n # cut_off_candidate_array = twitterusers[0..10]\n end",
"title": ""
},
{
"docid": "822953fa39a6d409371b05a95ee0b101",
"score": "0.47568133",
"text": "def discovered_servers\n servers.select {|s| s[:discovered] }\n end",
"title": ""
},
{
"docid": "6340a8d3e4341fd15e1ff903018c998d",
"score": "0.47517374",
"text": "def get_fewest_options_candidate(board)\n fewest_x = nil\n fewest_y = nil\n fewest_count = 9\n\n board.each do |x, y, value|\n if value.is_a?(Set) and value.size < fewest_count\n fewest_x = x\n fewest_y = y\n fewest_count = value.size\n end\n end\n\n return fewest_x, fewest_y\n end",
"title": ""
},
{
"docid": "0e714627a08927704f039102b54e6db2",
"score": "0.47509205",
"text": "def update_candidates\n @tiles.select {|_, tile| not tile[:fixed]}.each do |position, tile|\n @tiles.each do |other_position, other_tile|\n areas.each do |area|\n if tile[area].eql? other_tile[area] and not other_position.eql? position\n tile[:candidates][other_tile[:content]] = false if other_tile[:content]\n end\n end\n end\n end\n end",
"title": ""
}
] |
e1e35728ac85140d6f8ff2ce2dd1ac71
|
Determines the moves a queen can make at any given time
|
[
{
"docid": "c3e5406dc401d909b1e3c2f889da1c5d",
"score": "0.67742735",
"text": "def moves_queen(color, a, b)\n\t\t_moves = []\n\t\t(continue_left(color, a, b)).each{|move| _moves << move}\n\t\t(continue_right(color, a, b)).each{|move| _moves << move}\n\t\t(continue_up(color, a, b)).each{|move| _moves << move}\n\t\t(continue_down(color, a, b)).each{|move| _moves << move}\n\t\t(continue_up_left(color, a, b)).each{|move| _moves << move}\n\t\t(continue_up_right(color, a, b)).each{|move| _moves << move}\n\t\t(continue_down_left(color, a, b)).each{|move| _moves << move}\n\t\t(continue_down_right(color, a, b)).each{|move| _moves << move}\n\t\t_moves.compact\n\tend",
"title": ""
}
] |
[
{
"docid": "c4922f920965f2e263f73c069f60f8f5",
"score": "0.6882753",
"text": "def possible_moves(spaces)\n possible_moves = []\n if ((@position + 1) % 8 == 0)\n @moves = [8,7,-1,-9,-8]\n elsif (@position % 8 == 0)\n @moves = [-8,-7,1,9,8]\n end\n @moves.each do |move|\n possible_moves << (@position + move)\n end\n possible_moves.select! { |move| (0..63).include?(move) }\n possible_moves.select! do |move| \n spaces[move].class == Fixnum or spaces[move].side_id != @side_id ? true : false\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "76aa01db9f14bc9aeb31f308e30743f3",
"score": "0.6729492",
"text": "def run(n)\n return \"Really? Run me with a real number greater than 3!\" if n<4\n @board = GameBoard.build(n,n) {|i| i = 0}\n @board.row(0).each_index {|c| @board.new_queen([0,c])}\n @last_move=nil\n z = 0\n witty_remarks = [\"Working...\",\"Busy...\",\"Reticulating splines...\",\"Counting vector articulation...\",\"Pleasing the masses...\",\"Getting a coffee...\",\"Finding a safe place...\",\"Moving...\",\"There's #{n} queens in the room, it's gonna be a while...\",\"Being greedy...\"]\n while true\n max_collisions = @board.queens.max_by {|x| x.collisions}.collisions\n problem_queens = @board.queens.select {|x| x.collisions == max_collisions}.shuffle\n if problem_queens.size > 1\n queen = problem_queens.select {|x| x.position[1]!=@last_move}.last\n else\n queen = problem_queens.first\n end\n if queen.move_count > (n*100)/10\n # print \"~\"\n @board.queens.each do |e|\n r = Random.rand(n)\n until r!=e.position[0]\n r = Random.rand(n)\n end\n e.move_to(r,e.position[1])\n e.reset_move_count\n end\n next\n end\n # print \"*\"\n puts witty_remarks.shuffle.first if z%200==0 && z>0\n if queen.collisions == 0\n print \"\\n\"\n puts \"WIN!\"\n puts @board.valid_move_mask.pretty\n break\n end\n move = @board.best_available_position(queen.position)\n @last_move=move[1]\n @board[*queen.position].move_to(*move)\n z+=1\n end\n\n @board\nend",
"title": ""
},
{
"docid": "6dd1ae2dd1b985dcd95f3a0b358e48ab",
"score": "0.6685235",
"text": "def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end",
"title": ""
},
{
"docid": "04779e850c730fb3c76047cff7ea2993",
"score": "0.6648285",
"text": "def valid_move?(row, col, queens)\n # Go through each of the current valid moves\n queens.each do |q_pos|\n # Grab the coords\n q_row, q_col = q_pos\n\n # If the coords to be checked land on either the same col or row as an existing\n # valid move, the coords are invalid\n return false if q_row == row || q_col == col\n # Check to see if the slope between the coords and any valid moves is equal to 1.\n # Having a slope of 1 on board means the two points are on the same diagonal line.\n return false if ((row - q_row) / (col - q_col).to_f).abs == 1\n end\n\n true\nend",
"title": ""
},
{
"docid": "69a39a8cc1e1aee96ac5a4bea9496479",
"score": "0.66017175",
"text": "def n_queens(num = 8)\n # The queens var will hold arrays containing row and col of valid positions\n queens = []\n\n solvable?(num, 0, queens)\n\n queens\nend",
"title": ""
},
{
"docid": "d3a897b9609cd4742c3024160ccb1886",
"score": "0.6548232",
"text": "def get_moves(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?.\n if board[[3, valid_col]] == ?.\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[3, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n end\n end\n end\n # If not in its column (can never stand in hallway anf column at same time)\n elsif (piece.col == valid_col && piece.row == 2 && board[[piece.row + 1, piece.col]] != piece.name) || (piece.col != valid_col && piece.row == 2)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n elsif piece.row == 3 && piece.col != valid_col && board[[2, piece.col]] == ?.\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 2\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n moves\nend",
"title": ""
},
{
"docid": "ad0c15068206c8312985aa58bb4dc651",
"score": "0.6525768",
"text": "def place_queens(column=0, row=0, queen_count=8)\n square = board.select_column(column)[row]\n board.place_queen(square)\n\n next_column = board.select_column(column + 1)\n if\n if board.next_empty_square\n place_queens\n else\n board.remove_queen(square)\n square.status = :tried\n return\n end\n end\nend",
"title": ""
},
{
"docid": "9baf9cd5a0d14178262eb868d41e2cc2",
"score": "0.6520713",
"text": "def possible_moves\r\n return [] if won?\r\n (0..8).select {|i| board.cells[i] == \" \"}\r\n end",
"title": ""
},
{
"docid": "4a8c66cbd43600b954767bf3c9fd6fba",
"score": "0.6518288",
"text": "def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend",
"title": ""
},
{
"docid": "eca6998af7129a9547a3c59382f33290",
"score": "0.6502563",
"text": "def position_queen(q_placed)\t\n\twhile(q_placed.row <= $nQ && !q_placed.is_good)\n\t\tif(attack_check(q_placed))\n\t\t\tq_placed.row += 1\n\t\telse\n\t\t\tq_placed.is_good = true\n\t\t\t#puts \"this one is good:\"\n\t\t\t#q_placed.show\n\t\t\tnextcol = q_placed.column + 1\n\t\t\tnextindex = q_placed.id\n\t\t\tif(nextcol > $nQ)\n\t\t\t\treturn q_placed.is_good\n\t\t\tend\n\t\t\tn_queen = Queen.new(q_placed.id + 1)\n\t\t\tn_queen.row = 1\n\t\t\tn_queen.column = nextcol\n\t\t\t$q_array << n_queen\n\t\t\tis_good = position_queen(n_queen) \n\t\t\tif(!is_good)\n\t\t\t\t$q_array.pop\n\t\t\t\tq_placed.row += 1\n\t\t\t\tq_placed.is_good = false\n\t\t\tend\n\t\tend\n\tend\n\treturn q_placed.is_good\nend",
"title": ""
},
{
"docid": "45ce42dab19904e131c1d4b7990e1b06",
"score": "0.64757663",
"text": "def knight_moves\n\t\tnode = Square.new(@start)\n\t\t@queue << node\n\t\twhile @queue.empty? == false\n\t\t\tcurrent = @queue[0]\n\t\t\tif current.value == @final\n\t\t\t\tdisplay_result(current)\t\t\t\n\t\t\telse\n\n\t\t\t\t8.times do |num|\n\t\t\t\t\tx = current.value[0] + @row[num]\n\t\t\t\t\ty = current.value[1] + @col[num]\n\t\t\t\t\tif (x.between?(1,8) && y.between?(1,8)) && @revised.include?([x, y]) == false\n\t\t\t\t\t\tnode = Square.new([x, y])\n\t\t\t\t\t\tnode.parent = current\n\t\t\t\t\t\tnode.count = current.count + 1\n\t\t\t\t\t\t@queue << node\n\t\t\t\t\telse\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t@revised << current.value\n\t\t\t\t@queue.shift\n\t\t\tend\n\t\tend\n\t\tputs \"NOT FOUND !!!\"\n\t\tputs \"This program presumes a 8x8 Chess Board\"\n\t\tputs \"Therefore your coordinates must be between (1, 1) and (8, 8).\"\n\tend",
"title": ""
},
{
"docid": "9f0fc50b3526defea6092ee819ac8749",
"score": "0.6446917",
"text": "def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end",
"title": ""
},
{
"docid": "388e560d33f4cc5fc2ea605413f1eca8",
"score": "0.64118856",
"text": "def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end",
"title": ""
},
{
"docid": "e36466c767bd08f5890e2a7de334ef2f",
"score": "0.6381223",
"text": "def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end",
"title": ""
},
{
"docid": "c24e5ea3b22a96247facd1d3744a4825",
"score": "0.63724864",
"text": "def valid_moves\n\n end",
"title": ""
},
{
"docid": "7884ae6ceb30382e0fef19a884fc4be4",
"score": "0.6356841",
"text": "def valid_moves(temp_board)\n moves.select do |end_pos|\n temp_board.valid_pos?(end_pos) && temp_board.empty?(end_pos)\n end\n end",
"title": ""
},
{
"docid": "7e757723446bd26665d1681cef51b6d4",
"score": "0.63543403",
"text": "def possible_moves_in_board(position)\n POSSIBLE_MOVES.select do |move|\n x = position[0] + move[0]\n y = position[1] + move[1]\n\n within_board?(x, y)\n end\n end",
"title": ""
},
{
"docid": "ecefbb7084a5c5026206974b00766959",
"score": "0.63534844",
"text": "def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end",
"title": ""
},
{
"docid": "5a643944a000d28cc785217c28f2212e",
"score": "0.63485444",
"text": "def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"title": ""
},
{
"docid": "7092b3b58fa15e56842a8c72f5e7d0b9",
"score": "0.6341538",
"text": "def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"title": ""
},
{
"docid": "2cb3568c116a6759ff3ebcbce4d40cdd",
"score": "0.6319057",
"text": "def attack_check(q_check)\n\t#first attack check, make sure queen isn't on the same row\n\tfor q in $q_array\n\t\tif(q.id != q_check.id && q.row == q_check.row)\n\t\t\treturn true\n\t\tend\n\tend\n\t\n\t#second attack check, make sure that no negative upward diagonals exist\n\tc = 1\n\twhile(q_check.column - c > 0)\n\t\tfor q_ud in $q_array\n\t\t\trowcheck = q_check.row - c\n\t\t\tcolcheck = q_check.column - c\n\t\t\tif(q_ud.id != q_check.id && q_ud.column == colcheck && q_ud.row == rowcheck)\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\tc += 1\n\tend\n\t\n\t#third attack check, make sure that no negative downward diagonals exist\n\td = 1\n\twhile(q_check.column - d > 0)\n\t\tfor q_ud in $q_array\n\t\t\trowcheck = q_check.row + d\n\t\t\tcolcheck = q_check.column - d\n\t\t\tif(q_ud.id != q_check.id && q_ud.column == colcheck && q_ud.row == rowcheck)\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\td += 1\n\tend\n\t\n\t\n\treturn false\nend",
"title": ""
},
{
"docid": "eb7d9e1166739c0f38e417d4a12b0963",
"score": "0.6314008",
"text": "def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end",
"title": ""
},
{
"docid": "893ad2f35d2770da5556fae86b52b606",
"score": "0.6308473",
"text": "def potential_diagonal_moves is_king=false\n moves = []\n\n # Possible moves\n # - all possible combination of increment/decrement of r_idx/c_idx\n\n r_min = is_king ? (r_idx - 1 >= 0 ? r_idx - 1 : r_idx) : 0\n c_min = is_king ? (c_idx - 1 >= 0 ? c_idx - 1 : c_idx) : 0\n r_max = is_king ? (r_idx + 1 <= 7 ? r_idx + 1 : r_idx) : Board::WIDTH - 1\n c_max = is_king ? (c_idx + 1 <= 7 ? c_idx + 1 : c_idx) : Board::WIDTH - 1\n\n # top-right: row-decrement, column-increment [4, 5] [3, 6]\n r = r_idx - 1\n c = c_idx + 1\n while (r >= r_min) && (c <= c_max)\n moves << [r, c]\n r -= 1\n c += 1\n end\n\n # bottom-right: row-increment, column-increment [4, 5] [5, 6]\n r = r_idx + 1\n c = c_idx + 1\n while (r <= r_max) && (c <= c_max)\n moves << [r, c]\n r += 1\n c += 1\n end\n\n # bottom-left: row-increment, column-decrement [4, 5] [5, 4]\n r = r_idx + 1\n c = c_idx - 1\n while (r <= r_max) && (c >= c_min)\n moves << [r, c]\n r += 1\n c -= 1\n end\n\n # top-left: row-decrement, column-decrement [4, 5] [3, 4]\n r = r_idx - 1\n c = c_idx - 1\n while (r >= r_min) && (c >= c_min)\n moves << [r, c]\n r -= 1\n c -= 1\n end\n\n # TODO\n # - refactor to avoid repeated pattern of code without compromising with runtime\n\n moves\n end",
"title": ""
},
{
"docid": "45ed728abbd58af7470d25b74b9c4938",
"score": "0.63069874",
"text": "def moves!\n total_possible_moves = []\n total_possible_moves.concat(diag_moves(diag_initializer))\n total_possible_moves.concat(straight_moves(move_initializer))\n total_possible_moves.select { |move| self.valid_move?(move) }\n end",
"title": ""
},
{
"docid": "3d6be71cfffb45229b2c70852d4fbf45",
"score": "0.6298176",
"text": "def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"title": ""
},
{
"docid": "f08fc1d7e2a7cd44dbe1eade1c84e517",
"score": "0.6282447",
"text": "def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end",
"title": ""
},
{
"docid": "804aef6606017fc2251a2725d9959d8b",
"score": "0.6274914",
"text": "def possible_queen_moves(start_arr)\n\t\tchildren = []\n\t\tchildren << possible_rook_moves(start_arr)\n\t\tchildren << possible_bishop_moves(start_arr)\n\t\tchildren = children.flatten(1)\n\tend",
"title": ""
},
{
"docid": "ca4aa945112c037da0396932a01bd573",
"score": "0.6268051",
"text": "def possible_moves \n row = @current_row\n column = @current_column\n values = Hash.new \n if (row + 1) <= @matrix.length \n values[@matrix[row + 1][column]] = [(row + 1),column]\n end \n if (row - 1) >= 0\n values[@matrix[row - 1][column]] = [(row - 1),column]\n end \n if (column + 1) <= @matrix[0].length \n values[@matrix[row][column + 1]] = [row,(column + 1)]\n end\n if (column - 1) >= 0 \n values[@matrix[row][column - 1]] = [row,(column - 1)]\n end \n highest_value_square(values)\nend",
"title": ""
},
{
"docid": "c22bd21b91fb22b8c73c0d8fed74d52d",
"score": "0.62672716",
"text": "def castling_moves(pos, board)\n return [] if @owner.check || pos[1] != 4 || !@owner.can_castle\n\n home_rank = (0..7).map { |index| board.locate_piece([pos[0], index]) }\n [castle_queenside(home_rank[0..3], pos, board), castle_kingside(home_rank[5..7], pos, board)].compact\n end",
"title": ""
},
{
"docid": "171ada6774a90cfac415a0311c6ae83e",
"score": "0.62659585",
"text": "def solution(a, b)\n return 0 if a == 0 && b == 0 # why do anything?\n\n nummoves = 0 # track moves\n board = Board.new(a, b) # handle visited squares\n\n queue = [ {x: 0, y: 0} ] \n while queue.size > 0 && nummoves < MAX_MOVES do \n nummoves = nummoves + 1 \n\n # \"drain queue\" to check and mark as checked\n queue.each do |square|\n board.push square\n square[:moves] = []\n\n MOVES.each do |move|\n nextmove = { x: move[:x] + square[:x], y: move[:y] + square[:y] }\n return nummoves if nextmove[:x] == a && nextmove[:y] == b\n if board.in_bounds?(nextmove[:x], nextmove[:y]) && !board.visited?(nextmove[:x], nextmove[:y]) \n square[:moves].push nextmove \n end\n end\n end \n \n # enqueue children since we haven't hit our mark\n newq = []\n queue.each do |square|\n newq.concat square[:moves]\n end\n queue = newq.uniq\n end\n \n -1\nend",
"title": ""
},
{
"docid": "a8d8d4b39a047ddbf498ea5c1e4e5dd2",
"score": "0.62625694",
"text": "def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless empty_square?(next_move)\n if on_board?(next_move)\n available_moves << next_move\n end\n end\n\n available_moves + capture_moves\n end",
"title": ""
},
{
"docid": "6737d3e0512045c68fec3f511853c88a",
"score": "0.6257125",
"text": "def possible_moves(pos)\n\tchanges = [[-2,-1],[-2,1],[-1,-2],[-1,2],[2,-1],[2,1],[1,-2],[1,2]]\n\tmoves = []\n\tchanges.each { |change| moves << [pos[0]+change[0], pos[1]+change[1]] }\n\tmoves.select { |move| is_valid_position?(move) }\nend",
"title": ""
},
{
"docid": "7cf2e5cdf6598298ed4de713ccdb1f54",
"score": "0.62547797",
"text": "def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end",
"title": ""
},
{
"docid": "0d49dec16d715d8451dfbd21261c8a91",
"score": "0.6237447",
"text": "def valid_moves(from)\r\n\tpossible_moves(from).select { |move| valid_position?(move) }\r\nend",
"title": ""
},
{
"docid": "1b70da5f914475aef0c6549fe411a958",
"score": "0.6236",
"text": "def valid_moves(from)\n piece = @board.at(from)\n if piece.king? || piece.knight?\n piece.moves.map do |move|\n to = relative_coords(from, move)\n to if possible_move?(to)\n end.compact\n elsif piece.pawn?\n pawn_valid_moves(from)\n else\n valid_moves_recursive(from)\n end\n end",
"title": ""
},
{
"docid": "afe17693de77012de24b89144138f510",
"score": "0.62311375",
"text": "def valid_moves(pos)\n valid_moves = []\n long = [-2,2]\n short = [1,-1]\n valid_moves += valid_moves_helper(pos, long, short)\n valid_moves += valid_moves_helper(pos, short, long)\n end",
"title": ""
},
{
"docid": "def860442346aff15250f66268100a75",
"score": "0.62254846",
"text": "def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"title": ""
},
{
"docid": "f809b0b89e4b66b3ad2e4bee8cf60987",
"score": "0.6223152",
"text": "def get_possible_moves_for(position)\n possible = []\n x = position.square[0]\n y = position.square[1]\n moves = [\n Placement.new([x-1,y-2], position), \n Placement.new([x-1,y+2], position), \n Placement.new([x-2,y-1], position), \n Placement.new([x-2,y+1], position), \n Placement.new([x+1,y+2], position), \n Placement.new([x+1,y-2], position), \n Placement.new([x+2,y-1], position), \n Placement.new([x+2,y+1], position)\n ]\n moves.each do |move|\n possible << move unless Chess.not_on_board?(move)\n end\n possible\n end",
"title": ""
},
{
"docid": "51f9efa4572e37c73f849aa94a543ba8",
"score": "0.621003",
"text": "def possible_moves\n # p possible_non_attack_moves\n # p possible_attack_moves\n moves = possible_non_attack_moves + possible_attack_moves\n moves.reject! { |move| move.any? { |c| c < 0 || c > 7} }\n moves\n end",
"title": ""
},
{
"docid": "c75f42813c3315b57f08f7b0a1540aaf",
"score": "0.61830807",
"text": "def available_moves(board)\n\t\tmoves = []\n\t\tboard.each_with_index{|cell, index| moves << index.to_s if cell == \" \"}\n\t\tmoves\n\tend",
"title": ""
},
{
"docid": "2773ae5095c46fd40f2cdab63502ebc7",
"score": "0.6178014",
"text": "def possible_moves(pos, board)\n moves = @moves.reduce([]) { |all_moves, move| all_moves.push(move.valid_moves(pos, board, @owner)) }\n moves.flatten(1)\n end",
"title": ""
},
{
"docid": "8f3443b546bf17fdf06e8681519e6b43",
"score": "0.6175103",
"text": "def possible_moves(location)\n # something that returns legal_destinations, minus blocked paths\n # print \"legal dest are: #{legal_destinations(location)}\\n\"\n possible_moves = legal_destinations(location).select do |legal_move|\n # print \"current legal move is #{legal_move}\\n\"\n legal_move_obj = @board[legal_move]\n no_piece_in_the_way?(location, legal_move) &&\n (legal_move_obj == nil || legal_move_obj.color != self.color) &&\n legal_move.all? { |coord| coord >= 0 && coord <= 8 }\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "934f6af2d6cfb3c5c95c0b67a89a9cef",
"score": "0.6173073",
"text": "def legal_moves\n # Fill this in\n end",
"title": ""
},
{
"docid": "d14155726376196460f335a4874b7e55",
"score": "0.61718595",
"text": "def knight_moves(starting_position,ending_position)\n return puts \"You didn't need to move at all!\" if starting_position == ending_position\n search_queue = []\n moves_array = [starting_position]\n knight = Knight.new(starting_position)\n possible_moves = knight.next_possible_moves\n if possible_moves.include?(ending_position)\n moves_array << ending_position\n number_of_moves = moves_array.size - 1\n else\n possible_moves.each do |position|\n search_queue << [position]\n end\n end\n until moves_array[-1] == ending_position\n next_moves = search_queue.shift\n knight.position = next_moves[-1]\n possible_moves = knight.next_possible_moves\n if possible_moves.include?(ending_position)\n next_moves.each { |move| moves_array << move }\n number_of_moves = moves_array.size\n moves_array << ending_position\n else\n possible_moves.each do |position|\n possibility = next_moves + [position]\n search_queue << possibility\n end\n end\n end\n if number_of_moves == 1\n puts \"You made it in #{number_of_moves} move! Here's your path:\"\n else\n puts \"You made it in #{number_of_moves} moves! Here's your path:\"\n end\n moves_array.each { |position| puts position.inspect }\nend",
"title": ""
},
{
"docid": "753dc7e4a298f28b150310a538611d4e",
"score": "0.6160881",
"text": "def valid_moves(from)\n\tpossible_moves(from).select { |move| valid_position?(move) }\nend",
"title": ""
},
{
"docid": "19b053e5f533dbff50d8a5c0ddd431ac",
"score": "0.61556053",
"text": "def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"title": ""
},
{
"docid": "b4d9d4fd397da5064eefdbe5341d5cbc",
"score": "0.6139632",
"text": "def find_available_moves(board)\n board.cells.each_with_index.collect {|v,i| i if v == \" \"}.compact\n end",
"title": ""
},
{
"docid": "f9ec46fb7245dcd54ded4c8bf5ab3043",
"score": "0.6137555",
"text": "def knight_moves(position, final)\n position == final ? result = [final] : result = 0\n position = [position]\n queue = []\n while result == 0\n pm = possible_movements(position.last)\n if pm.include?(final)\n result = position << final\n else\n pm.each do |move|\n queue << (position + [move])\n end\n position = queue.delete_at(0)\n end\n end\n pretty_result(result)\nend",
"title": ""
},
{
"docid": "1d6050d7d48574918dd74a7518897349",
"score": "0.61350757",
"text": "def available_moves\n adjacent_tiles(*@hole)\n end",
"title": ""
},
{
"docid": "4be277603e8f4989ef2d73733a2f1907",
"score": "0.61349505",
"text": "def possible_moves\n\t\t@board.map.with_index { |piece, idx| piece == \"-\" ? idx : nil }.compact\n\tend",
"title": ""
},
{
"docid": "5055a1af7d80fc440cedcdb1105a454b",
"score": "0.61345255",
"text": "def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"title": ""
},
{
"docid": "07e97b3bc52c346c556ad4c5a52226de",
"score": "0.61315584",
"text": "def get_valid_moves\n possible_moves.select do |dir, moves| \n moves.select! { |mov| check_bounds(mov[0], mov[1]) }\n !moves.empty? && move_directions.include?(dir)\n end\n end",
"title": ""
},
{
"docid": "3673ff1dc2af88f41125385f03f492ad",
"score": "0.6130992",
"text": "def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end",
"title": ""
},
{
"docid": "43281bc43786be95b6e2600a7273447b",
"score": "0.61272025",
"text": "def moves\n moves = []\n\n x, y = self.position\n sign = self.color == :white ? 1 : -1\n init_row = self.color == :white ? 1 : 6\n\n one_up = [x + (1 * sign), y]\n two_up = [x + (2 * sign), y]\n\n moves << one_up if self.board[one_up].nil?\n\n if (self.board[one_up].nil? && self.board[two_up].nil? && self.position.first == init_row)\n moves << two_up\n end\n\n diag_left = [x + (1 * sign), y + 1]\n diag_right = [x + (1 * sign), y - 1]\n\n if self.board[diag_left] && self.board[diag_left].color != self.color\n moves << diag_left\n end\n\n if self.board[diag_right] && self.board[diag_right].color != self.color\n moves << diag_right\n end\n\n moves.select { |move| on_board?(move) }\n end",
"title": ""
},
{
"docid": "f84d0a2c136ee0401fa11dd0797d6246",
"score": "0.6112994",
"text": "def valid_moves\n @pad.cells.select { |c| self.can_move?(*c.pos) }\n end",
"title": ""
},
{
"docid": "5ad66742e07a8996edf31bbd62abcabb",
"score": "0.6099886",
"text": "def possible_moves\n return []\n end",
"title": ""
},
{
"docid": "841398547259458a9cee68e2a2e4d809",
"score": "0.6097598",
"text": "def get_possible_states\n if queens_size == @size\n return Array.new\n end\n\n possible_states = Array.new\n bit_state = @state\n bit_counter = 0\n\n # Go through each row and locate a state where a queen can be placed\n (@size * @size).times { |cell|\n if !@state[cell]\n bit_state.set(bit_counter)\n new_state = Bitset.from_s(@state.to_s)\n\n if is_valid_state(new_state)\n possible_states << new_state\n end\n\n bit_state.clear(bit_counter)\n end\n bit_counter += 1\n }\n\n if @random\n possible_states.sort_by! { rand }\n end\n\n return possible_states\n end",
"title": ""
},
{
"docid": "f9e370a92c5eeeb45a724fc53c516d15",
"score": "0.6094318",
"text": "def valid_moves(pos)\n valids = []\n MOVE_DIFFERENTIALS.each do |move_diff|\n valids << [(pos[0] + move_diff[0]), (pos[1] + move_diff[1])]\n end\n valids.select { |move| on_board?(move) }\n end",
"title": ""
},
{
"docid": "f66121ceabc7c6d10ba99af7204cc45e",
"score": "0.6088226",
"text": "def available_moves\n @available_moves = []\n first_row = [35, 36, 37, 38, 39, 40, 41]\n first_row.each do |position|\n until UI.game.board.cells[position].empty? || position < 0\n position -= 7\n end\n @available_moves << position unless position < 0\n end\n return @available_moves\n end",
"title": ""
},
{
"docid": "1de6ca8e49f012c1a3e72c3734739c3f",
"score": "0.6082014",
"text": "def search_next_and_move(index, queen_list)\r\n\r\n last_queen = queen_list[index]\r\n next_index = -1\r\n while true\r\n next_index = rand(queen_list.size)\r\n if queen_list[next_index] != last_queen &&\r\n queen_list[next_index].tile.hits > 0\r\n break\r\n end\r\n end\r\n\r\n # if conflict found,\r\n # move queen randomly to lowest\r\n # conflict tile which is\r\n # not the current tile in this column.\r\n if next_index != -1\r\n\r\n # find set of min-conflict row in current column\r\n # (excluding current queen's tile)\r\n curr_queen = queen_list[next_index]\r\n curr_tile = curr_queen.tile\r\n curr_col = curr_queen.mapx\r\n tmp_min_hits = 9999999\r\n tmp_min_tiles = []\r\n for i in 0..@map[curr_col].size-1\r\n if @map[curr_col][i] != curr_tile\r\n curr_hits = @map[curr_col][i].hits\r\n if tmp_min_hits > curr_hits\r\n tmp_min_hits = curr_hits\r\n tmp_min_tiles = [] # clear it!\r\n tmp_min_tiles.push(@map[curr_col][i])\r\n elsif tmp_min_hits == curr_hits\r\n tmp_min_tiles.push(@map[curr_col][i])\r\n end\r\n end\r\n end\r\n\r\n # place queen at random tile from set of\r\n # min-conflicted tiles in current column\r\n # re-calculate hits (Optimized)\r\n rnd_index = rand(tmp_min_tiles.size)\r\n choice = tmp_min_tiles[rnd_index]\r\n curr_queen.revert_conflicts()\r\n self.place( curr_queen, choice )\r\n curr_queen.update_conflicts()\r\n\r\n # return index of this queen\r\n # (in the queen's list)\r\n return curr_col\r\n\r\n else\r\n # else, return first queen in list\r\n return 0\r\n\r\n end\r\n end",
"title": ""
},
{
"docid": "d432cd6fbbd1aedf3eecb8d1afb71494",
"score": "0.60816354",
"text": "def knight_moves(position_start,position_end)\n \n\n move = [-2,-1,1,2,].product([-2,-1,1,2]).select do |x,y| x.abs != y.abs end\n \n board = (0..7).map do \n [Array.new(8,nil)]\n end\n \n queue= []\n queue.push(position_start)\n notFind = true\n \n \n while !queue.empty? && notFind \n position = queue.shift\n move.\n collect do |x,y| \n [position[0] + x , position[1] + y]\n end.\n find_all do |x,y| \n (0..7) === x && (0..7) === y \n end.\n each do |x,y|\n if board[x][y].nil? \n board[x][y] = position \n notFind = !(x == position_end[0] && y == position_end[1])\n queue.push([x,y])\n end \n end \n end\n \n path = []\n position = position_end\n path << position_end\n while position != position_start \n position = board[position[0]][position[1]]\n path.unshift(position)\n end\n \n path\n end",
"title": ""
},
{
"docid": "e5d038ad70b86129158b4e8e6ef47a2b",
"score": "0.60801977",
"text": "def determine_moves(loc)\n\n piece = @spaces[loc]\n\n moveset = []\n attackset = []\n new_moves = []\n\n x = loc[0]\n y = loc[1]\n\n enemy_king_checked = false\n\n\n case piece.type\n\n when \"pawn\"\n\n if piece.color == \"white\"\n\n new_moves << [x, y+1]\n new_moves << [x,y+2] if y == 1\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if y == 1\n\n end\n\n atk_moves = [[x+1, y+1], [x-1, y+1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"black\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"black\" and @spaces[move].type == \"king\"\n end\n end\n \n\n elsif piece.color == \"black\"\n\n new_moves = [[x, y-1]]\n new_moves << [x,y-2] if y == 6\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if loc[1] == 6\n\n end\n\n atk_moves = [[x+1, y-1], [x-1, y-1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"white\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"white\" and @spaces[move].type == \"king\"\n end\n end\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n \n\n when \"rook\"\n\n runner(loc, :north)\n runner(loc, :east)\n runner(loc, :south)\n runner(loc, :west)\n\n when \"knight\"\n\n possible_directions =\n [ [x+1, y+2],\n [x+1, y-2],\n [x-1, y+2],\n [x-1, y-2],\n [x+2, y+1],\n [x+2, y-1],\n [x-2, y+1],\n [x-2, y-1] ]\n\n moveset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and @spaces[d].nil?\n end\n\n attackset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and (@spaces[d].nil?.! and @spaces[d].color != @spaces[loc].color)\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n\n\n when \"bishop\"\n\n runner(loc, :northeast)\n runner(loc, :southeast)\n runner(loc, :northwest)\n runner(loc, :southwest)\n\n\n when \"queen\"\n\n runner(loc, :north)\n runner(loc, :northeast)\n runner(loc, :east)\n runner(loc, :southeast)\n runner(loc, :south)\n runner(loc, :southwest)\n runner(loc, :west)\n runner(loc, :northwest)\n\n\n when \"king\"\n\n runner(loc, :north, 1)\n runner(loc, :northeast, 1)\n runner(loc, :east, 1)\n runner(loc, :southeast, 1)\n runner(loc, :south, 1)\n runner(loc, :southwest, 1)\n runner(loc, :west, 1)\n runner(loc, :northwest, 1)\n\n end\n\n\n end",
"title": ""
},
{
"docid": "b6a8c7a1dd61a310ca56a6a83c81292d",
"score": "0.60710096",
"text": "def move_knight\n #there is no more than eight moves\nend",
"title": ""
},
{
"docid": "5a224751744b0043837bb33ff529ccf9",
"score": "0.6065137",
"text": "def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end",
"title": ""
},
{
"docid": "f2fe2ad60125cb2ee3cab126f156688d",
"score": "0.60633373",
"text": "def get_possible_states\n if queens_size == @size\n return Array.new\n end\n\n possible_states = Array.new\n bit_state = @state\n bit_counter = 0\n\n # Go through each row and locate a state where a queen can be placed\n (@size * @size).times { |cell|\n if !@state[cell]\n bit_state.set(bit_counter)\n new_state = Bitset.from_s(@state.to_s)\n possible_states << new_state\n bit_state.clear(bit_counter)\n end\n bit_counter += 1\n }\n\n if @random\n possible_states.sort_by! { rand }\n end\n\n return possible_states\n end",
"title": ""
},
{
"docid": "00d45c95598e5241d561951705bea280",
"score": "0.605926",
"text": "def legal_moves\n out = Set.new\n board = self.unrolled\n mark = next_turn_taker(board)\n \n board.each_with_index do |space, i|\n if space == @@MARKS[:empty]\n new_state = GameState.new(self.board_bits)\n new_state.mark_index i, mark\n out << new_state\n end\n end\n \n return out\n end",
"title": ""
},
{
"docid": "ca182ace81df68c0501e168df20bed46",
"score": "0.6056847",
"text": "def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end",
"title": ""
},
{
"docid": "354d2bd76b242fee3e3ddd99ffb4a097",
"score": "0.60466385",
"text": "def find_possible_moves(board)\n possible_moves = []\n move_mechanics.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possible_moves << [rank, file] unless board.data[rank][file]\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "d62398e3c267aa043e175337c4e014bf",
"score": "0.6039939",
"text": "def checkmoves(king, attacking_pieces, board )\n if self == king\n enemy_pieces = self.game.pieces.where('player_id != ?', king.player_id).where(captured_piece: false)\n king_moves = king.piece_can_move_to(board)\n enemy_pieces.each do |enemy_piece|\n if enemy_piece.type == \"Pawn\" #testing for if pawn is attacking square king could move to. wierd case since pawn cant move to this square unless an enemy piece is there to capture (take diagonal)\n pawn_test_spots = []\n if enemy_piece.game.black_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position - 1,enemy_piece.x_position - 1],[enemy_piece.y_position - 1,enemy_piece.x_position + 1]]\n\n elsif enemy_piece.game.white_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position + 1,enemy_piece.x_position - 1],[enemy_piece.y_position + 1,enemy_piece.x_position + 1]]\n end\n king_moves -= pawn_test_spots\n next\n end\n king_moves -= enemy_piece.piece_can_move_to(board)\n end\n return king_moves\n end\n\n return [] if attacking_pieces.length > 1 # can't defend from two attacking pieces unless king is moved\n\n current_piece = self\n current_piece_moves_avail = current_piece.piece_can_move_to(board)\n enemy_piece = attacking_pieces[0] # since only one piece is attacking, we should rename this\n current_piece_moves_avail = current_piece_moves_avail & (enemy_piece.piece_can_move_to(board) + [[enemy_piece.y_position,enemy_piece.x_position]])# finding the squares these pieces can both move to\n\n prevent_check_moves = []\n\n current_piece_moves_avail.each do |square|\n y = square[0]\n x = square[1]\n play_board = Marshal.load(Marshal.dump(board))\n play_board[self.y_position][self.x_position] = 0\n play_board[y][x] = self.player_id\n # enemy piece should have x,y such that board[y][x] should equal to enemy player.id\n if play_board[enemy_piece.y_position][enemy_piece.x_position] == self.player_id\n prevent_check_moves << square\n next\n end\n prevent_check_moves << square if !enemy_piece.piece_can_move_to(play_board).include?([king.y_position,king.x_position])\n end\n return prevent_check_moves\n\n end",
"title": ""
},
{
"docid": "9fd8375209b7aaf6c3d61965499a28a7",
"score": "0.6034101",
"text": "def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"title": ""
},
{
"docid": "fab278f996b19dfc43bd3dc69dcef2e7",
"score": "0.6027668",
"text": "def add_queen_to_board(position)\n\t\t# Determine if the square is free\n\t\tif board[position] != 0\n\t\t\treturn false\n\t\tend\n\n\t\t# If this square is free, put a queen on it\n\t\tboard[position] = 1\n\n\t\t# Sets the moves available by the queen to be attacked\n\t\tQueen.moves(position).each do |attack_position|\n\t\t\tboard[attack_position] = 2 if board[attack_position] == 0\n\t\tend\n\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "840d92d2536b08b1f5668f7a381eb5a1",
"score": "0.60250175",
"text": "def castle_queenside?(x,y)\n x == 2 && y == y_position && castle_rook_queenside && \\\n castle_rook_queenside.never_moved? && \\\n castle_rook_queenside.path_blocked?(4, y_position) == false\n end",
"title": ""
},
{
"docid": "5f0ab7e1a93c53701c0b33fd0f2d46ac",
"score": "0.60237837",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend",
"title": ""
},
{
"docid": "14e95f6c4b5994412e7170d40358295e",
"score": "0.60168177",
"text": "def solve_n_queens(n)\n @queens_in_board = []\n row = 0\n column = 0\n until @queens_in_board.size == n\n if queen_in_row(row) || queen_in_diagonal(row, column, n)\n row += 1\n while row >= n\n row = @queens_in_board[-1][0] + 1\n column = @queens_in_board[-1][1]\n puts \"Backtracking, deleted: #{@queens_in_board.pop}\"\n end\n else\n place_queen(row, column)\n p \"placing at #{row} #{column}\"\n row = 0\n column += 1\n end\n end\n @queens_in_board\n end",
"title": ""
},
{
"docid": "3fdeee6a6189116aedc9d6481df0f4c3",
"score": "0.6012606",
"text": "def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"title": ""
},
{
"docid": "928ab05ac513029f4392d24f6595f694",
"score": "0.60123146",
"text": "def solve_n_queens(n, row = 0, curr_board = [], result = [])\n result << curr_board if row == n\n \n (0...n).each do |col|\n if(row == 0 || legal_placement?(row, col, curr_board))\n board = curr_board + [[row, col]]\n solve_n_queens(n, row + 1, board, result)\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "44dd148aa1b575d91ac7d130cfa27ffa",
"score": "0.6005899",
"text": "def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "77422cbf94975d405972b9005ed88236",
"score": "0.59962505",
"text": "def get_possible_states\n if queens_size == @size\n return Array.new\n end\n\n possible_states = Array.new\n bit_state = @state\n row_number = queens_size\n\n # Find possible locations in the empty row where a queen can be placed\n @size.times { |cell|\n if !@state[(@size * row_number) + cell]\n bit_state.set((@size * row_number) + cell)\n new_state = Bitset.from_s(@state.to_s)\n\n if is_valid_state(new_state)\n possible_states << new_state\n end\n\n bit_state.clear((@size * row_number) + cell)\n end\n }\n\n if @random\n possible_states.sort_by! { rand }\n end\n\n return possible_states\n end",
"title": ""
},
{
"docid": "f3d830fbdcd4edbf89df6671d8a7398e",
"score": "0.5993018",
"text": "def valid_moves(position)\n moves = []\n MOVES.each do |move|\n new_pos1 = move[0] + position[0]\n new_pos2 = move[1] + position[1]\n pos = [new_pos1, new_pos2]\n if pos.min >= 0 && pos.max < 9\n moves << pos\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "82efd63b22a139245b9f6de8a04220f7",
"score": "0.59867364",
"text": "def moves\n @board.compact.count\n # calling .compact reduces the number of objects to anything that has a true value (eliminates nil)\n # and .count will return the number of objects\n # e.x. if @board = [\"x\", \"x\", \"o\", \"o\", \"o\", \"x\", \"o\", nil, \"x\"] , moves would return 8\n end",
"title": ""
},
{
"docid": "6852ab29cad144d3cb30549c1deec4fe",
"score": "0.5977674",
"text": "def get_possible_states\n if queens_size == @size\n return Array.new\n end\n\n possible_states = Array.new\n bit_state = @state\n row_number = queens_size\n\n # Find possible locations in the empty row where a queen can be placed\n @size.times { |cell|\n if !@state[(@size * row_number) + cell]\n bit_state.set((@size * row_number) + cell)\n new_state = Bitset.from_s(@state.to_s)\n possible_states << new_state\n bit_state.clear((@size * row_number) + cell)\n end\n }\n\n if @random\n possible_states.sort_by! { rand }\n end\n\n return possible_states\n end",
"title": ""
},
{
"docid": "adba88218629b12d31ba43647630a539",
"score": "0.59744453",
"text": "def available_moves(from_cell, chessboard)\n map_chess_move_array(from_cell, available_cells(from_cell, chessboard))\n end",
"title": ""
},
{
"docid": "fb59f191211b191d7820cad5bce9d1db",
"score": "0.5973083",
"text": "def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end",
"title": ""
},
{
"docid": "dfb65e655427a347b521f0acb482c837",
"score": "0.59729165",
"text": "def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end",
"title": ""
},
{
"docid": "84f9ee1343094228a74e8eb4177581ae",
"score": "0.59685516",
"text": "def next_move(player,board,move)\n completed = false;\n blocking = false;\n if(move == 1) #First Move (hard coded)\n puts \"2 0\";\n elsif(move == 2) #Second Move (hard coded)\n if(board[1][1] == 'X')\n puts \"2 2\";\n else\n puts \"1 1\";\n end \n elsif(move == 3) #Third move (hard coded)\n if(board[0][1] == 'O' || board[1][0] == 'O' || board[1][2] == 'O' || board[2][1] == 'O')\n puts \"1 1\";\n elsif(board[1][1] == 'O')\n puts \"0 2\";\n elsif(board[0][2] == 'O' || board[2][2] == 'O')\n puts \"0 0\";\n else\n puts \"2 2\";\n end\n else #Any move after the 3rd\n completed = can_complete(player,board)\n if(completed == false)\n blocking = must_block(player,board);\n if(blocking == false)\n prevent = can_complete(player,board)\n if(move == 4 && (board[0][0] == 'X' || board[0][2] == 'X' || board[2][0] == 'X' || board[2][2] == 'X') && (board[0][1] == 'X' || board[1][0] == 'X' || board[1][2] == 'X' || board[2][1] == 'X'))\n if(board[0][1] == 'X' || board[2][1] == 'X')\n puts \"1 0\";\n else\n puts \"0 1\";\n end\n elsif(move == 4 && ((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X') || (board[0][1] == 'X' && board[2][1] == 'X') || (board[1][0] == 'X' && board[1][2] == 'X')))\n if((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X'))\n puts \"0 1\";\n else\n puts \"0 0\";\n end\n elsif(move == 6 && (board[2][1] == 'X' || board[0][1] == 'X') && (board[1][0] == 'X' || board[1][2] == 'X') && board[2][2] == '_')\n puts \"2 2\";\n elsif(board[0][0] == \"_\")\n puts \"0 0\";\n elsif(board[0][2] == \"_\")\n puts \"0 2\";\n elsif(board[2][2] == \"_\")\n puts \"2 2\";\n elsif(board[2][0] == \"_\")\n puts \"2 0\";\n elsif(board[0][1] == \"_\")\n puts \"0 1\";\n elsif(board[2][1] == \"_\")\n puts \"2 1\";\n elsif(board[1][0] == \"_\")\n puts \"1 0\";\n elsif(board[1][2] == \"_\")\n puts \"1 2\";\n else\n puts \"1 1\";\n end\n end\n end\n end\nend",
"title": ""
},
{
"docid": "9ce1ed42fdb53b2985bea81184ecda0d",
"score": "0.5966277",
"text": "def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "26b59fbc27d2b6c001c0617ff16c43d6",
"score": "0.5959126",
"text": "def valid_moves(board, current_pos)\n array_of_moves = moves(current_pos)\n\n array_of_moves.delete_if {|pair| pair.min < 0 || pair.max > 7}\n array_of_moves.delete_if {|pair| pair == current_pos}\n\n # array_of_moves = array_of_moves.select {|pos| obstructed?(current_pos,pos,board)} if slider\n #\n # puts array_of_moves\n # sleep 2\n\n end",
"title": ""
},
{
"docid": "632aa35c4b595d2167438a14639965d6",
"score": "0.59497446",
"text": "def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend",
"title": ""
},
{
"docid": "63af5de4089fc148ef9c8c2cf8a78898",
"score": "0.5945018",
"text": "def find_possible_moves(board)\n possibilities = []\n move_set.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possibilities << [rank, file] unless board.data[rank][file]\n end\n possibilities\n end",
"title": ""
},
{
"docid": "1ee5d3e95032df2194517f42e43484e2",
"score": "0.59424657",
"text": "def valid_moves(pos)\n valid_moves =[]\n DELTAS.each do |delta_pair|\n valid_moves << [delta_pair[0] + pos[0], delta_pair[1] + pos[1]]\n end\n valid_moves.reject! { |coord| coord.any? { |x| x < 0 || x > 8} }\n end",
"title": ""
},
{
"docid": "872ac7d7c020756164fb8257f46c1725",
"score": "0.59406084",
"text": "def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend",
"title": ""
},
{
"docid": "f64df888437b2fe9c57dc5123d783ed3",
"score": "0.59390986",
"text": "def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend",
"title": ""
},
{
"docid": "d1b931e9fb4ae209ec8aa1e81e071d69",
"score": "0.5938905",
"text": "def moves_king(color, a, b, check)\n\t\t_moves = []\n\t\t(_moves << up(a, b) << down(a, b) << left(a, b) << right(a, b) << up_right(a, b) << up_left(a, b) << down_right(a, b) << down_left(a, b))\n\t\t_moves.map! do |spot|\n\t\t\tx, y = spot\n\t\t\tnext if (x < 0 || x > 7 || y < 0 || y > 7)\n\t\t\tspot if @board[x][y].piece == nil || @board[x][y].piece.color != color\n\t\tend\n\t\t_moves << ([a + 2, b] if castling_right(a, b, check) == true) << ([a - 2, b] if castling_left(a, b, check) == true)\n\t\t_moves.compact\n\tend",
"title": ""
},
{
"docid": "296ec3b34815892fc4e531689cf21739",
"score": "0.5937569",
"text": "def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end",
"title": ""
},
{
"docid": "3f447f1deea05f0ad0b217bae5dafd71",
"score": "0.5932208",
"text": "def possibleMoves(position)\n moves = []\n for x in 0..2\n for y in 0..2\n if position[x][y]==0\n moves << 3*x + y + 1 #board labeled 1 - 9\n end\n end\n end\n return moves\n end",
"title": ""
},
{
"docid": "31cc8044f4567a746d1c85af8d9a2e1b",
"score": "0.5930078",
"text": "def knight_moves(start, dest)\n return puts \"You are already there.\" if start == dest # If user input same starting and destination\n return puts \"Starting position is invalid\" if !valid_play(start[0], start[1]) # If user input invalid starting position\n return puts \"Destination is invalid\" if !valid_play(dest[0], dest[1]) # If user input invalid position on the board as destination\n\n visited = [start] # Start the visited array with start position as that has been checked for above (if start == dest)\n queue = []\n \n queue = build_path(Node.new(start), visited) # Returns the first iteration of the possible moves for the knight piece\n while !queue.empty? # Run until all positions have been checked\n current = queue.shift()\n if current.value == dest # If found\n print_path(current)\n break\n else\n visited << current.value # Mark position checked for\n queue += build_path(current, visited) # Add on new possible positions the knight can take\n end\n end\n end",
"title": ""
},
{
"docid": "253326b2b43b1842f0c847d629f72bf6",
"score": "0.5922365",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "fd137ad9fc6bc4e28a576068c44022ef",
"score": "0.5922354",
"text": "def valid_move?(board,index)\n if index.between?(0,8) && position_taken?(board,index)\n true\n end\nend",
"title": ""
},
{
"docid": "853fbc0882b54d36f8e208609b385f57",
"score": "0.59216976",
"text": "def knight_moves(from, to)\r\n if from == to\r\n return to\r\n end\r\n queue = []\r\n #hash for tracking paths taken, initialized with start location\r\n paths_list = {from.to_s.to_sym => [from]}\r\n #This tracks if we have made a particular move from the current node\r\n #values are stored as symbolized node + move type \r\n visited = {}\r\n answer = []\r\n done = false\r\n #start location\r\n queue.push from\r\n\r\n until queue.empty? || done do\r\n #get first item in queue\r\n node = queue.shift\r\n\r\n @@moves.each do |move_type, offset|\r\n destinaiton = [node[0] + offset[0], node[1] + offset[1]]\r\n \r\n if @board.in_bounds?(destinaiton) && !visited[(node.to_s + move_type.to_s).to_sym]\r\n visited[(node.to_s + move_type.to_s).to_sym] = true\r\n queue.push destinaiton\r\n \r\n #track backward the path taken\r\n paths_list[destinaiton.to_s.to_sym] = (paths_list[node.to_s.to_sym] + [destinaiton])\r\n if to == destinaiton\r\n answer = paths_list[destinaiton.to_s.to_sym]\r\n done = true\r\n break\r\n end\r\n end\r\n end\r\n end\r\n answer\r\n end",
"title": ""
},
{
"docid": "39a710f7d78bbd3052d86411b878aac9",
"score": "0.5921358",
"text": "def allowed_moves(from_cell, chessboard)\n map_chess_move_array(from_cell, allowed_cells(from_cell, chessboard))\n end",
"title": ""
}
] |
16db3ef075547c7f6068183a8257c168
|
DELETE /run_histories/1 DELETE /run_histories/1.json
|
[
{
"docid": "e008503ff64c306a3a94d6fdb25145c4",
"score": "0.75385565",
"text": "def destroy\n @run_history.destroy\n respond_to do |format|\n format.html { redirect_to run_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "162bc3ad5b1bc316dc328036f6446967",
"score": "0.69162446",
"text": "def destroy\n @pur_hist = PurHist.find(params[:id])\n @pur_hist.destroy\n\n respond_to do |format|\n format.html { redirect_to pur_hists_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1e4ac9838020557781112ce116240948",
"score": "0.6699208",
"text": "def destroy\n @run_stat.destroy\n respond_to do |format|\n format.html { redirect_to run_stats_url, notice: 'Run stat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a5eee55e6e20ee5a63f6c7cb40f8a576",
"score": "0.6692714",
"text": "def destroy\n @hourly_histogram.destroy\n respond_to do |format|\n format.html { redirect_to hourly_histograms_url, notice: 'Hourly histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0016082f0d198d1b9712cd9f3b4af9e9",
"score": "0.6672835",
"text": "def destroy\n @daily_histogram.destroy\n respond_to do |format|\n format.html { redirect_to daily_histograms_url, notice: 'Daily histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4089b498f5ffc35070d1337aec8a44b4",
"score": "0.6631982",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ffdf08b23f9268883755e68533382792",
"score": "0.6631599",
"text": "def destroy\n @deploy_history.destroy\n respond_to do |format|\n format.html { redirect_to deploy_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9aa6cd805c51a1a6a83ccd241e4fe937",
"score": "0.6582995",
"text": "def destroy\n @historial_oct = HistorialOct.find(params[:id])\n @historial_oct.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_octs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cb0c78338c9751b9b4d000675cadd753",
"score": "0.6564011",
"text": "def destroy\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d2552ac204463916f8faa99fffde66ef",
"score": "0.65567887",
"text": "def destroy\n\n @as_run.logs.delete_all\n @as_run.destroy\n filePath = get_file_path @as_run.attachment_url\n File.delete(filePath) if File.exist?(filePath)\n\n respond_to do |format|\n format.html { redirect_to as_runs_url, notice: 'As run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3663298e34c00c8a0364d11e8a3c236f",
"score": "0.65530366",
"text": "def destroy\n @histogram = Histogram.find(params[:id])\n @histogram.destroy\n\n respond_to do |format|\n format.html { redirect_to(histograms_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f3dfc3ef2b7dbd3fd3cfb751f19edf48",
"score": "0.6546402",
"text": "def destroy\n @run.destroy\n head 200\n end",
"title": ""
},
{
"docid": "3b6e3b9ababd13f898731fb06e1adf8e",
"score": "0.65279806",
"text": "def destroy\n @history.destroy\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c3da96396d70f366300a8c66c34dc111",
"score": "0.65226406",
"text": "def destroy\n @run = Run.find(params[:id])\n @run.destroy\n\n respond_to do |format|\n format.html { redirect_to runs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c3da96396d70f366300a8c66c34dc111",
"score": "0.65226406",
"text": "def destroy\n @run = Run.find(params[:id])\n @run.destroy\n\n respond_to do |format|\n format.html { redirect_to runs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c3da96396d70f366300a8c66c34dc111",
"score": "0.65226406",
"text": "def destroy\n @run = Run.find(params[:id])\n @run.destroy\n\n respond_to do |format|\n format.html { redirect_to runs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c19324eced6304fc595c1fb5756d3e7",
"score": "0.6521051",
"text": "def destroy\n @resource_history = Resource::History.find(params[:id])\n @resource_history.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_histories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "488046ec544579f63613b0323a41e8aa",
"score": "0.64886624",
"text": "def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "488046ec544579f63613b0323a41e8aa",
"score": "0.64886624",
"text": "def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "488046ec544579f63613b0323a41e8aa",
"score": "0.64886624",
"text": "def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "488046ec544579f63613b0323a41e8aa",
"score": "0.64886624",
"text": "def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "377cdb363a2ed1ea63b9dde16ed190c8",
"score": "0.64607286",
"text": "def destroy\n @batch_histogram.destroy\n respond_to do |format|\n format.html { redirect_to batch_histograms_url, notice: 'Batch histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7c929ea77174f2550d3fc1b6d5274b68",
"score": "0.64527404",
"text": "def destroy\n @historium.destroy\n respond_to do |format|\n format.html { redirect_to historia_url, notice: 'Historia eliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1e47c32b2ad18957e363627854fcf676",
"score": "0.64484495",
"text": "def destroy\n @harajs_history = HarajsHistory.find(params[:id])\n @harajs_history.destroy\n\n respond_to do |format|\n format.html { redirect_to harajs_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4662f3fb8578ff074fd8794946f4b8c",
"score": "0.64459205",
"text": "def destroy\n @historium.destroy\n respond_to do |format|\n format.html { redirect_to historia_url, notice: 'Historium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4662f3fb8578ff074fd8794946f4b8c",
"score": "0.64459205",
"text": "def destroy\n @historium.destroy\n respond_to do |format|\n format.html { redirect_to historia_url, notice: 'Historium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1f5d4dcadddc48158cd36370a964bb44",
"score": "0.6421467",
"text": "def destroy\n @thermostat_history.destroy\n respond_to do |format|\n format.html { redirect_to thermostat_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1f5d4dcadddc48158cd36370a964bb44",
"score": "0.6421467",
"text": "def destroy\n @thermostat_history.destroy\n respond_to do |format|\n format.html { redirect_to thermostat_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "937bba91d4e52bc8eed1004326ad082c",
"score": "0.64162904",
"text": "def destroy\n @rushing_stat = RushingStat.find(params[:id])\n @rushing_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to rushing_stats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0b24cbc6495df3923ea7679acbcd8deb",
"score": "0.64039946",
"text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"title": ""
},
{
"docid": "4c8a4de286d829f54c89663cf4f4c487",
"score": "0.6398077",
"text": "def destroy\n @running_entry.destroy\n respond_to do |format|\n format.html { redirect_to running_entries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bd96dd5b240ba477bd8729db52c251c0",
"score": "0.63942575",
"text": "def destroy\n @dividend_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_dividend_histories_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9e8827352cee93c6c5df55c711af0b0a",
"score": "0.637743",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a49db061722fbfea9d603f70a67dc0ab",
"score": "0.6372315",
"text": "def test_delete_not_exist_metric\n not_exist_id = '10000'\n output = `curl -X DELETE http://localhost:8080/metrics/metrics/#{not_exist_id}`\n assert_match \"<html>\", output, \"TEST 5: delete not existing metric - FAILED\"\n end",
"title": ""
},
{
"docid": "179ff0053e8f4f967cb3d92206094cf0",
"score": "0.6369266",
"text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"title": ""
},
{
"docid": "e8cccdc332045791cf1e8886f86d61b4",
"score": "0.63683957",
"text": "def delete(id)\n params = {:id => id}\n requires params\n DataSift.request(:DELETE, 'historics/delete', @config, params)\n end",
"title": ""
},
{
"docid": "a16ffa4a46950e906a26d7921fbd3c19",
"score": "0.6365246",
"text": "def destroy\n @historial_odc = HistorialOdc.find(params[:id])\n @historial_odc.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odcs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "92b138bc5cd612d8530ef61b6a318df6",
"score": "0.6360828",
"text": "def destroy\n @alarm_history = AlarmHistory.find(params[:id])\n @alarm_history.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a7b5c5e5176cee8fe3076332b43faec8",
"score": "0.63528174",
"text": "def destroy\n @capture_history.destroy\n respond_to do |format|\n format.html { redirect_to capture_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7b60b41375de3ddf5c374dd57de356ec",
"score": "0.63485354",
"text": "def destroy\n @test_run_log.destroy\n redirect_to test_run_logs_url\n end",
"title": ""
},
{
"docid": "0661ff25d0ad9c36635b228e8f772e3b",
"score": "0.63450456",
"text": "def destroy\n @telemetry = Telemetry.find(params[:id])\n #path = \"telemetries/IXV/#{@telemetry.database.version}/#{@telemetry.name}_#{@telemetry.version}\"\n delete = %x[rm -R #{@telemetry.path}]\n @telemetry.destroy\n respond_to do |format|\n format.html { redirect_to telemetries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "988a3e53b1c6f7354fdeaed5670d6303",
"score": "0.63370335",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "988a3e53b1c6f7354fdeaed5670d6303",
"score": "0.63368285",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "988a3e53b1c6f7354fdeaed5670d6303",
"score": "0.63368285",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "988a3e53b1c6f7354fdeaed5670d6303",
"score": "0.63368285",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "988a3e53b1c6f7354fdeaed5670d6303",
"score": "0.63368285",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "561b57f9fa7222e279229f89405ac038",
"score": "0.6326131",
"text": "def test_delete_not_exist_experiment\n not_exist_id = '10000'\n output = `curl -X DELETE http://localhost:8080/metrics/experiments/#{not_exist_id}`\n assert_match \"<html>\", output, \"TEST 3: delete not existing experiment - FAILED\"\n end",
"title": ""
},
{
"docid": "ba92c8502cd05c29a5d7b97e5b2ee8cb",
"score": "0.63158053",
"text": "def destroy\n @website_history.destroy\n respond_to do |format|\n format.html { redirect_to website_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dea0a4e32f0e84c56b44bb9bde627a28",
"score": "0.6305266",
"text": "def destroy\n @blo_run = BloRun.find(params[:id])\n @blo_run.destroy\n\n respond_to do |format|\n format.html { redirect_to blo_runs_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6176280030f8fa5cf031f6d65ee84ccb",
"score": "0.6294524",
"text": "def destroy\n @hr_person_history.destroy\n respond_to do |format|\n format.html { redirect_to hr_person_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f37195292f789f8fe9bd262807254791",
"score": "0.6278226",
"text": "def destroy\n @monthly_histogram.destroy\n respond_to do |format|\n format.html { redirect_to monthly_histograms_url, notice: 'Monthly histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b749066b0b9a34fa56ad6b06e9404d4d",
"score": "0.6271965",
"text": "def destroy\n @game_history = GameHistory.find(params[:id])\n @game_history.destroy\n\n respond_to do |format|\n format.html { redirect_to game_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0d6a49f1dd5eccad33015bfd714beae2",
"score": "0.6270786",
"text": "def destroy\n @step = RunStep.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"title": ""
},
{
"docid": "6b60ff49920ac3f81250e9820e813830",
"score": "0.62685126",
"text": "def destroy\n @upload_history.destroy\n respond_to do |format|\n format.html { redirect_to upload_histories_url, notice: 'Upload history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1a76b4099ee68993673e79e2e906a047",
"score": "0.6266118",
"text": "def destroy\n @file_ops_audit = FileOpsAudit.find(params[:id])\n @file_ops_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to file_ops_audits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d795a0752ce2895b13be86c607c7da0d",
"score": "0.6263402",
"text": "def destroy\n @runit = Runit.find(params[:id])\n @runit.destroy\n\n respond_to do |format|\n format.html { redirect_to runits_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "16e845f6a340f54bae2981bc5da167d1",
"score": "0.62598515",
"text": "def destroy\n @destroye_history.destroy\n respond_to do |format|\n format.html { redirect_to destroye_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d273cb8e5393b6c78a8131a470de1414",
"score": "0.6254069",
"text": "def destroy\n @happiness_entry = HappinessEntry.find(params[:id])\n @happiness_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to happiness_entries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8f67c1ef8c14ed36d3aac581dfcbcafb",
"score": "0.6253111",
"text": "def destroy\n @item_history = ItemHistory.find(params[:id])\n @item_history.destroy\n\n respond_to do |format|\n format.html { redirect_to item_histories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a32d9d27dd665dceab80084851b5ee10",
"score": "0.6247062",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html do\n redirect_to runs_url,\n notice: 'Run was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d85b1e3c44ef5325e44b13cf1382e347",
"score": "0.62461126",
"text": "def destroy\n @item_history = ItemHistory.find(params[:id])\n @item_history.destroy\n\n respond_to do |format|\n format.html { redirect_to item_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "64fc623a7f2b8c30c343aa50091880a6",
"score": "0.6245367",
"text": "def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to request.referrer || root_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7436edb7d5253e778f8ed1f287c64806",
"score": "0.6240627",
"text": "def destroy\n @animal_history.destroy\n respond_to do |format|\n format.html { redirect_to animal_histories_url, notice: t('messages.delete.animal_history') }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "29a4d36cbb432a72fa1de99435910853",
"score": "0.62370205",
"text": "def destroy\n @creature_history = CreatureHistory.find(params[:id])\n @creature_history.destroy\n\n respond_to do |format|\n format.html { redirect_to creature_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d7477917452326a7a8cc672be19d79a4",
"score": "0.62348926",
"text": "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to(historials_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b65082dfea64f6d5a77ccb7de6082f0e",
"score": "0.6231615",
"text": "def destroy\n @run_step = RunStep.find(params[:id])\n @run_step.destroy\n\n respond_to do |format|\n format.html { redirect_to run_steps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9d8b547770a838a9f323b24f61d1f904",
"score": "0.62280494",
"text": "def destroy\r\n @state_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to state_histories_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "74103d497fd206add7652610d845e569",
"score": "0.62106013",
"text": "def destroy\n @run = Run.find(params[:id])\n @run.destroy\n\n respond_to do |format|\n format.html { redirect_to(runs_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2f9891039a650e11b8d9153e7aaccbe5",
"score": "0.6209641",
"text": "def destroy\n @personal_history = PersonalHistory.find(params[:id])\n @personal_history.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_histories_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e32e58d691bb0d12fb6d483f3aaff6c8",
"score": "0.6203207",
"text": "def destroy\n @run = current_user.runs.find(params[:id])\n @run.destroy\n\n respond_to do |format|\n format.html { redirect_to runs_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2c6661d5567d0a55c8631d38b382e5d7",
"score": "0.62020284",
"text": "def destroy\n @history = History.find(params[:id])\n\n respond_to do |format|\n if @history\n @history.destroy\n format.html { redirect_to histories_url }\n format.json { render nothing: true, status: :ok }\n else\n format.html { redirect_to histories_url }\n format.json { render nothing: true, status: :not_found }\n end\n end\n end",
"title": ""
},
{
"docid": "590237900bcee31d9489c3d346a6d2d6",
"score": "0.6198382",
"text": "def delete_history(*hist)\n raise 'TODO: Not Implemented Yet'\n end",
"title": ""
},
{
"docid": "3073c86fc289fc53d88c495727e44a63",
"score": "0.6196129",
"text": "def destroy\n @baseline.destroy\n respond_to do |format|\n format.html { redirect_to baselines_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "531554202acf166d32279a36215079fd",
"score": "0.6194699",
"text": "def destroy\n @routes_history = RoutesHistory.find(params[:id])\n @routes_history.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "94726a1d84fbf7f7315b9f76d1c772ce",
"score": "0.61908793",
"text": "def destroy\n @hit = Hit.find(params[:id])\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1c10af7e2483a6020fbbcb56a57b52b5",
"score": "0.61898106",
"text": "def destroy\n @hd_ggk_history = Hd::GgkHistory.find(params[:id])\n @hd_ggk_history.destroy\n\n respond_to do |format|\n format.html { redirect_to hd_ggk_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6c22d6fd579a0b53781ae9f133181ccf",
"score": "0.6188703",
"text": "def destroy\n @loan_history = LoanHistory.find(params[:id])\n @loan_history.destroy\n\n respond_to do |format|\n format.html { redirect_to loan_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d700b856492f98b1a2e658791a424b1f",
"score": "0.6187532",
"text": "def destroy\n @coaching_history = CoachingHistory.find(params[:id])\n @coaching_history.destroy\n\n respond_to do |format|\n format.html { redirect_to coaching_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fafa1d8c481e931cea162a61649ac873",
"score": "0.61873496",
"text": "def destroy\n @clinic_history.destroy\n respond_to do |format|\n format.html { redirect_to clinic_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fafa1d8c481e931cea162a61649ac873",
"score": "0.61873496",
"text": "def destroy\n @clinic_history.destroy\n respond_to do |format|\n format.html { redirect_to clinic_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "49f20e444d104f47c26b0e20f0824d71",
"score": "0.618709",
"text": "def destroy\n @histoire = Histoire.find(params[:id])\n @histoire.destroy\n\n respond_to do |format|\n format.html { redirect_to(histoires_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "90490efb6a065ee723c7cfeba9d29481",
"score": "0.6180934",
"text": "def destroy\n @artifact_status = ArtifactStatus.find(params[:id])\n @artifact_status.destroy\n\n respond_to do |format|\n format.html { redirect_to artifact_statuses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f56ac81cc87d07de8460a896585983e9",
"score": "0.6180429",
"text": "def destroy\n @run.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "2042959522c6384913321a7cb1ea492e",
"score": "0.6180194",
"text": "def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to(histories_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2042959522c6384913321a7cb1ea492e",
"score": "0.6180194",
"text": "def destroy\n @history = History.find(params[:id])\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to(histories_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "53eb2b11c7018b800647edf85c10d8b6",
"score": "0.61776847",
"text": "def destroy\n @health_datum.destroy\n respond_to do |format|\n format.html { redirect_to health_data_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "feb05fa712cede2232b7a79bf0cdeb56",
"score": "0.6174667",
"text": "def delete\n render json: Entry.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "c5e5111019ca51c691601820034f24d3",
"score": "0.61622995",
"text": "def destroy\n @sketch_history.destroy\n respond_to do |format|\n format.html { redirect_to sketch_histories_url, notice: 'Sketch history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "48ddcfeee49f76a29b2fc103c6d7eb4e",
"score": "0.61594486",
"text": "def destroy\n @medical_history = MedicalHistory.find(params[:id])\n @medical_history.destroy\n\n respond_to do |format|\n format.html { redirect_to medical_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "888f7bb0861507ee75846fd534531aa0",
"score": "0.61585444",
"text": "def destroy\n @log_entry = LogEntry.find(params[:id])\n @log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to log_entries_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "10a072b796f554b26df49fd2681aa191",
"score": "0.6157558",
"text": "def destroy\n @batting_history.destroy\n respond_to do |format|\n format.html { redirect_to batting_histories_url, notice: 'Batting history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "988aa95bb5c0ff77f456c49170b50aa5",
"score": "0.6145425",
"text": "def destroy\n @link_history.destroy\n respond_to do |format|\n format.html { redirect_to link_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5131ec900be006c7ee21ce4680c2e819",
"score": "0.6137376",
"text": "def destroy\n @run_step_activity = RunStepActivity.find(params[:id])\n @run_step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to run_step_activities_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ebab52b04bdc44e8f28870b175d8feda",
"score": "0.6130164",
"text": "def destroy\n @case_history.destroy\n respond_to do |format|\n format.html { redirect_to case_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2148e2fd9383c12872890f51efee3615",
"score": "0.6129987",
"text": "def delete\n begin\n task_id = \"#{@file}\".gsub(/\\.\\/singularity\\//, \"\").gsub(/\\.json/, \"\")\n # delete the request\n RestClient.delete \"#{@uri}/api/requests/request/#{task_id}\"\n puts \"#{task_id} DELETED\"\n rescue\n puts \"#{task_id} #{$!.response}\"\n end\n end",
"title": ""
},
{
"docid": "bb31be0d568e78205214dd1084fc1388",
"score": "0.6126831",
"text": "def destroy\n @refresh_audit.destroy\n respond_to do |format|\n format.html { redirect_to refresh_audits_url, notice: 'Refresh audit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "545a430f8de36d8a85ac96c28e787f7d",
"score": "0.6123979",
"text": "def destroy\n @json_sample = JsonSample.find(params[:id])\n @json_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to json_samples_url }\n format.json { render json: {msg: \"complete\", status: \"OK\"} }\n end\n end",
"title": ""
},
{
"docid": "9c6f045d6a903cfc7209814372f5aee9",
"score": "0.61209345",
"text": "def destroy\n @history_resource = HistoryResource.find(params[:id])\n @history_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to history_resources_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "34d15e65ac7107fbce67620ba55ffd5f",
"score": "0.6120679",
"text": "def destroy\n historia = History.find(params[:id])\n @history.destroy\n Log.create(description: \"Se elimino el historial del motor <strong> Serial: </strong> #{historia.engine.serial} <strong> Codigo: </strong> #{historia.engine.code} en la </strong> Fecha: </strong> #{Time.new.strftime(\"%d-%m-%Y %H:%M:%S %p\")}\" , user_id: current_user.id)\n\n respond_to do |format|\n format.html { redirect_to histories_url, :notice => { :class => 'success', :body => 'La Historia ha sido eliminada.'} }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c47962fd26cb5cf54f2157e00855535a",
"score": "0.61193115",
"text": "def destroy\n @logunit.destroy\n respond_to do |format|\n format.html { redirect_to logunits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "65293572917996271a9df7d415445111",
"score": "0.6113694",
"text": "def destroy\n @cow_history.destroy\n respond_to do |format|\n format.html { redirect_to cow_histories_url, notice: 'Cow history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
d30cf75ce4888bcbeb6f568c109d9fd5
|
PUT /users/1 PUT /users/1.xml
|
[
{
"docid": "a9cefa8af3f8964e2b308cb918686b42",
"score": "0.0",
"text": "def update\n @user = User.find(params[:id])\n if not (@current_user.mine?(@user) || @current_user.admin? || @current_user.produce? )\n redirect_to @current_user\n else\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n @user.role = 1\n if !params[:role3].blank? then @user.role *= 3 end\n if !params[:role5].blank? then @user.role *= 5 end\n if !params[:role7].blank? then @user.role *= 7 end\n if !params[:role11].blank? then @user.role *= 11 end\n if !params[:role13].blank? then @user.role *= 13 end\n @user.save\n flash[:notice] = 'User was successfully updated.'\n\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\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "796bea4dfdd3ac16e7fb19e770af3338",
"score": "0.6381075",
"text": "def update_user_attributes(attributes)\n # puts \"update_user_attrbites: [#{attributes.inspect}]\"\n raise ArgumentError, \"username blank\", caller if attributes['username'].empty?\n path = \"/a/feeds/nyit.edu/user/2.0/#{attributes[\"username\"]}\"\n xml = <<EOF\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:apps=\"http://schemas.google.com/apps/2006\" xmlns:gd=\"http://schemas.google.com/g/2005\">\n <atom:id>https://apps-apis.google.com/a/feeds/nyit.edu/user/2.0/#{ attributes['username'] }</atom:id>\n <apps:login userName=\"#{ attributes['username'] }\" password=\"#{ attributes['password'] }\" suspended=\"false\" admin=\"false\" changePasswordAtNextLogin=\"false\" agreedToTerms=\"true\"/>\n </atom:entry>\nEOF\n #puts \"update_user XML: #{xml}\"\n xmldoc = Document.new(xml)\n resp = @rest_client.PUT(path, xmldoc.to_s)\n end",
"title": ""
},
{
"docid": "b5edb8a9b2cad14c7874c5f42c5809e9",
"score": "0.6378409",
"text": "def test_put_user\n json_data = '{\"name\":\"test\", \"last_name\":\"test\", \"document\" : \"098\"}'\n put '/users/4', json_data\n assert_equal 204, last_response.status, 'Código de respuesta incorrecto'\n end",
"title": ""
},
{
"docid": "d0a9ca650949efc2e171cbc48421587b",
"score": "0.6346737",
"text": "def update\n update_user(users_path)\n end",
"title": ""
},
{
"docid": "f0686f191a0def3b6c3ad6edfbcf2f03",
"score": "0.6332809",
"text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n )\n end",
"title": ""
},
{
"docid": "23b5f5e4dacfb330cb1e0ffd4590ef63",
"score": "0.6313082",
"text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end",
"title": ""
},
{
"docid": "699d9259b5511ca444c672d0fdd17ed2",
"score": "0.62727845",
"text": "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"title": ""
},
{
"docid": "0b4c2960540c3a0c5e7102619705473d",
"score": "0.6254856",
"text": "def update_user( name, data )\n response = put(\"#{@config['url']}/api/2.1/rest/users/#{name}\", data, {accept: :json, :cookies => cookies})\n return response.code\n end",
"title": ""
},
{
"docid": "bb443a428f2563539f43b17c71594928",
"score": "0.62393373",
"text": "def update_user(user_id, request)\n start.uri('/api/user')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end",
"title": ""
},
{
"docid": "c77c61632e7a5655fa8215c4d35a24f0",
"score": "0.6200327",
"text": "def update\n @user = User.find_by_name(params[:id])\n @user.update_attributes(params[:user])\n \n respond_with @user, :stautus => :ok\n end",
"title": ""
},
{
"docid": "f81b4218bd91be735d0858cc2e57580d",
"score": "0.61998814",
"text": "def update_user( api, user )\n\n \n connection_config = YAML::load_file( 'alma.yml' )\n\n update_url = 'https://' + connection_config['url_base'] + '/almaws/v1/users/' + user.primary_id\n api_uri = URI( update_url )\n\n \n request = Net::HTTP::Put.new( api_uri ) \n \n request.body = user.to_xml\n request.content_type = 'application/xml' \n \n \n response = api.call( api_uri, request )\n \n # this is too verbose for even debug, uncomment only when really needed...\n #@log.debug( user.to_xml )\n \n if response.code.to_i >= 400 and response.code.to_i < 600\n \n \n @log.info(\"Got an error response (#{response.code}) on api call for #{user.eppn} (#{user.primary_id})\")\n @log.debug(\"Error updating #{user.eppn} (#{user.primary_id})\" + response.body )\n end\nend",
"title": ""
},
{
"docid": "fc3229e22820a998dcee8399ec666969",
"score": "0.61733925",
"text": "def update\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => t(\"users.update.success\")) }\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",
"title": ""
},
{
"docid": "f190cc14e9e48cb5ce4866a7552775bb",
"score": "0.6171278",
"text": "def update_rest\n @dialogix_user = DialogixUser.find(params[:id])\n\n respond_to do |format|\n if @dialogix_user.update_attributes(params[:dialogix_user])\n flash[:notice] = 'DialogixUser was successfully updated.'\n format.html { redirect_to(@dialogix_user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dialogix_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ebfa5c43a28c0c6ae3c7116c2834ee3",
"score": "0.6171037",
"text": "def update_user(user_id, request)\n start.uri('/api/user')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end",
"title": ""
},
{
"docid": "54a3c2fb285f039c2e2807986f26dd56",
"score": "0.6159024",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'Users was successfully updated.'\n format.html { redirect_to(users_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",
"title": ""
},
{
"docid": "e586a9de0a72df1ef5804a5b6c9ea75e",
"score": "0.6138672",
"text": "def update\n @user = User.find_by_username(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user]) \n flash[:success] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else \n #flash[:error] = 'Failed to update user.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "88e4ba9cdfaff2966257aa6f7c4721a8",
"score": "0.61139387",
"text": "def update\n respond_to do |format|\n if user.update_attributes( params[:user] ? user_attributes : {} )\n format.html { redirect_to(user, flash: { success: 'User 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",
"title": ""
},
{
"docid": "95ac4d40654ddb40cd4e7c9e9dd64b48",
"score": "0.6108009",
"text": "def update_user(user)\n savon_request(:update_user, returns_error_string: true) do |soap|\n soap.message({})\n user.to_soap(soap[:message])\n end\n end",
"title": ""
},
{
"docid": "7798b842b6aa9eca903ab0aba447f049",
"score": "0.60927856",
"text": "def update\n @user = User.find( params[:id] )\n \n respond_to do |format|\n if ( @user.update_attributes( params[:user] ) )\n format.html { redirect_to( @user, { :notice => 'User was successfully updated.' } ) }\n format.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",
"title": ""
},
{
"docid": "ccf9ed09d600e760d6f263e0380c88ca",
"score": "0.60892963",
"text": "def update\n update_resource(@user)\n end",
"title": ""
},
{
"docid": "ccf9ed09d600e760d6f263e0380c88ca",
"score": "0.60892963",
"text": "def update\n update_resource(@user)\n end",
"title": ""
},
{
"docid": "c54a2b6c1d4b8ac5c8b393c83bf8043f",
"score": "0.6088882",
"text": "def update\n @user = User.get(params[:id])\n \n respond_to do |format|\n if @user.update(params[:user])\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n else\n format.json { render :text => \"Could not update user\", :status => :unprocessable_entity } \n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "36f10a27b491361b2dccfbaf89edd760",
"score": "0.6079926",
"text": "def update\n respond_to do |format|\n if user.update_attributes( user_attributes )\n format.html { redirect_to user, flash: { success: 'User 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",
"title": ""
},
{
"docid": "028dce1c2742c2ef7692ca78535d42d1",
"score": "0.6066396",
"text": "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'user was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "fad5fcc1906f8e60eaf79a50e9b1651e",
"score": "0.6051281",
"text": "def update\n @user1 = User1.find(params[:id])\n\n respond_to do |format|\n if @user1.update_attributes(params[:user1])\n format.html { redirect_to(@user1, :notice => 'User1 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "96c4a83f81787ffab052a78a0ed8cde0",
"score": "0.60490847",
"text": "def update\n\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "a35e3c14bea464d78e34b1f766743f33",
"score": "0.60375744",
"text": "def update\n convert_to_parent_id_from_real_name_if_necessary()\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(user_path(@user),\n :notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9cb7dd2f033f13e722feaa3a2f439bb",
"score": "0.6034428",
"text": "def update\n @user = @users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:title] = \"User Updated\"\n flash[:class] = \"information\"\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(line_user_url(@line, @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",
"title": ""
},
{
"docid": "e191d4b22e8435280dc0abf51939d272",
"score": "0.60320044",
"text": "def update\r\n\r\n @user = User.find(params[:id])\r\n respond_to do |format|\r\n if @user.update_attributes(params[:user])\r\n flash[:notice] = 'User was successfully updated.'\r\n format.html { redirect_to(@user) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "2d28518e441f1a5e894ee2ab08a00122",
"score": "0.60251194",
"text": "def changePassword\n @user = User.find(params[:user][:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.xml { render :xml => successRsp }\n else\n format.xml { render :xml => errorRsp( @user.errors.to_s ) }\n end\n end\n end",
"title": ""
},
{
"docid": "0cb46e242a339293232b4f53c37d1deb",
"score": "0.6020848",
"text": "def update_user(opts = {})\n put 'user', opts\n end",
"title": ""
},
{
"docid": "c01b1807e17d42d4c81e5b8a6e974932",
"score": "0.6012919",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(users_path) }\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",
"title": ""
},
{
"docid": "8cade912083e3e018feeeaaf930f4cf1",
"score": "0.6002689",
"text": "def update_user id, payload\n\t\t\t\t\t(@connection.put USERS, id, payload).code\n\t\t\t\tend",
"title": ""
},
{
"docid": "f2bda3fb76c64877bda9bb04cd337012",
"score": "0.60010946",
"text": "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.email} was successfully updated.\"\n format.html { redirect_to(:action=>'index') }\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",
"title": ""
},
{
"docid": "4aa9502621f97af0532047755f5d87e1",
"score": "0.5997308",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(root_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",
"title": ""
},
{
"docid": "b37b1e244d306df1250d435ddf0d5f7f",
"score": "0.59877366",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, \n :notice => I18n.t('.user')+\" #{@user.name} \"+I18n.t('.success1')) }\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",
"title": ""
},
{
"docid": "cb811e054aa094f04565336df38c5963",
"score": "0.5972634",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, notice: 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "cb811e054aa094f04565336df38c5963",
"score": "0.5972634",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, notice: 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "b19662ff5f3b2bc998886d1dc4550f00",
"score": "0.59716195",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\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",
"title": ""
},
{
"docid": "cecaa53079d6ce6f8c4a1d54e8d3f69c",
"score": "0.59713626",
"text": "def update_tomcat_usersxml strFile\n\n\tFile.open(strFile) do |tomcatusersfile|\n\t\tusersxml = REXML::Document.new(tomcatusersfile)\n\t\t#update the server port number \n\t\ttomcat_users_root = usersxml.elements['tomcat-users']\n\t\ttomcat_users_root.add_element(get_tomcat_admin_role())\n\t\ttomcat_users_root.add_element(get_tomcat_admin_user())\n\t\tfusersxml = File.open(\"#{dspace_tomcatusers_xml}\", \"w\")\n\t\tfusersxml.puts usersxml\n\t\tusersXmlPath = fusersxml.path\n\t\tfusersxml.close\n\t\tend\nend",
"title": ""
},
{
"docid": "fad9f9a5663ff3109aa1ca711458461e",
"score": "0.5971282",
"text": "def user_update(username,options)\n make_request(:update,user_url(username),options)\n end",
"title": ""
},
{
"docid": "c96340573a1c548450e05aa5765cb7c0",
"score": "0.5970414",
"text": "def update\r\n @user = User.find(params[:id])\r\n respond_to do |format|\r\n if @user.update_attributes(params[:user])\r\n flash[:notice] = 'User was successfully updated.'\r\n format.html { redirect_to user_url(@user) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @user.errors.to_xml }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "9c9b08f2927548cf1fa3e005714f7938",
"score": "0.5965765",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format_error_case(format,\"edit\",@user.errors)\n end\n end\n end",
"title": ""
},
{
"docid": "a57ccf1a5b27f3e307e4b283d3837c14",
"score": "0.5951411",
"text": "def add_user(name, email)\n post \"/api/users.xml\", {:user => {:name => name, :email => email}}\n end",
"title": ""
},
{
"docid": "4f172d6721da2302051d01f7629513ac",
"score": "0.5950722",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(:action => 'edit') }\n format.xml { head :ok }\n else\n flash[:error] = 'User was not successfully updated.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3d5e5731f191429dc918d0db12be56e",
"score": "0.595062",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(root_url, :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",
"title": ""
},
{
"docid": "154fb4015c0190e34de2019ccf5bacaf",
"score": "0.59497696",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "31498431bda8c62cfb094bf328bffb45",
"score": "0.59414136",
"text": "def update\n @user = User.find(params[:id])\n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to \"/retrospectives\", notice: 'Seu dados foram atualizados!' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "90f765c30f96a4eb75820cddba57accf",
"score": "0.59325916",
"text": "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "8143171390fad4bfd61a1bd093a50bc0",
"score": "0.5929223",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
},
{
"docid": "4e6fcb3372716740e3b7f86c61e6709e",
"score": "0.59287465",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.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",
"title": ""
}
] |
3722c1eaa84001816677cf69e514ca4f
|
Displays the report via the configured reporter.
|
[
{
"docid": "27c24b94422ea3729fbcddd6aa1a1dbd",
"score": "0.8511658",
"text": "def display\n @reporter.display_report(self)\n end",
"title": ""
}
] |
[
{
"docid": "bc33b7d5f03d0063327c3f5efcb07387",
"score": "0.68412495",
"text": "def report\n end",
"title": ""
},
{
"docid": "bc33b7d5f03d0063327c3f5efcb07387",
"score": "0.68412495",
"text": "def report\n end",
"title": ""
},
{
"docid": "56e1dbd233cb245ce5ba45e07bdd5044",
"score": "0.67708",
"text": "def report(options)\n report = Report.new(self, options)\n report.print\n end",
"title": ""
},
{
"docid": "fe82c323a1692442a2feff1ff0df7759",
"score": "0.67401147",
"text": "def reporter; end",
"title": ""
},
{
"docid": "8c11f60ff5d0c1c0e5f420d2c89217ee",
"score": "0.6727822",
"text": "def report\n end",
"title": ""
},
{
"docid": "ea2398ae1ba3b104ee2b00efdb502339",
"score": "0.6719042",
"text": "def print_report(report, options)\n reporter = options.fetch(:reporter,\n SlimLint::Reporter::DefaultReporter).new(log)\n reporter.display_report(report)\n end",
"title": ""
},
{
"docid": "8fb72975c94529413202086879790186",
"score": "0.6700902",
"text": "def report(output = nil)\n html = render(Vanity.template(\"_report.erb\"),\n experiments: Vanity.playground.experiments,\n experiments_persisted: Vanity.playground.experiments_persisted?,\n metrics: Vanity.playground.metrics)\n if output\n File.write(output, html)\n puts \"New report available in #{output}\"\n else\n $stdout.write html\n end\n end",
"title": ""
},
{
"docid": "773191bb6ee071a4d10091dd7e613618",
"score": "0.6636804",
"text": "def show\n\t\t@report = Report.new\n\t\t@report.title = \"Example PDF Title\"\n\t\t@report.body = \"###Some very important data\\n\\nLorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.\\n\\nDonec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.\\n\\nIn enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a,\"\n\n\t\trespond_to do |f|\n\t\t\tf.pdf do\n\t\t\t\trender pdf: \"Report\"\n\t\t\tend\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "59ba73f2a18c0157bcdb2a625edd675a",
"score": "0.66277194",
"text": "def report\n Driver.report.each { |line| puts line }\n end",
"title": ""
},
{
"docid": "d7db31a37cb311e352c24025da934682",
"score": "0.65385896",
"text": "def show\n puts \"\\n******** reports_show ********\"\n @report = Report.all\n end",
"title": ""
},
{
"docid": "0326b93fa06c44c3e9df1ab4acd8ba1f",
"score": "0.6532971",
"text": "def report(output = nil)\n html = render(Vanity.template(\"report\"))\n if output\n File.open output, 'w' do |file|\n file.write html\n end\n puts \"New report available in #{output}\"\n else\n $stdout.write html\n end\n end",
"title": ""
},
{
"docid": "5d26aea8ba75f8c8f93e5a24b6560570",
"score": "0.64850235",
"text": "def send_report\n begin\n report = generate_report()\n rescue => detail\n Puppet.err \"Could not generate report: %s\" % detail\n return\n end\n\n if Puppet[:summarize]\n puts report.summary\n end\n\n if Puppet[:report]\n begin\n report.save()\n rescue => detail\n Puppet.err \"Reporting failed: %s\" % detail\n end\n end\n end",
"title": ""
},
{
"docid": "69190a6b93ed460dcf6676bbf1dd5c4e",
"score": "0.6458134",
"text": "def print_results\n puts @reports \n end",
"title": ""
},
{
"docid": "25e0a24de50203868103c2d1febab45d",
"score": "0.64496225",
"text": "def report\n print_status \"Grabbing scan report...\"\n\n # this will return the AuditStore as a string in YAML format\n audit_store = @server.framework.auditstore\n\n # run the loaded reports and get the generated filename\n @framework.reports.run( audit_store )\n\n print_status \"Grabbing stats...\"\n\n stats = @server.framework.stats\n\n print_line\n print_info( \"Sent #{stats[:requests]} requests.\" )\n print_info( \"Received and analyzed #{stats[:responses]} responses.\" )\n print_info( 'In ' + stats[:time].to_s )\n\n avg = 'Average: ' + stats[:avg].to_s + ' requests/second.'\n print_info( avg )\n\n print_line\n end",
"title": ""
},
{
"docid": "451f6fc658ef8564a6fcb2bffb773471",
"score": "0.6432269",
"text": "def report(*args)\n options = args.first\n reporter = create_reporter(options)\n reporter.report\n reporter\n end",
"title": ""
},
{
"docid": "a7c8536fd3de2479e0d356a354efa3da",
"score": "0.6406743",
"text": "def report\n refresh!\n yield self\n refresh!(true)\n\n result\n rescue Exception => ex\n refresh!(true) # Clear any output.\n fail ex\n end",
"title": ""
},
{
"docid": "b16f509bfac20d9345a23c016d35b9b2",
"score": "0.64037365",
"text": "def report\n Report.report_errors\n Report.report_skips\n Report.report_incompletes\n Report.report_failures\n Report.report_stats\n end",
"title": ""
},
{
"docid": "eae69c38dabf6ad22757d37c721037ae",
"score": "0.6379578",
"text": "def report; end",
"title": ""
},
{
"docid": "eae69c38dabf6ad22757d37c721037ae",
"score": "0.6379578",
"text": "def report; end",
"title": ""
},
{
"docid": "eae69c38dabf6ad22757d37c721037ae",
"score": "0.6379578",
"text": "def report; end",
"title": ""
},
{
"docid": "bbe1392702adbe62fbe2d058e1297b93",
"score": "0.6356645",
"text": "def report\n super\n io.puts unless verbose? # finish the dots\n io.puts ['', aggregated_results, summary, ''].compact.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "083a25b607901baead242409a8b31abc",
"score": "0.6331522",
"text": "def show\n @report = Report.find(params[:id])\n begin\n respond_to do |format|\n format.html { render :show, :locals => { :report => @report } } # show.html.erb\n format.json { render json: @report }\n format.pdf do\n pdf = PdfReport.new(:left_margin => 40, :page_size => 'LETTER').to_pdf(@report)\n filename = @report.description\n send_data pdf, :type => \"application/pdf\", :disposition => \"inline\", :filename => \"report_of_#{filename}\"\n end\n end\n rescue\n logger.fatal $!\n end\n end",
"title": ""
},
{
"docid": "39a627fc07d3dcf1d22541c609e963cd",
"score": "0.6327666",
"text": "def reporter(*args, &block)\n @reporters.use(*args, &block)\n end",
"title": ""
},
{
"docid": "16c7f4e3eac727415897fd34e05da954",
"score": "0.63012326",
"text": "def report\n puts \"I'm #{@name}, I've delivered: #{@experience} papers\"\n puts \"Based on this paper route, I've earned: #{@earnings} \"\n end",
"title": ""
},
{
"docid": "0fe13cdd06e6731538407b34db912cc3",
"score": "0.62856984",
"text": "def print_report\n\t\tputs name\n\t\tputs \"enstablished at year #{year}\"\n\t\tputs \"number of beers #{beers.count}\"\n\t\tputs \"number of ratings #{ratings.count}\"\n\tend",
"title": ""
},
{
"docid": "c386ba81336661daa2aca5c7ecc4f5ca",
"score": "0.6273954",
"text": "def render_report(format=nil)\n format ||= 'html'\n unless @report.valid?\n flash[:error] = t(:invalid_report)\n redirect_to :back\n return\n end\n\n rendered_report = @report.render(format)\n\n case format\n when 'pdf'\n send_data(rendered_report,\n :type => \"application/pdf\",\n :filename => \"#{@report.file_name}.pdf\"\n )\n when 'csv'\n send_data(rendered_report,\n :type => \"text/csv\",\n :filename => \"#{@report.file_name}.csv\"\n )\n when 'html'\n @rendered_report = rendered_report\n render :action => 'show', :layout => 'report_layout'\n else\n raise(RuntimeError, \"Format: #{format}, is currently not supported\", caller)\n end\n end",
"title": ""
},
{
"docid": "cc925f4155e49b19f3e1afc776621178",
"score": "0.6263904",
"text": "def report\n puts 'E'\n end",
"title": ""
},
{
"docid": "18556f16192ff5146917534942f7e86b",
"score": "0.62628025",
"text": "def report(*args)\n options = args.first\n overview_report(options)\n tools_report(options)\n end",
"title": ""
},
{
"docid": "d38c6ca09ea3ff8ce8d3a8a938dfaec9",
"score": "0.6258945",
"text": "def index\n @reports = Report.all\n display @reports\n end",
"title": ""
},
{
"docid": "02eadd5dfd11955e28491a46ad308256",
"score": "0.62438315",
"text": "def render(format, user, *args)\n AssessmentReport.render(format, :report => self, :user => user)\n end",
"title": ""
},
{
"docid": "37a4809f846321cc0e0b155d6b0e1116",
"score": "0.6217877",
"text": "def render output\n\t\t\t\ttext Report.classification.upcase, :align => :center\n\t\t\t\ttext \"\\n\"\n\n\t\t\t\treport_title Report.title\n\t\t\t\treport_subtitle \"Failed Audit Checks\"\n\t\t\t\treport_author \"This report was prepared by\\n#{Report.author}\"\n\n\t\t\t\ttext \"\\n\\n\\n\"\n\n\t\t\t\ttext \"Verify each finding. The compliance audits only look for exact matches. For example, if the policy value for minimum password length is 8, and the actual value is 10, this finding can be ignored.\"\n\n\t\t\t\ttext \"\\n\\n\\n\"\n\n\t\t\t\tHost.all.each do |h|\n\t\t\t\t\tprint_header(20, \"#{h.name} (#{h.ip})\", \"000000\")\n\n\t\t\t\t\tif h.items.where(:cm_compliance_result => \"FAILED\").count > 0\n\t\t\t\t\t\tdata = [[\"Name\", \"Policy\", \"Value\"]]\n\t\t\t\t\t\th.items.where(:cm_compliance_result => \"FAILED\").each do |cm|\n\t\t\t\t\t\t\tdata += [[cm.cm_compliance_check_name, cm.cm_compliance_policy_value, cm.cm_compliance_actual_value]]\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\toutput.table(data, :header => true) do\n\t\t\t\t\t\t\trow(0).style(:font_style => :bold, :background_color => 'D0D0D0')\n\t\t\t\t\t\t\tcells.borders = [:top, :bottom, :left, :right]\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttext \"\\n\"\n\n\t\t\t\t\telsif h.items.where(:cm_compliance_result => \"PASSED\").count > 0\n\t\t\t\t\t\ttext \"Host passed all audits.\"\n\t\t\t\t\telse\n\t\t\t\t\t\ttext \"Audits were not conducted on host.\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ttext \"\\n\\n\\n\"\n\n\t\t\t\toutput.start_new_page\n\t\t\tend",
"title": ""
},
{
"docid": "1daf20cf61be3c89b6678c8bc6362702",
"score": "0.62141794",
"text": "def show\n @contents = @report_group.reports\n end",
"title": ""
},
{
"docid": "4c5f5486e0acb560c6fff60b28b3b13f",
"score": "0.6209406",
"text": "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\t@text.each do |line|\n\t\t\toutput_line line\n\t\tend\n\t\toutput_end\n\tend",
"title": ""
},
{
"docid": "96f68d6f21ae589f9fb78e469a1acb59",
"score": "0.6204839",
"text": "def all\n check_for_report\n page do |out|\n @report.print_text(false, nil, out)\n end\n end",
"title": ""
},
{
"docid": "138cfc81b7190715da0e8f12ccf6c77e",
"score": "0.6193724",
"text": "def report\n say \"#{test_number}) #{'Error'.yellow}: #{test.name}\\n- #{@test.errorMessage}\" if @test.errored\n say \"#{test_number}) #{'Failure'.red}: #{test.name}\\n#{@test.failureReports.map { |s| \" - #{s}\" }.join(\"\\n\")}\" if @test.failed\n end",
"title": ""
},
{
"docid": "fddd8449bf74bb11fa576d9bcd7cb7a8",
"score": "0.617698",
"text": "def reporter\n @reporter ||= reporter_find(format)\n end",
"title": ""
},
{
"docid": "4658645b18c1fa9fc0fcb0e30238e23d",
"score": "0.61667544",
"text": "def show\n @version = @report.version\n @product = @version.product\n @hostname = \"http://\"+request.host+\":\"+request.port.to_s || \"www.mydomain.com\"\n @title = @report.test_case.name+' - '+@report.build.name\n end",
"title": ""
},
{
"docid": "42feac449a0c3e9fe7c23bdbe85b005e",
"score": "0.6165993",
"text": "def report\n @reporters.each do |reporter|\n Thread.new do\n reporter.report\n end\n end\n end",
"title": ""
},
{
"docid": "266ce6d5b07d5b6a7207d06f54248eec",
"score": "0.61516684",
"text": "def send(report)\n puts report\n end",
"title": ""
},
{
"docid": "dce590a4458b213fc6433459c912effc",
"score": "0.61410993",
"text": "def report io = $stdout\n focus = option[:focus]\n type = option[:format] || :text\n\n send \"report_#{type}\", io, focus, missing_locations\n end",
"title": ""
},
{
"docid": "49dde731622b935bc450b5b2483ccdd5",
"score": "0.6137188",
"text": "def display\n \n @dialog.show {\n \n puts \"[ResultsWebUI.display] Showing ResultsWebUI...\\n\\n\" if $cutlister_debug\n \n }\n \n end",
"title": ""
},
{
"docid": "a939e747969496cb642639000d5b5703",
"score": "0.61325634",
"text": "def show\n handle_show do\n @actions = @report_instance.try(:get_actions)\n \n sanitized_report_name = @report.to_s.parameterize(separator: '_')\n\n respond_to do |format|\n format.html\n format.xls do\n response.headers['Content-Disposition'] = \"attachment; filename=#{sanitized_report_name}.xls\"\n end\n format.pdf do\n send_data report_pdf_template(sanitized_report_name), type: 'application/pdf', disposition: 'inline'\n end\n format.csv do \n headers['Content-Disposition'] = \"attachment;filename=#{sanitized_report_name}.csv\"\n render template: \"reports/show.csv.haml\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "856af29a871c8166489d0b84138ced19",
"score": "0.6123348",
"text": "def report\n validate\n parse\n filter_issues\n comment\n end",
"title": ""
},
{
"docid": "200da06f07728544d445ed926d221474",
"score": "0.6114132",
"text": "def output_report\n head\n body_start\n body\n body_end\n end",
"title": ""
},
{
"docid": "f5a578d53e78ae6e23bb84344a87ab2f",
"score": "0.6105397",
"text": "def report\n get_all_metrics\n get_description_from_params\n create_report('google_analytics/index.pdf.erb')\n end",
"title": ""
},
{
"docid": "1d1e613bfaf7af604a455a379a36c537",
"score": "0.6094311",
"text": "def show\n @custom_report = custom_report\n raise ReportFileNotFoundError unless authorize @custom_report\n @record = last_result\n check_report_existence\n raise ReportFileNotFoundError unless authorize @record\n format = \"text/#{@record.custom_report.result_format}\"\n encoding = @record.custom_report.utf_encoding ? 'utf-8' : 'windows-1251'\n send_file(\n @record.result_file_path,\n filename: @record.result_path,\n type: \"text/#{format}; charset=#{encoding}\",\n disposition: 'attachment',\n x_sendfile: true\n )\n rescue Pundit::NotAuthorizedError\n render_error(error: 'You are not allowed to read this report.', status: :unauthorized, status_code: 401)\n rescue ActiveRecord::RecordNotFound => error\n render_error(error: error, status: :not_found, status_code: 404)\n rescue ReportFileNotFoundError => error\n render_error(error: error.message, status: :internal_server_error, status_code: 500)\n rescue StandardError => error\n render_error(error: error, status: :internal_server_error, status_code: 500)\n end",
"title": ""
},
{
"docid": "9f92080b642d05ce06009e25eb0aabb9",
"score": "0.6093638",
"text": "def report\n #overwrite me\n end",
"title": ""
},
{
"docid": "7c93e57d96acdd991cae97d2510b0bb3",
"score": "0.60857004",
"text": "def show\n set_report\n # halt(404, { result: 'NotFound' }.to_json) if report.nil?\n # if @report.nil?\n # render json: @report.errors, status: :unprocessable_entity\n # else\n @report.to_json\n # end\n end",
"title": ""
},
{
"docid": "1cf87e6e4a09aedeabfcbb843430a556",
"score": "0.6048405",
"text": "def output_report\n output_start\n output_head\n output_body_start\n output_body\n output_body_end\n output_end\n end",
"title": ""
},
{
"docid": "1cf87e6e4a09aedeabfcbb843430a556",
"score": "0.6048405",
"text": "def output_report\n output_start\n output_head\n output_body_start\n output_body\n output_body_end\n output_end\n end",
"title": ""
},
{
"docid": "101fc1acfb6f2014d9bf70ae735fda7b",
"score": "0.60328245",
"text": "def open_analysis_result_report_page(pu_id = PU_ID,\n pj_id = PJ_ID,\n task_id = ID,\n subtask_id = SUB_ID,\n result_id = RESULT_ID)\n open(url_for(:controller => \"review\",\n :action => \"view_result_report\",\n :pu => pu_id,\n :pj => pj_id,\n :id => task_id,\n :sub_id => subtask_id,\n :result_id => result_id))\n\n file_name = Result.find(result_id,\n :select => \"file_name\").file_name\n\n page_title = $page_titles[\"review_view_result_report\"].sub(\"__FILE_NAME__\",\n file_name)\n wait_for_text_present(page_title)\n end",
"title": ""
},
{
"docid": "b1b4577bfc70828de97519cf63f43db0",
"score": "0.60228735",
"text": "def report\n p \"I'm #{@name}, I've delivered #{@experience} papers and I've earned #{@earnings} so far!\"\n end",
"title": ""
},
{
"docid": "1e0bb96dc06cb9589949f1ae221c6dcb",
"score": "0.59982896",
"text": "def full_report; end",
"title": ""
},
{
"docid": "484d34c287b51c1dad2f50fe3281c0ca",
"score": "0.5988287",
"text": "def full_report\n\n end",
"title": ""
},
{
"docid": "1deb31fb37a12027c09c85f590abaa2a",
"score": "0.59829867",
"text": "def report\n return if failures.nil? # because danger calls `report` before loading a file\n warn(\"Skipped #{skipped.count} tests.\") if show_skipped_tests && skipped.count > 0\n\n unless failures.empty? && errors.empty?\n fail('Tests have failed, see below for more information.', sticky: false)\n message = \"### Tests: \\n\\n\"\n\n tests = (failures + errors)\n keys = headers || tests.first.attributes.keys\n attributes = keys.map(&:to_s).map(&:capitalize)\n\n # Create the headers\n message << attributes.join(' | ') + \"|\\n\"\n message << attributes.map { |_| '---' }.join(' | ') + \"|\\n\"\n\n # Map out the keys to the tests\n tests.each do |test|\n row_values = keys.map { |key| test.attributes[key] }.map { |v| auto_link(v) }\n message << row_values.join(' | ') + \"|\\n\"\n end\n\n markdown message\n end\n end",
"title": ""
},
{
"docid": "a6d85d2713411c16a11df295e4696f08",
"score": "0.59702843",
"text": "def show_report\n\t\t@airports_info.each do |airport_id,airport_data|\n\t\t\tputs \"------\"\n\t\t\tputs \"Airport:#{airport_data[\"Airport Name\"]}\"\n\t\t\ttrasactions = airport_data[\"transactions\"]\n\t\t\tif !trasactions.empty?\n\t\t\t\tputs \"Date/time\\t\\t\\t\\t\\t Type\\t\\t\\t\\ Fuel\\t\\t\\t\\ Aircraft\"\n\t\t\t\ttrasactions.each do |trasaction|\n\t\t\t\t\tputs \"#{trasaction['Date/Time']}\\t\\t\\t\\ #{trasaction['Type']} \\t\\t\\t\\ #{trasaction['Fuel']} \\t\\t\\t\\ #{trasaction['Aircraft']}\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"------\"\n\t\tend\n\t\tget_user_input\n\tend",
"title": ""
},
{
"docid": "17354236d762e5f45dfc307febf44044",
"score": "0.5967991",
"text": "def show\n\n respond_to do |format|\n @laboratory = Laboratory.find(@report.laboratory_id)\n pdf_options = @report.pdf_options\n opts = {:pdf => \"\", :javascript_delay => \"1000\", :disable_smart_shrinking => false}.merge(pdf_options).deep_symbolize_keys\n\n format.html\n format.pdf do\n render(opts)\n #render :pdf => \"show\"\n end\n end\n end",
"title": ""
},
{
"docid": "9cd71b4f7dbf04aac9898b51f276d2ef",
"score": "0.5961068",
"text": "def display_results\n\t\tdisplay_stats\n\t\tdisplay_data\n\tend",
"title": ""
},
{
"docid": "73e4cf0aa3bc975d29c56c16392d0859",
"score": "0.5960632",
"text": "def display\n puts \"I'm a Premiertimingsystems Race Results Scraper!\"\n end",
"title": ""
},
{
"docid": "ecc3d1d5358321821a62328e5f8677f5",
"score": "0.59568644",
"text": "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if edited_rows_count + errors_count > 0\n if edited_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- UPDATED Meetings in calendar: #{ edited_rows_count }\" )\n @edited_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n end\n end",
"title": ""
},
{
"docid": "0486bad2e502ddc2288209cb844982da",
"score": "0.59332305",
"text": "def display_report\n print \"#{@state} will lose #{predicted_deaths} people in this outbreak\"\n print \" and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end",
"title": ""
},
{
"docid": "5c0517b3207c7938ba56d2a491b36b49",
"score": "0.5931632",
"text": "def run(report); end",
"title": ""
},
{
"docid": "62c41414d772daba79ad3d579753ce4f",
"score": "0.59289384",
"text": "def cycleReport()\n @reporter.report() if(@reporter) ;\n end",
"title": ""
},
{
"docid": "89fed5aa6d021367ddb95e0c72144da6",
"score": "0.5923564",
"text": "def report (opts = {})\n default_options = {\n :user => 'all',\n :group_subaccount => true,\n :report_type => 'basic'\n }\n\n opts.reverse_merge! default_options\n post 'report', opts, \"report_#{opts[:report_type]}\".to_sym\n end",
"title": ""
},
{
"docid": "0972e8218d4bb4bcb1d316fe7c4da53e",
"score": "0.59183323",
"text": "def report\n Report.new(self)\n end",
"title": ""
},
{
"docid": "0972e8218d4bb4bcb1d316fe7c4da53e",
"score": "0.59183323",
"text": "def report\n Report.new(self)\n end",
"title": ""
},
{
"docid": "0972e8218d4bb4bcb1d316fe7c4da53e",
"score": "0.59183323",
"text": "def report\n Report.new(self)\n end",
"title": ""
},
{
"docid": "cdb66f0dfd0b56daebccd386837d4b70",
"score": "0.5911348",
"text": "def execute\r\n puts @robot.report\r\n end",
"title": ""
},
{
"docid": "f58a1a3b8e4dd560e265225ea3e7141b",
"score": "0.5908171",
"text": "def report\n puts \"I'm #{@name}, I've delivered #{@experience} papers and I've made $#{@earnings} so far!\"\n end",
"title": ""
},
{
"docid": "19b255b54a15a47713e480e117618bf2",
"score": "0.5904684",
"text": "def show\n @report = Report.find(params[:id])\n # add entry to view log if one does not exist for this staff/report combination\n current_staff.has_seen?(@report) || ReportViewLog.create(:staff_id => current_staff.id, :report_id=> @report.id)\n # get the interested parties to email for this report type\n @interested_parties = InterestedParty.where(:report_type_id=>@report.type_id)\n\n\n respond_to do |format|\n format.html { render 'reports/show' }\n format.iphone { render 'reports/show', :layout => 'mobile_application' }\n format.pdf { render :pdf => \"#{@report.tag}\", :template=> \"reports/show.pdf.erb\", :stylesheets => [\"radar_pdf\"] }\n end\n end",
"title": ""
},
{
"docid": "25a1de34f740af71435b6eb39ea4e86e",
"score": "0.5903986",
"text": "def set_report\n\n end",
"title": ""
},
{
"docid": "25a1de34f740af71435b6eb39ea4e86e",
"score": "0.5903986",
"text": "def set_report\n\n end",
"title": ""
},
{
"docid": "9e0ecd1b5eac25015bda8c3822fa2c5b",
"score": "0.58662075",
"text": "def print(reports, options = {})\n style = options[:style] || IO.read(File.join(File.expand_path('..', __FILE__),'default_style.css'))\n template = options[:template] || Haml::Engine.new(IO.read File.join(File.expand_path('..', __FILE__), 'default_template.html.haml'))\n stats = Stats.new(reports)\n template.render binding\n end",
"title": ""
},
{
"docid": "4dcf601106f116d5c7f0aa5bde03ef79",
"score": "0.5858826",
"text": "def report_printer\n unless @report_printer\n printer_class = report_printer_class || ScanReportPrinters::ScanSummaryReporter\n @report_printer ||= printer_class.new(session, report_printer_arg)\n end\n @report_printer\n end",
"title": ""
},
{
"docid": "f9b6390aa7ed71ed55edcdedd713300d",
"score": "0.5854656",
"text": "def print_report\n\tascii_art('Sales Report')\n\ttodays_date\n\tascii_art('Products')\n\tsection_break\n\tproducts\n\tascii_art('Brands')\n\tsection_break\n\tbrands\nend",
"title": ""
},
{
"docid": "b62d44cd896dcab9c2b1dbae916f221e",
"score": "0.5853806",
"text": "def show\n @report = Report.find(params[:id])\n\n # if @report\n # charset = nil\n # html = open(@report.src_url) do |f|\n # charset = f.charset # 文字種別を取得\n # f.read # htmlを読み込んで変数htmlに渡す\n # end\n # doc = Nokogiri::HTML.parse(html, nil, charset)\n # p doc.content\n end",
"title": ""
},
{
"docid": "76cb1fba3e7bdc336a176fd08f868e05",
"score": "0.58497906",
"text": "def report\r\n sprintf \"Number of paragraphs %d \\n\" <<\r\n \"Number of sentences %d \\n\" <<\r\n \"Number of words %d \\n\" <<\r\n \"Number of characters %d \\n\\n\" <<\r\n \"Average words per sentence %.2f \\n\" <<\r\n \"Average syllables per word %.2f \\n\\n\" <<\r\n \"Flesch score %2.2f \\n\" <<\r\n \"Flesch-Kincaid grade level %2.2f \\n\" <<\r\n \"Fog Index %2.2f \\n\",\r\n num_paragraphs, num_sentences, num_words, num_characters,\r\n words_per_sentence, syllables_per_word,\r\n flesch, kincaid, fog\r\n end",
"title": ""
},
{
"docid": "c9bb2869280dcec3899d37170df68e9a",
"score": "0.5838155",
"text": "def create_report\n print_heading\n print_data\nend",
"title": ""
},
{
"docid": "148c7d4c64427d64b2d5dd7e7ee3fe30",
"score": "0.5833563",
"text": "def start\n @config.reporters.each(&:start)\n end",
"title": ""
},
{
"docid": "8c8c60d6afeb28513096590fef562fba",
"score": "0.5833148",
"text": "def report(date = nil)\n filter!\n @reporter.report date\n end",
"title": ""
},
{
"docid": "ad54cbe0b1f9c26df1af98e36820888e",
"score": "0.5826637",
"text": "def display\n if debugging?\n wait_for_jobs\n else\n display_jobs\n end\n\n if job_failed?\n display_log_location if log_location\n abort\n end\n end",
"title": ""
},
{
"docid": "709798e7acdbdef662d5468d158363ce",
"score": "0.5823921",
"text": "def index\n @reporters = Reporter.all\n end",
"title": ""
},
{
"docid": "cae753d96bc52188c6b50b34180b6414",
"score": "0.5820534",
"text": "def report\n debug(\"Reporting summary\")\n close_pending_suites\n []\n end",
"title": ""
},
{
"docid": "ee53927d9eb55e274e452570db257fe3",
"score": "0.5807865",
"text": "def run\n @@dialog.setMainProgress(0, 3)\n start = Time.now\n @@dialog.setMainProgress(1) if populate\n return nil if @@dialog.abortWasRequested\n\n @@dialog.setMainStatusAndLogIt(\"Exporting to #{@export_dir}\")\n export\n return nil if @@dialog.abortWasRequested\n\n @@dialog.setMainProgress(2)\n summarize\n SummaryReporter.new(start, @export_dir, @reports_dir, 'Custodian').write\n end",
"title": ""
},
{
"docid": "637cb16369423a43ffec457029411c0d",
"score": "0.58058965",
"text": "def report\n\t\tsprintf \"Number of paragraphs %d \\n\" <<\n\t\t\t\t\"Number of sentences %d \\n\" <<\n\t\t\t\t\"Number of words %d \\n\" <<\n\t\t\t\t\"Number of characters %d \\n\\n\" <<\n\t\t\t\t\"Average words per sentence %.2f \\n\" <<\n\t\t\t\t\"Average syllables per word %.2f \\n\\n\" <<\n\t\t\t\t\"Flesch score %2.2f \\n\" <<\n\t\t\t\t\"Flesh-Kincaid grade level %2.2f \\n\" <<\n\t\t\t\t\"Fog Index %2.2f \\n\",\n\t\t\t\tnum_paragraphs, num_sentences, num_words, num_characters,\n\t\t\t\twords_per_sentence, syllables_per_word,\n\t\t\t\tflesch, kincaid, fog\n\tend",
"title": ""
},
{
"docid": "f17ec292ee70f0c8e0739826532ba42a",
"score": "0.580075",
"text": "def index\n @screens = Screen.all\n respond_to do |format|\n format.html\n format.json\n format.pdf do\n render :template => 'screens/report',\n :pdf => \"Report \",\n :layout => 'pdf.html'\n end\n end\n end",
"title": ""
},
{
"docid": "bf6dd30894bc7e639e589011cd9f9113",
"score": "0.5797456",
"text": "def report\n\t\t@departments = Department.find(:all)\n\n\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"departmentreport.pdf\", :type => 'application/pdf')\n\tend",
"title": ""
},
{
"docid": "abab617d4a765578742dff974bbabf98",
"score": "0.5792861",
"text": "def dashboard\n template = OpenStudioMeasureTester::Dashboard.new(test_results_dir)\n template.render\n end",
"title": ""
},
{
"docid": "e3cfd8097da09d713dd54f6966c5d8ea",
"score": "0.5785746",
"text": "def show\r\n @test_report = TestReport.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @test_report }\r\n end\r\n end",
"title": ""
},
{
"docid": "448a7ff57b5f8bdf66614edd581a9462",
"score": "0.5785125",
"text": "def report\n pdf = ItemReport.new(current_user)\n send_data pdf.render, filename: \"PhotoGear.pdf\",\n type: \"application/pdf\"\n end",
"title": ""
},
{
"docid": "69e3bbc1eec2a5923cfe95b08e8149c1",
"score": "0.5776089",
"text": "def show\n @title = @expert.full_name_with_degree\n\n respond_to do |format|\n format.html\n format.pdf { send_report ExpertReport.new(@expert, current_user) }\n end\n end",
"title": ""
},
{
"docid": "d8fd8cf7ec8b3bc44edaab18ce9f67da",
"score": "0.57727873",
"text": "def report\n Railroader::Report.new(@app_tree, self)\n end",
"title": ""
},
{
"docid": "83360ca2d8e4d083264da17242dbec4d",
"score": "0.5770607",
"text": "def report\n # Header lines\n line = \"Heat \"\n @lanes.sort.each do |lane|\n line << \"Lane #{lane} \"\n end\n puts line\n line = \"---- \"\n @lanes.sort.each do |lane|\n line << \"------ \"\n end\n puts line\n # Report lines\n @heats.each do |heat|\n line = sprintf(\"%3d \", heat)\n @heat_lane_cars[heat].keys.sort.each do |lane|\n line << sprintf(\"%5d \", @heat_lane_cars[heat][lane])\n end\n puts line\n end\n end",
"title": ""
},
{
"docid": "506ab99114810ef835f111930c288a5f",
"score": "0.5763552",
"text": "def send_report\n ReportMailer.send_report\n end",
"title": ""
},
{
"docid": "052dc1612150e2ccb47f087555b4fe40",
"score": "0.57622004",
"text": "def create_report\n\ttitle_report(\"Sales Report\")\n\tprint_report \"********************\"\n\t# Displays the time when the salee report was generated.\n\ttime_date\n\tprint_report \"********************\"\n\t# Prints all the products data to the sales report\n\tprint_products\n\t# Prints all the brand data to the the sales report\n\tprint_brands\nend",
"title": ""
},
{
"docid": "0c459c95d07e8e0a4f7593e0aead3cb5",
"score": "0.5758023",
"text": "def show\n respond_to do |format|\n format.html\n format.json\n format.pdf {render template: 'reports/report', pdf: 'report'}\n end\n end",
"title": ""
},
{
"docid": "259ec66fe9c6aa4b388afd7934786303",
"score": "0.57560706",
"text": "def show\n return false unless authorize(permissions = [\"view_medical_report\"])\n @medical_report = MedicalReport.find(params[:id])\n\n @config = YAML::load(File.open(\"#{RAILS_ROOT}/config/report.yml\"))\n @header = ReportHeader.find_by_id(@config[\"header\"])\n\n @htmlOutput = @medical_report.file\n @breakPos = 0\n\n while true\n @breakPos = @htmlOutput.index('page-break-after', @breakPos)\n \n if @breakPos == nil\n break\n end\n\n @endBreak = @htmlOutput.index('</div>', @breakPos) +6\n @htmlOutput = @htmlOutput[0,@endBreak]+ @header.html + @htmlOutput[@endBreak,@htmlOutput.length]\n \n @breakPos += @header.html.length\n end\n \n if @header != nil\n @medical_report.file = @header.html + @htmlOutput\n else\n @medical_report.file = @htmlOutput\n end\n \n \n\n respond_to do |format|\n format.html { render :layout => 'medical_report'}\n #format.html {render :layout => 'medical_report'}# show.html.erb\n format.xml { render :xml => @medical_report }\n end\n end",
"title": ""
},
{
"docid": "71b7ead72382723f0391646318483839",
"score": "0.5752918",
"text": "def show\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "71b7ead72382723f0391646318483839",
"score": "0.5752918",
"text": "def show\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "431506e3278b34653df8e2a16b515896",
"score": "0.5749822",
"text": "def show\n basename = @report.name.tr(' ', '_')\n respond_to do |format|\n format.html {}\n format.xlsx do\n send_data(@report.expenses.render_xlsx, filename: \"#{basename}.xlsx\")\n end\n format.pdf do\n send_data(@report.expenses.render_pdf, filename: \"#{basename}.pdf\")\n end\n end\n end",
"title": ""
}
] |
d31f52a5d6586abcb7e327baf0d78df6
|
GET /materials/1 GET /materials/1.json
|
[
{
"docid": "1a500bfeec9c218c04691be0489968be",
"score": "0.6502998",
"text": "def show\n if @material\n @object=@material\n curriculum_id=@material.curriculum_id\n @curriculum = Curriculum.find(curriculum_id)\n @materials=Curriculum.get_root_material(curriculum_id)\n else\n flash[:error] = t('msg_access_error')\n end\n end",
"title": ""
}
] |
[
{
"docid": "8a41b32bd282ecaac703a3741b5f7655",
"score": "0.8052943",
"text": "def show\n\n type = params[:material_type]\n id = params[:id]\n include_related = params.has_key?(:include_related) ?\n params[:include_related].to_i :\n @@DEFAULT_RELATED_MATERIALS_COUNT\n\n status = 200\n data = {}\n\n begin\n item = get_materials_item id, type\n rescue ActiveRecord::RecordNotFound => rnf\n render json: { :message => rnf.message}, :status => 400\n return\n end\n\n if item\n array = materials_data [item], nil, include_related\n\n if array.size == 1\n\n data = array[0]\n\n else\n status = 400\n data = {:message =>\n \"Unexpected materials size #{array.size}\"}\n end\n\n else\n status = 400\n data = { :message =>\n \"Cannot find materials item type (#{type}) with id (#{id})\" }\n end\n\n render json: data, :status => status\n\n end",
"title": ""
},
{
"docid": "28b7c9d48aaa7cc8449ef645d7d0ea71",
"score": "0.7921671",
"text": "def index\n @materials = Material.all\n\n render json: @materials\n end",
"title": ""
},
{
"docid": "aa0c7729448efe91c6b1ffd4afe7f2ee",
"score": "0.7787645",
"text": "def show\n @material = Material.find(params[:id])\n render json: @material\n end",
"title": ""
},
{
"docid": "63f008f007dadc32c4dda5bd554cc34d",
"score": "0.7566031",
"text": "def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end\n end",
"title": ""
},
{
"docid": "63f008f007dadc32c4dda5bd554cc34d",
"score": "0.7566031",
"text": "def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end\n end",
"title": ""
},
{
"docid": "0e5d046d0f69106355768278a7992915",
"score": "0.7538583",
"text": "def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end \n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "0f5f80f2e5f7c5134943ba1e7d9b4c05",
"score": "0.739712",
"text": "def index\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "14551b88f690973dd93a3793d2287c6d",
"score": "0.7388668",
"text": "def show\n @materials_collection = MaterialsCollection.find(params[:id])\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @materials_collection }\n end\n end",
"title": ""
},
{
"docid": "3b91bc79dd45bf76779bcb88c1b1840b",
"score": "0.7277221",
"text": "def retrieve_materials(materials)\n show do\n title 'Retrieve Materials'\n note 'Please get the following items'\n table create_location_table(materials)\n end\n end",
"title": ""
},
{
"docid": "1b6152ded4acbe341ef5a79dfe7830a7",
"score": "0.72725147",
"text": "def show\n @item_material = ItemMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_material }\n end\n end",
"title": ""
},
{
"docid": "c5dd90cd1d8174538f5d3cf9f19584e9",
"score": "0.72260016",
"text": "def lookup_materials\n raw_response = open('https://api.data.gov/sftool/v1/materials?api_key=dMBLd1yIH2IPbsLLSXncwX4CPaZkPm8FH0wT7Ipp')\n response = JSON.load(raw_response)\n\n response.map do |material|\n material_hash = {\n id: material[\"id\"],\n name: material[\"name\"],\n overview: material[\"overview\"]\n }\n end\nend",
"title": ""
},
{
"docid": "6f195f22ad427c5778446f6d7b8bca31",
"score": "0.72084945",
"text": "def show\n @raw_material = RawMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @raw_material }\n end\n end",
"title": ""
},
{
"docid": "714f24da2d12920de06e7a1a8ff43875",
"score": "0.7187489",
"text": "def show\n @type_material = TypeMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_material }\n end\n end",
"title": ""
},
{
"docid": "e7bd843d0231f6f0565ba9da47fa99ff",
"score": "0.7182887",
"text": "def show\n @reference_material = ReferenceMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference_material }\n end\n end",
"title": ""
},
{
"docid": "4c515f91068157daa2d9bca2ba431afc",
"score": "0.71550804",
"text": "def index\n materials = current_user.materials.find_by_type(params[:material_type].to_i)\n render_json_auto materials and return\n # render :json => @ws_client.index(params[:material_type])\n end",
"title": ""
},
{
"docid": "3fdeda5b8b609b4b2e7098649d72dbb9",
"score": "0.7141352",
"text": "def index\n @tour = current_user.tour.where(id: params[:tour_id]).first\n @materials = @tour.material\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materials }\n end\n end",
"title": ""
},
{
"docid": "51dcacdc3e7de60e3e72ae218b5572c3",
"score": "0.71284294",
"text": "def index\n @materials = @project.materials.all\n end",
"title": ""
},
{
"docid": "27c8f9dd386ead1663d6f6438896d0c7",
"score": "0.709624",
"text": "def show\n render json: @material\n end",
"title": ""
},
{
"docid": "3610598379b2aa15ef5b94d00464f00c",
"score": "0.7087563",
"text": "def show\n @pattern = Pattern.find_by(id: params[:pattern_id])\n if @pattern\n @materials = @pattern.materials.find_by(id: params[:id])\n else\n @material = Material.find_by(id: params[:id])\n end\n render json: @material\n end",
"title": ""
},
{
"docid": "f4ea057a618a4cd93103292a962b52b8",
"score": "0.70223045",
"text": "def index\n @glaze_materials = GlazeMaterial.all\n end",
"title": ""
},
{
"docid": "c464885f957216e03d9979ef65dd56b7",
"score": "0.7010355",
"text": "def show\n @tool_material = ToolMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tool_material }\n end\n end",
"title": ""
},
{
"docid": "60e101792e538483b026084d53eeb377",
"score": "0.6998192",
"text": "def new\n @material = Material.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @material }\n end \n end",
"title": ""
},
{
"docid": "d27cf71293ee6800e816c4a3db09a551",
"score": "0.6988129",
"text": "def materials\n\n end",
"title": ""
},
{
"docid": "4eb4ddb841f2060daea28854e638946c",
"score": "0.69695765",
"text": "def show\n @sent_material = SentMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sent_material }\n end\n end",
"title": ""
},
{
"docid": "914dc02844d149432797a15019533e75",
"score": "0.69545966",
"text": "def new\n @material = Material.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @material }\n end\n end",
"title": ""
},
{
"docid": "8ace019eb4b3f89d1d8b704b5d25c782",
"score": "0.69470954",
"text": "def show\n @learning_material = LearningMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @learning_material }\n end\n end",
"title": ""
},
{
"docid": "2498b3e45a80f1e2a5117fc1f58e0691",
"score": "0.68968886",
"text": "def show\n @materials = Material.where(unit_id:@unit.id)\n end",
"title": ""
},
{
"docid": "a991f5a48072dd13ad1bd4711075ab22",
"score": "0.68850887",
"text": "def show\n @located_material = LocatedMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @located_material }\n end\n end",
"title": ""
},
{
"docid": "01372fe5f99cb74eb436b5de4d64e08b",
"score": "0.68778485",
"text": "def index\n @location[:sub_menu] = 'list_materials'\n @materials = Material.all\n end",
"title": ""
},
{
"docid": "9e8954dc7261da6c8af9a713a1d80c9d",
"score": "0.6838785",
"text": "def show\n @material_of_quantity = MaterialOfQuantity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material_of_quantity }\n end\n end",
"title": ""
},
{
"docid": "d513b99ef8acffbe6a38758520b9a1b8",
"score": "0.6810399",
"text": "def index\n @materials = current_user.materials\n end",
"title": ""
},
{
"docid": "47b0863779b5b0e5941a2a2e04835a46",
"score": "0.6808384",
"text": "def show\n @coletamaterial = Coletamaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coletamaterial }\n end\n end",
"title": ""
},
{
"docid": "3ae53d0936dca0a1d433a96e85bd99e5",
"score": "0.680806",
"text": "def show\n @vendor_material = VendorMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vendor_material }\n end\n end",
"title": ""
},
{
"docid": "543709fd0c72d8494e917b1771acf8dd",
"score": "0.6803836",
"text": "def set_api_v1_material\n @api_v1_material = Material.find(params[:id])\n end",
"title": ""
},
{
"docid": "2b4455a788b275d62d70961602eff952",
"score": "0.67996013",
"text": "def get_material(material_id)\n Material.find(material_id)\n end",
"title": ""
},
{
"docid": "526bd2a21af8d6d48ace2454f99a914c",
"score": "0.67974263",
"text": "def show\n @materials = @bow_string.materials.map { |material| Material.find(material) }\n end",
"title": ""
},
{
"docid": "1a3bd84e8540b5ae4b383bb26c87aff9",
"score": "0.6795441",
"text": "def index\n @learning_materials = LearningMaterial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @learning_materials }\n end\n end",
"title": ""
},
{
"docid": "eaf7c079c97688813129e7d4a515be0c",
"score": "0.67895675",
"text": "def new\n @materials_collection = MaterialsCollection.new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @materials_collection }\n end\n end",
"title": ""
},
{
"docid": "3bc7c6c5d9350b133fa3e131ae1d39f9",
"score": "0.6788752",
"text": "def index\n @section_materials = SectionMaterial.all\n end",
"title": ""
},
{
"docid": "cf77eee382956df789581e0ac01c037b",
"score": "0.67670685",
"text": "def show\n @material_use = MaterialUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material_use }\n end\n end",
"title": ""
},
{
"docid": "47b8a97825d937c773f9329085ef3822",
"score": "0.67445135",
"text": "def index\n @raw_materials = RawMaterial.all\n end",
"title": ""
},
{
"docid": "3424b11f7518595ecc916979b712e38a",
"score": "0.67312247",
"text": "def set_material\n @material = @project.materials.find(params[:id])\n end",
"title": ""
},
{
"docid": "d9e09f9e544386b6b6c795c904e1a4d1",
"score": "0.67101955",
"text": "def index\n @stored_materials = StoredMaterial.all\n end",
"title": ""
},
{
"docid": "fabb0def023f4e61265852707730718b",
"score": "0.670262",
"text": "def index\n @property_materials = PropertyMaterial.all\n end",
"title": ""
},
{
"docid": "71fb26fa2e23e14cc7a404dfa9cac0fe",
"score": "0.6687918",
"text": "def new\n @item_material = ItemMaterial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_material }\n end\n end",
"title": ""
},
{
"docid": "95a94cf6149b0585dc67f5519f4eba00",
"score": "0.66784996",
"text": "def validate_material\n\n type = params[:material_type]\n id = params[:material_id]\n\n begin\n item = get_materials_item id, type\n rescue ActiveRecord::RecordNotFound => rnf\n render json: {\n :message => \"Invalid material type (#{type}) or id (#{id})\"},\n :status => 400\n return\n end\n\n end",
"title": ""
},
{
"docid": "2786874d4351f5ea7e16eb7b5825432e",
"score": "0.66717654",
"text": "def new\n @artifact = Artifact.new\n #@material = Material.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artifact }\n end\n end",
"title": ""
},
{
"docid": "ff66595c72adaa575cf9f92b58aeec69",
"score": "0.66406643",
"text": "def new\n @reference_material = ReferenceMaterial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_material }\n end\n end",
"title": ""
},
{
"docid": "943f3e70529d427713cc35144f3a2bde",
"score": "0.6631457",
"text": "def index\n @related_materials = RelatedMaterial.all\n end",
"title": ""
},
{
"docid": "64e5a5bc8f466e961ff4f08608324509",
"score": "0.660466",
"text": "def index\n @demand_materials = DemandMaterial.all\n end",
"title": ""
},
{
"docid": "4ce19f3bd58225aa34ec6bff91efa44f",
"score": "0.66040176",
"text": "def show\n @material_code = MaterialCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material_code }\n end\n end",
"title": ""
},
{
"docid": "ebbefa14a3c4fc038a57267d3805f076",
"score": "0.6603247",
"text": "def index\n @manufacture_materials = ManufactureMaterial.all\n end",
"title": ""
},
{
"docid": "0c468953bd9f2385bfaaea8a8ada2bb2",
"score": "0.6597436",
"text": "def new\n @raw_material = RawMaterial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @raw_material }\n end\n end",
"title": ""
},
{
"docid": "6f046f2d0d62a44b17116469476d8e94",
"score": "0.65927094",
"text": "def new\n @type_material = TypeMaterial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_material }\n end\n end",
"title": ""
},
{
"docid": "9aeae947938fcad2e0fcd7def952ef72",
"score": "0.6583422",
"text": "def material\n fetch('commerce.product_name.material')\n end",
"title": ""
},
{
"docid": "0778f65bcbbf0ccc83460a24e34028b9",
"score": "0.6581486",
"text": "def show\n @material = Material.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @material }\n end\n end",
"title": ""
},
{
"docid": "037067fd20440a3973a0e0a61f342716",
"score": "0.6581305",
"text": "def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @material }\n end\n end",
"title": ""
},
{
"docid": "0afcc88debd1e9faef673fbba69916d3",
"score": "0.657605",
"text": "def index\n @materials = @course.materials.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @materials }\n end\n end",
"title": ""
},
{
"docid": "f2488f9e7a267eb52d315d5ed39667bd",
"score": "0.65709245",
"text": "def show\n @documented_material = DocumentedMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @documented_material }\n end\n end",
"title": ""
},
{
"docid": "e0b6bcc55dab937fae9c263f2ee30ebc",
"score": "0.6567361",
"text": "def create\n @material = Material.new(params[:material])\n if @material.save\n render json: @material, status: :created, location: @material\n else\n render json: @material.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a594632e68b181665e75b554a13579c9",
"score": "0.65472174",
"text": "def show\n\t\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @material }\n end\n end",
"title": ""
},
{
"docid": "692c7f68c48dcbe2b714548056b524ff",
"score": "0.6538022",
"text": "def update\n @material = Material.find(params[:id])\n if @material.update_attributes(params[:material])\n head :no_content\n else\n render json: @material.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f3230e9830fd5bc2d8751af9b0cc01bc",
"score": "0.65329736",
"text": "def create\n @raw_material = RawMaterial.new(params[:raw_material])\n @raw_materials=RawMaterial.all\n\n respond_to do |format|\n if @raw_material.save\n format.html { redirect_to raw_materials_path, notice: 'Raw material was successfully created.' }\n format.json { render json: @raw_material, status: :created, location: @raw_material }\n else\n format.html { render action: \"index\" }\n format.json { render json: @raw_material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76d85adfa4ede8265967d0db6bb3a85b",
"score": "0.6528586",
"text": "def show\n @metal = Metal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metal }\n end\n end",
"title": ""
},
{
"docid": "f8428715dfbf4736b965a58c74fedbc5",
"score": "0.65135586",
"text": "def show\n @quality_lot_material = QualityLotMaterial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quality_lot_material }\n end\n end",
"title": ""
},
{
"docid": "c50059112ea64a7abb4a18bc6599ae1a",
"score": "0.6512812",
"text": "def create\n @material = Material.new(material_params)\n\n if @material.save\n render json: @material, status: :created, location: @material\n else\n render json: @material.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "b2a77427f1d893f694168e49a9acde61",
"score": "0.6502137",
"text": "def set_material\n @material = Material.find(params[:id])\n end",
"title": ""
},
{
"docid": "fdb7df0d5910baa13a5404cd3007c01e",
"score": "0.65019643",
"text": "def get_materials_item(id, type)\n\n rubyclass = @@supported_material_types[type]\n\n if rubyclass\n\n includes = [ :user,\n :projects,\n :subject_areas,\n :grade_levels ]\n\n item = rubyclass.includes(includes).find(id)\n\n if item\n return item\n end\n\n else\n raise ActiveRecord::RecordNotFound, \"Invalid material type (#{type})\"\n end\n\n raise ActiveRecord::RecordNotFound,\n \"Cannot find material type (#{type}) with id (#{id})\"\n end",
"title": ""
},
{
"docid": "947d0e2e535ee78742850a9447fc7d01",
"score": "0.6497541",
"text": "def index\n @materials = Material.valid_materials @current_shop.materials\n end",
"title": ""
},
{
"docid": "1c71b8528dd94bd169f57e413ae83cd7",
"score": "0.64939404",
"text": "def loadMaterials\n material1 = $MaterialIdentifier.getMaterial(\"texture1\")\n material2 = $MaterialIdentifier.getMaterial(\"texture2\")\n material3 = $MaterialIdentifier.getMaterial(\"texture3\")\n material4 = $MaterialIdentifier.getMaterial(\"texture4\")\n material5 = $MaterialIdentifier.getMaterial(\"texture5\")\n material6 = $MaterialIdentifier.getMaterial(\"texture6\")\nend",
"title": ""
},
{
"docid": "4e755d7d223726b6e4b16ab900d358a4",
"score": "0.6492715",
"text": "def index\n @course_materials = CourseMaterial.all\n end",
"title": ""
},
{
"docid": "410547e2edc450d9e5a64d9fd5a23eda",
"score": "0.6489783",
"text": "def update\n respond_to do |format|\n if @material.update(material_params)\n format.html { redirect_to materials_path, notice: 'Material was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_materials_path }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "91069a797d0639decc70f9f4cdf09271",
"score": "0.6487262",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_material }\n end\n end",
"title": ""
},
{
"docid": "ef277425af723abbf1eb97cf4f22b4bf",
"score": "0.6478542",
"text": "def index\n @material_of_quantities = MaterialOfQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @material_of_quantities }\n end\n end",
"title": ""
},
{
"docid": "3de778a7c84839cbff3a59ff3d613f66",
"score": "0.64694625",
"text": "def create\n @material = Material.new(params[:material])\n \n respond_to do |format|\n if @material.save\n format.html { redirect_to @material, notice: 'Material was successfully created.' }\n format.json { render json: @material, status: :created, location: @material }\n else\n format.html { render action: \"new\" }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94af276da1aa41ba9ef2a7eeb1553cf9",
"score": "0.6468199",
"text": "def get_admin_material_types\n material_types = get_material_types\n respond_to do |format|\n format.json { render json: material_types}\n end\n end",
"title": ""
},
{
"docid": "699ec070b1c672137a1e28b752435d83",
"score": "0.6458175",
"text": "def index\n @materials_types = MaterialsType.all\n end",
"title": ""
},
{
"docid": "ad6f7873e6a9f89492f9cab482dfa1aa",
"score": "0.6456387",
"text": "def show\n @tour = current_user.tour.where(id: params[:tour_id]).first\n unless @tour\n return redirect_to tours_path, alert: \"Asset doesn't exist for that tour\"\n end\n @material = @tour.material.where(id: params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end\n end",
"title": ""
},
{
"docid": "04ce29465b5a20fbf1c6b314b4e072f5",
"score": "0.6455455",
"text": "def destroy\n @material = Material.find(params[:id])\n @material.destroy\n\n respond_to do |format|\n format.html { redirect_to materials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "04ce29465b5a20fbf1c6b314b4e072f5",
"score": "0.6455455",
"text": "def destroy\n @material = Material.find(params[:id])\n @material.destroy\n\n respond_to do |format|\n format.html { redirect_to materials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "04ce29465b5a20fbf1c6b314b4e072f5",
"score": "0.6455455",
"text": "def destroy\n @material = Material.find(params[:id])\n @material.destroy\n\n respond_to do |format|\n format.html { redirect_to materials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d7d1c20fda11451beb6ef7f3f3d3cd74",
"score": "0.64547586",
"text": "def new\n @tool_material = ToolMaterial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool_material }\n end\n end",
"title": ""
},
{
"docid": "1daa9dd651d92d1968c7f23eb8cb76b2",
"score": "0.6449962",
"text": "def create\n @material = Material.new(params[:material])\n respond_to do |format|\n if @material.save\n format.html { redirect_to @material, notice: 'Material was successfully created.' }\n format.json { render json: @material, status: :created, location: @material }\n else\n format.html { render action: \"new\" }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9be20bb19767da93b11b7a31884a2a3a",
"score": "0.64488",
"text": "def materials\n Material.where(manager_id: managers.ids)\n end",
"title": ""
},
{
"docid": "0f531e5e78c680d75870a5e29a9a4c95",
"score": "0.64456385",
"text": "def set_material\n @material = @current_shop.materials.find(params[:id])\n end",
"title": ""
},
{
"docid": "f9b1bd0d40a25e4237904253587624a0",
"score": "0.6440253",
"text": "def show\n @material = Material.find_by_id(params[:id])\n respond_to do |format|\n format.html { \n if @material.material_type == 1\n url = @material.picture_url\n redirect_to(url.blank? ? '/assets/materials/no-image.png' : URI.encode(url.strip)) and return\n end\n return \n }\n format.json { render_json_auto @material and return }\n end\n end",
"title": ""
},
{
"docid": "39020b35741afbc2a6a16cb70d6d151d",
"score": "0.64313173",
"text": "def index\n @consumable_materials = ConsumableMaterial.all\n end",
"title": ""
},
{
"docid": "337637e809732108121b6c1523c31d87",
"score": "0.64300114",
"text": "def get_material_(curriculum_id)\n materials = Material.where(parent_id: nil, curriculum_id: curriculum_id)\n materials\n end",
"title": ""
},
{
"docid": "e91d8a4ff0d9ca7e50486593a2810a06",
"score": "0.6429374",
"text": "def index\n @packaging_materials = PackagingMaterial.all\n end",
"title": ""
},
{
"docid": "51f5a41f60a8da32992c7264dd3d1c05",
"score": "0.64237374",
"text": "def index\n @spell_materials = SpellMaterial.all\n end",
"title": ""
},
{
"docid": "799dd6b707a7fdf0ca3fd44600139840",
"score": "0.64166427",
"text": "def create\n @material = Material.new(material_params)\n\n respond_to do |format|\n if @material.save\n format.html { redirect_to @material, notice: 'Material was successfully created.' }\n format.json { render :show, status: :created, location: @material }\n else\n format.html { render :new }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "799dd6b707a7fdf0ca3fd44600139840",
"score": "0.64166427",
"text": "def create\n @material = Material.new(material_params)\n\n respond_to do |format|\n if @material.save\n format.html { redirect_to @material, notice: 'Material was successfully created.' }\n format.json { render :show, status: :created, location: @material }\n else\n format.html { render :new }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "799dd6b707a7fdf0ca3fd44600139840",
"score": "0.64166427",
"text": "def create\n @material = Material.new(material_params)\n\n respond_to do |format|\n if @material.save\n format.html { redirect_to @material, notice: 'Material was successfully created.' }\n format.json { render :show, status: :created, location: @material }\n else\n format.html { render :new }\n format.json { render json: @material.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
974bf9e414c6b1f7ef85a48c118113da
|
Linux container processes Runs the "lxcps" command.
|
[
{
"docid": "13c8e676872cb714aab9bda068c5bbc0",
"score": "0.5494576",
"text": "def ps(*args)\n self.exec(\"lxc-ps\", *args).split(\"\\n\")\n end",
"title": ""
}
] |
[
{
"docid": "1664e66d9354c7cc961cf07e2faccd17",
"score": "0.57496953",
"text": "def start(*args)\n self.exec(\"lxc-start\", *args)\n end",
"title": ""
},
{
"docid": "949135f1d7f4f365d951e702f95123aa",
"score": "0.5618335",
"text": "def exec(*args)\n arguments = Array.new\n arguments << args.shift\n arguments << %(-n #{self.name})\n arguments << args\n arguments.flatten!.compact!\n\n @lxc.exec(*arguments)\n end",
"title": ""
},
{
"docid": "592bf66eb9126291279a19cbfe690969",
"score": "0.5617497",
"text": "def create_lxc_config\n\t\t@ip = self.container_ip\n\t\t@ram = self.ram\n\t\t@name = self.app_name\n\n\t\ttemplate = %{\nlxc.utsname = <%= @name %>\nlxc.mount = /var/lib/lxc/<%= @name %>/fstab\nlxc.rootfs = /var/lib/lxc/<%= @name %>/rootfs\n\n# networking\nlxc.network.type=veth\nlxc.network.flags=up\nlxc.network.link=lxcbr0\n#lxc.network.hwaddr=00:16:3e:85:68:c1\nlxc.network.name = eth0\nlxc.network.ipv4=<%= @ip %>/24\nlxc.network.ipv4.gateway = 10.0.3.1\n\nlxc.devttydir = lxc\nlxc.tty = 4\nlxc.pts = 1024\nlxc.arch = amd64\nlxc.cap.drop = sys_module mac_admin\nlxc.pivotdir = lxc_putold\n\nlxc.cgroup.memory.limit_in_bytes = <%= @ram %>M\n\n# uncomment the next line to run the container unconfined:\n#lxc.aa_profile = unconfined\n\nlxc.cgroup.devices.deny = a\n# Allow any mknod (but not using the node)\nlxc.cgroup.devices.allow = c *:* m\nlxc.cgroup.devices.allow = b *:* m\n# /dev/null and zero\nlxc.cgroup.devices.allow = c 1:3 rwm\nlxc.cgroup.devices.allow = c 1:5 rwm\n# consoles\nlxc.cgroup.devices.allow = c 5:1 rwm\nlxc.cgroup.devices.allow = c 5:0 rwm\n#lxc.cgroup.devices.allow = c 4:0 rwm\n#lxc.cgroup.devices.allow = c 4:1 rwm\n# /dev/{,u}random\nlxc.cgroup.devices.allow = c 1:9 rwm\nlxc.cgroup.devices.allow = c 1:8 rwm\nlxc.cgroup.devices.allow = c 136:* rwm\nlxc.cgroup.devices.allow = c 5:2 rwm\nlxc.cgroup.devices.allow = c 254:0 rwm\nlxc.cgroup.devices.allow = c 10:229 rwm\nlxc.cgroup.devices.allow = c 10:200 rwm\nlxc.cgroup.devices.allow = c 1:7 rwm\nlxc.cgroup.devices.allow = c 10:228 rwm\nlxc.cgroup.devices.allow = c 10:232 rwm\n}\n\n\t\terb = ERB.new(template)\n\n\t\tFile.open(\"#{@name}_config\", 'w') do |f|\n\t\t\tf.write erb.result(self.get_binding)\n\t\tend\n\n\t\tsystem(\"sudo mv #{@name}_config /var/lib/lxc/#{@name}/config\")\n\tend",
"title": ""
},
{
"docid": "3f20df6f286963195be36798f41a3c07",
"score": "0.5434269",
"text": "def c\n process_command_line preset_command: 'cp'\n end",
"title": ""
},
{
"docid": "5b6f2a3764309050133a0be8130374aa",
"score": "0.542979",
"text": "def lxc(options={})\n if (!defined?(@lxc) || @lxc.nil?)\n @lxc_runner ||= ::LXC::Runner::SSH.new(:ui => @ui, :ssh => self.ssh)\n @lxc ||= ::LXC.new(:ui => @ui, :runner => @lxc_runner)\n end\n @lxc\n end",
"title": ""
},
{
"docid": "1b30969c5c1c9454b0eeac65b1543fbd",
"score": "0.5415815",
"text": "def to_lxc\n lxc = {}\n\n # Always include default file with uids mapping\n lxc['lxc.include'] = [@lxcrc[:default_lxc_config]]\n\n # Add disks\n disks.each do |disk|\n disk.to_lxc.each do |key, val|\n if lxc[key].nil?\n lxc[key] = [val]\n else\n lxc[key] << val\n end\n end\n end\n\n # Add nics\n get_nics.each_with_index do |nic, i|\n lxc[\"lxc.net.#{i}.type\"] = 'veth'\n lxc[\"lxc.net.#{i}.link\"] = nic['BRIDGE']\n lxc[\"lxc.net.#{i}.hwaddr\"] = nic['MAC']\n lxc[\"lxc.net.#{i}.veth.pair\"] = \"one-#{@vm_id}-#{nic['NIC_ID']}\"\n end\n\n # rubocop:disable Layout/LineLength\n\n # Add cgroup limitations\n cg_version = get_cgroup_version\n\n if cg_version != 0\n # rubocop:disable Style/ConditionalAssignment\n cg_set = if cg_version == 2\n CGROUP_NAMES.keys[1]\n else\n CGROUP_NAMES.keys[0]\n end\n # rubocop:enable Style/ConditionalAssignment\n\n pre= \"lxc.#{cg_set}.\"\n\n lxc[\"#{pre}cpu.#{CGROUP_NAMES[cg_set][:cpu]}\"] = cpu_shares(cg_version)\n\n numa_nodes = get_numa_nodes\n\n if !numa_nodes.empty?\n nodes = []\n cores = []\n\n numa_nodes.each do |node|\n nodes << node['MEMORY_NODE_ID']\n cores << node['CPUS']\n end\n\n lxc[\"#{pre}cpuset.#{CGROUP_NAMES[cg_set][:cores]}\"] = cores.join(',')\n lxc[\"#{pre}cpuset.#{CGROUP_NAMES[cg_set][:nodes]}\"] = nodes.join(',')\n end\n\n memory = limits_memory\n\n lxc[\"#{pre}memory.#{CGROUP_NAMES[cg_set][:memory_max]}\"] = memory\n lxc[\"#{pre}memory.#{CGROUP_NAMES[cg_set][:memory_low]}\"] = \"#{(memory.chomp.to_f*0.9).ceil}M\"\n\n lxc[\"#{pre}memory.#{CGROUP_NAMES[cg_set][:swap]}\"] = limits_memory_swap('LXC_SWAP') if swap_limitable?\n\n # Avoid OOM to kill the process when limit is reached\n lxc[\"#{pre}memory.#{CGROUP_NAMES[cg_set][:oom]}\"] = 1\n\n # rubocop:enable Layout/LineLength\n end\n\n # User mapping\n # rubocop:disable Layout/LineLength\n\n if privileged?\n @lxcrc[:id_map] = 0\n\n lxc['lxc.include'] << \"#{@lxcrc[:profiles_location]}/profile_privileged\"\n else\n lxc['lxc.idmap'] = [\"u 0 #{@lxcrc[:id_map]} #{@lxcrc[:max_map]}\",\n \"g 0 #{@lxcrc[:id_map]} #{@lxcrc[:max_map]}\"]\n\n end\n\n # rubocop:enable Layout/LineLength\n\n # Add profiles\n lxc['lxc.include'] |= parse_profiles\n\n # logging\n # 0 = trace, 1 = debug, 2 = info, 3 = notice, 4 = warn,\n # 5 = error, 6 = critical, 7 = alert, 8 = fatal\n lxc['lxc.log.level'] = 5\n lxc['lxc.log.file'] = \"/var/log/lxc/one-#{@vm_id}.log\"\n\n # Parse RAW section (lxc values should prevail over raw section values)\n lxc = parse_raw.merge(lxc)\n\n hash_to_lxc(lxc)\n end",
"title": ""
},
{
"docid": "633fc62d38a7b184b55ac4c6dbfa9f81",
"score": "0.5398452",
"text": "def lxc\n @lxc ||= self.node.lxc.container(self.id)\n end",
"title": ""
},
{
"docid": "c56f72e20dfb1a46ca7eb3ed59a329c1",
"score": "0.52466613",
"text": "def start_container(options)\n name = options[:name]\n XLXC.setup_net(name)\n XLXC.setup_fs(name)\n if options[:daemon]\n `lxc-start -n #{name} -d`\n else\n `lxc-start -n #{name}`\n end\nend",
"title": ""
},
{
"docid": "545b2683123a9aa1fc848f8bb6d179ba",
"score": "0.5237674",
"text": "def start_action\n begin\n lxc.start\n if(ephemeral_command)\n lxc.wait_for_state(:running)\n lxc.container_command(ephemeral_command, 0) # no retries on ephemeral commands\n else\n cli_output\n lxc.wait_for_state(:stopped)\n end\n ensure\n cleanup\n end\n true\n end",
"title": ""
},
{
"docid": "5426453cd6ac1d1d2360519625ae631b",
"score": "0.5224047",
"text": "def execute_prlctl(*command, &block)\n execute(@prlctl_path, *command, &block)\n end",
"title": ""
},
{
"docid": "f175ca17810df42a91c193507ac4da7b",
"score": "0.520993",
"text": "def populate_lxc_post(options)\n post_list = []\n post_list.push(\"#!/bin/sh\")\n post_list.push(\"# Install additional pacakges\")\n post_list.push(\"\")\n post_list.push(\"export TERM=vt100\")\n post_list.push(\"export LANGUAGE=en_US.UTF-8\")\n post_list.push(\"export LANG=en_US.UTF-8\")\n post_list.push(\"export LC_ALL=en_US.UTF-8\")\n post_list.push(\"locale-gen en_US.UTF-8\")\n post_list.push(\"\")\n post_list.push(\"if [ \\\"`lsb_release -i |awk '{print $3}'`\\\" = \\\"Ubuntu\\\" ] ; then\")\n post_list.push(\" dpkg-reconfigure locales\")\n post_list.push(\" cp /etc/apt/sources.list /etc/apt/sources.list.orig\")\n post_list.push(\" sed -i 's,#{options['mirror']},#{$local_ubuntu_mirror},g' /etc/apt/sources.list.orig\")\n post_list.push(\" apt-get install -y libterm-readkey-perl 2> /dev/null\")\n post_list.push(\" apt-get install -y nfs-common 2> /dev/null\")\n post_list.push(\" apt-get install -y openssh-server 2> /dev/null\")\n post_list.push(\" apt-get install -y python-software-properties 2> /dev/null\")\n post_list.push(\" apt-get install -y software-properties-common 2> /dev/null\")\n post_list.push(\"fi\")\n post_list.push(\"\")\n repo_file = \"/etc/yum.repos.d/CentOS-Base.repo\"\n post_list.push(\"if [ \\\"`lsb_release -i |awk '{print $3}'`\\\" = \\\"Centos\\\" ] ; then\")\n post_list.push(\" sed -i 's/^mirror./#&/g' #{repo_file}\")\n post_list.push(\" sed -i 's/^#\\\\(baseurl\\\\)/\\\\1/g' #{repo_file}\")\n post_list.push(\" sed -i 's,#{$default_centos_mirror},#{$local_centos_mirror}' #{repo_file}\")\n post_list.push(\"fi\")\n post_list.push(\"\")\n return post_list\nend",
"title": ""
},
{
"docid": "b3e152a5bac8d552aec4f1f6236d4432",
"score": "0.5199946",
"text": "def run(command, *args)\n command_name = \"lxc-#{command}\"\n\n unless BIN_FILES.include?(command_name)\n raise ArgumentError, \"Invalid command: #{command_name}.\"\n end\n\n cmd = \"\"\n cmd << \"sudo \" if use_sudo == true\n cmd << \"#{command_name} #{args.join(\" \")}\".strip\n cmd << \" | #{yield}\" if block_given?\n\n # Debug if LXC_DEBUG env is set\n if ENV[\"LXC_DEBUG\"]\n puts \"Executing: #{cmd}\"\n end\n\n out = `#{cmd.strip}`\n end",
"title": ""
},
{
"docid": "7c36d207d52e1d9c280d5f5f9f0758cd",
"score": "0.51944166",
"text": "def lxc_clone\n @lxc_clone ||= self.node.lxc.container(\"#{self.id}-master\")\n end",
"title": ""
},
{
"docid": "1a6128eb91d5bf1df0ee73cd32f76f6d",
"score": "0.5194021",
"text": "def lxc_attach_command(cmd)\n id = container.id\n ['lxc-attach', '-n', id, '--', 'sh', '-c', cmd]\n end",
"title": ""
},
{
"docid": "9825be750d7c8e9dd8039550021a9eae",
"score": "0.51831883",
"text": "def execute(command, opts={})\n if(stopped?)\n cmd = Shellwords.split(command)\n result = nil\n begin\n tmp_execute_script(command, opts) do |script_path|\n result = run_command(\"lxc-execute -n #{name} -- #{script_path}\", :sudo => true)\n end\n rescue => e\n if(e.result.stderr.downcase.include?('failed to find an lxc-init'))\n $stderr.puts \"ERROR: Missing `lxc-init` installation on container (#{name}). Install lxc-init on container before using `#execute`!\"\n end\n raise\n end\n else\n raise \"Cannot execute against running container (#{name})\"\n end\n end",
"title": ""
},
{
"docid": "7f8edcf0f7042e4800ba45afdb63a137",
"score": "0.5170159",
"text": "def execute(*args)\n self.exec(\"lxc-execute\", \"-f\", self.config.filename, \"--\", *args)\n end",
"title": ""
},
{
"docid": "5250c7b57248177608cac900083f6591",
"score": "0.5117001",
"text": "def launch_process(cmd, title)\n pid = fork\n if not pid\n puts \"launching process: #{title}\"\n\tprefix = \"#{$out}/xterm_#{title}\"\n cmd_pid = \"echo $! >#{prefix}.pid\"\n\tcmd = \"xterm -T #{title} -e \\\"script -f #{prefix}.log -c '#{cmd} 2>&1'\\\"& #{cmd_pid}\"\n p cmd\n #exec(\"xterm -T ccc -e \\\"ping www.baidu.com\\\" &\")\n exec(cmd)\n end\nend",
"title": ""
},
{
"docid": "be088dca4fcf6f5b02180874d55cd70b",
"score": "0.50935537",
"text": "def initialize(lxc, one, client)\n @client = client\n\n @lxc = lxc\n @one = one\n\n @lxc_command = 'lxc'\n @lxc_command.prepend 'sudo -n ' if client.snap\n\n @rootfs_dir = \"#{@client.lxd_path}/storage-pools/default/containers/\"\\\n \"#{name}/rootfs\"\n @context_path = \"#{@rootfs_dir}/context\"\n end",
"title": ""
},
{
"docid": "57adcb1f1c9bb462686c6857c130d8f7",
"score": "0.5084414",
"text": "def prepare_domain\n cgroup_path = @one.fcrc[:cgroup_location]\n\n if @one.fcrc[:cgroup_cpu_shares] == true\n cpu_val = @one.cpu_shares\n else\n cpu_val = CGROUP_DEFAULT_SHARES\n end\n\n params = \"-c #{cgroup_path} -p #{cpu_val} -s #{@one.sysds_path}\"\\\n \" -v #{@one.vm_id}\"\n\n cmd = \"#{COMMANDS[:prepare_domain]} #{params}\"\n\n Command.execute_rc_log(cmd)\n end",
"title": ""
},
{
"docid": "b98b4f87220e0a7c45b2d70042a45abd",
"score": "0.50738883",
"text": "def execute_lxc_post(options)\n options['clientdir'] = options['lxcdir']+\"/\"+options['name']\n post_file = options['clientdir']+\"/root/post_install.sh\"\n if not File.exist?(post_file)\n post_list = populate_lxc_post()\n create_lxc_post(options['name'],post_list)\n end\n boot_lxc(options)\n post_file = \"/root/post_install.sh\"\n message = \"Information:\\tExecuting post install script on \"+options['name']\n command = \"ssh -o 'StrictHostKeyChecking no' #{options['name']} '#{post_file}'\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "dd207881b8ead454bcc1683f58f8df3c",
"score": "0.5049704",
"text": "def clone(*args)\n self.lxc.exec(\"lxc-clone\", *args)\n end",
"title": ""
},
{
"docid": "23b96f8edd437534881a3c0c32cdd606",
"score": "0.5048697",
"text": "def start_procs; end",
"title": ""
},
{
"docid": "8be4fe0e0502d7a3701164c2dcd604de",
"score": "0.50270253",
"text": "def start\n conditionally_run('prlctl', 'start', uuid)\n end",
"title": ""
},
{
"docid": "fa1cfeb728c30976b1eb5d6083294062",
"score": "0.5025123",
"text": "def list_lxc_isos()\n return\nend",
"title": ""
},
{
"docid": "8872bdb43f386b10d467df5c24596f07",
"score": "0.5011678",
"text": "def create_wrapper!\n wrapper = Tempfile.new('lxc-wrapper').tap do |file|\n file.puts \"#!/opt/vagrant/embedded/bin/ruby\"\n file.puts \"# Automatically created by vagrant-lxc\"\n file.puts <<-EOF\nclass Whitelist\n class << self\n def add(command, *args)\n list[command] << args\n end\n\n def list\n @list ||= Hash.new do |key, hsh|\n key[hsh] = []\n end\n end\n\n def allowed(command)\n list[command] || []\n end\n\n def run!(argv)\n begin\n command, args = `which \\#{argv.shift}`.chomp, argv || []\n check!(command, args)\n puts `\\#{command} \\#{args.join(\" \")}`\n exit $?.to_i\n rescue => e\n STDERR.puts e.message\n exit 1\n end\n end\n\n private\n def check!(command, args)\n allowed(command).each do |checks|\n return if valid_args?(args, checks)\n end\n raise_invalid(command, args)\n end\n\n def valid_args?(args, checks)\n return false unless valid_length?(args, checks)\n check = nil\n args.each_with_index do |provided, i|\n check = checks[i] unless check == '**'\n return false unless match?(provided, check)\n end\n true\n end\n\n def valid_length?(args, checks)\n args.length == checks.length || checks.last == '**'\n end\n\n def match?(arg, check)\n check == '**' || check.is_a?(Regexp) && !!check.match(arg) || arg == check\n end\n\n def raise_invalid(command, args)\n raise \"Invalid arguments for command \\#{command}, \" <<\n \"provided args: \\#{args.inspect}\"\n end\n end\nend\n\nbase = \"/var/lib/lxc\"\nbase_path = %r{\\\\A\\#{base}/.*\\\\z}\ntemplates_path = %r{\\\\A/usr/(share|lib|lib64|local/lib)/lxc/templates/.*\\\\z}\n\n##\n# Commands from provider.rb\n# - Check lxc is installed\nWhitelist.add '/usr/bin/which', /\\\\Alxc-\\\\w+\\\\z/\n\n##\n# Commands from driver.rb\n# - Container config file\nWhitelist.add '/bin/cat', base_path\n# - Shared folders\nWhitelist.add '/bin/mkdir', '-p', base_path\n# - Container config customizations and pruning\nWhitelist.add '/bin/cp', '-f', %r{/tmp/.*}, base_path\nWhitelist.add '/bin/chown', 'root:root', base_path\n# - Template import\nWhitelist.add '/bin/cp', %r{\\\\A.*\\\\z}, templates_path\nWhitelist.add '/bin/cp', %r{\\\\A.*\\\\z}, templates_path\nWhitelist.add '/bin/cp', %r{\\\\A.*\\\\z}, templates_path\nWhitelist.add '/bin/chmod', '+x', templates_path\n# - Template removal\nWhitelist.add '/bin/rm', templates_path\n# - Packaging\nWhitelist.add '/bin/tar', '--numeric-owner', '-cvzf', %r{/tmp/.*/rootfs.tar.gz}, '-C', base_path, './rootfs'\nWhitelist.add '/bin/chown', /\\\\A\\\\d+:\\\\d+\\\\z/, %r{\\\\A/tmp/.*/rootfs\\.tar\\.gz\\\\z}\n\n##\n# Commands from driver/cli.rb\nWhitelist.add '/usr/bin/lxc-version'\nWhitelist.add '/usr/bin/lxc-ls'\nWhitelist.add '/usr/bin/lxc-info', '--name', /.*/\nWhitelist.add '/usr/bin/lxc-create', '-B', /.*/, '--template', /.*/, '--name', /.*/, '**'\nWhitelist.add '/usr/bin/lxc-destroy', '--name', /.*/\nWhitelist.add '/usr/bin/lxc-start', '-d', '--name', /.*/, '**'\nWhitelist.add '/usr/bin/lxc-stop', '--name', /.*/\nWhitelist.add '/usr/bin/lxc-shutdown', '--name', /.*/\nWhitelist.add '/usr/bin/lxc-attach', '--name', /.*/, '**'\nWhitelist.add '/usr/bin/lxc-attach', '-h'\n\n##\n# Commands from driver/action/remove_temporary_files.rb\nWhitelist.add '/bin/rm', '-rf', %r{\\\\A\\#{base}/.*/rootfs/tmp/.*}\n\n# Watch out for stones\nWhitelist.run!(ARGV)\n EOF\n end\n wrapper.close\n wrapper.path\n end",
"title": ""
},
{
"docid": "c9eb18d88baf76fe2847f148380ad2bf",
"score": "0.500191",
"text": "def console\n self.exec(\"lxc-console\")\n end",
"title": ""
},
{
"docid": "61e4e758c6a36969dd8261d83a12e1cc",
"score": "0.50007623",
"text": "def lxc_start(vmid, node = @node)\n http_action_post \"nodes/#{node}/lxc/#{vmid}/status/start\"\n end",
"title": ""
},
{
"docid": "b9b8347fb1459ce1aecc1155752b5ec8",
"score": "0.49916774",
"text": "def imcl(cmd_options)\n cwd = Dir.pwd\n Dir.chdir(Dir.home(resource[:user]))\n command = \"#{imcl_command_path} #{cmd_options}\"\n Puppet::Util::Execution.execute(command, uid: resource[:user], combine: true, failonfail: true)\n Dir.chdir(cwd)\n end",
"title": ""
},
{
"docid": "19099df269ac42a8ccc5c256a28da5ee",
"score": "0.49731165",
"text": "def run\n puts \"Creating lxc container '#{config[:node_name]}' with ip '#{config[:node_ip]}' from template '#{config[:distro]}'\"\n\t node = LxcNode.new(config[:node_name])\n\t if config.has_key?(:lxc_template_args)\n\t\t node.create(config[:lxc_template], config[:lxc_template_args])\n\t else\n\t\t node.create(config[:lxc_template])\n\t end\n puts \"configuring conatiner auth\"\n if config.has_key?(:ssh_password)\n node.set_user_passwd(config[:ssh_user],config[:ssh_password])\n elsif\n node.set_user_sshkey(config[:ssh_user],config[:identity_file])\n else\n puts \"No passwd or ssh_key setuped for user #{config[:ssh_user]}, let's hope you don't need it...\"\n end\n puts \"Starting lxc container '#{config[:node_name]}\"\n node.start()\n puts \"Run chef client with run list: #{config[:run_list].join(' ')}\"\n bootstrap = Chef::Knife::Bootstrap.new\n bootstrap.name_args = [node.ip]\n bootstrap.config[:run_list] = config[:run_list]\n bootstrap.config[:ssh_user] = config[:ssh_user]\n bootstrap.config[:identity_file] = config[:identity_file]\n bootstrap.config[:ssh_password] = config[:ssh_password]\n bootstrap.config[:distro] = config[:distro]\n bootstrap.config[:no_host_key_verify] = true\n bootstrap.config[:use_sudo] = true unless config[:ssh_user] == 'root'\n bootstrap.run\n puts \"Node created! Details: ip => #{node.ip}, name => #{node.name} \"\n end",
"title": ""
},
{
"docid": "c5a1e92a0364be4ffacfa7f87c5c2eff",
"score": "0.4965506",
"text": "def check_processes\n %x[/usr/bin/svcs -a -H -o state,fmri | /usr/bin/grep maintenance].split(\"\\n\")\nend",
"title": ""
},
{
"docid": "e3779dc8373f967153c1c7c64c760f2d",
"score": "0.49568048",
"text": "def install_contrail_software_compute\n @compute_contrail_packages.each { |pkg| sh(\"gdebi -n #{pkg}\") }\n sh(\"apt-get -y autoremove\")\n sh(\"sync; echo 3 > /proc/sys/vm/drop_caches\")\nend",
"title": ""
},
{
"docid": "21c0a324d92cabc8f1090ccb686e8cfe",
"score": "0.49493083",
"text": "def ps!\n retrieve_processes\n end",
"title": ""
},
{
"docid": "21c0a324d92cabc8f1090ccb686e8cfe",
"score": "0.49493083",
"text": "def ps!\n retrieve_processes\n end",
"title": ""
},
{
"docid": "21c0a324d92cabc8f1090ccb686e8cfe",
"score": "0.49493083",
"text": "def ps!\n retrieve_processes\n end",
"title": ""
},
{
"docid": "9fed498a1073bd2df02fbcc5bd581aab",
"score": "0.4945725",
"text": "def ls(*args)\n self.exec(\"lxc-ls\", *args).split(\"\\n\").join(' ').split.uniq\n end",
"title": ""
},
{
"docid": "7d636bcfcd8fd9931f47c03b16d50f14",
"score": "0.49422324",
"text": "def create(*args)\n self.exec(\"lxc-create\", *args)\n end",
"title": ""
},
{
"docid": "db7927908610d3a140173e4c7f66cdad",
"score": "0.49403608",
"text": "def startup\n system('docker', 'run', '-dit', '-v', \"#{Dir.pwd}/#{config.tmp_folder}/#{config.repository_name}:/opt/current\", '--workdir', '/opt/current', '--entrypoint', '/bin/bash', '--name', config.ref_tree, config.spec['languages'])\n end",
"title": ""
},
{
"docid": "d87fb4e84d212f1bb211bdeea808945a",
"score": "0.4915483",
"text": "def docker_commands\n [\n %(RUN apt-get update),\n %(RUN DEBIAN_FRONTEND=noninteractive apt-get -y install openssh-server supervisor),\n %(RUN mkdir -p /var/run/sshd),\n %(ADD config_files/ssh_config /etc/ssh/ssh_config),\n %(ADD config_files/sshd_config /etc/ssh/sshd_config),\n %(ADD config_files/supervisord-sshd.conf /etc/supervisor/conf.d/supervisord-sshd.conf),\n %(EXPOSE 22),\n #%(RUN chmod 755 /*.sh),\n #%(CMD [\"/run.sh\"])\n ]\n end",
"title": ""
},
{
"docid": "5e7d3af0e08d39eb21cb97cac8b73b50",
"score": "0.4911926",
"text": "def launch\n command = []\n command << @adl_path\n command << @adl_extra_opts\n command << escape(@appxml_path)\n command << escape(@base_dir)\n process(command)\n end",
"title": ""
},
{
"docid": "e8113ac489c76a4c8132d8ae6910d8a6",
"score": "0.49103966",
"text": "def run\n puts \"Lxc containers list\"\n containers = `lxc-ls`.split.uniq\n server_list = [\n ui.color('Name', :bold),\n ui.color('Ip', :bold)\n ]\n containers.each do |container|\n server_list << container\n server_list << get_ip(container)\n end\n puts ui.list(server_list, :uneven_columns_across, 2)\n end",
"title": ""
},
{
"docid": "f1018bdeba25e5d600b43af0165e630b",
"score": "0.49085656",
"text": "def start\n stop\n sleep 2\n IO.popen \"virtualbox --startvm '#{@name}'\"\n end",
"title": ""
},
{
"docid": "b0456cf48b98fa9f4f853e4891b32c66",
"score": "0.49045983",
"text": "def create_centos_lxc_config(options)\n tmp_file = \"/tmp/lxc_\"+options['name']\n file = File.open(tmp_file,\"w\")\n file.write(\"\\n\")\n file.close\n return\nend",
"title": ""
},
{
"docid": "9c0e2d114b1a4a7ba403d627a953d609",
"score": "0.48927566",
"text": "def process(inputpath,cmd=nil) \n output_path =@cm.get_target_path(inputpath) \n \n cl= cmd.gsub('%executable%', @cm.get_conf(:bin_paths)[@default_command]).\n gsub('%input%',inputpath).\n gsub('%output%', output_path)\n system(cl)\n notify(\"run command #{cl}, pid=#{$?.pid} exitstatus=#{$?.exitstatus}\", :debug) \n output_path\n end",
"title": ""
},
{
"docid": "14b604d4017a3153560f6666a58d0315",
"score": "0.48873866",
"text": "def node_ssh_cpipe_command ( node, cmd, options= {})\n begin\n remote_server_addr = node.get_prefered_network_address\n pipeline = Pipeline.find(node.pipeline_id)\n ssh_login_key_file= pipeline.get_root_key_filename!\n remote_server_user = 'puser' #TODO get from options\n #server_url = \"http://pipeline1.astro.washington.edu\" #TODO get from options\n\t server_url = SERVER_DATA['server_address'] \n puts \"USER id = #{node.user_id}, SERVER addr = #{server_url}\"\n login_user = 'root'\n root_dir = pipeline.get_node_pipe_root\n shared_secret = pipeline.shared_secret\n result = nil\n Net::SSH.start( remote_server_addr, login_user,\n :host_key => \"ssh-rsa\",\n :encryption => \"blowfish-cbc\",\n :keys=> [ ssh_login_key_file],\n :verbose => :warn #:info # :debug\n ) do |ssh_session|\n # result = _do_ssh_work(ssh_session, \"su #{remote_server_user} -c \\\"cd '#{root_dir}' && /opt/local/bin/cpipe -pid #{pipeline.id} -url '#{server_url}' -sss '#{shared_secret}' #{cmd} 2>&1 | tee -a /var/tmp/astro-cpipe-commands.#{pipeline.id}.log\\\"\")\n result = _do_ssh_work(ssh_session, \"su #{remote_server_user} -c \\\"cd '#{root_dir}' && /opt/local/bin/cpipe -pid #{pipeline.id} -url '#{server_url}' -sss '#{shared_secret}' #{cmd} \\\"\")\n #logger.debug(\n\t\t puts \"node_ssh_cpipe_command: su #{remote_server_user} -c \\\"cd '#{root_dir}' && /opt/local/bin/cpipe -pid #{pipeline.id} -url '#{server_url}' -sss '#{shared_secret}' #{cmd}\\\" ===> #{result.inspect}\"\n end\n rescue Exception => e\n logger.debug(\"node_ssh_cpipe_command: error #{e.inspect}\")\n #TODO: what to really do ?\n raise e\n end\n return result\n end",
"title": ""
},
{
"docid": "dd6b853ec2c3581272728d58237f7f1f",
"score": "0.4885323",
"text": "def run_in_container_context(command, options = {})\n require 'openshift-origin-node/utils/selinux_context'\n options[:unsetenv_others] = true\n options[:uid] = @container.uid\n options[:gid] = @container.gid\n options[:selinux_context] = SelinuxContext.instance.from_defaults(mcs_label)\n ::OpenShift::Runtime::Utils::oo_spawn(command, options)\n end",
"title": ""
},
{
"docid": "c84ae0a0ee7bd4a17ff87a9a3613149f",
"score": "0.48848212",
"text": "def purge_sysvipc\n ['-m', '-q', '-s'].each do |ipctype|\n out, err, rc=::OpenShift::Runtime::Utils::oo_spawn(%{/usr/bin/ipcs -c #{ipctype} 2> /dev/null})\n out.lines do |ipcl|\n next unless ipcl=~/^\\d/\n ipcent = ipcl.split\n if ipcent[2] == @container.uuid\n # The ID may already be gone\n ::OpenShift::Runtime::Utils::oo_spawn(%{/usr/bin/ipcrm #{ipctype} #{ipcent[0]}})\n end\n end\n end\n end",
"title": ""
},
{
"docid": "940ccb18c57e54325e8de7b2a2cd6fac",
"score": "0.4883293",
"text": "def ls(*args)\n self.exec(\"lxc-ls\", *args).split(\"\\n\").uniq\n end",
"title": ""
},
{
"docid": "8f8b36995dc38f3c1d49e44bb6aca5a9",
"score": "0.48784682",
"text": "def set_lpar_proc_units(frame, lpar, units)\n execute_cmd \"chhwres -r proc -m #{frame} -o a -p #{lpar} --procunits #{units} \"\n end",
"title": ""
},
{
"docid": "926dcf47f53f0ccd7534a8ede3d01252",
"score": "0.48695529",
"text": "def start_crmux!(opts)\n self.chrome_debugging_port = find_free_port(Capybara::ChromeDevTools.preferred_port)\n self.crmux_listen_port = find_free_port(chrome_debugging_port + 1)\n opts[:options].args << \"--remote-debugging-port=#{chrome_debugging_port}\"\n #opts[:options].add_preference 'debuggerAddress', \"127.0.0.1:#{crmux_listen_port}\"\n\n @debug_crmux = true\n command = \"npx crmux #{'-d' if @debug_crmux} \\\n --port=#{chrome_debugging_port} \\\n --listen=#{crmux_listen_port}\"\n puts %(command: #{command}) if Capybara::ChromeDevTools.verbose >= 3\n if @debug_crmux\n spawn_opts = {[:out, :err] => 'log/crmux.log'}\n else\n spawn_opts = {}\n end\n @crmux_pid = spawn(command, spawn_opts)\n puts %(Started crmux [pid #{@crmux_pid}], listening at http://localhost:#{crmux_listen_port}, connected to localhost:#{chrome_debugging_port})\n # You can also get the part later with: page.driver.browser.capabilities[\"goog:chromeOptions\"][\"debuggerAddress\"]\n sleep 0.1\n\n at_exit do\n puts \"Killing crmux process #{@crmux_pid}...\" if Capybara::ChromeDevTools.verbose >= 1\n Process.kill 'TERM', @crmux_pid\n end\n end",
"title": ""
},
{
"docid": "cefcc7850734e7a0c30bb0db6c928138",
"score": "0.48444524",
"text": "def purge_sysvipc\n ['-m', '-q', '-s' ].each do |ipctype|\n out,err,rc=::OpenShift::Runtime::Utils::oo_spawn(%{/usr/bin/ipcs -c #{ipctype} 2> /dev/null})\n out.lines do |ipcl|\n next unless ipcl=~/^\\d/\n ipcent = ipcl.split\n if ipcent[2] == @container.uuid\n # The ID may already be gone\n ::OpenShift::Runtime::Utils::oo_spawn(%{/usr/bin/ipcrm #{ipctype} #{ipcent[0]}})\n end\n end\n end\n end",
"title": ""
},
{
"docid": "e8be30db2993f0af0f7b4f181a92c48d",
"score": "0.48444507",
"text": "def lpci\n puts %x{ lspci }\nend",
"title": ""
},
{
"docid": "e9977c3e15260ebbdad7e0d694ba268c",
"score": "0.48428968",
"text": "def run_in_container_root_context(command, options = {})\n options[:unsetenv_others] = true\n\n if options[:env].nil? or options[:env].empty?\n options[:env] = ::OpenShift::Runtime::Utils::Environ.for_gear(@container.container_dir)\n end\n\n if not File.exist?(\"/dev/container-id\")\n command = \"cd #{options[:chdir]} ; #{command}\" if options[:chdir]\n command = \"/usr/bin/virt-sandbox-service execute #{@container.uuid} -- /bin/bash -c '#{command}'\"\n OpenShift::Runtime::Utils::oo_spawn(command, options)\n else\n OpenShift::Runtime::Utils::oo_spawn(command, options)\n end\n end",
"title": ""
},
{
"docid": "f2bf564050b058b7495647e12e798ac1",
"score": "0.48389742",
"text": "def test_CPX_absolute\n reset_and_load_memory %w[ec 9f c0 00 ec 9f c0 00 ec 9f c0 00]\n\n @cpu.x_register = 0x80\n @cpu.write_ram(address: 0xc09f, data: 0x7f)\n @cpu.execute(address: @base_address)\n assert_equal(0x80, @cpu.x_register)\n assert_equal(false, @cpu.set?(SR_ZERO))\n assert_equal(false, @cpu.set?(SR_NEGATIVE))\n assert_equal(true, @cpu.set?(SR_CARRY))\n\n @cpu.write_ram(address: 0xc09f, data: 0x80)\n @cpu.execute(address: @cpu.program_counter)\n assert_equal(true, @cpu.set?(SR_ZERO))\n assert_equal(false, @cpu.set?(SR_NEGATIVE))\n assert_equal(true, @cpu.set?(SR_CARRY))\n\n @cpu.write_ram(address: 0xc09f, data: 0xff)\n @cpu.execute(address: @cpu.program_counter)\n assert_equal(false, @cpu.set?(SR_ZERO))\n assert_equal(true, @cpu.set?(SR_NEGATIVE))\n assert_equal(false, @cpu.set?(SR_CARRY))\n end",
"title": ""
},
{
"docid": "62c38c0079ddf70074cf23dbddc7b206",
"score": "0.48279908",
"text": "def exec(command)\n cmd = \"#{@lxc_command} exec #{@one.vm_name} -- #{command}\"\n Command.execute(cmd, true)\n end",
"title": ""
},
{
"docid": "3e10da43081732289f334cf621e131dc",
"score": "0.4822787",
"text": "def provision_cluster(vm)\n vm.provision(\n :shell, name: \"apply-calico\", path: \"provision/pod-network/calico.sh\")\nend",
"title": ""
},
{
"docid": "f5b07a795dce6afc05a59764b95808b5",
"score": "0.48001388",
"text": "def startLaneAnalysis()\n cmdPrefix = \"ruby /stornext/snfs5/next-gen/Illumina/ipipe/bin/BWA_Pipeline.rb \" +\n @fcName.to_s \n\n @laneBarcodes.each do |laneBarcode|\n cmd = cmdPrefix + \" \" + laneBarcode.to_s \n puts \"Running the command : \" + cmd.to_s\n output = `#{cmd}`\n sleep 5\n end\n end",
"title": ""
},
{
"docid": "554b6993a327e56fc5014c6293585b70",
"score": "0.47925588",
"text": "def attach(*args)\n self.exec(\"lxc-attach\", *args)\n end",
"title": ""
},
{
"docid": "d31a43e324b293278edebd07f5c36f28",
"score": "0.47831762",
"text": "def run\n puts \"Creating lxc container '#{config[:node_name]}' with ip '#{config[:node_ip]}' from template '#{config[:distro]}'\"\n node = Toft::NodeController.instance.create_node config[:node_name], {:ip => config[:node_ip], :type => config[:distro]}\n start_node node\n # HACK: is debian-specific\n run_ssh node, 'apt-get install -y wget ca-certificates'\n bootstrap_for_node(node).run\n# puts \"Run chef client with run list: #{config[:run_list].join(' ')}\"\n# run_chef node, config[:run_list], config[:environment]\n puts \"Node created! Details: ip => #{node.ip}, name => #{node.hostname} \"\n end",
"title": ""
},
{
"docid": "6271048cea15950446aca1067a45a909",
"score": "0.47770882",
"text": "def cmdline\n @proc.cmdline()\n end",
"title": ""
},
{
"docid": "9d4a49d3ae3e3861e123ba646b006376",
"score": "0.47749218",
"text": "def start!(extra_options)\n raise \"KVM for #{@machine.name} is already running\" if\n running?\n Commands.system(*(command_line + extra_options))\n end",
"title": ""
},
{
"docid": "199bf076c1f7ecdc72ce4e343801b11e",
"score": "0.476963",
"text": "def execute(cmdline)\n\n raw_pipeline = parse_pipeline(cmdline)\n cmd_pipeline = construct_pipeline(raw_pipeline)\n\n begin\n cmd_pipeline.each do |command|\n command.execute\n end\n rescue Interrupt => e\n puts \"\"\n end\n\n end",
"title": ""
},
{
"docid": "9f44756951ec9cec2f1a9b363b5d0035",
"score": "0.47666702",
"text": "def bootstrap(content)\n output = nil\n\n ZTK::RescueRetry.try(:tries => 5, :on => ContainerError) do\n tempfile = Tempfile.new(\"bootstrap\")\n lxc_tempfile = File.join(\"\", \"tmp\", File.basename(tempfile.path))\n host_tempfile = File.join(self.fs_root, lxc_tempfile)\n\n self.lxc.runner.file(:target => host_tempfile, :chmod => '0755', :chown => 'root:root') do |file|\n file.puts(content)\n end\n\n output = self.attach(%(-- /bin/bash #{lxc_tempfile}))\n\n if !(output =~ /#{lxc_tempfile}: No such file or directory/).nil?\n raise ContainerError, \"We could not find the bootstrap file!\"\n end\n end\n\n output\n end",
"title": ""
},
{
"docid": "d4f354c2604d14f19687f8d4220f5842",
"score": "0.47624505",
"text": "def create_lxc_post(options,post_list)\n tmp_file = \"/tmp/post\"\n options['clientdir'] = options['lxcdir']+\"/\"+options['name']\n post_file = options['clientdir']+\"/rootfs/root/post_install.sh\"\n file = File.open(tmp_file,\"w\")\n post_list.each do |line|\n output = line+\"\\n\"\n file.write(output)\n end\n file.close\n message = \"Information:\\tCreating post install script\"\n command = \"cp #{tmp_file} #{post_file} ; chmod +x #{post_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "9f4902c14808de6040921b8c5c31d074",
"score": "0.47470003",
"text": "def start \n `killall gammu-smsd` && puts(\"Killing Daemons!\")\n puts \"Loading Daemons......\"\n @phones.values.each do |provider|\n fork do\n exec \"gammu-smsd -c #{@datafolder+provider} &\"\n end\n end\n end",
"title": ""
},
{
"docid": "6329ecac23323dc4b51a0b17d0cc2682",
"score": "0.4744657",
"text": "def initial_complexity(complexity)\n FFMpegCommand << \"-rc_init_cplx #{complexity}\"\n end",
"title": ""
},
{
"docid": "b377dbf1989ad7e3af8af0e3b0d04d9c",
"score": "0.47305837",
"text": "def cp from, to\n ScpProcess.new( from, to, @debug_options ).run\n end",
"title": ""
},
{
"docid": "d3b5e4e67011d15aad0b0a8a0ec0062c",
"score": "0.47207797",
"text": "def detect_lxc_docker\n return false unless inspec.file('/proc/self/cgroup').exist?\n cgroup_content = inspec.file('/proc/self/cgroup').content\n if cgroup_content =~ %r{^\\d+:[^:]+:/(lxc|docker)/.+$} ||\n cgroup_content =~ %r{^\\d+:[^:]+:/[^/]+/(lxc|docker)-.+$} # rubocop:disable Layout/MultilineOperationIndentation\n @virtualization_data[:system] = $1 # rubocop:disable Style/PerlBackrefs\n @virtualization_data[:role] = 'guest'\n elsif lxc_version_exists? && cgroup_content =~ %r{\\d:[^:]+:/$}\n # lxc-version shouldn't be installed by default\n # Even so, it is likely we are on an LXC capable host that is not being used as such\n # So we're cautious here to not overwrite other existing values (OHAI-573)\n unless @virtualization_data[:system] && @virtualization_data[:role]\n @virtualization_data[:system] = 'lxc'\n @virtualization_data[:role] = 'host'\n end\n else\n return false\n end\n true\n end",
"title": ""
},
{
"docid": "fb9eed6d47ba202d8a59ca2809c85ece",
"score": "0.47100532",
"text": "def run_in_background\n FileUtils.rm_rf @options.log_folder\n FileUtils.mkdir_p @options.log_folder\n\n pid = spawn(*cli_command, %i[err out] => File.join(@options.log_folder, 'convert_videos.log'))\n nice_process pid\n report_process_priority pid\n pid\n end",
"title": ""
},
{
"docid": "760c9610c376d3d35fb0602e3a8db9c7",
"score": "0.4702961",
"text": "def start_powershell_process\n platform = RightScale::Platform\n shell = platform.shell\n\n # Import ChefNodeCmdlet.dll to allow powershell scripts to call get-ChefNode, etc.\n # Also pass in name of pipe that client needs to connect to\n lines_before_script = [\"import-module #{CHEF_NODE_CMDLET_DLL_PATH}\", \"$RS_pipeName='#{@pipe_name}'\"]\n\n # enable debug and verbose powershell output if log level allows for it.\n if Log.debug?\n lines_before_script << \"$VerbosePreference = 'Continue'\"\n lines_before_script << \"$DebugPreference = 'Continue'\"\n end\n\n # specifically disable additional error checking intended for RightScript\n # and Powershell provider in Chef. doing this to ensure that existing\n # dynamic provider scripts do not break if they have not cleared their\n # $Error list before finishing.\n lines_after_script = []\n\n command = shell.format_powershell_command4(\n ::RightScale::Platform::Shell::POWERSHELL_V1x0_EXECUTABLE_PATH,\n lines_before_script,\n lines_after_script,\n RUN_LOOP_SCRIPT_PATH)\n\n Log.debug(format_log_message(\"Starting powershell process for host #{command}\"))\n\n ::RightScale::RightPopen.popen3_async(\n command,\n :environment => nil,\n :target => self,\n :stdout_handler => :on_read_output,\n :stderr_handler => :on_read_output,\n :exit_handler => :on_exit)\n\n return true\n end",
"title": ""
},
{
"docid": "7043ff13c78bbfe20ea57e041157b46e",
"score": "0.46997538",
"text": "def set_proc_units_dlpar(units)\n #This command adds or removes, doesn't 'set'\n #TODO: add logic to make it behave like a 'set' and not an add/remove\n units > desired_proc_units ? op=\"a\" : op=\"r\"\n difference = (units-desired_proc_units).abs\n if is_running?\n if proc_mode == \"shared\"\n hmc.execute_cmd(\"chhwres -r proc -m #{frame} -o #{op} -p #{name} --procunits #{difference} \")\n elsif proc_mode == \"dedicated\"\n #Apparently if the proccessor sharing mode is 'dedicated',\n #then you need to use the --procs flag when changing processor units\n hmc.execute_cmd(\"chhwres -r proc -m #{frame} -o #{op} -p #{name} --procs #{difference} \")\n end\n end\n end",
"title": ""
},
{
"docid": "47b439741b5a9043b55716a97efd7cb1",
"score": "0.46958768",
"text": "def test_CLC\n reset_and_load_memory %w[18 00]\n\n @cpu.set_flag(SR_CARRY)\n @cpu.execute(address: @base_address)\n assert_equal(false, @cpu.set?(SR_CARRY))\n end",
"title": ""
},
{
"docid": "c06ec63ef2b720f3799ef5e4a5f102ab",
"score": "0.46859938",
"text": "def change_vbox_vm_cpu(options)\n message = \"Information:\\tSetting VirtualBox VM \"+options['name']+\" CPUs to \"+options['vcpus']\n command = \"#{options['vboxmanage']} modifyvm #{options['name']} --cpus #{options['vcpus']}\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "21a3a4ad398a1e9e1511fb39c4cd799d",
"score": "0.46763712",
"text": "def processes_start_times\n %x(#{option(:ps_command)} | grep #{option(:process_name)} | grep -v grep | awk '{print $9}')\n end",
"title": ""
},
{
"docid": "952ba86d9a937561fb98dfeb0d0c9ae2",
"score": "0.46673906",
"text": "def run_in_container_context(command, options = {})\n require 'openshift-origin-node/utils/selinux_context'\n options[:unsetenv_others] = true\n\n if options[:env].nil? or options[:env].empty?\n options[:env] = ::OpenShift::Runtime::Utils::Environ.for_gear(@container.container_dir)\n end\n\n if not File.exist?(\"/dev/container-id\")\n command = \"cd #{options[:chdir]} ; #{command}\" if options[:chdir]\n command = \"/usr/bin/nsjoin #{@container.uuid} \\\"#{command}\\\"\"\n OpenShift::Runtime::Utils::oo_spawn(command, options)\n else\n options[:uid] = @container.uid\n OpenShift::Runtime::Utils::oo_spawn(command, options)\n end\n end",
"title": ""
},
{
"docid": "b55d2a6379e5ec213a7f6d5048c05798",
"score": "0.4666682",
"text": "def testCommandLineProcessShort\n executeMaster( [ '-p', 'DummyProcess', '-u', 'DummyUser' ], :AddRegressionProcesses => true )\n end",
"title": ""
},
{
"docid": "26575bb18f5951cde17f6c9149e1ffae",
"score": "0.46541196",
"text": "def start_ephemeral(*args)\n self.lxc.exec(\"lxc-start-ephemeral\", *args)\n end",
"title": ""
},
{
"docid": "922a665a7518e8a1712dbc5df44858d1",
"score": "0.46513495",
"text": "def vm_set_cpu(conf, cpu)\n conf.vm.provider('virtualbox') { |vm| vm.cpus = cpu; }\n conf.vm.provider('vmware_fusion') { |vm| vm.vmx['numvcpus'] = cpu; }\nend",
"title": ""
},
{
"docid": "a5b45e9bf4dab6eb903302ed00c83c63",
"score": "0.46459338",
"text": "def startLaneAnalysisBarcodeFC()\n\n cmdPrefix = \"ruby /stornext/snfs5/next-gen/Illumina/ipipe/bin/BWA_Pipeline.rb \" +\n @fcName.to_s \n\n if @makeJobName == nil || @makeJobName.empty?()\n puts \"ERROR : name of make job is null or empty\"\n exit -1\n end\n\n outputFileName = @outputDir + \"/barcodes.sh\" \n\n outFile = File.open(outputFileName, \"w\")\n\n outFile.puts \"#!/bin/bash\"\n\n @laneBarcodes.each do |laneBarcode|\n cmd = cmdPrefix + \" \" + laneBarcode.to_s\n outFile.puts cmd\n end\n\n outFile.close\n\n cmd = \"sh \" + outputFileName\n obj = Scheduler.new(@fcName + \"-LaneBarcodes\", cmd)\n obj.setMemory(8000)\n obj.setNodeCores(1)\n obj.setPriority(@priority)\n obj.setDependency(@makeJobName.to_s)\n obj.runCommand()\n jobName = obj.getJobName()\n puts \"Job for command : \" + cmd + \" : \" + jobName.to_s\n end",
"title": ""
},
{
"docid": "63de56ed325071eecb9f01bba6d8c640",
"score": "0.4640703",
"text": "def spawn(automation_template, options, log_file)\n splat_args = spawn_arguments(automation_template, options)\n logger = options[:logger]\n RunLoop::Logging.log_debug(logger, \"xcrun #{splat_args.join(' ')} >& #{log_file}\")\n pid = Process.spawn('xcrun', *splat_args, {:out => log_file, :err => log_file})\n Process.detach(pid)\n pid.to_i\n end",
"title": ""
},
{
"docid": "b548de61b295ef7efea30334dae0f718",
"score": "0.46350378",
"text": "def spawn_command\n [\n @launcher.spawn_cmd_path,\n '-s', @config['listen'],\n '-U', listen_uid.to_s,\n '-G', listen_gid.to_s,\n '-M', '0660',\n '-u', uid.to_s,\n '-g', gid.to_s,\n '-C', '4',\n '-n'\n ]\n end",
"title": ""
},
{
"docid": "25faab77ebc2f1ff04e1c9ca7b057b3e",
"score": "0.46136287",
"text": "def to_lxc\n lxc = {}\n\n lxc['name'] = @vm_name\n\n lxc['config'] = {}\n lxc['devices'] = {}\n\n profile(lxc)\n memory(lxc['config'])\n cpu(lxc['config'])\n extra_config(lxc['config'])\n network(lxc['devices'])\n storage(lxc['devices']) unless wild?\n\n lxc\n end",
"title": ""
},
{
"docid": "7d1274b52ef130047e9dceb937436dbe",
"score": "0.46005678",
"text": "def testCommandLineProcess\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ], :AddRegressionProcesses => true )\n end",
"title": ""
},
{
"docid": "c4dd56f301efa12a3648182697d74804",
"score": "0.4596582",
"text": "def install\n ENV.deparallelize\n\n args=[\"--download-blopex\"]\n\n petsc_dir = Formula[\"petsc\"].prefix\n ENV['SLEPC_DIR'] = Dir.getwd\n\n ENV['PETSC_ARCH'] = \"\"\n\n petsc_arch = 'arch-darwin-cxx-debug'\n ENV['PETSC_DIR'] = \"#{petsc_dir}/#{petsc_arch}\"\n system \"./configure\", \"--prefix=#{prefix}/#{petsc_arch}\",*args\n system \"make SLEPC_DIR=$PWD PETSC_DIR=#{petsc_dir}/#{petsc_arch} \"\n system \"make SLEPC_DIR=$PWD PETSC_DIR=#{petsc_dir}/#{petsc_arch} install\"\n\n petsc_arch = 'arch-darwin-cxx-opt'\n ENV['PETSC_DIR'] = \"#{petsc_dir}/#{petsc_arch}\"\n system \"./configure\", \"--prefix=#{prefix}/#{petsc_arch}\",*args\n system \"make SLEPC_DIR=$PWD PETSC_DIR=#{petsc_dir}/#{petsc_arch} \"\n system \"make SLEPC_DIR=$PWD PETSC_DIR=#{petsc_dir}/#{petsc_arch} install\"\n\n #ENV['PETSC_DIR'] = Formula[\"petsc\"].opt_prefix\n #ENV['PETSC_ARCH'] = petsc_arch\n #system \"./configure\", \"--prefix=#{prefix}/#{petsc_arch}\"\n #system \"make PETSC_ARCH=#{petsc_arch}\"\n # system \"make PETSC_ARCH=#{petsc_arch} install\"\n # ENV['PETSC_ARCH'] = ''\n # system \"make SLEPC_DIR=#{prefix}/#{petsc_arch} test\"\n # ohai 'Test results are in ~/Library/Logs/Homebrew/slepc. Please check.'\n\n # # Link what we need.\n # include.install_symlink Dir[\"#{prefix}/#{petsc_arch}/include/*.h\"], \"#{prefix}/#{petsc_arch}/finclude\", \"#{prefix}/#{petsc_arch}/slepc-private\"\n # lib.install_symlink Dir[\"#{prefix}/#{petsc_arch}/lib/*.a\"], Dir[\"#{prefix}/#{petsc_arch}/lib/*.dylib\"]\n # prefix.install_symlink \"#{prefix}/#{petsc_arch}/conf\"\n # doc.install 'docs/slepc.pdf', Dir[\"docs/*.htm\"], 'docs/manualpages' # They're not really man pages.\n # share.install 'share/slepc/datafiles'\n end",
"title": ""
},
{
"docid": "02eb2366cc83183ede014064296f99f8",
"score": "0.45940885",
"text": "def commands_for_vm\n [{:write_file => {:filename => 'Pirate.java', :content => @process_code}},\n {:execute => {:command => 'javac -cp $LIB$/java $PATH$/Pirate.java', :stderr => 'compile', :permissions => 'read-write'}},\n {:execute => {:command => 'echo ok', :stdout => 'ok'}}]\n end",
"title": ""
},
{
"docid": "e6ca88444d855bcd52f107d343673013",
"score": "0.45884597",
"text": "def create_ubuntu_lxc_config(options)\n tmp_file = \"/tmp/lxc_\"+options['name']\n options['ip'] = single_install_ip(options)\n options['clientdir'] = options['lxcdir']+\"/\"+options['name']\n config_file = options['clientdir']+\"/config\"\n message = \"Information:\\tCreating configuration for \"+options['name']\n command = \"cp #{config_file} #{tmp_file}\"\n execute_command(options,message,command)\n copy = []\n info = IO.readlines(config_file)\n info.each do |line|\n if line.match(/hwaddr/)\n if options['mac'].to_s.match(/[0-9]/)\n output = \"lxc.network.hwaddr = \"+options['mac']+\"\\n\"\n copy.push(output)\n output = \"lxc.network.ipv4 = \"+options['ip']+\"\\n\"\n copy.push(output)\n else\n copy.push(line)\n output = \"lxc.network.ipv4 = \"+options['ip']+\"\\n\"\n copy.push(output)\n end\n else\n copy.push(line)\n end\n end\n copy = copy.join\n File.open(tmp_file,\"w\") { |file| file.write(copy) }\n message = \"Information:\\tCreating network configuration file \"+config_file\n command = \"cp #{tmp_file} #{config_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",config_file)\n file = File.open(tmp_file,\"w\")\n gateway = options['q_struct']['gateway'].value\n broadcast = options['q_struct']['broadcast'].value\n netmask = options['q_struct']['netmask'].value\n network = options['q_struct']['network_address'].value\n nameserver = options['q_struct']['nameserver'].value\n file.write(\"# The loopback network interface\\n\")\n file.write(\"auto lo\\n\")\n file.write(\"iface lo inet loopback\\n\")\n file.write(\"\\n\")\n file.write(\"auto eth0\\n\")\n file.write(\"iface eth0 inet static\\n\")\n file.write(\"address #{options['ip']}\\n\")\n file.write(\"netmask #{netmask}\\n\")\n file.write(\"gateway #{gateway}\\n\")\n file.write(\"network #{network}\\n\")\n file.write(\"broadcast #{broadcast}\\n\")\n file.write(\"dns-nameservers #{nameserver}\\n\")\n file.write(\"post-up route add default gw 192.168.1.#{options['gatewaynode']}\\n\")\n file.write(\"\\n\")\n file.close\n options['clientdir'] = options['clientdir']+\"/rootfs\"\n net_file = options['clientdir']+\"/etc/network/interfaces\"\n message = \"Information:\\tCreating network interface file \"+net_file\n command = \"cp #{tmp_file} #{net_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n user_username = options['q_struct']['user_username'].value\n user_uid = options['q_struct']['user_uid'].value\n user_gid = options['q_struct']['user_gid'].value\n user_crypt = options['q_struct']['user_crypt'].value\n root_crypt = options['q_struct']['root_crypt'].value\n user_fullname = options['q_struct']['user_fullname'].value\n user_home = options['q_struct']['user_home'].value\n user_shell = options['q_struct']['user_shell'].value\n passwd_file = options['clientdir']+\"/etc/passwd\"\n shadow_file = options['clientdir']+\"/etc/shadow\"\n info = IO.readlines(passwd_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n field = line.split(\":\")\n if field[0] != \"ubuntu\" and field[0] != \"#{user_username}\"\n file.write(line)\n end\n end\n output = user_username+\":x:\"+user_uid+\":\"+user_gid+\":\"+user_fullname+\":\"+user_home+\":\"+user_shell+\"\\n\"\n file.write(output)\n file.close\n message = \"Information:\\tCreating password file\"\n command = \"cat #{tmp_file} > #{passwd_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",passwd_file)\n info = IO.readlines(shadow_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n field = line.split(\":\")\n if field[0] != \"ubuntu\" and field[0] != \"root\" and field[0] != \"#{user_username}\"\n file.write(line)\n end\n if field[0] == \"root\"\n field[1] = root_crypt\n copy = field.join(\":\")\n file.write(copy)\n end\n end\n output = user_username+\":\"+user_crypt+\":::99999:7:::\\n\"\n file.write(output)\n file.close\n message = \"Information:\\tCreating shadow file\"\n command = \"cat #{tmp_file} > #{shadow_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",shadow_file)\n client_home = options['clientdir']+user_home\n message = \"Information:\\tCreating SSH directory for \"+user_username\n command = \"mkdir -p #{client_home}/.ssh ; cd #{options['clientdir']}/home ; chown -R #{user_uid}:#{user_gid} #{user_username}\"\n execute_command(options,message,command)\n # Copy admin user keys\n rsa_file = user_home+\"/.ssh/id_rsa.pub\"\n dsa_file = user_home+\"/.ssh/id_dsa.pub\"\n key_file = client_home+\"/.ssh/authorized_keys\"\n if File.exist?(key_file)\n system(\"rm #{key_file}\")\n end\n [rsa_file,dsa_file].each do |pub_file|\n if File.exist?(pub_file)\n message = \"Information:\\tCopying SSH public key \"+pub_file+\" to \"+key_file\n command = \"cat #{pub_file} >> #{key_file}\"\n execute_command(options,message,command)\n end\n end\n message = \"Information:\\tCreating SSH directory for root\"\n command = \"mkdir -p #{options['clientdir']}/root/.ssh ; cd #{options['clientdir']} ; chown -R 0:0 root\"\n execute_command(options,message,command)\n # Copy root keys\n rsa_file = \"/root/.ssh/id_rsa.pub\"\n dsa_file = \"/root/.ssh/id_dsa.pub\"\n key_file = options['clientdir']+\"/root/.ssh/authorized_keys\"\n if File.exist?(key_file)\n system(\"rm #{key_file}\")\n end\n [rsa_file,dsa_file].each do |pub_file|\n if File.exist?(pub_file)\n message = \"Information:\\tCopying SSH public key \"+pub_file+\" to \"+key_file\n command = \"cat #{pub_file} >> #{key_file}\"\n execute_command(options,message,command)\n end\n end\n # Fix permissions\n message = \"Information:\\tFixing SSH permissions for \"+user_username\n command = \"cd #{options['clientdir']}/home ; chown -R #{user_uid}:#{user_gid} #{user_username}\"\n execute_command(options,message,command)\n message = \"Information:\\tFixing SSH permissions for root \"\n command = \"cd #{options['clientdir']} ; chown -R 0:0 root\"\n execute_command(options,message,command)\n # Add sudoers entry\n sudoers_file = options['clientdir']+\"/etc/sudoers.d/\"+user_username\n message = \"Information:\\tCreating sudoers file \"+sudoers_file\n command = \"echo 'administrator ALL=(ALL) NOPASSWD:ALL' > #{sudoers_file}\"\n execute_command(options,message,command)\n # Add default route\n rc_file = options['clientdir']+\"/etc/rc.local\"\n info = IO.readlines(rc_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n if line.match(/exit 0/)\n output = \"route add default gw #{gateway}\\n\"\n file.write(output)\n file.write(line)\n else\n file.write(line)\n end\n end\n file.close\n message = \"Information:\\tAdding default route to \"+rc_file\n command = \"cp #{tmp_file} #{rc_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "1479b76539866862f75dc7c090e0e4c4",
"score": "0.458609",
"text": "def start_process # :nodoc:\n # Open a pipe to monitor the child startup\n r, w = IO.pipe\n\n @pid = fork do\n # Open the redirection outputs\n stdout, stderr = nil\n begin\n if redirection.respond_to?(:to_str)\n stdout = stderr = File.open(redirection_path(redirection), \"w\")\n elsif redirection\n if stdout_file = redirection[:stdout]\n stdout = File.open(redirection_path(stdout_file), \"w\")\n end\n if stderr_file = redirection[:stderr]\n stderr = File.open(redirection_path(stderr_file), \"w\")\n end\n end\n rescue Exception => e\n Roby.log_exception_with_backtrace(e, Roby, :error)\n w.write(\"#{KO_REDIRECTION}\")\n return\n end\n\n STDOUT.reopen(stdout) if stdout\n STDERR.reopen(stderr) if stderr\n\n r.close\n w.fcntl(Fcntl::F_SETFD, 1) # set close on exit\n ::Process.setpgrp\n begin\n exec(*command_line)\n rescue Errno::ENOENT\n w.write(\"#{KO_NO_SUCH_FILE}\")\n rescue Exception => e\n Roby.log_exception_with_backtrace(e, Roby, :error)\n w.write(\"#{KO_EXEC}\")\n end\n end\n\n ExternalProcess.processes[pid] = self\n\n w.close\n begin\n read, _ = select([r], nil, nil, 5)\n rescue IOError\n Process.kill(\"SIGKILL\", pid)\n retry\n end\n\n if read && (control = r.read(1))\n case Integer(control)\n when KO_REDIRECTION\n raise \"could not start #{command_line.first}: cannot establish output redirections\"\n when KO_NO_SUCH_FILE\n raise \"could not start #{command_line.first}: provided command does not exist\"\n when KO_EXEC\n raise \"could not start #{command_line.first}: exec() call failed\"\n end\n end\n\n # This block is needed as there is a race condition between the fork\n # and the assignation to ExternalProcess.processes (which is\n # required for the SIGCHLD handler to work).\n begin\n if Process.waitpid(pid, ::Process::WNOHANG)\n if exit_status = $?\n exit_status = exit_status.dup\n end\n engine.once { dead!(pid, exit_status) }\n return\n end\n rescue Errno::ECHILD\n end\n\n rescue Exception => e\n ExternalProcess.processes.delete(pid)\n raise e\n end",
"title": ""
},
{
"docid": "9034f001cd0e2c0e3df487180d3f5a54",
"score": "0.4580806",
"text": "def run_cmd\n hostfile = \"#{@p.to_s}cores.txt\"\n begin\n cmd = `echo \"#{@a} #{@b} #{@n}\" | mpirun --prefix /opt/openmpi -hostfile #{hostfile} ./trap_run`\n rescue\n return nil \n end \n\n #If the previous run failed, try again \n p = parse_output(cmd)\n if p[\"time\"] == nil then\n puts \"failed run, trying again.......\\n\"\n sleep(2)\n return run_cmd\n else\n return p\n end\n end",
"title": ""
},
{
"docid": "60b2b5b11a0de0db57e96b5cc4dc064a",
"score": "0.45802197",
"text": "def vnc_command(signal, lxc_command)\n data = @xml.element('//TEMPLATE/GRAPHICS')\n return unless data && data['TYPE'].casecmp('vnc').zero?\n\n pass = data['PASSWD']\n pass = '-' if pass.empty?\n\n case signal\n when 'start'\n command = @lxdrc[:vnc][:command]\n command = data['COMMAND'] unless data['COMMAND'].empty?\n\n \"#{data['PORT']} #{pass} #{lxc_command} exec #{@vm_name} #{command}\\n\"\n when 'stop'\n \"-#{data['PORT']}\\n\"\n end\n end",
"title": ""
},
{
"docid": "045b23e88e13011eeda606915a42609b",
"score": "0.45757455",
"text": "def start_command\n \"./bin/catalina.sh run\"\n end",
"title": ""
},
{
"docid": "045b23e88e13011eeda606915a42609b",
"score": "0.45757455",
"text": "def start_command\n \"./bin/catalina.sh run\"\n end",
"title": ""
},
{
"docid": "de653af7e752b4c2bf598198e3003a73",
"score": "0.45741546",
"text": "def exec\n container = Docker::Container.create(Image: image.id,\n Cmd: ['bash'],\n Tty: true)\n container.start\n container\n end",
"title": ""
},
{
"docid": "8e977bcf12ba62d2e2f24b760eda86e5",
"score": "0.45641527",
"text": "def container(name)\n LXC::Container.new(:lxc => self, :name => name)\n end",
"title": ""
},
{
"docid": "b228d2b5b915b0a6e91d9f06fbb1051f",
"score": "0.45511",
"text": "def direct_container_command(command, args={})\n if(args.fetch(:run_as, Lxc.container_command_via).to_sym == :ssh)\n begin\n result = connection(args).execute command\n CommandResult.new(result)\n rescue Rye::Err => e\n if(args[:raise_on_failure])\n raise CommandFailed.new(\n \"Command failed: #{command}\",\n CommandResult.new(e)\n )\n else\n false\n end\n end\n else\n tmp_execute_script(command, :networking => false) do |script_path|\n command(\"lxc-attach --clear-env -n #{name} -- #{script_path}\", args.merge(:sudo => true))\n end\n end\n end",
"title": ""
},
{
"docid": "0d46d63a099d14eedb2c0b51c49adb28",
"score": "0.45477635",
"text": "def cleanup_cgroups\n CGroup.rmpath_all(File.join(ct.cgroup_path, \"lxc.payload.#{ct.id}\"))\n CGroup.rmpath_all(File.join(ct.cgroup_path, \"lxc.monitor.#{ct.id}\"))\n CGroup.rmpath_all(File.join(ct.cgroup_path, \"lxc.pivot.#{ct.id}\"))\n end",
"title": ""
},
{
"docid": "6608c4ca8bc0111e6398de9130633a11",
"score": "0.45465448",
"text": "def vnc(signal)\n command = @one.vnc_command(signal, @lxc_command)\n return if command.nil?\n\n w = @one.lxdrc[:vnc][:width]\n h = @one.lxdrc[:vnc][:height]\n t = @one.lxdrc[:vnc][:timeout]\n\n vnc_args = \"-w #{w} -h #{h} -t #{t}\"\n\n pipe = '/tmp/svncterm_server_pipe'\n bin = 'svncterm_server'\n server = \"#{bin} #{vnc_args}\"\n\n rc, _o, e = Command.execute_once(server, true)\n\n unless [nil, 0].include?(rc)\n OpenNebula.log_error(\"#{__method__}: #{e}\\nFailed to start vnc\")\n return\n end\n\n lfd = Command.lock\n\n File.open(pipe, 'a') do |f|\n f.write command\n end\n ensure\n Command.unlock(lfd) if lfd\n end",
"title": ""
},
{
"docid": "d734f01b04f60e0f6c7fed94aa50df56",
"score": "0.45448363",
"text": "def run_cc_scripts\n log.info \"Running CC scripts\"\n Yast::Execute.on_target(\"/usr/lib/common-criteria/run\")\n end",
"title": ""
},
{
"docid": "782550eaf55a8b51bf7924af0092740e",
"score": "0.454443",
"text": "def stop\n @container.kill_procs\n out, err, rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/virt-sandbox-service stop #{@uuid}\")\n raise Exception.new(\"Failed to stop lxc container. rc=#{rc}, out=#{out}, err=#{err}\") if rc != 0\n end",
"title": ""
},
{
"docid": "9f0107f0a22e0d1410fd1fa2d2ef80e7",
"score": "0.45379362",
"text": "def exec_in_container(os)\n cmd = \"docker run -v #{KAIGARA_GEMPATH}:/root:ro --rm heliostech/kaigara:#{os} bash -c 'cd testops && ../bin/kaish sysops exec'\"\n puts \"Running: #{ cmd }\"\n stdin, stdout, stderr, wait_thr = Open3.popen3({}, cmd)\n Thread.new do\n stdout.each { |l| puts l }\n end\n Thread.new do\n stderr.each { |l| STDERR.puts l }\n end\n stdin.close\n exit_status = wait_thr.value.exitstatus\n if exit_status != 0\n raise \"Command #{ cmd } returned status code #{ exit_status }\"\n end\nend",
"title": ""
},
{
"docid": "388f5dc6c9f95ee51045d20f3f683a47",
"score": "0.45368615",
"text": "def execute_cmdstager_begin(_opts)\r\n if @target_platform.include? \"Windows\"\r\n @cmd_list.each do |command|\r\n command.insert(0, \"C:\\\\Windows\\\\System32\\\\cmd.exe /c \")\r\n end\r\n else\r\n @cmd_list.each do |command|\r\n command.insert(0, \"/bin/bash -c $@|/bin/bash . echo \")\r\n end\r\n end\r\n end",
"title": ""
}
] |
96932d06e4932ac3ff1008a2652c90d3
|
PUT /trackings/1 PUT /trackings/1.json
|
[
{
"docid": "a7d44de81c402a22c1b47b5630944cfd",
"score": "0.631741",
"text": "def update\n @tracking = Tracking.find(params[:id])\n\n respond_to do |format|\n if @tracking.update_attributes(params[:tracking])\n format.html { redirect_to @tracking, notice: 'Tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "c7faf8c55127145d7f3645fb1d60b6e0",
"score": "0.6991279",
"text": "def update\n @track = Track.find(params[:id])\n\n if @track.update(track_params)\n head :no_content\n else\n render json: @track.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c7faf8c55127145d7f3645fb1d60b6e0",
"score": "0.6991279",
"text": "def update\n @track = Track.find(params[:id])\n\n if @track.update(track_params)\n head :no_content\n else\n render json: @track.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2a5c26a091bcf264858f972fb91eb37f",
"score": "0.6905496",
"text": "def update_track! (track_id, data = {})\n check_auth :update_track\n \n response = connection.put do |req|\n req.url \"/track/update/#{track_id}\", data\n req.body = { :format => @format }\n end\n response\n end",
"title": ""
},
{
"docid": "72d2fa0246254d1bcc602d09c27e17cc",
"score": "0.67131305",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72d2fa0246254d1bcc602d09c27e17cc",
"score": "0.6711806",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72d2fa0246254d1bcc602d09c27e17cc",
"score": "0.6711806",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72d2fa0246254d1bcc602d09c27e17cc",
"score": "0.6711806",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72d2fa0246254d1bcc602d09c27e17cc",
"score": "0.6711806",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72d2fa0246254d1bcc602d09c27e17cc",
"score": "0.6711806",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d8d4e03d2acae62af13975d64648abe",
"score": "0.6594077",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d8d4e03d2acae62af13975d64648abe",
"score": "0.6594077",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d8d4e03d2acae62af13975d64648abe",
"score": "0.6594077",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d8d4e03d2acae62af13975d64648abe",
"score": "0.6594077",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d8d4e03d2acae62af13975d64648abe",
"score": "0.6594077",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "760262d4f25fa523102f551177721a76",
"score": "0.6593369",
"text": "def update\n respond_to do |format|\n if @spot_track.update(spot_track_params)\n format.html { redirect_to @spot_track, notice: 'Spot track was successfully updated.' }\n format.json { render :show, status: :ok, location: @spot_track }\n else\n format.html { render :edit }\n format.json { render json: @spot_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e94950395af59151b0bdb9e55e801231",
"score": "0.6578028",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to tracks_path }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "439332f1f6a7540594a9cd380cd3f981",
"score": "0.64468527",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "439332f1f6a7540594a9cd380cd3f981",
"score": "0.64468527",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "439332f1f6a7540594a9cd380cd3f981",
"score": "0.64468527",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c5c1af78a6bd58fd950af2f415c5232",
"score": "0.6438081",
"text": "def set_track\n @track = Track.find(params[:id])\n \n end",
"title": ""
},
{
"docid": "bec0fa455dbe1e7e7199cf01e3ed2cc3",
"score": "0.6426904",
"text": "def update\n respond_to do |format|\n if @trackable.update(trackable_params)\n format.html { redirect_to @trackable, notice: 'Trackable was successfully updated.' }\n format.json { render :show, status: :ok, location: @trackable }\n else\n format.html { render :edit }\n format.json { render json: @trackable.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb3fb07922201e98ee19453255ee1d0f",
"score": "0.6401935",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to tracks_url, notice: 'Track was successfully updated!' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe139c21dfee46091ce003d443ac1024",
"score": "0.6391802",
"text": "def update\n respond_to do |format|\n if update_track\n\n #Searchkick::ProcessQueueJob.perform_later(class_name: \"YamsCore::Track\")\n\n format.html { redirect_to yams_core.edit_track_path(@track), notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8c6270ca0b2423ebd62c44598cc299e0",
"score": "0.6364956",
"text": "def track!\n post(Staccato.tracking_uri, params)\n end",
"title": ""
},
{
"docid": "9641146940e7001de9b17982627598dc",
"score": "0.635399",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "9641146940e7001de9b17982627598dc",
"score": "0.635399",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "9641146940e7001de9b17982627598dc",
"score": "0.635399",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "d5bfc09346f11bd003a0827eda7d536d",
"score": "0.6350904",
"text": "def update\n @spotify_track = SpotifyTrack.find(params[:id])\n\n respond_to do |format|\n if @spotify_track.update_attributes(params[:spotify_track])\n format.html { redirect_to(@spotify_track, :notice => 'SpotifyTrack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spotify_track.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6336fdbcda2efd97703f82d86cafcef6",
"score": "0.6342741",
"text": "def update\n # # @track = current_user.tracks(track_params)\n # @track = current_user.tracks.find_by_id(params[:id])\n\n\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e0daee72fe7ea263ee81c55e0aac0f8c",
"score": "0.632287",
"text": "def update\n respond_to do |format|\n if @track_head.update(track_head_params)\n format.html { redirect_to @track_head, notice: 'Track head was successfully updated.' }\n format.json { render :show, status: :ok, location: @track_head }\n else\n format.html { render :edit }\n format.json { render json: @track_head.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e342b43b9e75545d8c36e4717ad0897",
"score": "0.63183844",
"text": "def track\n body = {\n get_related_updates: true,\n flatten_data: true,\n tracking_nos: [@attributes[:tracking_no]]\n }\n\n response = connection.post(self.class.tracking_path, body.to_json, self.class.headers)\n self.class.format.decode(response.body)[0]\n end",
"title": ""
},
{
"docid": "15c48a6c4a06eda73cb526cc3494e7bb",
"score": "0.63115036",
"text": "def update\n @track = track_owned_by_current_user params[:id]\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2761a2ad60e4cbdb4a9e63a236a5d468",
"score": "0.62992126",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n flash[:notice] = 'Track was successfully updated.'\n format.html { redirect_to(@track) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @track.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b4092b7a8dfbf096313f8e7c25adf183",
"score": "0.6292597",
"text": "def create\n @track = Track.new(track_params)\n\n if @track.save\n render json: @track, status: :created, location: [:v1, @track]\n else\n render json: @track.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "125973aaa424d5a0b9ea27af94a1c424",
"score": "0.62856305",
"text": "def update\n @track = Track.find(params[:id])\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to(@track, :notice => 'Track was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @track.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f4fa03fb3b2fcbe492341571786bb7df",
"score": "0.6277452",
"text": "def update\n respond_to do |format|\n if @wanted_track.update(wanted_track_params)\n format.html { redirect_to @wanted_track, notice: 'Wanted track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wanted_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa05a0f5fb50441fc9e7d5c997f18cb7",
"score": "0.6272215",
"text": "def update\n respond_to do |format|\n if @timetrack.update(timetrack_params)\n format.html { redirect_to @timetrack, success: 'Savepoint was successfully created.'}\n format.json { render :show, status: :ok, timetrack: @timetrack }\n else\n format.html { render :edit }\n format.json { render json: @timetrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "5b1b858a6e5821a5e8b45e948dc3901a",
"score": "0.62291",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "12da96385b7d183ba4b2ce709b17ed1c",
"score": "0.62232816",
"text": "def update\n respond_to do |format|\n if @tracking.update(tracking_params)\n format.html { redirect_to @tracking, notice: 'Tracking was successfully updated.' }\n format.json { render :show, status: :ok, location: @tracking }\n else\n format.html { render :edit }\n format.json { render json: @tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb49a5c5dbeae9ca137621d9107a9bf9",
"score": "0.62094736",
"text": "def update\n if params[\"label\"].present?\n params[\"label\"].each do |name|\n l = Label.find_or_create_by(:name => name.strip.downcase)\n @time_track.labels << l\n end\n end\n respond_to do |format|\n if @time_track.update(time_track_params)\n History.add_history(@time_track, current_user, 'update_timetrack')\n format.html { redirect_to @time_track, notice: 'Time track was successfully updated.' }\n format.js {render :layout => false}\n else\n format.html { render :edit }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n format.js{ render :layout => false }\n end\n end\n end",
"title": ""
},
{
"docid": "f39eae91f97b321094cdc15265d793f9",
"score": "0.6190903",
"text": "def update\n \n respond_to do |format|\n if @tracking.update(tracking_params)\n format.html { redirect_to @tracking, notice: 'Tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bed49bb610b7e433a98ba15398db1d68",
"score": "0.6184971",
"text": "def update\n respond_to do |format|\n if @track.update_attributes(params[:track])\n flash[:success] = 'Track was successfully updated.'\n format.html { redirect_to(track_path(@track)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @track.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a4ce587bb319fbab73be544a843bc789",
"score": "0.61809415",
"text": "def update\n respond_to do |format|\n if @ground_track.set(ground_track_params)\n format.html { redirect_to @ground_track, notice: 'Ground track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ground_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "961cea621469a8b7c9815a81e672bfda",
"score": "0.61740786",
"text": "def update_tracks\n unless Track.find_by_sprint_id_and_task_id feature.sprint.id, id\n new_tracks\n end\n end",
"title": ""
},
{
"docid": "76c5a3e6139d3a06e8e0f890a4ddd4bb",
"score": "0.6165331",
"text": "def set_track\n @track = Track.find(params[:id])\n @tracks = [@track]\n end",
"title": ""
},
{
"docid": "a51d4a6f587207356cd148eeb20249b6",
"score": "0.61240035",
"text": "def set_track\n @track = Track.find(params[:id])\n end",
"title": ""
},
{
"docid": "9f0051b558835aecbc69fb16db9f00b7",
"score": "0.6122469",
"text": "def update_track(track)\n self\n end",
"title": ""
},
{
"docid": "13fd45b62137722be5a6b4b5f2d4bb5d",
"score": "0.61141",
"text": "def track(params={})\n post(params)\n end",
"title": ""
},
{
"docid": "8a83e3707e4f38c611477a8c25ef6302",
"score": "0.610632",
"text": "def set_spot_track\n @spot_track = SpotTrack.find(params[:id])\n end",
"title": ""
},
{
"docid": "6a6b9591822cfc43c561cffeb0b52352",
"score": "0.6101429",
"text": "def update\n respond_to do |format|\n if @track_head2.update(track_head2_params)\n format.html { redirect_to @track_head2, notice: 'Track head2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @track_head2 }\n else\n format.html { render :edit }\n format.json { render json: @track_head2.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f7881f562d4b266394d167483b725b1",
"score": "0.60989463",
"text": "def update\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "99e103dbe69615a51338b4ff31310618",
"score": "0.6093734",
"text": "def save_track\n Baidu::Service::Track::App.save_track self\n end",
"title": ""
},
{
"docid": "1a2e764b512c6c80a40755c70aa25893",
"score": "0.6087797",
"text": "def update\n respond_to do |format|\n if @sky_track.set(sky_track_params)\n format.html { redirect_to @sky_track, notice: 'Sky track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sky_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3743170c3cef3c97db472b803d940e99",
"score": "0.6066352",
"text": "def update\n @tracker = Tracker.find(params[:tracker_id]) \n if @tracker.update(tracker_params)\n # format.html {redirect_to @tracker, notice: 'Tracker was successfully updated.' and return}\n render json: @tracker, status: :ok\n @store = Location.find_by(tracker_id: @tracker.id)\n if @store.trackinfo.instance_of? String\n original_json = JSON.parse(@store.trackinfo)\n else\n original_json = @store.trackinfo\n end\n new_json = {\n @tracker.updated_at => {\n \"trackid\" => @tracker.trackid,\n \"latitude\" => @tracker.latitude, \n \"longitude\" => @tracker.longitude, \n \"height_above_sea\" => @tracker.height_above_sea, \n \"speed\" => @tracker.speed\n }\n }\n @store.trackinfo = original_json.reverse_merge!(new_json)\n @store.save! \n else\n # format.html { render :edit }\n render json: @tracker.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1997254e6554acbe98f2aa8e8571683b",
"score": "0.60628456",
"text": "def update\n @release_track = ReleaseTrack.find(params[:id])\n\n respond_to do |format|\n if @release_track.update_attributes(params[:release_track])\n format.html { redirect_to @release_track, notice: 'Release track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @release_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ec86376623cea9ea68440850beafd1b7",
"score": "0.60628295",
"text": "def update\n respond_to do |format|\n if @time_track.update(time_track_params)\n format.html { redirect_to time_tracks_url, notice: 'Time track was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_track }\n else\n format.html { render :edit }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02bb4f542619e17532c6831bafa5de6c",
"score": "0.6057274",
"text": "def set_track\n begin\n @track = Track.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render :json => {error: 'record not found'}, status: :not_found\n end\n end",
"title": ""
},
{
"docid": "7a9cb3a08b8fee2b03d840885b9d4d50",
"score": "0.60567415",
"text": "def create\n @track = Track.create(track_params)\n render status: 200, json: @track.to_json\n end",
"title": ""
},
{
"docid": "680fdd1dc9a007bc47533cb35d16a0fa",
"score": "0.605006",
"text": "def add_track\n new_track = Track.new(track_params)\n if new_track.save\n render :json => new_track\n else\n render :json => new_track.errors.full_messages\n end\n end",
"title": ""
},
{
"docid": "80bad9c83f81bd0c2c9f73e632bc3281",
"score": "0.6044876",
"text": "def create\n @track = Track.new(track_params)\n\n if @track.save\n render json: @track, status: :created, location: @track\n else\n render json: @track.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "841f822e2af22dd8224a233f0cf22747",
"score": "0.6037376",
"text": "def update\n respond_to do |format|\n if @activity_track.update(activity_track_params)\n format.html { redirect_to @activity_track, notice: 'Activity track was successfully updated.' }\n format.json { head :no_content }\n else\n @activities = Activity.all\n format.html { render action: 'edit' }\n format.json { render json: @activity_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "648a7447a6fbe586c929fb277f462161",
"score": "0.6036505",
"text": "def track_params\n params.require(:track).permit(:name, :location, :track_id, :layout_id, :strategy_id)\n end",
"title": ""
},
{
"docid": "50914c6de95f988614fdbdcb839f1651",
"score": "0.6031225",
"text": "def track_params\n params.require(:track).permit(:title, :competition_id, :track_data)\n end",
"title": ""
},
{
"docid": "fd75000e08cff362defb0fc93eff473e",
"score": "0.6015311",
"text": "def save!\n result = JSON.parse(RestClient.put(uri, raw.to_json))\n \n # update our stats\n raw[\"_id\"] = result[\"id\"]\n raw[\"_rev\"] = result[\"rev\"] \n \n result[\"ok\"]\n end",
"title": ""
},
{
"docid": "cae01aacf1bb112c17486d6778d28f67",
"score": "0.6008075",
"text": "def update\n @temp = @track.committee\n respond_to do |format|\n if @track.update(track_params)\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { render :show, status: :ok, location: @track }\n else\n @track.committee = @temp\n format.html { render :edit, notice: 'You are the PC Chair of this conference.' }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46472db66df1c7b78400655673147e3c",
"score": "0.60074943",
"text": "def set_tracked_thing\n @tracked_thing = TrackedThing.find(params[:id])\n end",
"title": ""
},
{
"docid": "0e1da0a06e127319da58f9b4a616150c",
"score": "0.6003288",
"text": "def set_timetrack\n @timetrack = Timetrack.find(params[:id])\n end",
"title": ""
},
{
"docid": "5301f0507f6bcbd784caf6b3a5aecf05",
"score": "0.598615",
"text": "def update\n unless params[:artist].nil?\n @track.artist = Artist.find_or_initialize_by(name: params[:artist]) do |artist|\n artist.rating = 0\n end\n end\n unless params[:album].nil?\n @track.album = Album.find_or_initialize_by(name: params[:album]) do |album|\n album.rating = 0\n end\n end\n unless params[:genres].nil?\n @track.genres = []\n params[:genres].each { |genre| @track.genres << Genre.find_or_create_by(name: genre) }\n end\n @track.slug = nil\n respond_to do |format|\n if @track.update(track_params)\n format.json { render json: {track: @track.slug, album: @track.album.slug, artist: @track.artist.slug, notice: 'Track was successfully updated.'}, status: :ok, location: @track }\n else\n format.json { render json: { errors: @track.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "40e0e6b8801b60cf35575b3262821f31",
"score": "0.5984168",
"text": "def update\n respond_to do |format|\n if @acquisition_track.update(acquisition_track_params)\n format.html { redirect_to @acquisition_track, notice: 'Acquisition track was successfully updated.' }\n format.json { render :show, status: :ok, location: @acquisition_track }\n else\n format.html { render :edit }\n format.json { render json: @acquisition_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "295bac5037da47ca650d3102bcbf9c88",
"score": "0.5973186",
"text": "def track_params\n params.require(:track).permit(:happening_id, :name, :longitude, :latitude, :description, :polyline, :location, :length, :group_id)\n end",
"title": ""
},
{
"docid": "142a42e7e6f2b4885dd7b1f29c862b9b",
"score": "0.5972537",
"text": "def update\n @track_info = TrackInfo.find(params[:id])\n\n respond_to do |format|\n if @track_info.update_attributes(params[:track_info])\n flash[:notice] = 'TrackInfo was successfully updated.'\n format.html { redirect_to(@omatsuri) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @track_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e134460864dfe0646dcee5937de66ada",
"score": "0.5962472",
"text": "def update\n @tracks = Track.all\n respond_to do |format|\n if @track.update(track_params)\n p \"Option A\"\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n # format.json { render :show, status: :ok, location: @track }\n format.json { \n p \"JSON Track\"\n # render json: @tracks.to_json \n render json: @tracks.map { |track|\n track.as_json.merge({ image: url_for(track.cover_art), isPlaying: false })\n }\n }\n else\n p \"Option B\"\n format.html { render :edit }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f69cb80d7727add034fbd286d83e91ef",
"score": "0.595711",
"text": "def set_wanted_track\n @wanted_track = WantedTrack.find(params[:id])\n end",
"title": ""
},
{
"docid": "16bc77eb265e359b7cb52e122dc3cf04",
"score": "0.5947865",
"text": "def update\n respond_to do |format|\n if @mock_track.update(mock_track_params)\n format.html { redirect_to @mock_track, notice: 'Mock track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mock_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "117459a3e934b7aff3bfc3d6e512a433",
"score": "0.59418696",
"text": "def track_params\n params.require(:track).permit(:code, :name, :status)\n end",
"title": ""
},
{
"docid": "15c56914626dfb6901cf9983118ac0de",
"score": "0.5927355",
"text": "def set_time_track\n @time_track = TimeTrack.find(params[:id] || params[:time_track_id])\n end",
"title": ""
},
{
"docid": "fa5de50566e20a958ac7dd7da59098c0",
"score": "0.5927296",
"text": "def update\n @track = Track.find(params[:id], :conditions => { :user_id => current_user.id })\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n flash[:notice] = 'Track was successfully updated.'\n format.html { redirect_to tracks_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @track.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4a8522d4b268f90856ff9de5249f32a8",
"score": "0.5926826",
"text": "def track_params\n params.require(:track).permit(:title, :description, :likes, :comments, :url, :posted_by_id, :team_id)\n end",
"title": ""
}
] |
8a910a8fc5eab06f2f4eff1021c716c3
|
Devuelve la huella nutricional de un plato
|
[
{
"docid": "99d53ec8f52281677e2772297b7ed610",
"score": "0.61443675",
"text": "def new_Huella_nutricional\n\t\t((Float(self.new_VCT + self.new_GEI))/2).round(1)\n\tend",
"title": ""
}
] |
[
{
"docid": "aaa94c6ac7458336986d42612c438e8a",
"score": "0.7088777",
"text": "def plato(n)\n\t\t plat=\"#{@descripcion[n]}, #{@porcion[n]}, #{@gramos[n]}\"\n\t\t return plat\n\t end",
"title": ""
},
{
"docid": "6f549691c907be92de6414ace3102203",
"score": "0.6663754",
"text": "def huella_nutricional\n x = impacto_energetico\n y = impacto_carbono\n (x+y) / 2.0\n end",
"title": ""
},
{
"docid": "bbe47c62cbf11932fc1cb2fd4ae1564e",
"score": "0.65324324",
"text": "def huella_nutricional\n\t\t\n\t\treturn (indice_impacto_huella_carbono+indice_impacto_energia)/2.0;\n\n\tend",
"title": ""
},
{
"docid": "f8aefb8c8cfc968e43a81f98f7cefe70",
"score": "0.6517651",
"text": "def huella_nutricional\n (huellacarbono + energia) / 2.0\n end",
"title": ""
},
{
"docid": "541e1796c61c42e21daae01b05460904",
"score": "0.6511598",
"text": "def huella_nutricional\n\t\tif @alimentos.energia <= 670 \n\t\t\t@huella_energia = 1.0\n\t\telsif @alimentos.energia > 670 and @alimentos.energia <= 830\n\t\t\t@huella_energia = 2.0\n\t\telse\t\n\t\t\t@huella_energia = 3.0\n\t\tend\t\n\n\t\tif @alimentos.gases <= 800\n\t\t @huella_carbo = 1.0\n\t\telsif @alimentos.gases > 800 and @alimentos.gases <= 1200\n\t\t\t@huella_carbo = 2.0 \n\t\telse\n\t\t\t@huella_carbo = 3.0\n\t\tend\t\n\t\t\t\t\n\t\treturn (@huella_energia + @huella_carbo)/2\t\n\t end",
"title": ""
},
{
"docid": "6c734447a4199fd985b0259d717747c1",
"score": "0.64902097",
"text": "def huella_nutricional\n ((huella_energetica+huella_ambiental)/2).round(0)\n end",
"title": ""
},
{
"docid": "cb930094c1b27d3b50d678457ffab3b8",
"score": "0.64521736",
"text": "def huella_nutricional\n\t\treturn (indice_energia + huella_carbono)/2\n\tend",
"title": ""
},
{
"docid": "f0c596e2043070858a81b0eede8a6626",
"score": "0.6365403",
"text": "def huella_nutricional \n\t\t\n\t\timpactoEnergia = impacto_energia\n\t\timpactoCarbono = impacto_huella\n\n\t\treturn (impactoEnergia+impactoCarbono)/2;\n\n end",
"title": ""
},
{
"docid": "d9684c80e80b0fe4b67c4d67b8653d67",
"score": "0.63567364",
"text": "def huella_nutricional\n indiceImpactoEnergia, indiceImpactoCarbono = 0\n if valor_energetico < 670\n\t indiceImpactoEnergia = 1.0\n\t elsif valor_energetico > 830\n\t indiceImpactoEnergia = 3.0\n\t else\n\t indiceImpactoEnergia = 2.0\n \t \n\t end\n\n\t if emisionesGEI < 800\n\t indiceImpactoCarbono = 1.0\n\t elsif emisionesGEI > 1200\n indiceImpactoCarbono = 3.0\n\t else\n indiceImpactoCarbono = 2.0\n\t end\n\n\t return (indiceImpactoEnergia + indiceImpactoCarbono) / 2.0\n\n\n\t\nend",
"title": ""
},
{
"docid": "0c6fb02e9affc1ae0aaa912a2b71e403",
"score": "0.63216406",
"text": "def huella_nutricional\n\t\t@huella_energia\n\t\tif @alimentos.get_energia <=670\n\t\t\t@huella_energia=1.0\n\t\telsif @alimentos.get_energia>670 and @alimentos.get_energia<=830\n\t\t @huella_energia=2.0\n\t\telse\n\t\t @huella_energia=3.0\n\t\tend\n\n\t\t@huella_carbono\n\t\tif @alimentos.gases <=800\n\t\t\t@huella_carbono=1.0\n\t\telsif @alimentos.gases>800 and @alimentos.gases<=1200\n\t\t @huella_carbono=2.0\n\t\telse\n\t\t @huella_carbono=3.0\n\t\tend\n\t\t\n\t\treturn (@huella_carbono+@huella_energia)/2\n\tend",
"title": ""
},
{
"docid": "1a031b8e7ae27e06ff168ab3bbe51de4",
"score": "0.6305643",
"text": "def huella_nutricional\n if (valor_calorico < 670)\n aux = 1\n elsif (valor_calorico < 830)\n aux = 2\n else\n aux = 3\n end\n\n if (emisiones_gases_anuales < 0.8)\n aux2 = 1\n elsif (emisiones_gases_anuales < 1.2)\n aux2 = 2\n else\n aux2 = 3\n end\n\n return ((aux+aux2)/2.0).round(2)\n end",
"title": ""
},
{
"docid": "df780de7e2b04df3a1eec969c15d817e",
"score": "0.6303774",
"text": "def nplatos()\n\t\t plat=''\n\t\t i=0\n\t\t while i < @descripcion.size\n\t\t\t plat=plat + \"- #{@descripcion[i]}, #{@porcion[i]}, #{@gramos[i]}\\n\"\n\t\t\t i=i+1\n\t\t end\n\t\t return plat\n\t\tend",
"title": ""
},
{
"docid": "8dddf1011b9dc69366db450f07cdd392",
"score": "0.6250795",
"text": "def to_s\n\t\toutput = \"Valor Nutricional del plato: #{@nombre}\\n\"\n\t\toutput << \"Valor energetico: #{valor_energetico}\\n\"\n\t \toutput << \"Valor ambiental: #{huella}\\n\"\t\n\tend",
"title": ""
},
{
"docid": "596ac6f9fc34697a7aeb712cb88d4b07",
"score": "0.6127554",
"text": "def huella_nutricional\n indicador_energia = 2\n indicador_carbono = 2\n\n if vct < 670 then indicador_energia = 1\n elsif vct > 830 then indicador_energia = 3\n end\n if emisiones[:co2] < 800 then indicador_carbono = 1\n elsif emisiones[:co2] > 1200 then indicador_carbono = 3\n end\n\n (indicador_energia + indicador_carbono) / 2\n end",
"title": ""
},
{
"docid": "afea027654e8ecdb4776d0b6473878ac",
"score": "0.61047566",
"text": "def nombreplato(nombre)\n @nombre_plato = nombre\n end",
"title": ""
},
{
"docid": "c266c86446f6b1f4d4a61861cd7cbaef",
"score": "0.6086606",
"text": "def indicador_huella_nutricional\n ((indicador_huella_energetica+indicador_huella_ambiental)/2).round(0)\n end",
"title": ""
},
{
"docid": "dc489b9e4e6f712baa1568820e682e2b",
"score": "0.60823244",
"text": "def qtde_plantas\n ((10000/esp_ruas)/esp_plantas)*area\n end",
"title": ""
},
{
"docid": "dd823dca1bd975a037ad78c9d80855b0",
"score": "0.6043905",
"text": "def platform_unit\n @obj['PU']\n end",
"title": ""
},
{
"docid": "5fc6863176b71da28a54da196e1a10e3",
"score": "0.6014264",
"text": "def pesoTeoricoIdeal ()\n (self.datosAntropometricos.talla * 100 - 150) * 0.75 + 50\n end",
"title": ""
},
{
"docid": "e6aa2dc5121c1823449a34e58aa8e927",
"score": "0.596195",
"text": "def pesoTeoricoIdeal ()\n \t(self.talla * 100 - 150) * 0.75 + 50\n \tend",
"title": ""
},
{
"docid": "d2e9cde2536bb06f68dc00e09ae083ee",
"score": "0.58581513",
"text": "def huellaNutricional()\n \n if ( @vct <= 670 )\n indicadorEnergia = 1\n elsif ( @vct >= 670 && @vct <= 830 )\n indicadorEnergia = 2\n else\n indicadorEnergia = 3\n end\n\n if ( self.instance_of? PlatoAmbiental )\n if ( @emisionesDiarias <= 800 )\n indicadorCarbono = 1\n elsif ( @emisionesDiarias >= 800 && @emisionesDiarias <= 1200 )\n indicadorCarbono = 2\n else\n indicadorCarbono = 3\n end\n return ( indicadorEnergia + indicadorCarbono ) / 2\n\n else\n return indicadorEnergia\n end\n end",
"title": ""
},
{
"docid": "31f940743de304a5745fbe2e06784692",
"score": "0.5826052",
"text": "def kilocalorias\n ((@proteinas* 4.0.to_d)+ (@lipidos* 9.0.to_d)+ (@carbohidratos* 4.0.to_d))\n end",
"title": ""
},
{
"docid": "3eb1c856b8e24384f01e93951bbb5caa",
"score": "0.5807688",
"text": "def kilocalorias\n\t\t\t(@grasas*9)+(@hidratos_carbono*4)+(@proteinas*4)+(@sal*6)\n\t\tend",
"title": ""
},
{
"docid": "e9737bbcb098c5f7f353f844ff67ebac",
"score": "0.57848203",
"text": "def getPlateau()\n return @plateau\n end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5758677",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5758677",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5758677",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "9e33ddf1721a75f962fe567a739358d6",
"score": "0.5758677",
"text": "def minor_units; end",
"title": ""
},
{
"docid": "969e31cd809b2d6f1d718ed911d6e21b",
"score": "0.5758337",
"text": "def lutjanidae_unilobe_pretended(mesophyllous)\n pawnbrokery(paraboloid, melic_cystaster)\n end",
"title": ""
},
{
"docid": "6f741db9fb8dc0a9bfa6cca1dc5ea8a9",
"score": "0.5720064",
"text": "def build_top_plate(pt)\r\n h = @top_plate_z\r\n case roof_type\r\n when SHED_ROOF\r\n \ta = Geom::Point3d.new(0, 0, 0)\r\n \tb = Geom::Point3d.new(0, 0, h)\r\n \tc = Geom::Point3d.new(0, @base_plate_line[1].y, @base_plate_line[1].z - @base_plate_line[0].z + h)\r\n \td = Geom::Point3d.new(0, @base_plate_line[1].y, @base_plate_line[1].z - @base_plate_line[0].z)\r\n profile = [a, b, c, d ]\r\n newpt = Geom::Point3d.new(pt.x, pt.y, pt.z)\r\n \r\n lumber = Lumber.new('profile' => profile,\r\n 'depth' => width,\r\n 'origin' => newpt,\r\n 'style' => 'custom', \r\n 'orientation' => SIDE,\r\n\t\t\t\t\t\t\t'metric' => is_metric(),\r\n 'layer' => layer)\r\n \tgroup = lumber.draw\r\n when GABLE_ROOF\r\n entities = []\r\n \ta = Geom::Point3d.new(0, 0, 0)\r\n \tb = Geom::Point3d.new(0, 0, h)\r\n \tc = Geom::Point3d.new(0, @base_plate_line1[1].y, @base_plate_line1[1].z - @base_plate_line1[0].z + h)\r\n \td = Geom::Point3d.new(0, @base_plate_line1[1].y, @base_plate_line1[1].z - @base_plate_line1[0].z)\r\n profile = [a, b, c, d ]\r\n newpt = Geom::Point3d.new(pt.x, pt.y, pt.z)\r\n lumber = Lumber.new('profile' => profile,\r\n 'depth' => width,\r\n 'origin' => newpt,\r\n 'style' => 'custom', \r\n 'orientation' => SIDE,\r\n\t\t\t\t\t\t\t'metric' => is_metric(),\r\n 'layer' => layer)\r\n \tentities.push(lumber.draw())\r\n \ta = Geom::Point3d.new(0, 0, 0)\r\n \tb = Geom::Point3d.new(0, 0, h)\r\n \tc = Geom::Point3d.new(0, -@base_plate_line2[1].y, @base_plate_line2[1].z - @base_plate_line2[0].z + h)\r\n \td = Geom::Point3d.new(0, -@base_plate_line2[1].y, @base_plate_line2[1].z - @base_plate_line2[0].z)\r\n profile = [a, b, c, d ]\r\n newpt = Geom::Point3d.new(pt.x, pt.y + length, pt.z)\r\n lumber = Lumber.new('profile' => profile,\r\n 'depth' => width,\r\n 'origin' => newpt,\r\n 'style' => 'custom', \r\n 'orientation' => SIDE,\r\n\t\t\t\t\t\t\t'metric' => is_metric(),\r\n 'layer' => layer)\r\n \tentities.push(lumber.draw())\r\n \tmodel = Sketchup.active_model\r\n \tgroup = model.active_entities.add_group(entities);\r\n end\r\n\treturn group\r\nend",
"title": ""
},
{
"docid": "9ea4047fe77ed9ff1e4eadb9c4d1cd73",
"score": "0.5719084",
"text": "def to_s\n \"El plato #{@nombre} genera #{@gases} kg de CO2 y requiere #{@terreno} m2 de terreno\"\n end",
"title": ""
},
{
"docid": "1dfd3ccab6046fc95b9eb95499d913a1",
"score": "0.5699595",
"text": "def velocidade\n 250\n end",
"title": ""
},
{
"docid": "d11233fdbb647c45dea344812c79e121",
"score": "0.569601",
"text": "def set_plato\n @plato = Plato.find(params[:id])\n end",
"title": ""
},
{
"docid": "97ecc9a0d815d803b81169f03ec3d51d",
"score": "0.56699616",
"text": "def gastoEnergeticoBasal ()\n if (self.datosAntropometricos.sexo == 0)\n (10 * self.datosAntropometricos.peso) + (6.25 * self.datosAntropometricos.talla * 100) - (5 * self.datosAntropometricos.edad) - 161\n elsif (self.datosAntropometricos.sexo == 1)\n (10 * self.datosAntropometricos.peso) + (6.25 * self.datosAntropometricos.talla * 100) - (5 * self.datosAntropometricos.edad) + 5\n end\n end",
"title": ""
},
{
"docid": "554d3367b2b472bb4f9836f5ff5d7c9f",
"score": "0.56366444",
"text": "def territory; end",
"title": ""
},
{
"docid": "174fe76ee7fd09322ec28582148e8d40",
"score": "0.5582866",
"text": "def porcGrasa\n (1.2 * self.imc + 0.23 * @edad - 10.8 * @sexo - 5.4).round(1)\n end",
"title": ""
},
{
"docid": "9f754cbb74623f5085ae2109d77c2645",
"score": "0.55773944",
"text": "def kilocalorie? = unit == 'kilocalorie'",
"title": ""
},
{
"docid": "fd64224eac5c6df258d9e346c0f5192f",
"score": "0.5562285",
"text": "def peso_teorico_ideal\n ((@datos.talla * 100) - 150) * 0.75 + 50 \n end",
"title": ""
},
{
"docid": "b4d8fcd602e294147c582c771f932314",
"score": "0.5538517",
"text": "def to_s\n\t \"Nombre del plato: #{@nombreplato}\\n Alimentos: #{@alimentos} \\n Cantidades en gramos: #{@cantidadesalimentos} \\n Porcentajes proteínas #{@pproteinas} \n \tPorcentaje de carbohidratos: #{@phidratos} \\n Porcentaje de lípidos: #{@plipidos} \\n Valor calórico: #{@vct}\"\n\tend",
"title": ""
},
{
"docid": "4086324b9a288952cb22ddcbfac8eb7c",
"score": "0.5535914",
"text": "def plato_params\n params.require(:plato).permit(:nombre, :precio, :descripcion, :cantidad_personas, :imagen, :valoracion)\n end",
"title": ""
},
{
"docid": "3f73d571b9fd97b304cb1a17327c564f",
"score": "0.55245626",
"text": "def cargo\n self.cargo_representante_de_turma\n end",
"title": ""
},
{
"docid": "4b4c31d84039944c5df3f5b1cc980d79",
"score": "0.5507974",
"text": "def prodigus(faussebrayed_ratoon, laughably_enhydris)\n end",
"title": ""
},
{
"docid": "e2a05f8bba13eed8054a56a4a5d4d745",
"score": "0.55019575",
"text": "def get_plate\n @plate\n end",
"title": ""
},
{
"docid": "db72337c653f61f882b86cafcfe650ac",
"score": "0.5494973",
"text": "def temple_nomological(daybeam_morocota, basommatophorous)\n end",
"title": ""
},
{
"docid": "ead72d760bcf44d2f1b945ecdc985526",
"score": "0.5492034",
"text": "def najdi_polomer\n kolik = self.excentricity.length\n min = 999\n for i in 0..kolik - 1\n hodnota = self.excentricity[i]\n if hodnota < min\n min = hodnota\n end\n end\n self.polomer = min\n end",
"title": ""
},
{
"docid": "ae06bc46a00f7fe0996e958bde7009b0",
"score": "0.548471",
"text": "def get_precio\n\t\t@precio\n\tend",
"title": ""
},
{
"docid": "47fa14e987305bb793373e857d69a0ff",
"score": "0.54704505",
"text": "def politica\n\t\t\n\tend",
"title": ""
},
{
"docid": "f0287aeb418235d1cd7eb6fd80f52678",
"score": "0.5460116",
"text": "def to_s\n plat=\"\"\n \n plateau.each do |elm|\n elm.each do |elmt|\n plat= plat + \"#{elmt} \".chomp\n end\n plat = plat + \"\\n\"\n end\n puts plat\n end",
"title": ""
},
{
"docid": "545b082397bf6e1630dab4894a2a6f80",
"score": "0.5442544",
"text": "def gastoEnergeticoBasal ()\n \tif (self.sexo == 0)\n \t\t(10 * self.peso) + (6.25 * self.talla * 100) - (5 * self.edad) - 161\n \telsif (self..sexo == 1)\n \t\t(10 * self.peso) + (6.25 * self.talla * 100) - (5 * self.edad) + 5\n \tend\n \tend",
"title": ""
},
{
"docid": "53ecbc030ed2801e3001c6749879a0e7",
"score": "0.5436592",
"text": "def set_plato\n @plato = @restaurant.platos.find(params[:id])\n end",
"title": ""
},
{
"docid": "7794076f14fdc9f06e3bba8238e814ce",
"score": "0.542994",
"text": "def huellaNutricional()\n\t\treturn @huellaNutricional/self.size()\n\tend",
"title": ""
},
{
"docid": "28e326228c9a6bd50d254c317e31b042",
"score": "0.54225326",
"text": "def initialize(world, parent, pin_tra, group = nil)\n super(world, parent, pin_tra, group)\n MSPhysics::Newton::Piston.create(@address)\n MSPhysics::Newton::Piston.set_min(@address, DEFAULT_MIN)\n MSPhysics::Newton::Piston.set_max(@address, DEFAULT_MAX)\n MSPhysics::Newton::Piston.enable_limits(@address, DEFAULT_LIMITS_ENABLED)\n MSPhysics::Newton::Piston.set_rate(@address, DEFAULT_RATE)\n MSPhysics::Newton::Piston.set_power(@address, DEFAULT_POWER)\n MSPhysics::Newton::Piston.set_reduction_ratio(@address, DEFAULT_REDUCTION_RATIO)\n MSPhysics::Newton::Piston.set_controller(@address, DEFAULT_CONTROLLER)\n\t MSPhysics::Newton::Piston.set_controller_mode(@address, DEFAULT_CONTROLLER_MODE)\n end",
"title": ""
},
{
"docid": "4e3aef0b0ff1bcdf30d5cffe54cfa1f4",
"score": "0.54135424",
"text": "def set_producto_plato\n @producto_plato = ProductoPlato.find(params[:id])\n end",
"title": ""
},
{
"docid": "44045cd853ec217f31753160425a3b61",
"score": "0.5413337",
"text": "def componente(args = {})\n @componentes << args.slice(:plato, :precio)\n @precio += args[:precio]\n end",
"title": ""
},
{
"docid": "67351f1a1eaa64500b8ebeacab34ca67",
"score": "0.53957343",
"text": "def peso_teorico_ideal\n ((@talla*100-150)*0.75+50).round(2)\n end",
"title": ""
},
{
"docid": "60e7428ce7d7b5f1d9b889321a0a46fc",
"score": "0.5373492",
"text": "def initialize(nombre_plato, lista_alimentos, lista_gramos)\n super(nombre_plato, lista_alimentos, lista_gramos)\n end",
"title": ""
},
{
"docid": "4e2be08356f687f7393ebfcbf622ac95",
"score": "0.5372952",
"text": "def plato_params\n params.require(:plato).permit(:nombre, :img, :tiempo_preparacion, :estado)\n end",
"title": ""
},
{
"docid": "866ad0adb02f78ec45dea2e3df087b96",
"score": "0.53543496",
"text": "def stylochus_hyperdolichocephaly()\n bedcap_lollipop()\n discontinuousness(nonsurface_overshadowment)\n tilikum_iliopectineal(dioxide_peripatetic)\n end",
"title": ""
},
{
"docid": "e6568679f57519fdbd5609e9d95417d7",
"score": "0.53446233",
"text": "def test_mazzo_per_sette\n player = @round_players[0]\n extra = 6\n if player.type == :human_local\n extra = 1\n end\n index_pl_gui = (@mazzo_gioco.size - 1) - extra\n index_briscola = (@mazzo_gioco.size - 1)\n @mazzo_gioco[index_pl_gui] = :_7s\n @mazzo_gioco[index_pl_gui - 1] = :_Rs\n @mazzo_gioco[index_briscola] = :_Cs\n end",
"title": ""
},
{
"docid": "2118a3b5206836517c758e94fa44a16f",
"score": "0.53400064",
"text": "def build_plate(pt)\r\n lumber = Lumber.new(fill_options(%w[style layer metric],\r\n 'depth' => length,\r\n 'origin' => pt,\r\n 'rotation' => 90.degrees,\r\n 'orientation' => FRONT))\r\n\tgroup = lumber.draw\r\n\t# print \"group = \" + group.to_s + \"\\n\"\r\n\treturn group\r\nend",
"title": ""
},
{
"docid": "dad57efa80c8cfdd26a9d690b2357929",
"score": "0.5339566",
"text": "def glucid()\n espriella_pseudocommissure_unproportionally(jozy, anapaest_attend)\n end",
"title": ""
},
{
"docid": "9d8d9fbf152f1171266737c7e56d9285",
"score": "0.5338735",
"text": "def solar_luminosity? = unit == 'solar-luminosity'",
"title": ""
},
{
"docid": "0f814932a1d9865a7ac23bf7dcf44376",
"score": "0.5324064",
"text": "def margine_persone\n vincolo_persone - abitanti\n end",
"title": ""
},
{
"docid": "0f814932a1d9865a7ac23bf7dcf44376",
"score": "0.5324064",
"text": "def margine_persone\n vincolo_persone - abitanti\n end",
"title": ""
},
{
"docid": "afcd5eea9055f06410f7198d4d5a876b",
"score": "0.5321162",
"text": "def degustar_uno()\n\t\tif @contador == 0\n\t\t\tif @annos > 35\n\t\t\t\treturn \"El cocinero se ha jubilado y no hay mas platos disponibles\"\n\t\t\telse\n\t\t\t\treturn \"No hay platos disponibles\"\n\t\t\tend\n\t\telse\n\t\t\t@contador -= 1\n\t\t\treturn \"Que delicioso está el plato\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d3397817e6c6c948e622da55fd3ac407",
"score": "0.53103405",
"text": "def arnut(intracontinental_typographia, drudge)\n end",
"title": ""
},
{
"docid": "d91f28af17cf1061635c78ab2d685257",
"score": "0.53099185",
"text": "def get_nutrient(nutrient)\n nutrients = {protein: 'protein_g', iron: 'iron_mg', calcium: 'calcium_mg', calory: 'energ_kcal', fat: 'lipid_tot_g',\n vitC: 'vit_c_mg', vitA: 'vit_a_rae', sodium: 'sodium_mg', sugar: 'sugar_tot_g',\n carbohydrate: 'carbohydrt_g', fiber: 'fiber_td_g', saturated_fat: 'fa_sat_g', vitK: 'vit_k_ug', folate: 'folate_tot_ug',\n magnesium: 'magnesium_mg', potassium: 'potassium_mg'}\n # serving size for juice is 125 mL\n serving_size = 125\n # total volume of the juice considering the water density for the juice\n size = 0\n joint_record = self.ingredients_recipes\n ingredient_nutrient = []\n joint_record.each do |ingredient_recipe|\n q = ingredient_recipe.quantity\n u = ingredient_recipe.unit.unit_name\n case u\n when \"gr\"\n g = 1\n when \"cup\"\n g = 250\n when \"oz\"\n g = 29.58\n when \"lb\"\n g = 454\n end\n # size returns the total amount grams of the juice\n size += (q*g)\n # v is the amount of nutrient per 100 gram of an ingredient\n if (ingredient_recipe.ingredient.send(\"#{nutrients[nutrient.to_sym]}\") == nil)\n v = 0\n else\n v = ingredient_recipe.ingredient.send(\"#{nutrients[nutrient.to_sym]}\")\n end\n ingredient_nutrient << (q*g)*(v/100.0)\n end\n total_per_serving = (ingredient_nutrient.sum)/(size/125.0)\n #Calory is rounded to the nearest 10\n if nutrient == 'calory'\n return total_per_serving.round(-1)\n else\n return total_per_serving.round(2)\n end\n end",
"title": ""
},
{
"docid": "a08e2705fc8ad7b60c3dfd96099c1161",
"score": "0.5305025",
"text": "def inventory_for_superficie_presentation_unit_type_measurement\n surface = packing_material.presentation_unit_type_measure.side_dimension_x * packing_material.presentation_unit_type_measure.side_dimension_y\n inventories.map(& :quantity).inject(0) { |s,v| s += v } * surface\n end",
"title": ""
},
{
"docid": "371936c1f83ad8bab17e85029d4df676",
"score": "0.5300316",
"text": "def neto_actual_sin_ganancia\n salario_actual.neto_del_mes_acum()[:diciembre]\n end",
"title": ""
},
{
"docid": "deadef34ddc6ac69a7fa1d308b25e860",
"score": "0.529954",
"text": "def montesco(outblacken_princehood, oxyphonia_firlot, tubbable_preinspector)\n end",
"title": ""
},
{
"docid": "a8f723dcf3e2a2f77e8bdd8ce1ca29c5",
"score": "0.5299514",
"text": "def to_s\n\t\t\"\\tPlato: #{name}\\nAlimentos: #{self.Alimentos}\\nPorcentaje Proteinas: #{self.Porcentaje_prot}\\nPorcentaje Lipidos: #{self.Porcentaje_lip}\\nPorcentaje Cerbohidratos: #{self.Porcentaje_carb}\\nKcal total: #{self.VCT}\" \n\tend",
"title": ""
},
{
"docid": "05948ab0c1c4d7f631c8fb502d45f7dd",
"score": "0.52984416",
"text": "def to_s\n string= \"#{@nombrePlato}:\\n\"\n conjuntoAlimentos.size.times do |i|\n string+= \"#{conjuntoAlimentos[i].nombre}, #{conjuntoCantidades[i]};\\n\"\n end\n return string\n end",
"title": ""
},
{
"docid": "38aa1346faef6e53d6b430663f4388dd",
"score": "0.52983046",
"text": "def unitsPreference\n if @openstudio_2\n super\n else\n @units_preference\n end\n end",
"title": ""
},
{
"docid": "81939c919b5c9e3128a6bcd6c71e1031",
"score": "0.52937376",
"text": "def huella_ambiental\n eficiencia_energetica[0]/@numeroplatos\n end",
"title": ""
},
{
"docid": "07027e863cae8869ba02a0076d86e137",
"score": "0.5292156",
"text": "def area\n return @base * @altura\n end",
"title": ""
},
{
"docid": "5b2ea8f31a5992bc8a01c8a6705c8d0d",
"score": "0.5291319",
"text": "def initialize(nombre_plato, lista_alimentos, lista_gramos)\n @nombre_plato = nombre_plato\n @lista_alimentos = lista_alimentos\n @lista_gramos = lista_gramos\n end",
"title": ""
},
{
"docid": "2fa1e8ad2f9281f0df6631858787eb8b",
"score": "0.5286619",
"text": "def get_plateau_dimensions\n # get the size of the plateau from the first text line\n dimensions = next_line.split.map { |num| num.to_i }\n Plateau.instance.breadth = dimensions.first\n Plateau.instance.length = dimensions.last\n end",
"title": ""
},
{
"docid": "a1e18dcf72814fe6aa3c8c58b9626812",
"score": "0.52837485",
"text": "def on_pluto\n # Very approximate, due to a different orbital plane to the other 8 planets\n years / 247.939767283\n end",
"title": ""
},
{
"docid": "7e9809d31f5d3dc096f3c1f93a23e21e",
"score": "0.527723",
"text": "def modeler_description\n return 'The building floor area can be described as a footprint size or as a total building area. The shape can be described by its aspect ratio or can be defined as a set width.'\n end",
"title": ""
},
{
"docid": "00213cbe56e0b3ff866af82b54dd7fba",
"score": "0.52733487",
"text": "def get_cout_ha\n self.dosage * self.produit.get_prix_unitaire\n end",
"title": ""
},
{
"docid": "7fc8cb7e9bb5eec2de111ecad5716c57",
"score": "0.5273012",
"text": "def to_s\n total = 0\n output = @name\n output << \"\\n#{'=' * @name.size}\\n\\n\"\n output << \"Composición nutricional:\\n\"\n output << \"%20s\" % \"\" + \"%-10s\" % \"glúcidos\" + \"%-10s\" % \"proteínas\" + \"%-10s\" % \"lípidos\" + \"%-20s\" % \"valor energético\\n\"\n @vegetales.each{ |x, y| output << \"%-20s\" % x.nombre + \"%-10s\" % x.glucidos + \"%-10s\" % x.proteinas + \"%-10s\" % x.lipidos + \"%-20f\\n\" % (x.val_energ/100*y); total += x.val_energ/100*y}\n @frutas.each{ |x, y| output << \"%-20s\" % x.nombre + \"%-10s\" % x.glucidos + \"%-10s\" % x.proteinas + \"%-10s\" % x.lipidos + \"%-20f\\n\" % (x.val_energ/100*y); total += x.val_energ/100*y}\n @granos.each{ |x, y| output << \"%-20s\" % x.nombre + \"%-10s\" % x.glucidos + \"%-10s\" % x.proteinas + \"%-10s\" % x.lipidos + \"%-20f\\n\" % (x.val_energ/100*y); total += x.val_energ/100*y}\n @proteinas.each{ |x, y| output << \"%-20s\" % x.nombre + \"%-10s\" % x.glucidos + \"%-10s\" % x.proteinas + \"%-10s\" % x.lipidos + \"%-20f\\n\" % (x.val_energ/100*y); total += x.val_energ/100*y}\n @aceites.each{ |x, y| output << \"%-20s\" % x.nombre + \"%-10s\" % x.glucidos + \"%-10s\" % x.proteinas + \"%-10s\" % x.lipidos + \"%-20f\\n\" % (x.val_energ/100*y); total += x.val_energ/100*y}\n output << \"%-41s\" % \"Valor energético total\" + \"%20f\" % total\n output\n end",
"title": ""
},
{
"docid": "017569bad97174c638f5f77bc1b60ca5",
"score": "0.5272809",
"text": "def clasificacion # este metodo devuleve la descripcion de gtin y la base para mostrarlo en el formulario\n \t\"#{self.try(:categoria)}\" + \" \" + \"#{self.try(:division)}\" + \" \" + \"#{self.try(:grupo)}\" + \" \" + \"#{self.try(:clase)}\" + \" \" + \"#{self.try(:descripcion)}\"\n end",
"title": ""
},
{
"docid": "75484beb32984b1365bffaa92a5c7d90",
"score": "0.52646244",
"text": "def floor_area\n # @width * @length + 300\n super + 300 # `super` calls `floor_area` of `Building`\n end",
"title": ""
},
{
"docid": "3907cd99c9c449048b9d86fa515baf9b",
"score": "0.5264593",
"text": "def set_ingrediente_plato\n @ingrediente_plato = IngredientePlato.find(params[:id])\n end",
"title": ""
},
{
"docid": "6f436c53c13c4313ce4c0247e309d38f",
"score": "0.5261072",
"text": "def efectoTermogeno ()\n \tself.gastoEnergeticoBasal() * 0.10\n \tend",
"title": ""
},
{
"docid": "fcdc19fb6f31788f32bc86f0147f4724",
"score": "0.52580786",
"text": "def to_s\n\t\talimentos = \"El plato contiene : \"\n\t\t@listaAl.each do |element|\n\t\t\talimentos = alimentos + element.alimento\n\t\t\talimentos = alimentos + \" \"\n\t\tend\n\t\treturn alimentos\n\tend",
"title": ""
},
{
"docid": "3bdf5f13d5fe2829bc258d6fca0afbe6",
"score": "0.52406543",
"text": "def no_of_unit\n case property_type\n when \"sfh\", \"condo\"\n return 1\n when \"duplex\"\n return 2\n when \"triplex\"\n return 3\n when \"fourplex\"\n return 4\n end\n end",
"title": ""
},
{
"docid": "e492f0721bd367cce73f1cc51559defe",
"score": "0.523046",
"text": "def afficherPlateau\n\t\tprint @plateau\n\tend",
"title": ""
},
{
"docid": "a027683effa2edcb28e5bff268913020",
"score": "0.5230242",
"text": "def tonic\n modal = {\n ionian: 0,\n dorian: 2,\n phrygian: 4,\n lydian: 5,\n mixolydian: 7,\n aeolian: 9,\n locrian: 11\n }\n (@pitch.pitch_class - modal[@mode.to_sym]) % 12\n end",
"title": ""
},
{
"docid": "dad273570048afe94f285164174754ee",
"score": "0.5215654",
"text": "def efectoTermogeno ()\n self.gastoEnergeticoBasal() * 0.10\n end",
"title": ""
},
{
"docid": "0d8c07d40926bddd36a15f4c7e036df4",
"score": "0.52084285",
"text": "def modeler_description\n return \"Each window in the building is assigned a thermochromic window construction and a shading control. The shading control is set to increase the window tint to meet the daylighting setpoint in the zone. If the zone already has daylighting controls, the setpoints from those controls are used. If the zone does not have controls, new controls are added at the center of the zone with a setpoint of 500 lux. These controls are only used for changing the window tint; they are not used to control the interior lighting.\"\n end",
"title": ""
},
{
"docid": "1fc3d2b54d4c11f89c6e3b087c4bcc95",
"score": "0.52064896",
"text": "def modeler_description\n return '''\n This measure helps create a new thermostat for each conditioned thermal zone, and generate random heating and cooling setpoints based on a Gaussin distribution.\n '''\n end",
"title": ""
},
{
"docid": "1fc3d2b54d4c11f89c6e3b087c4bcc95",
"score": "0.52064896",
"text": "def modeler_description\n return '''\n This measure helps create a new thermostat for each conditioned thermal zone, and generate random heating and cooling setpoints based on a Gaussin distribution.\n '''\n end",
"title": ""
},
{
"docid": "ce00752b4e5c2ef83bccb699ee4f8412",
"score": "0.5203751",
"text": "def getTailleLigne\n return @plateau[0].size()\n end",
"title": ""
},
{
"docid": "d22003e2a9e6db6a11812f26874e9fed",
"score": "0.51891595",
"text": "def build_top_plate(pt)\r\n return build_plate(pt)\r\nend",
"title": ""
},
{
"docid": "1b9777fa121b9279617cc218209568b6",
"score": "0.5178501",
"text": "def getTailleLigne (plateau)\n return plateau[0].size()\n end",
"title": ""
},
{
"docid": "ede2eca816636aa29778d92ee2458a81",
"score": "0.5172656",
"text": "def vincitore_mano(carte_giocate)\r\n \r\n end",
"title": ""
},
{
"docid": "e83ce05ff527ad5a047cf200dd83967b",
"score": "0.5167638",
"text": "def minor_unit\n return @minor_unit\n end",
"title": ""
},
{
"docid": "4edf078869c27e4c3cf5f2e8a9277570",
"score": "0.5165445",
"text": "def ingrediente_plato_params\n params.require(:ingrediente_plato).permit(:ingrediente_id, :plato_id, :cantidad)\n end",
"title": ""
},
{
"docid": "c4555460957728972d95e2287ea27828",
"score": "0.51568747",
"text": "def mill_plate(pCent_x, pCent_y, plate_thickness)\r\n # # # # # # # # #\r\n print \"(MILL PLATES pCent_x=\", pCent_x, \" pCent_y=\", pCent_y, \")\\n\" \r\n print \"(plate_thick = \", plate_thickness, \")\\n\"\r\n \r\n plate_through = 0 - (plate_thickness + 0.009)\r\n print \"(plate_through = \", plate_through, \")\\n\"\r\n \r\n air_area_depth = plate_thickness * 0.60\r\n rim_thick = wall_thick / 2\r\n print \"(Air area depth =\", air_area_depth, \")\\n\"\r\n print \"(rim_thick =\", rim_thick, \")\\n\"\r\n \r\n old_bit = aMill.current_bit\r\n bit2 = CNCBit.new(aMill, \"config/bit/carbide-0.125X0.5X1.5-4flute.rb\")\r\n aMill.curr_bit = bit2\r\n bit2.recalc()\r\n print \"(new bit diam=\", mill.bit_diam, \" radius=\", mill.bit_radius, \")\\n\"\r\n \r\n \r\n print \"(center pCent_x=\", pCent_x, \" center pCent_y = \", pCent_y, \")\\n\"\r\n \r\n \r\n cut_out_diam = (wheel_diam + mill.bit_diam)\r\n cut_out_radius = cut_out_diam / 2.0\r\n print \"(Cut out diameter=\", cut_out_diam, \")\\n\"\r\n \r\n \r\n calc_wing_height = wheel_diam * 0.1 \r\n if (calc_wing_height < rim_thick* 3)\r\n calc_wing_height = rim_thick * 3\r\n end \r\n print \"(calc wing height=\", calc_wing_height, \")\\n\"\r\n \r\n \r\n \r\n inlet_beg_diam = shaft_diam + rim_thick * 1.5\r\n inlet_diam = wheel_diam * 0.25\r\n if (inlet_diam < mill.bit_diam)\r\n inlet_diam == mill.bit_diam\r\n end\r\n inlet_end_diam = inlet_beg_diam + inlet_diam\r\n inlet_beg_radius = inlet_beg_diam / 2.0\r\n inlet_end_radius = inlet_end_diam / 2.0\r\n print \"(inlet_beg_diam=\", inlet_beg_diam, \")\\n\"\r\n print \"(inlet_end_diam=\", inlet_end_diam, \")\\n\"\r\n \r\n \r\n spoke_length = wheel_diam * 0.1\r\n if (spoke_length < rim_thick)\r\n spoke_length = rim_thick * 2\r\n end \r\n spoke_beg_diam = inlet_end_diam\r\n spoke_end_diam = spoke_beg_diam + spoke_length\r\n spoke_beg_radius = spoke_beg_diam / 2.0\r\n spoke_end_radius = spoke_end_diam / 2.0\r\n print \"(spoke_beg_diam=\", spoke_beg_diam, \")\\n\"\r\n print \"(spoke_length=\", spoke_length, \")\\n\" \r\n print \"(spoke_end_diam=\", spoke_end_diam, \")\\n\"\r\n print \"(spoke_beg_radius=\", spoke_beg_radius, \")\\n\"\r\n print \"(spoke_end_radius=\", spoke_end_radius, \")\\n\"\r\n \r\n air_beg_diam = spoke_end_diam \r\n air_end_diam = wheel_diam - calc_wing_height\r\n if (air_beg_diam > air_end_diam)\r\n air_end_diam = air_air_beg_diam\r\n print \"(Warning no room for air area)\"\r\n end\r\n air_beg_radius = air_beg_diam / 2.0\r\n air_end_radius = air_end_diam / 2.0\r\n print \"(air_beg_diam=\", air_beg_diam, \")\\n\" \r\n print \"(air_end_diam=\", air_end_diam, \")\\n\"\r\n print \"(air_beg_radius=\", air_beg_radius, \")\\n\" \r\n print \"(air_end_radius=\", air_end_radius, \")\\n\"\r\n \r\n \r\n # Trace the outer wheel So we get a cleaner\r\n # finish. We trace a little larger so when\r\n # we come back to cut it out latter we get\r\n # a good cut.\r\n print \"(trace outline)\" \r\n \r\n \r\n mill.retract()\r\n curr_cepth = 0\r\n mill.move_fast(pCent_x - cut_out_radius, pCent_y)\r\n spiral_down_circle(mill, pCent_x,pCent_y,\r\n cut_out_diam + mill.cut_inc * 0.4,\r\n 0,\r\n plate_through * 0.50,\r\n adjust_for_bit_radius = false,\r\n outside = true,\r\n auto_speed_adjust = false)\r\n \r\n \r\n tSpeed = mill.speed\r\n mill.set_speed(tSpeed * 2.5)\r\n \r\n \r\n # mill the keyed axel holder\r\n mill.retract()\r\n mill_DShaft(aMill, x = pCent_x,y=pCent_y, diam=0.22, beg_z=0.0, end_z= plate_through, adjust_for_bit_radius=true)\r\n \r\n mill_end_slots(mill,pCent_x,pCent_y,\r\n (air_beg_diam + air_end_diam) / 2.0,\r\n wheel_diam + mill.bit_radius, \r\n 6, 0,\r\n 0- air_area_depth)\r\n \r\n # Mill out center holes as large as possible\r\n # without comprimising strength\r\n num_holes = 3\r\n degrees_per_hole = 360 / num_holes\r\n usable_degrees = degrees_per_hole * 0.85 \r\n beg_degree = 0 \r\n for hole_num in (1..num_holes)\r\n mill.retract()\r\n \r\n print \"(mill_plate in arc loop x=\", pCent_x, \" y=\", pCent_y, \")\\n\"\r\n \r\n arc_segment_pocket(\r\n mill, \r\n pCent_x,\r\n pCent_y,\r\n inlet_beg_radius,\r\n air_end_radius, \r\n beg_degree,\r\n beg_degree + (usable_degrees), \r\n 0,\r\n 0- air_area_depth\r\n ) \r\n \r\n mill.retract(0-air_area_depth)\r\n arc_segment_pocket(\r\n mill, \r\n pCent_x,\r\n pCent_y,\r\n inlet_beg_radius,\r\n inlet_end_radius, \r\n beg_degree,\r\n beg_degree + usable_degrees , \r\n plate_through\r\n ) \r\n mill.retract()\r\n \r\n \r\n \r\n \r\n beg_degree += degrees_per_hole \r\n \r\n end #for\r\n \r\n \r\n \r\n \r\n \r\n \r\n # Mill out the Air area\r\n mill.retract()\r\n aCircle = CNCShapeCircle.new(aMill)\r\n aCircle.beg_depth = 0.0\r\n aCircle.mill_pocket(pCent_x, pCent_y, \r\n air_end_diam, \r\n 0 - air_area_depth,\r\n island_diam = air_beg_diam - mill.bit_radius) \r\n curr_depth = 0 - air_area_depth \r\n \r\n mill.set_speed(tSpeed) \r\n \r\n\r\n # mill cutout of edge almost all the\r\n # way through.\r\n print \"(preparing to do final cutout)\\n\" \r\n mill.retract(0.05)\r\n curr_cepth = 0\r\n mill.move_fast(pCent_x - cut_out_radius, pCent_y)\r\n spiral_down_circle(mill, pCent_x,pCent_y,\r\n cut_out_diam, \r\n 0, \r\n plate_through * 0.80,\r\n adjust_for_bit_radius = false,\r\n auto_speed_adjust = false)\r\n mill.retract() \r\n \r\n mill.retract(0.05)\r\n curr_cepth = 0\r\n mill.move_fast(pCent_x, pCent_y - cut_out_radius) \r\n \r\n # Trim around the top edges.\r\n mill_circle_s(mill, pCent_x,pCent_y, \r\n cut_out_diam - (mill.bit_radius), \r\n 0 - (plate_through * 0.02),\r\n adjust_for_bit_radius=false, outside=true)\r\n \r\n # retrace the end slots to get a better finish\r\n mill_end_slots(mill,pCent_x,pCent_y,\r\n (air_beg_diam + air_end_diam) / 2.0,\r\n wheel_diam + mill.bit_radius, \r\n 6, \r\n 0- (air_area_depth),\r\n 0- (air_area_depth + (air_area_depth * 0.001))) \r\n \r\n # Cut the rest of the way except for 4 spikes\r\n mill.retract()\r\n num_spikes = 4\r\n width_of_segment = 360 / num_spikes\r\n width_of_spike = 20\r\n width_mill_area = width_of_segment - width_of_spike \r\n beg_degree = 0\r\n curr_depth = (plate_through * 0.80) - mill.cut_depth_inc\r\n while (true) \r\n curr_depth -= mill.cut_depth_inc\r\n next_depth = curr_depth - mill.cut_depth_inc\r\n if (next_depth < plate_through)\r\n next_depth = plate_through\r\n end\r\n if (curr_depth < plate_through)\r\n curr_depth = plate_through \r\n end\r\n for spik_num in 1..num_spikes\r\n mill.retract() \r\n changing_radius_curve(mill, pCent_x,pCent_y,cut_out_diam/2, beg_degree, curr_depth, cut_out_diam/2, \r\n beg_degree + width_mill_area,\r\n next_depth, pDegrees_per_step=2.0, pSkip_z_LT=nil, pSkip_z_GT=nil, pAuto_speed_adjust=false)\r\n beg_degree += width_of_segment \r\n end #for segments\r\n mill.retract()\r\n if (curr_depth == plate_through)\r\n break\r\n end\r\n end #while depth\r\n \r\n \r\n mill.home()\r\n \r\n \r\n \r\n end",
"title": ""
}
] |
066675d4dedb4f6f6bebce652b9d552f
|
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
|
[
{
"docid": "1b857122a7654efbde23598f4bb52c0f",
"score": "0.0",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DeleteResultSet.new(resp)\n return results\n end",
"title": ""
}
] |
[
{
"docid": "c4ca32683e8ce75eb6a187d63df8fa77",
"score": "0.76639634",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DoneResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "6f7a7d9be674ad4cf17d6743eb1f7836",
"score": "0.7641797",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetNextResultsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "ea872306361fc864408e8279b0199bbe",
"score": "0.7593966",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "ea872306361fc864408e8279b0199bbe",
"score": "0.7593966",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "8930e1716b013d16d7b7de258c2d40a6",
"score": "0.7570661",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BasicResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.7562012",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bf6609d69b18cbe3a5f620c672c2cbbf",
"score": "0.75597274",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "2af7c3fdbc792c97315016366b268df9",
"score": "0.74925923",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9f335c551760f3d4173d3a6cb083a0e2",
"score": "0.7487777",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ObjectSetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.74491423",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.74491423",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.74491423",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.74491423",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bb4c4c00d82ad064a5082b7afe4c48d2",
"score": "0.7447624",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "afe0e8ec443f796166358039fdecdb0d",
"score": "0.74474907",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IteratorHelper2ResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "648c8b0f1dc24c0412d5f7d4e3cea344",
"score": "0.7438828",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MultiQueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "6b4ba316137428ce500c97e409be2902",
"score": "0.7424318",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RunCommandResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "34f15f5a73f216a32c95e6c664949f2d",
"score": "0.7389863",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetMetadataResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "1239dac60dfed8a0d5b4d31e8106e390",
"score": "0.7383775",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IteratorHelper1ResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f28ec6dc9cedee6469f71c907f1704ef",
"score": "0.7383127",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveSpecificRowsOrColumnsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9fdcd1a770560eb59a2dbe7abd869eaf",
"score": "0.73820543",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9fdcd1a770560eb59a2dbe7abd869eaf",
"score": "0.73820543",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9fdcd1a770560eb59a2dbe7abd869eaf",
"score": "0.73820543",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9fdcd1a770560eb59a2dbe7abd869eaf",
"score": "0.73820543",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "855c1fa00591ce07697f8e545054fce7",
"score": "0.7377712",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MQLReadResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "a165902ed6748b64b4117b8c8b9abae7",
"score": "0.73522276",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = IteratorHelperResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "01a45040460ae3c472e612d6ad45559d",
"score": "0.73477095",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CivicResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "543e0f21a9a5617a696a566b984b2262",
"score": "0.73357207",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ObjectGetResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "d9fc5548c5903ea3474c0673f4d3a9e6",
"score": "0.7330397",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BatchResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "b545d160e048eb964734c4364860c054",
"score": "0.7312797",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = StructuredQueryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "05bac4be2091b0eb847f688449846159",
"score": "0.72956973",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SendResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "eb3f4ac33af2cc00b368b83f5b921210",
"score": "0.72914517",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = PutResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "4c3a65d523d09d06b46fa6381bd6ae1f",
"score": "0.72735226",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = FQLResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "2e0d4dea0d6309b1ed6921de241cf809",
"score": "0.72717243",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = Step1ResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e",
"score": "0.72599536",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e",
"score": "0.72599536",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e",
"score": "0.72599536",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e",
"score": "0.72599536",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "be2e71a3d96dbc3a3a57b306ce4f7a3e",
"score": "0.7255672",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "be102b9c81183d9f8bd4d09a7fdce73a",
"score": "0.72510105",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = MakeCallResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "ba8fbcad6ce69ca11b25814f5c7d80e7",
"score": "0.72424424",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetValuesFromXMLResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "e374c864ae8365e83576224986afc8db",
"score": "0.7237946",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RunRightScriptResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "c640cb069c5325833bd1f90f353677cf",
"score": "0.7233013",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReplyResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "03e4ddb0fbc8ad7e8fed24e516422ee5",
"score": "0.7232028",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = Step2ResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "da581a489c99b7ffa036d73d31deb567",
"score": "0.7231047",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RequestResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "afe71b77fbb9b12089a4f05186d7a93f",
"score": "0.72046906",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BillResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "02533070f2fee1b7c51ffcfb358467fc",
"score": "0.7194001",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RunInstancesResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "a527666f0126166571e60612e4c25b27",
"score": "0.71933115",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9de8750a58a9526fbdee57ac41e90203",
"score": "0.71887404",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ParseResponseResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "54f48540754909bc086af097cb2575d7",
"score": "0.7184124",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = XLSToXMLResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "973dca0d927cf5e0927d87002d02cb4e",
"score": "0.71660966",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CompleteEntryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "2d80834625bd1cf93415aa6aee3849b8",
"score": "0.7155356",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReadProductResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "62cbf9188960f4e3579331a0940c0958",
"score": "0.71538115",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetRequestResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "36a3ae9b6c96bb8c08a7ad4cd30ed18c",
"score": "0.7152561",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ExecuteViewsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "5dcada835dd4f5661948bcc1afb69b1f",
"score": "0.7147464",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReadActionsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "546f796abecb4a53efd4abd86391d9fe",
"score": "0.7142717",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ColumnsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "04486efd3eefc68f700419fbb9ac3d1c",
"score": "0.713733",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateActionResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "5a968378a28e150e178cf6c07cbaefd3",
"score": "0.71348464",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ReadRunsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "9b3005154a1b6ab53713f1ddc148f13d",
"score": "0.7123863",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetEntityResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f3548ebc7ee3a9e55a11c1017d9ae306",
"score": "0.7122013",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetStatusResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "d40537899945eadb9ffb703dec94db88",
"score": "0.7107206",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateRunResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "070004d2425f03200a0bfaf85b97fbc0",
"score": "0.7105372",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetRecordResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "3c4057ad4872f4dc31fb615931da74eb",
"score": "0.7105145",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateRequestResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "409fcd9d77023f2d8987b5f8e05def02",
"score": "0.71037024",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = PromptResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "0c4b8dcec2478b63814035cead2c697f",
"score": "0.71025413",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = XMLResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "550802d802281c5bead9f1836a8dd4f3",
"score": "0.70984364",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ObjectUpdateResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "33fe7f64c30effa42e552f81862db2fb",
"score": "0.70921504",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = CreateWantsToReadResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "ce00867599ac0237408f7c0f396a40ed",
"score": "0.70896024",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetInstanceResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f97a7bd13d335a38327ac328f1ea794e",
"score": "0.708848",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BatchHelperVersion9ResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "3d51df9e4ec249f86008ab8460df25f1",
"score": "0.7088256",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = UpdateWantsToReadResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "89345f402106c25cde12e1484b175b2f",
"score": "0.70863056",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ByIDResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "c5ff4261c62823872d930ef8c5d2a4b1",
"score": "0.70850044",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrieveObjectResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f414f475e00c01cab69153edccf57d9b",
"score": "0.7079918",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SeriesResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "5157f9b8dcc2756d8bc274f2ffca783a",
"score": "0.7079187",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetEntryResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "dc572ee0e3ff2c0edde3d0f62a304488",
"score": "0.7072195",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListedResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f971bba6c1135825990f5dca6f6e740a",
"score": "0.70647645",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = EndItemResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f4f33869b9bf248ee3302246637d8e18",
"score": "0.706404",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = InfluenceResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "77bf542a39db31850ec6ecd794d13113",
"score": "0.7061568",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = LeadershipPACsResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "0ee572471a295b58d45bfd8ea90c6c19",
"score": "0.7052522",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "0ee572471a295b58d45bfd8ea90c6c19",
"score": "0.7052522",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "0ee572471a295b58d45bfd8ea90c6c19",
"score": "0.7052522",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "0ee572471a295b58d45bfd8ea90c6c19",
"score": "0.7052522",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "0ee572471a295b58d45bfd8ea90c6c19",
"score": "0.7052522",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListAllResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f12b25229dc0d7f5aeb720aec7dd0fad",
"score": "0.70521766",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShareResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "f12b25229dc0d7f5aeb720aec7dd0fad",
"score": "0.70521766",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ShareResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "e3506f6b0376127238b649b3d7106521",
"score": "0.7051334",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetBatchEntitiesResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "cbaab2aa9aa5f4134435a7e41c36275e",
"score": "0.7048862",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = HereNowResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "e58c7422dbc490d17e70263cdd8227e4",
"score": "0.70482516",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RetrievePlanResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "bede436b8562b6553f3d58aed04867c3",
"score": "0.7046229",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = BooksResultSet.new(resp)\n return results\n end",
"title": ""
}
] |
42384a48a310b2c7e2f01a93352ae979
|
Returns true if the given token matches the digest
|
[
{
"docid": "ccf1dd4fda2592dea22553a6fc9e9cbe",
"score": "0.0",
"text": "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
}
] |
[
{
"docid": "8ddd0f11de4f651615620fb44c9e44e9",
"score": "0.8236084",
"text": "def matches_token?(digest, token)\n if digest.present?\n BCrypt::Password.new(digest).is_password?(token)\n else\n false\n end\n rescue BCrypt::Errors::InvalidHash\n false\n end",
"title": ""
},
{
"docid": "aaebb583416029d57fe1f47c3b7ef743",
"score": "0.7698801",
"text": "def secure_match?(token)\n ActiveSupport::SecurityUtils.secure_compare(\n ::Digest::SHA256.hexdigest(token),\n ::Digest::SHA256.hexdigest(verification_token)\n )\n end",
"title": ""
},
{
"docid": "4906d1495f7fe4e319efe4d74ec2b18f",
"score": "0.7347927",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n #comparing rem_token and digest\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "1d928a925f2d188c0c64dff70ccfc539",
"score": "0.7270992",
"text": "def match_remdig(token)\n # following return prevents BCrypt from throwing exception\n return false if remember_digest.nil?\n BCrypt::Password.new(remember_digest) == token\n end",
"title": ""
},
{
"docid": "b5ee8e2831fd9da98ecde79ec4a6b7d5",
"score": "0.72430086",
"text": "def digest_matches?(digest, password)\n ::Argon2::Password.verify_password(password, digest, pepper)\n end",
"title": ""
},
{
"docid": "c20bbd5062a91949391e22d0f92a25c6",
"score": "0.71371895",
"text": "def verify_token(attribute, token)\n # Retrieve the hashed token\n digest = send(\"#{attribute}_token\")\n return false if digest.nil?\n\n # If the token is a password reset token check that the time period is still valid\n return false if attribute == \"reset_password\" && (reset_password_sent_at + 4.hours) < Time.now.utc\n\n # Test that the token matches the stored token hash\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "cc88cbace7fc30bf3b0888a803da36f0",
"score": "0.71301675",
"text": "def token_authentic?(token)\n rcode = self.attribute_names.select do |attr|\n attr.split(\"_\").last.eql?(\"digest\") ?\n BCrypt::Password.new(self[attr]).is_password?(token) : false\n end.any? # any? returns true/false if any digest matched\n Rails.logger.debug \" #{self.class.name}.#{__method__} called for #{username}'s Token Valid=#{rcode}\"\n rcode\n end",
"title": ""
},
{
"docid": "d862ffdc1f138cbb42733bd71d7feb91",
"score": "0.70948577",
"text": "def authentic_token?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "4257e50eb1db186bf6c8a02327c5e3ea",
"score": "0.7065759",
"text": "def digest_matches?(digest, password)\n bcrypt = bcrypt_from_digest(digest)\n return false if bcrypt.nil?\n\n password = \"#{password}#{pepper}\" if pepper.present?\n password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n\n ::Sorcery::CryptoProviders.secure_compare(bcrypt, password)\n end",
"title": ""
},
{
"docid": "c074c619f8553dafdf9ed39bc99dbb38",
"score": "0.70507497",
"text": "def secure_token_compare(token)\n a = self.access_token\n b = token\n\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"title": ""
},
{
"docid": "71b653c76175346bcbe44b2f6603ddb6",
"score": "0.703817",
"text": "def is_authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n # Matching token given with digest\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "95f66cf5ede178997a58f896b929322e",
"score": "0.70042443",
"text": "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n password = BCrypt::Password.new(digest)\n password == token ? true : false\n end",
"title": ""
},
{
"docid": "b3fec725c1b59252d7f023f14f665319",
"score": "0.69994867",
"text": "def validate_token( token, username, password )\n\t\tsalt = token.unpack( 'm' ).first[ -10..-1 ]\n\t\tremade_token = make_token( username, password, salt )\n\n\t\treturn token == remade_token\n\tend",
"title": ""
},
{
"docid": "30702139eb8ff6e0e465f9bd35ea156f",
"score": "0.6991881",
"text": "def authenticated?(attribute, token) # digest/ token\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "ba91a9cee38671020ddedb6e0b7bf830",
"score": "0.6985195",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest) == token\n end",
"title": ""
},
{
"docid": "990aef9b099795ae12c2875330fbe8fb",
"score": "0.69646925",
"text": "def authenticated?(attribute, token)\n digest = self.try(\"#{attribute}_digest\")\n return false if digest.nil?\n ::BCrypt::Password.new(digest) == token\n end",
"title": ""
},
{
"docid": "4cc3fb7be0d83120f3764b6097f9979b",
"score": "0.69594204",
"text": "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest) == token\n end",
"title": ""
},
{
"docid": "9c4e030e2a32aa7a1f2771bfdb3167ec",
"score": "0.6936503",
"text": "def correct_token?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "1174dccde90cb93bc04230f6181924b4",
"score": "0.6933108",
"text": "def tokens_match?\n return if email_credentials.blank?\n return if login_token.blank?\n return if email_token.blank?\n\n return unless login_token.bytesize == email_token.bytesize\n\n l = login_token.unpack \"C#{login_token.bytesize}\"\n res = 0\n email_token.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"title": ""
},
{
"docid": "5c6fbbd395feff5e4567b9ad902837a1",
"score": "0.6931501",
"text": "def ==(other_token_or_digest)\n other = other_token_or_digest.respond_to?(:digest) ? other_token_or_digest.digest : other_token_or_digest\n self.digest == other && self.ttl > 0\n end",
"title": ""
},
{
"docid": "e3a9fcfb5cf5dc4b2679a606c4e09c93",
"score": "0.6897368",
"text": "def authenticated?(attribute, token) #token can be ANY token\n digest = self.send(\"#{attribute}_digest\") #interpolates attribute w/ _digest ex: => remember_digest\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "3b3a643f9f1bd8d5e12bdc463249ba09",
"score": "0.68943137",
"text": "def authenticated?(auth_token)\n return false if auth_digest.nil?\n BCrypt::Password.new(auth_digest).is_password?(auth_token)\n end",
"title": ""
},
{
"docid": "b5400a5d098d2fe4291b9e9bb0489399",
"score": "0.68924123",
"text": "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n \n return false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "7c94c1870612221eb46b9609c46a7e58",
"score": "0.68863",
"text": "def authenticated?(attribute, token)\n\t\tdigest = self.send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tpassword = BCrypt::Password.new(digest)\n\t\tpassword == token ? true : false\n\tend",
"title": ""
},
{
"docid": "3b165c851b8bc5cc8fd8b2cf297128a7",
"score": "0.6868113",
"text": "def matches?(hash, *tokens)\n hash = new_from_hash(hash)\n\n #return if the hash is nil or empty to save time\n return false if hash.nil? || hash == {}\n\n tokens = tokens.first # we no longer use the salt from the tokens\n test = hash_secret(hash.salt, tokens)\n secure_compare(hash, test)\n end",
"title": ""
},
{
"docid": "c04aafdee778c76d2745d72314a1be13",
"score": "0.68329275",
"text": "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n # if the remember digest is nil, we are not authenticated\n return false if digest.nil?\n # otherwise, does the digest match the token?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "b904e11db850c8150062fb611b5bed49",
"score": "0.6815546",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "9cc71d4fc010bd29e76bb75ee795e37c",
"score": "0.68114626",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) # (1)\n end",
"title": ""
},
{
"docid": "17d924a27020b57699cac944b57bebb2",
"score": "0.6798928",
"text": "def check_authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "66f10cbc54a80e5fdddad3e8c3e9f113",
"score": "0.6784827",
"text": "def authenticated?(attribute,token)# to convert string to varaiable and access as class instance var use self.send(string)\n att = self.send(\"#{attribute}_digest\")\n return false if att.nil?\n att == token\n end",
"title": ""
},
{
"docid": "b1dfbe2203b864eae60ec5a94da60f6e",
"score": "0.6781307",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n\n return false if digest.blank?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "6ae34431ea0f6d2250b687a9a62660b8",
"score": "0.6776167",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\") \n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "ab7e5b1efce43fb9b049c87e97c972a0",
"score": "0.6774982",
"text": "def authenticated?(attribute, token)\n \tdigest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "f28873f03f5b608bf19cabeb7d1c2fc0",
"score": "0.67672396",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\") #a seconda del tipo di token chiama un metodo differente\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "1a0da0b923fa2475f9acdfd2caa5d700",
"score": "0.6767156",
"text": "def valid_token?(env, token)\n return false if token.nil? || !token.is_a?(String) || token.empty?\n\n session = session(env)\n\n begin\n token = decode_token(token)\n rescue ArgumentError # encoded_masked_token is invalid Base64\n return false\n end\n\n # See if it's actually a masked token or not. We should be able\n # to handle any unmasked tokens that we've issued without error.\n\n if unmasked_token?(token)\n compare_with_real_token(token, session)\n elsif masked_token?(token)\n token = unmask_token(token)\n\n compare_with_global_token(token, session) ||\n compare_with_real_token(token, session) ||\n compare_with_per_form_token(token, session, Request.new(env))\n else\n false # Token is malformed\n end\n end",
"title": ""
},
{
"docid": "111c5af3ccaf532a5bd8caba754d5609",
"score": "0.6757527",
"text": "def authenticated?(auth_token)\n return false if auth_token_digest.nil?\n BCrypt::Password.new(auth_token_digest).is_password? (auth_token)\n end",
"title": ""
},
{
"docid": "a97abd3b3974b8e679e81c3b35c1936b",
"score": "0.67572594",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\nend",
"title": ""
},
{
"docid": "e8263a96cbf388a1390e2e9a0c874525",
"score": "0.67563987",
"text": "def authenticated?(attribute, token)\n\tdigest = send(\"#{attribute}_digest\")\n\treturn false if digest.nil?\n\tBCrypt::Password.new(digest).is_password?(token)\nend",
"title": ""
},
{
"docid": "e8263a96cbf388a1390e2e9a0c874525",
"score": "0.67563987",
"text": "def authenticated?(attribute, token)\n\tdigest = send(\"#{attribute}_digest\")\n\treturn false if digest.nil?\n\tBCrypt::Password.new(digest).is_password?(token)\nend",
"title": ""
},
{
"docid": "8e5a528b94546f9742904268c8887587",
"score": "0.67419785",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\t end",
"title": ""
},
{
"docid": "230812b38147c2a57f96cd16d0aa3c8e",
"score": "0.67389435",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil? \n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "917cd8d17addb056764231370e547b1d",
"score": "0.6738686",
"text": "def authenticated?(attribute, token)\n\t digest = send(\"#{attribute}_digest\")\n\t return false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "a3ec34591c38b58f477927ab62609177",
"score": "0.673224",
"text": "def authenticated?(attribute, token)\n return false unless respond_to?(\"#{attribute}_digest\")\n digest = send(\"#{attribute}_digest\")\n return false if digest.blank?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "9e2e5f393d6e67556dc8ad5a5a384d05",
"score": "0.67315495",
"text": "def authenticated?(token)\n digest = self.access_digest\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) && !self.accepted?\n \tend",
"title": ""
},
{
"docid": "7fe19557d07ad1abbbb5d12905358043",
"score": "0.6731032",
"text": "def authenticated?(auth_token)\n return false if auth_digest.nil?\n BCrypt::Password.new(auth_digest).is_password?(auth_token)\n end",
"title": ""
},
{
"docid": "886340e63e3d50a0427f9b79adc7c1f9",
"score": "0.67285264",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "886340e63e3d50a0427f9b79adc7c1f9",
"score": "0.67285264",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "886340e63e3d50a0427f9b79adc7c1f9",
"score": "0.67285264",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "ac2aaf17ac399dbc76ddf60d267737d8",
"score": "0.67262477",
"text": "def password_match?(password=\"\", token=\"\")\n if token.blank?\n hashed_password == Guest.hash_with_salt(password, salt)\n else\n access_token == token\n end\n\n\n end",
"title": ""
},
{
"docid": "dc1daf69921b69e06bbbbe6aaa52a508",
"score": "0.67241395",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\t\t\t\n\tend",
"title": ""
},
{
"docid": "e2611444ed69e4b2b8d087d22adc3812",
"score": "0.67188466",
"text": "def authtoken_matches?(token, phrase=nil)\n phrase = @request.cookies['sid'] if phrase.nil?\n token == generate_authtoken(phrase)\n end",
"title": ""
},
{
"docid": "c8dc7a20aac82cb0d590f61664afb2d9",
"score": "0.6716894",
"text": "def authenticated?(attribute, token)\n\t digest = send(\"#{attribute}_digest\")\n\t return false if digest.nil?\n\t BCrypt::Password.new(digest).is_password?(token)\n\t end",
"title": ""
},
{
"docid": "34476096ec57dbc926c6e6737b7fa17e",
"score": "0.6712639",
"text": "def authenticated?(attribute, token)\n\t digest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\nend",
"title": ""
},
{
"docid": "5da74218269b80ca1ee8b94eaacd172f",
"score": "0.6711402",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "1f6fd3b88f4d37101b48b85c85a1dbb4",
"score": "0.6702064",
"text": "def authenticated?(attribute, token)\n digest = public_send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "e368d63a8d5b09c68ced8b3c8813e43f",
"score": "0.6698017",
"text": "def authenticated?(attribute, token)\r\n digest = send(\"#{attribute}_digest\")\r\n return false if digest.nil?\r\n BCrypt::Password.new(digest).is_password?(token)\r\n end",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "209b6e80e9eeb8770374fb52b4e1449d",
"score": "0.6697641",
"text": "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend",
"title": ""
},
{
"docid": "a6f9048bea5c5a49520f39c5a831e79e",
"score": "0.6696578",
"text": "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil? \n \n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "e368d63a8d5b09c68ced8b3c8813e43f",
"score": "0.66952413",
"text": "def authenticated?(attribute, token)\r\n digest = send(\"#{attribute}_digest\")\r\n return false if digest.nil?\r\n BCrypt::Password.new(digest).is_password?(token)\r\n end",
"title": ""
},
{
"docid": "51ab74398d2c2ecf423afba3fd73aa4b",
"score": "0.6694807",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.6690578",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.6690525",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.6690525",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
},
{
"docid": "7d5caeab7f31a515495c19359b27f308",
"score": "0.66899925",
"text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end",
"title": ""
}
] |
0921b16cdf55ed6112aa91dcdf749e91
|
CHANGE THIS CODE so that the tests pass. when you put in fruit as a key, you should get apple
|
[
{
"docid": "723d25834f1f3a96e7baaf908d984d7b",
"score": "0.5849558",
"text": "def get_favorite(key, json)\n\n\t#first- get some string and parse for JSON to get array of favorites\n\th = JSON.parse(json)\n\tfavorites=h[h.keys[0]]\n\t\n\n\t#find fruit in array favorites\n\treturn favorites[key]\n\nend",
"title": ""
}
] |
[
{
"docid": "a6bef6cc65f0c510526cd79d121cc760",
"score": "0.7041882",
"text": "def select_fruit(prod)\n keys = prod.keys\n counter = 0\n fruits = {}\n key_term = \"Fruit\"\n loop do\n break if counter > keys.size\n if prod[keys[counter]] == key_term\n fruits[keys[counter]] = key_term\n end\n counter += 1\n end\n puts fruits\nend",
"title": ""
},
{
"docid": "c83a97385b07ff308d314c2d7b09a4d2",
"score": "0.69128215",
"text": "def select_fruit(food)\n produce_keys = food.keys\n fruit = {}\n counter = 0\n\n loop do\n current_key = produce_keys[counter]\n current_value = food[current_key]\n \n fruit[current_key] = current_value if current_value == \"Fruit\"\n counter += 1\n break if counter >= food.size\n end\n\n fruit\nend",
"title": ""
},
{
"docid": "6efad8c97d3e829de2382e06ff0221f2",
"score": "0.6496771",
"text": "def select_fruit(hsh)\n keys = hsh.keys\n counter = 0\n fruits = {}\n \n loop do\n break if counter == keys.size\n current_key = keys[counter]\n current_value = hsh[current_key]\n \n if current_value == 'Fruit'\n fruits[current_key] = current_value \n end\n \n counter += 1\n end\n \n fruits\nend",
"title": ""
},
{
"docid": "c64f828f54fe1fbdd555f56fc15a5d3f",
"score": "0.64529073",
"text": "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]\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",
"title": ""
},
{
"docid": "15231eafe4ae334f109edf8c3015041a",
"score": "0.64198154",
"text": "def select_fruit(hash)\n key = hash.keys\n counter = 0\n new_hash = {}\n\n loop do\n break if counter == hash.size\n\n current_key = key[counter]\n current_value = hash[current_key]\n\n new_hash[current_key] = current_value if current_value == 'Fruit'\n\n counter += 1\n end\n\n new_hash\nend",
"title": ""
},
{
"docid": "6e1bd645aad2d3fda6775a802ab859fa",
"score": "0.6366387",
"text": "def select_fruit2(produce)\n keys = produce.keys\n counter = 0\n new_hash = {}\n loop do\n key = keys[counter]\n if produce[key] == 'Vegetable'\n new_hash[key] = produce[key]\n end\n counter += 1\n break if counter == keys.size\n end\n new_hash\nend",
"title": ""
},
{
"docid": "bbb6517edf3cb64fe5eaf87056c483b8",
"score": "0.6332328",
"text": "def select_fruit2(hash, argument)\n keychain = hash.keys\n valuechain = hash.values\n counter = 0 \n newhash = {}\n\n loop do \n break if counter > keychain.size\n current_key = keychain[counter]\n current_value = hash[current_key]\n if current_value == argument\n newhash[current_key] = current_value\n end \n counter += 1\n end\n return newhash\nend",
"title": ""
},
{
"docid": "35955dc43fa7aa94df67fe6565557d5c",
"score": "0.62958086",
"text": "def test_to_key; end",
"title": ""
},
{
"docid": "35955dc43fa7aa94df67fe6565557d5c",
"score": "0.62958086",
"text": "def test_to_key; end",
"title": ""
},
{
"docid": "b93158551f9a9c983d8da447a7a027ce",
"score": "0.6263384",
"text": "def select_fruit(hash)\n counter = 0\n selected_fruit = {}\n fruits = hash.keys\n\n loop do\n break if counter == fruits.size\n current_element = fruits[counter]\n element_value = hash[current_element]\n if element_value == 'Fruit'\n selected_fruit[current_element] = element_value\n end\n counter += 1\n end\n selected_fruit\nend",
"title": ""
},
{
"docid": "1c2360cda51e44db54acc1c0da8d0c30",
"score": "0.6129687",
"text": "def test_keys\n km = Tui::Core::KeyMaker.new( lambda { |i| return i } )\n km << 'core1'\n km << 'cpucore1'\n km << 'nic1'\n km << 'cdrom'\n keys = km.make\n assert keys.has_key?( 'co' ), keys.to_s\n assert keys.has_key?( 'cp' ), keys.to_s\n assert keys.has_key?( 'n' ), keys.to_s\n assert keys.has_key?( 'cd' ), keys.to_s\n\n km = Tui::Core::KeyMaker.new( lambda { |i| return i } )\n km << 'cor'\n km << 'core1'\n km << 'core2'\n km << 'core3'\n km << 'core4'\n km << 'cpucore1'\n km << 'cpucore2a'\n km << 'cpu1'\n km << 'cpu2'\n km << 'nic'\n km << 'therm_1'\n keys = km.make\n assert keys.has_key?( 'co1' ), keys.to_s\n assert keys.has_key?( 'co2' ), keys.to_s\n assert keys.has_key?( 'co3' ), keys.to_s\n assert keys.has_key?( 'co4' ), keys.to_s\n assert keys.has_key?( 'cor' ), keys.to_s\n assert keys.has_key?( 'cpc1' ), keys.to_s\n assert keys.has_key?( 'cpc2' ), keys.to_s\n assert keys.has_key?( 'cp1' ), keys.to_s\n assert keys.has_key?( 'cp2' ), keys.to_s\n assert keys.has_key?( 'n' ), keys.to_s\n assert keys.has_key?( 't' ), keys.to_s\n end",
"title": ""
},
{
"docid": "71baadce41d0abd9c590e2ffe622f15e",
"score": "0.6036355",
"text": "def find_pet_by_name(pet_shop, pet_name) \n # fake_pet = {}\n # fake_pet[:name] = \"Arthur\" \n # return fake_pet\n\n #for each pet, check if its name is pet_name\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"title": ""
},
{
"docid": "eb94dd9414ad7cd05a5a9186b37d3970",
"score": "0.6013738",
"text": "def mock_hash\n { 'doggo' => 'woof', 'catto' => 'meow', 'birdo' => 'tweet' }\nend",
"title": ""
},
{
"docid": "0d78fefc748543e021ddb63cdfbd01db",
"score": "0.59879947",
"text": "def general_select(produce_list, selection_criteria)\n produce_keys = produce_list.keys\n counter = 0\n selected_fruits = {}\n\n loop do\n break if counter == produce_keys.size \n\n current_key = produce_keys[counter]\n current_value = produce_list[current_key]\n\n # used to be current_value == 'Fruit'\n if current_value == selection_criteria \n selected_fruits[current_key] = current_value\n end\n\n counter += 1\n end\n\n selected_fruits\nend",
"title": ""
},
{
"docid": "3b6998be3fa350d2b04fd89da182d398",
"score": "0.59877336",
"text": "def select_apple\n apples = { big_apple: ['img/BigApple.png', 2],\n small_apple: ['img/SmallApple.png', 1] }\n @apple = apples[apples.keys.sample]\n end",
"title": ""
},
{
"docid": "d50a991e54be6127875ac36e1c08de37",
"score": "0.5976049",
"text": "def get_spicy_food_by_cuisine(spicy_foods, cuisine)\n spicy_foods.find do |spicy_food|\n spicy_food[:cuisine] == \"#{cuisine}\"\n end\n\nend",
"title": ""
},
{
"docid": "06b6edb14a34ee17759d9ccce56c685f",
"score": "0.59590566",
"text": "def get_key(key)\nend",
"title": ""
},
{
"docid": "06b6edb14a34ee17759d9ccce56c685f",
"score": "0.59590566",
"text": "def get_key(key)\nend",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5956798",
"text": "def get(key); end",
"title": ""
},
{
"docid": "0be6f22806274a56f2c8c15d7943f538",
"score": "0.595388",
"text": "def find_pet_by_name(pet_shop, pet_name)\n for name in pet_shop[:pets]\n if (pet_name == name[:name])\n #p name note this is returning the full hash - not sure if this is what is expected\n return name\n end\n end\n # p pet_name\n return nil\nend",
"title": ""
},
{
"docid": "abcb6ad6eafa4ef89b7c6fe17803f53f",
"score": "0.5936966",
"text": "def test_first_key_from_hash\n teacher_wallets = {\n 'Tony' => 12,\n 'Kat' => 10,\n 'Val' => 1356,\n 'Rick' => 1\n }\n result=first_key_from_hash(teacher_wallets)\n assert_equal('Tony',result)\nend",
"title": ""
},
{
"docid": "3e6b55b7643f97ac31d09ab44d944fc0",
"score": "0.5925839",
"text": "def test_add_get_entry\n @state.push(key: 'test', value: { :ballin_hard => 'true',\n :city => 'Atlanta'})\n assert_equal(@state.get(key:'test')[:ballin_hard],'true')\n end",
"title": ""
},
{
"docid": "c2fa704abdbcec3a02b87b3c5806cefe",
"score": "0.59228176",
"text": "def get(key)\n\n end",
"title": ""
},
{
"docid": "64ca20abcf515d0597bea483665cbf0c",
"score": "0.5870748",
"text": "def find_key(value, items) \n items.each do |key, val| \n \n if (______ == _______)\n\n \treturn _______\n end\n end\n\n return ______\nend",
"title": ""
},
{
"docid": "37de123954b5adec4fcf1c2b50ed3a04",
"score": "0.58498204",
"text": "def general_select(produce_list, selection_criteria)\n produce_keys = produce_list.keys\n counter = 0\n selected_produce = {}\n \n loop do\n break if counter == produce_keys.size\n \n current_key = produce_keys[counter]\n current_value = produce_list[current_key]\n \n #used to be current_value == 'Fruit'\n if current_value == selection_criteria\n selected_produce[current_key] = current_value\n end\n \n counter += 1 \n end\n\n selected_fruits\nend",
"title": ""
},
{
"docid": "ea06b703bcd0cdc0e8f52394e4518ff9",
"score": "0.58366746",
"text": "def get_fruit(id=0)\n fruit = [\"apple\", \"pear\"]\n return fruit[id]\nend",
"title": ""
},
{
"docid": "f7107cbd97772b4e65ab847aee14e882",
"score": "0.5827923",
"text": "def test_find_key_found\n assert_equal(:C3,find_key(@C_Bay,\"Chalk\"))\n end",
"title": ""
},
{
"docid": "e25d8411b07de446f47b596a5e0fc6b9",
"score": "0.5824412",
"text": "def get(key)\n \n end",
"title": ""
},
{
"docid": "e25d8411b07de446f47b596a5e0fc6b9",
"score": "0.5824412",
"text": "def get(key)\n \n end",
"title": ""
},
{
"docid": "e25d8411b07de446f47b596a5e0fc6b9",
"score": "0.5824412",
"text": "def get(key)\n \n end",
"title": ""
},
{
"docid": "e25d8411b07de446f47b596a5e0fc6b9",
"score": "0.5824412",
"text": "def get(key)\n \n end",
"title": ""
},
{
"docid": "51acc1d447f8d7f33d415f391c615a9d",
"score": "0.58098257",
"text": "def find_pet_by_name (pet_shop, input_name)\n name_found = []\n for pet_name in pet_shop[:pets]\n if pet_name[:name] == input_name\n name_found << pet_name\n end\n end\n return name_found.first #Adding the .first or [0] got the exact bit of data I required to pass the test, good to get the result\nend",
"title": ""
},
{
"docid": "a27feda8e7bae34606cf8c1b7840ed1e",
"score": "0.5788807",
"text": "def key(value); end",
"title": ""
},
{
"docid": "a27feda8e7bae34606cf8c1b7840ed1e",
"score": "0.5788807",
"text": "def key(value); end",
"title": ""
},
{
"docid": "a27feda8e7bae34606cf8c1b7840ed1e",
"score": "0.5788807",
"text": "def key(value); end",
"title": ""
},
{
"docid": "2cdb406300e79fe6eb5da152bd18f9a7",
"score": "0.5766433",
"text": "def get_fruit(id = 0)\n fruits = ['apple','pear']\n return fruits[id]\nend",
"title": ""
},
{
"docid": "b3008b9906e30e95a5286531c2e44958",
"score": "0.57482404",
"text": "def test_get_food\r\n food = BasicFood.new(\"Orange\", 67)\r\n assert_equal food.name, @fdb.get_food(\"Orange\").name , \"Should have returned BasicFood Orange 67!\"\r\n end",
"title": ""
},
{
"docid": "cf3689351423bf4cc6b38dde562e7675",
"score": "0.5743274",
"text": "def get_spicy_food_by_cuisine(spicy_foods, cuisine)\n # your code here\n singlehash = spicy_foods.find do |food|\n food[:cuisine] == cuisine\n end\n singlehash\nend",
"title": ""
},
{
"docid": "d5f3cb5e9cbf1793709c57a759dfe238",
"score": "0.5738258",
"text": "def find_pet_by_name(shop, name)\n\n # pet_name = {}\n pets = shop[:pets]\n for pet in pets\n if pet[:name] == name\n # pet_name[:name] = pet[:name]\n return pet\n end\n end\n nil\nend",
"title": ""
},
{
"docid": "ff4bf1ee60d344265ac9bc2261b421b1",
"score": "0.5729847",
"text": "def get( item )\n @foodbase[item]\n end",
"title": ""
},
{
"docid": "11fe6300e5bfbe7c83a6aeea68a97acc",
"score": "0.5722076",
"text": "def test_find_matches\r\n test = [BasicFood.new(\"Apple\", 50)]\r\n assert_equal test[0].name, @fdb.find_matches(\"App\")[0].name, \"Should have received list with BasicFood Apple!\" \r\n end",
"title": ""
},
{
"docid": "38dd0d6085664c9a221d4ba8a13b22ae",
"score": "0.5716031",
"text": "def test_get\n \torange = @fdb.get(\"Orange\")\n\tpbj = @fdb.get(\"PB&J Sandwich\")\n\tassert(orange.calories == 67, \"is orange?\")\n\tassert(pbj.name == \"PB&J Sandwich\", \"is pbj?\")\n end",
"title": ""
},
{
"docid": "3f5780920b27fd857edffa09bda5a677",
"score": "0.57132363",
"text": "def find_pet_by_name(shop_hash, pet_name_string)\n\n #Again a nightmare, remember that when you use return that's you - function over - don't pass go.\n #originally I tried to use a conditional, waste of time\n for array in shop_hash[:pets] #for every element(pet) in pets array\n if pet_name_string == array[:name] #if input string matches :name key/value\n return array # Give back the whole pet hash - THIS WILL BOOT YOU OUT OF FUNCTION!\n end\n end #if you find no matches you'll exit iterator at this point\n return nil #keep the return here, post-iterator else it'll exit too soon.\nend",
"title": ""
},
{
"docid": "80986fc030e2e4417a29d201fb2187ca",
"score": "0.5709988",
"text": "def store_items\n # TODO: find the correct data structure to hold the shopping store items\n # instead of using nil below\n store = {\n \"yogurts\" => 2,\n \"meat\" => 7,\n \"vegetables\" => 5,\n \"potatoes\" => 2,\n \"rice\" => 1\n }\n\n store\nend",
"title": ""
},
{
"docid": "ab9375e88a7f9061dada1766524401e9",
"score": "0.5695333",
"text": "def test_search_mines_for_ore\n test_prospector = Prospector.new 'p1'\n found = test_prospector.search?\n assert found.is_a?(Hash)\n assert_equal test_prospector.search?.key?('gold'), true\n assert_equal test_prospector.search?.key?('silver'), true\n end",
"title": ""
},
{
"docid": "7942440fb60692e0504aff01f02ddba4",
"score": "0.5694719",
"text": "def test_get\r\n food = BasicFood.new(\"Jelly\", 155)\r\n assert_equal food.name, @fdb.get(\"Jelly\").name, \"Should have returned BasicFood Jelly!\"\r\n end",
"title": ""
},
{
"docid": "cdf8b170e71ff6a418bc9dc84509d2dc",
"score": "0.5692136",
"text": "def test_hash_review\n skip\n \n city_populations = [\"New York City\" => 8, \"Los Angeles\" => 4, \"Chicago\" => 3]\n\n assert_equal '___', city_populations[\"New York City\"]\n assert_equal 3, '___'\n assert_equal 2, city_populations[\"Houston\"]\n end",
"title": ""
},
{
"docid": "318d8a08f8b4b47547b03a39738c7fa3",
"score": "0.5686556",
"text": "def get(key)\n # YOUR WORK HERE\n end",
"title": ""
},
{
"docid": "9031460f18db66fd8a4f6da4b3ffb77f",
"score": "0.56709707",
"text": "def test_get\n @table.add(IntHash.new(2))\n @table.add(IntHash.new(7))\n @table.add(StringHash.new(\"char\"))\n assert_equal(@table.get(IntHash.new(7)), IntHash.new(7))\n assert_equal(@table.get(StringHash.new(\"char\")), StringHash.new(\"char\"))\n end",
"title": ""
},
{
"docid": "ce333c81a0f3b3d230bf58c0d84399a3",
"score": "0.56548",
"text": "def select_fruit(produce)\n produce.select { |k, v| v == \"Fruit\" }\nend",
"title": ""
},
{
"docid": "f67ec35080122ee741bc48111fa50bd8",
"score": "0.56542283",
"text": "def [](key)\n # binding.pry\n @fake_hash[key.to_s] || @fake_hash[key.to_sym]\n end",
"title": ""
},
{
"docid": "64a023b69ddd972bfee6db9e8a3c9d3a",
"score": "0.5651133",
"text": "def test_set_up_intial_values\n # setup\n testicount = AccountInfo.new\n testicount.set_up_initial_values\n\n # run\n testicount.add_category(\"ralf\")\n # compare\n if testicount.categories.each_key{|key| puts key} == ralf\n print \"pass test set_up_initial_values\" + \"\\n\"\n else\n print \"fail test set_up_initial_values\" + \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "38b89bd4c944bab9bb75f6ca4781b268",
"score": "0.563169",
"text": "def test_give_me_capital_cities\n\n countries = {\n uk: {\n capital: 'London',\n population: 60\n },\n france: {\n capital: 'Paris',\n population: 70\n },\n italy: {\n capital: 'Rome',\n population: 56\n }\n }\n\n expected_result = [ 'London', 'Paris', 'Rome' ]\n result = give_me_capital_cities(countries)\n assert_equal(expected_result,result)\n\nend",
"title": ""
},
{
"docid": "0efb7539970d216e25637a855179626a",
"score": "0.5631268",
"text": "def add_item(grocery_list, item_name, quantity=0) \n \n # Print an error message: item is already in the hash\n if grocery_list.has_key?(item_name.downcase)\n\n puts \"Item is already in the list\"\n \n # Otherwise, add the item\n else\n grocery_list[item_name.downcase] = quantity\n end\n\n print_list(grocery_list)\n\n # return the hash\n return grocery_list\n\nend",
"title": ""
},
{
"docid": "225e11548a4eaba5b812e0fcc98e2d64",
"score": "0.561921",
"text": "def general_select(produce_list, selection_criteria)\n produce_keys = produce_list.keys\n counter = 0\n selected_produce = {}\n\n loop do\n break if counter == produce_keys.size\n\n current_key = produce_keys[counter]\n # init a local variable to pull from the produce hash[key]\n current_value = produce_list[current_key]\n\n # used to be current_value = \"Fruit\"\n if current_value == selection_criteria\n selected_produce[current_key] = current_value\n end\n\n counter += 1\n end\n\n selected_produce\nend",
"title": ""
},
{
"docid": "d1934d3e5780123af1be66d0be69fbde",
"score": "0.5604488",
"text": "def test_with_val\n with_map = @kb.with_val.map do |val, res|\n \"#{val}: #{res}\"\n end\n\n assert_equal('1: 1', with_map[0])\n assert_equal('3: Key', with_map[2])\n assert_equal('5: Buzz', with_map[4])\n assert_equal('15: KeyBuzz', with_map[14])\n assert_equal(nil, with_map[15])\n end",
"title": ""
},
{
"docid": "27e0173c2de86bf2952743148dd08902",
"score": "0.5601737",
"text": "def test_add_product_to_shop\n @shop.add('U Antka')\n @shop.add('U Baski')\n assert_equal 1, @shop.add_product(1, Hash[ :title => 'apple', :price => 2.50])\n assert_equal 2, @shop.add_product(1, Hash[ :title => 'banana', :price => 4.00])\n assert_equal 3, @shop.add_product(2, Hash[ :title => 'orange', :price => 3.25])\n end",
"title": ""
},
{
"docid": "8b6155a2dca72d2dea982387cfa8f1a4",
"score": "0.5598105",
"text": "def pets_by_breed(shop_hash,pet_breed_string)#feed it the pet shop hash and string to be matched\n breed_total = [] # create an empty array\n for array_element in shop_hash[:pets] # shop_hash[:pets] jumps into our array within pet shop hash\n if pet_breed_string == array_element[:breed]#access each array element and look for match in element[:key]\n breed_total << array_element[:name] #pass our array the name of the pet.\n end\n end\n return breed_total\nend",
"title": ""
},
{
"docid": "84f74a35cb6c1f3e9a0516a5993742a1",
"score": "0.55978066",
"text": "def result_key_for(value); end",
"title": ""
},
{
"docid": "8e90a9347d0fe4601870770df9da756e",
"score": "0.55903107",
"text": "def get_shelf()\n puts \"Enter product name: \"\n product_name = gets.chomp.downcase\n for product in NEW_PRODUCTS\n if product[:name] == product_name\n return product[:shelf]\n end\n end\nend",
"title": ""
},
{
"docid": "85c7f256abf801f416eface4850caffb",
"score": "0.55880266",
"text": "def mock_key_for(url, params = nil)\n if url == :catch_all\n url\n else\n key = url\n if params and !params.empty?\n key += flatten_and_sort_hash(params).to_s\n end\n key\n end\n end",
"title": ""
},
{
"docid": "568b17c106014b56c629975e5db3d411",
"score": "0.55877596",
"text": "def find_key\n end",
"title": ""
},
{
"docid": "6947cdf01064c863ee3d3c4d8199d6ee",
"score": "0.5573683",
"text": "def find_pet_by_name(pet_shop, pet_name)\n pets = pet_shop[:pets]\n for pet in pets\n return pet if pet[:name] == pet_name\n end\nend",
"title": ""
},
{
"docid": "c03201cb5c1703e856e17f4e39173d09",
"score": "0.55702394",
"text": "def get(key)\r\n \r\n end",
"title": ""
},
{
"docid": "c008ba74164a1884a5a1538d2f5863ba",
"score": "0.5564589",
"text": "def check_key_equals(response, data, key, val)\n data[key].should == val\n end",
"title": ""
},
{
"docid": "c27312cae8629e24bbbd60d30326c940",
"score": "0.55579937",
"text": "def test_setting_and_getting_values_from_a_hash\n hash = {} # or hash = Hash.new\n hash[\"abc\"] = 1\n hash[\"xyz\"] = 2\n \n assert_equal(1, hash[\"abc\"]) \n assert_equal(2, hash[\"xyz\"]) \n end",
"title": ""
},
{
"docid": "c104e08a99d96516c1e4d50ddbc267be",
"score": "0.5553604",
"text": "def add_item(grocery_hash, food_item_string, quantity)\r\n\tgrocery_hash[food_item_string] = quantity\r\n\tgrocery_hash\r\nend",
"title": ""
},
{
"docid": "95bd1d9a3c9f4e9821762baf565c51b8",
"score": "0.5552468",
"text": "def fetch(key); end",
"title": ""
},
{
"docid": "50bfe741ae67e3593d70fec6416c8f35",
"score": "0.555228",
"text": "def find_pet_by_name(pet_shop, name)\n return pet_shop[:pets][3]\nend",
"title": ""
},
{
"docid": "c7bd7e8797d67bdf870459580414705c",
"score": "0.55471283",
"text": "def test_productslist_to_bayslist()\n assert_equal([:c9, :c1, :c10], productslist_to_bayslist(@reference_hash, [\"shoe lace\", \"rusty nail\", \"leg warmers\"]))\nend",
"title": ""
},
{
"docid": "58863a6e25c04653699a7278bff8e82a",
"score": "0.554227",
"text": "def get(key)\n \n end",
"title": ""
},
{
"docid": "868d77d8437ccd88ef986b1223eaa5d4",
"score": "0.5535263",
"text": "def has_key?(value)\nputs \"Looking for value associated with #{{value}} but not finding it\"\nold_has_key?(value)\nend",
"title": ""
},
{
"docid": "74b1a8ad0f692edaf36ffdcbc6606308",
"score": "0.55311465",
"text": "def potential_keys(db, key)\n name = key.downcase() #all comparisons will be done case insensitively, relying on the edge comparison to say matches\n paren_ind = key.index('(')\n name = key[0, paren_ind-1] unless paren_ind.nil?\n arr = [name]\n\n raw_json = db.get(key)\n data = JSON.parse(raw_json)\n unless data.is_a?(Hash)\n STDERR.printf(\"bad json for %s: %s (%s)\\n\", key, raw_json, data.class)\n exit 1\n end\n arr << data['common_name'] if data['common_name'] && !arr.include?(data['common_name']) \n data['aliases'].each { |nh| n=nh['name']; arr << n unless arr.include?(n) || n.match(/Wikipedia:/) } if data['aliases']\n\n arr\nend",
"title": ""
},
{
"docid": "8eb6da2500b5d7c01de75fe263102ac7",
"score": "0.5528393",
"text": "def find_pet_by_name(pet_shop, name)\n result = nil\n\n for pet in pet_shop[:pets]\n if pet[:name] == name\n result = name\n end \n end\n\n return result\n\nend",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.5515984",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
},
{
"docid": "43ae9327eec2352614a32e1bde5b743a",
"score": "0.551568",
"text": "def key; end",
"title": ""
}
] |
2a07966b82b10bf26d6e72b604961bce
|
PUT /wikis/1 PUT /wikis/1.json
|
[
{
"docid": "9b57e2b6396f24350e69d6b08b33892b",
"score": "0.57333785",
"text": "def update\n @wiki = Wiki.find(params[:id])\n @wiki.update_attributes(:changed_by => current_user)\n \n\n respond_to do |format|\n if @wiki.update_attributes(params[:wiki])\n @wiki.audit_tag_with(@wiki.changetag) \n format.html { redirect_to @wiki, notice: @wiki.title << ' was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "d17160edc2e7eb736ae42e1c01a2db55",
"score": "0.6466409",
"text": "def update\n @wiki = @project.wikis.find(params[:id])\n\n respond_to do |format|\n if @wiki.update_attributes(params[:wiki])\n flash[:notice] = 'Wiki was successfully updated.'\n format.html { redirect_to project_wiki_path(@project, @wiki) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wiki.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b2a1a00ef4b0501e71bfa18e66acd76",
"score": "0.6338605",
"text": "def update\n respond_to do |format|\n if @wiki.update(wiki_params)\n format.html { redirect_to @wiki, notice: 'Wiki was successfully updated.' }\n format.json { render :show, status: :ok, location: @wiki }\n else\n format.html { render :edit }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6d6c76b57987d332e85fe522fe69fd43",
"score": "0.6329157",
"text": "def update \n respond_to do |format|\n if @wikipage.update(wikipage_params)\n save_version\n format.html { redirect_to @wikipage, notice: 'Wikipage was successfully updated.' }\n format.json { render :show, status: :ok, location: @wikipage }\n else\n format.html { render :edit }\n format.json { render json: @wikipage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac8710afbf0368f58127dec1a6887f72",
"score": "0.6272548",
"text": "def update\n respond_to do |format|\n if @wiki.update(wiki_params)\n format.html { redirect_to @wiki, notice: 'Wiki was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "132ff8f06b4ff70a70c0dbb3e22377db",
"score": "0.61716837",
"text": "def update\n respond_to do |format|\n if @wikipage.update(wikipage_params)\n format.html { redirect_to @wikipage, notice: 'Wikipage was successfully updated.' }\n format.json { render :show, status: :ok, location: @wikipage }\n else\n format.html { render :edit }\n format.json { render json: @wikipage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "53aa4e40bc09bc5169c7289c975f417a",
"score": "0.6095558",
"text": "def update\n respond_to do |format|\n if @wiki.update(wiki_params)\n format.html { redirect_to @wiki, notice: 'Wiki was successfully updated.' }\n format.json { render :show, status: :ok, location: @wiki }\n else\n format.html { render :edit }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1cfe0dd8ea8895b38fcb9e95f9bc9193",
"score": "0.6049908",
"text": "def set_wiki\n @wiki = Wiki.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { errors: 'Wiki not found' }, status: :not_found\n end",
"title": ""
},
{
"docid": "19b426bbcce925be4a7d4d66a07719dc",
"score": "0.6018833",
"text": "def update\n respond_to do |format|\n if @wiki.update_attributes(params[:wiki])\n flash[:notice] = 'Wiki was successfully updated.'\n format.html { redirect_to(@wiki) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wiki.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41c6c231662547e06b57db2ee2240482",
"score": "0.5867042",
"text": "def set_wiki\n @wiki = Wiki.find(params[:id])\n end",
"title": ""
},
{
"docid": "855f81d29ee8ff100cfefb3479cedcdd",
"score": "0.5828877",
"text": "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"title": ""
},
{
"docid": "412ae3dad39e36872670aaf547dcefbe",
"score": "0.5828734",
"text": "def update\n @wiki_form = WikiForm.find(params[:id])\n\n respond_to do |format|\n if @wiki_form.update_attributes(params[:wiki_form])\n format.html { redirect_to @wiki_form, notice: 'Wiki form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wiki_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5ff652a51897c435fbb7e943bbd7917",
"score": "0.58225757",
"text": "def set_wiki\n @wiki = Wiki.find(params[:id])\n end",
"title": ""
},
{
"docid": "f5ff652a51897c435fbb7e943bbd7917",
"score": "0.58225757",
"text": "def set_wiki\n @wiki = Wiki.find(params[:id])\n end",
"title": ""
},
{
"docid": "f5ff652a51897c435fbb7e943bbd7917",
"score": "0.58225757",
"text": "def set_wiki\n @wiki = Wiki.find(params[:id])\n end",
"title": ""
},
{
"docid": "f5ff652a51897c435fbb7e943bbd7917",
"score": "0.58225757",
"text": "def set_wiki\n @wiki = Wiki.find(params[:id])\n end",
"title": ""
},
{
"docid": "a372f98cff3f24bbdf67c5f09347f548",
"score": "0.578334",
"text": "def update\n authorize @wiki\n respond_to do |format|\n if @wiki.update(wiki_params)\n flash[:notice] = \"Wiki was successfully updated.\"\n format.html { redirect_to action: \"index\" }\n else\n flash.now[:alert] = \"There was an error saving the wiki. Please try again.\"\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "7218e1212c39e7eb1961b6ec224cd4f1",
"score": "0.5773138",
"text": "def set_wiki\n @wiki = Wiki.find_by_title(params[:id])\n end",
"title": ""
},
{
"docid": "c6d9c8048e9df1a8a9f75893617284f2",
"score": "0.5770124",
"text": "def update_wiki\n return unless request.post?\n @page.content = WikiContent.new(:page => @page) if @page.new_record?\n @content = @page.content_for_version(params[:version])\n @content.text = \"h1. #{@page.pretty_title}\" if @content.text.blank?\n @content.comments = nil\n\n if !@page.new_record? && @content.text == params[:content_text]\n # don't save if text wasn't changed\n return\n end\n\n # @content.attributes = params[:content_text]\n @content.text = params[:content_text]\n @content.author = User.find_by_login( params[:user] )\n @content.comments = params[:content_comments]\n if (@page.new_record? ? @page.save : @content.save)\n render :text => 'ok'\n else\n render :text => 'err'\n end\n\n end",
"title": ""
},
{
"docid": "589dfc5615a7cd5abdbc4895ed4319b7",
"score": "0.5765587",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8414f5e0adeb0834c05b08b96d98b72c",
"score": "0.57471794",
"text": "def update\n @story = Story.find(params[:id])\n @story.update_attributes(params[:story])\n respond_with @story\n end",
"title": ""
},
{
"docid": "db2df777e6e23ae3d5bc2f419b3e5a48",
"score": "0.56975913",
"text": "def create\n @wiki = Wiki.new(params[:wiki])\n\n respond_to do |format|\n if @wiki.save\n format.html { redirect_to @wiki, notice: @wiki.title << ' was successfully created.' }\n format.json { render json: @wiki, status: :created, location: @wiki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc95853a1457c614a83f7598e10b1e3e",
"score": "0.56880414",
"text": "def update\n if @story.update(story_params)\n head :no_content\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "4d24e98ca91232d01137bdeb2fafd550",
"score": "0.5648281",
"text": "def update\n @story = Story.find(params[:id])\n #@story = Story.friendly.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d6e8c5194e62e312158f872b688e37f",
"score": "0.56130624",
"text": "def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"title": ""
},
{
"docid": "6f95f40d248ce0f1fff60dab15ed0dca",
"score": "0.5611318",
"text": "def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"title": ""
},
{
"docid": "4c6059272baabee2212510e015eb7d8d",
"score": "0.56050205",
"text": "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"title": ""
},
{
"docid": "a3ae56d0d8e997fab56e94d33a8220e5",
"score": "0.55784374",
"text": "def update\n respond_to do |format|\n if @wiki_post.update(wiki_post_params)\n format.html { redirect_to @wiki_post, notice: \"Wiki post was successfully updated.\" }\n format.json { render :show, status: :ok, location: @wiki_post }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @wiki_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "df6991d7d3f7ac078674f909c1de2bee",
"score": "0.5578194",
"text": "def index\n @wikis = Wiki.all\n end",
"title": ""
},
{
"docid": "d37b39a795a6e081d6480942ece1c538",
"score": "0.5560592",
"text": "def put!\n request! :put\n end",
"title": ""
},
{
"docid": "8d6a2aa254b1fc307fe86f07a33cf011",
"score": "0.5547524",
"text": "def create\n @wikipage = Wikipage.new(wikipage_params)\n save_version\n respond_to do |format|\n if @wikipage.save\n format.html { redirect_to @wikipage, notice: 'Wikipage was successfully created.' }\n format.json { render :show, status: :created, location: @wikipage }\n else\n format.html { render :new }\n format.json { render json: @wikipage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8597772ca15c8db32184f5616007991a",
"score": "0.5526004",
"text": "def update\n @story = Story.find(params[:id])\n \n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Zmiany zostały zapisane.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2af2a3ef1ad5d52138b2264ab6ceb032",
"score": "0.55242825",
"text": "def index\n @wikis = @project.wikis\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wikis }\n end\n end",
"title": ""
},
{
"docid": "5ffe2ee593653c52679f160247b8911d",
"score": "0.55149424",
"text": "def create\n @wiki = Wiki.new(wiki_params)\n\n respond_to do |format|\n if @wiki.save\n format.html { redirect_to @wiki, notice: 'Wiki was successfully created.' }\n format.json { render :show, status: :created, location: @wiki }\n else\n format.html { render :new }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff17c63165c3d8b69b9e265bac925686",
"score": "0.5504851",
"text": "def update\n story = Story.find(params[:id])\n authorize story # check policies/story_policy.rb for auth rules\n\n if story_params[:tags]\n story_params[:tags].each do |tag|\n # If tag exists then use existing tag name\n if Tag.exists?(tag)\n story.tags << Tag.find_by_name(tag[\"name\"])\n else\n story.tags << Tag.new(tag)\n end\n end\n end\n\n if story.update(story_params.except(:tags)) && story.save\n response_with('Story successfully saved', 200)\n else\n response_with('Could not update story', 400)\n end\n end",
"title": ""
},
{
"docid": "3ae5462bfa02b591fe7c8108afd77ef8",
"score": "0.54981935",
"text": "def create\n @wiki = Wiki.new(wiki_params)\n\n respond_to do |format|\n if @wiki.save\n format.html { redirect_to @wiki, notice: 'Wiki was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wiki }\n else\n format.html { render action: 'new' }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f77b2d56da02b358753983bc58131c80",
"score": "0.5483571",
"text": "def create\n @wiki = Wiki.new(params[:wiki])\n @project.wikis << @wiki\n\n respond_to do |format|\n if @wiki.save\n flash[:notice] = 'Wiki was successfully created.'\n format.html { redirect_to project_wiki_path(@project, @wiki) }\n format.xml { render :xml => @wiki, :status => :created, :location => @wiki }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wiki.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c54523a3c59162365564ca8c3eae9414",
"score": "0.5472403",
"text": "def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end",
"title": ""
},
{
"docid": "313a528748a15afba5cf91f53ebfefbf",
"score": "0.54472715",
"text": "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"title": ""
},
{
"docid": "ba5a882c8b2dbce1dc8153798b2594c2",
"score": "0.5447183",
"text": "def update\n head :ok\n end",
"title": ""
},
{
"docid": "90e517907782c5543acad932132f6d83",
"score": "0.5431737",
"text": "def new\n @wiki = Wiki.new\n # @wikicat = params[:id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wiki }\n end\n end",
"title": ""
},
{
"docid": "598ce05f6082b7f191b55f93bdaf11d0",
"score": "0.5402878",
"text": "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"title": ""
},
{
"docid": "f92fba8e95e00b3dd2c5ecf63c292f9c",
"score": "0.5388217",
"text": "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"title": ""
},
{
"docid": "36f381d1cd731420226fe96d15ce5b98",
"score": "0.5380231",
"text": "def update\n @wikipage = Wikipage.find(params[:id])\n\n\n respond_to do |format|\n if @wikipage.update_attributes(params[:wikipage])\n format.html { redirect_to @wikipage, notice: 'Wikipage was successfully updated.' }\n format.js {@update_activity = Activity.last}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wikipage.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65023d9d0fe1fc2675ec2cd094e12691",
"score": "0.5375497",
"text": "def update\n @hike_story = HikeStory.find(params[:id])\n\n respond_to do |format|\n if @hike_story.update_attributes(params[:hike_story])\n flash[:notice] = 'HikeStory was successfully updated.'\n format.html { redirect_to(@hike_story) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hike_story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bba44aa99478376d7bd6614977ad6610",
"score": "0.5373137",
"text": "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"title": ""
},
{
"docid": "54f95a361000b6219275e377b8bf4555",
"score": "0.53728354",
"text": "def update options={}\n client.put(\"/#{id}\", options)\n end",
"title": ""
},
{
"docid": "9d1c794582d92727f56f288a236bd500",
"score": "0.53698975",
"text": "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d1c794582d92727f56f288a236bd500",
"score": "0.53698975",
"text": "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "11ce7f24f133ec32676bd246a43b5bca",
"score": "0.5369569",
"text": "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "92baec3512e1908decee8b79a337a488",
"score": "0.53676254",
"text": "def destroy\n @wiki = @project.wikis.find(params[:id])\n @project.wikis.delete(@wiki)\n @wiki.destroy\n\n respond_to do |format|\n format.html { redirect_to project_wikis_path(@project) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "25dc0c3f92664bfcd8f645767a379ad4",
"score": "0.5358943",
"text": "def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end",
"title": ""
},
{
"docid": "6f252d66ce7dbfd68db110237d46f187",
"score": "0.5346446",
"text": "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6f252d66ce7dbfd68db110237d46f187",
"score": "0.5346446",
"text": "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a",
"score": "0.53443044",
"text": "def put(*args)\n request :put, *args\n end",
"title": ""
},
{
"docid": "3faef576a3dcfca379c4006995263c18",
"score": "0.53361315",
"text": "def update\n # @topic = current_user.topics.find(params[:lesson][:topic_id])\n # @course = @topic.courses.first\n\n # @lesson.title = 'New Lesson (rename)' if params[:title] = ''\n respond_to do |format|\n if @lesson.update(lesson_update)\n format.html { redirect_to course_topic_lesson_path(@lesson.topic.course, @lesson.topic, @lesson), notice: 'Lesson was updated created.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3cb6e5af885f842e1404af2a6fb5b59b",
"score": "0.53283",
"text": "def index\n @wikis = Wiki.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wikis }\n end\n end",
"title": ""
},
{
"docid": "e31d9c3e2f91d75252197557365fff19",
"score": "0.5327325",
"text": "def wiki_params\n params.require(:wiki).permit(:title, :body, :private)\n end",
"title": ""
},
{
"docid": "7d4c461826ceb8e7a93bdd4158217079",
"score": "0.5324811",
"text": "def put url, object = nil\n request url, HTTP::Put, object\n end",
"title": ""
},
{
"docid": "2f62727076669744017847e5a5e7355d",
"score": "0.5322778",
"text": "def update\n puts \"Updating the following URL in the index: #{url}\".yellow\n keywords = nil\n title = nil\n update_attributes!(:title => title,\n :keywords => keywords,\n :updated_at => Time.now)\n\n end",
"title": ""
},
{
"docid": "82369a10c45fad9dc1a1a0fc2a27f091",
"score": "0.5321194",
"text": "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"title": ""
},
{
"docid": "26da1967084e91127dd907374356915a",
"score": "0.53169364",
"text": "def update\n @story = Story.find(params[:id])\n\t\t@title = \"Edycja newsa\"\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Wiadomość zapisano pomyślnie.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8b71184eb0f7eed4c5e2e8660f9da342",
"score": "0.53121245",
"text": "def update\n respond_to do |format|\n if @wiki_post.update(wiki_post_params)\n format.html { redirect_to @wiki_post, notice: 'Wiki post was successfully updated.' }\n format.json { render :show, status: :ok, location: @wiki_post }\n else\n format.html { render :edit }\n format.json { render json: @wiki_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eb485fe05a4e000b7cd4c5626e707aa2",
"score": "0.531135",
"text": "def update_record(http, ref)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Updated text.\"\n}|\n resp = http.send_request('POST', \"/v1/Article/#{ref}\", json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'update reply.code should be 0 meaning no error')\n updated = reply[:updated]\n assert_equal(1, updated.length, 'update reply.updated should contain exactly one member')\n ref = updated[0]\n refute_equal(nil, ref, 'update reply record reference can not be nil')\n refute_equal(0, ref, 'update reply record reference can not be 0')\n ref\n end",
"title": ""
},
{
"docid": "009a3e78ea2d917558adea21ef7e9ace",
"score": "0.53105295",
"text": "def update\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n if @yourstory.update_attributes(params[:yourstory])\n format.html { redirect_to @yourstory, notice: 'Yourstory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yourstory.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e0e35bb47ec0f1e27d091980aa2db21b",
"score": "0.53054714",
"text": "def put(path, params = {})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "e0e35bb47ec0f1e27d091980aa2db21b",
"score": "0.53054714",
"text": "def put(path, params = {})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "e0e35bb47ec0f1e27d091980aa2db21b",
"score": "0.53054714",
"text": "def put(path, params = {})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "f72cce49f43e718f4699e245a4fc75e0",
"score": "0.5299274",
"text": "def update_story(story)\n post(\"v1/fundraising/pages/#{@short_name}\", {:basic_auth => true}.merge({:storySupplement => story}))\n end",
"title": ""
},
{
"docid": "8f20bf69ff80f5be732782384f9cf85e",
"score": "0.5293312",
"text": "def put(path, opts = {})\n request(:put, path, opts).body\n end",
"title": ""
},
{
"docid": "79b37079894e1e99af9441e3cdb1c4ed",
"score": "0.5288387",
"text": "def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"title": ""
},
{
"docid": "13b1dd3c0a1e7640e9f6bbef06400b7e",
"score": "0.52748126",
"text": "def update\n @api_haiku = Api::Haiku.find(params[:id])\n\n respond_to do |format|\n if @api_haiku.update_attributes(params[:api_haiku])\n format.html { redirect_to @api_haiku, notice: 'Haiku was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_haiku.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5295136f400dae336e05f91d9bb123b1",
"score": "0.52719355",
"text": "def wiki(project, slug)\n get(\"/projects/#{url_encode project}/wikis/#{slug}\")\n end",
"title": ""
},
{
"docid": "1a7f2fd68f74cf313a61eed2730290eb",
"score": "0.5267115",
"text": "def create\n @wiki = Wiki.new(wiki_params)\n \n respond_to do |format|\n if @wiki.save\n format.html { redirect_to @wiki, notice: 'Wiki was successfully created.' }\n format.json { render :show, status: :created, location: @wiki }\n else\n format.html { render :new }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f8a8ea2f3e6a89abe85266b079d95635",
"score": "0.52658206",
"text": "def update\n @story = Story.find(params[:id])\n \n # If the user publishes it, mark the story as published\n if params[:draft].nil?\n @story.draft = false\n end\n\n if @story.update_attributes(params[:story]) && @story.update_contents(params[:story][:content])\n respond_to do |format|\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.js { render :js => \"window.location.href = ('#{story_path(@story)}');\"}\n format.json { head :no_content }\n end\n else\n @errormsg = @story.errors.to_a.each { |e| e.capitalize }.join(\". \")\n story_errors(@errormsg)\n end\n end",
"title": ""
},
{
"docid": "207406ffd56772b9ad462db9f3cc805a",
"score": "0.52652425",
"text": "def update\n respond_to do |format|\n if @wiki_record.update(wiki_record_params)\n format.html { redirect_to wiki_records_url, notice: 'Знание успешно обновлено.' }\n format.json { render :show, status: :ok, location: @wiki_record }\n else\n format.html { render :edit }\n format.json { render json: @wiki_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9dfdf4cb1bef0d335ae05371025382b8",
"score": "0.5253659",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9dfdf4cb1bef0d335ae05371025382b8",
"score": "0.5253659",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9dfdf4cb1bef0d335ae05371025382b8",
"score": "0.5253659",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9dfdf4cb1bef0d335ae05371025382b8",
"score": "0.5253659",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9dfdf4cb1bef0d335ae05371025382b8",
"score": "0.5253659",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { render :show, status: :ok, location: @story }\n else\n format.html { render :edit }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d1c62c78e69f5f54d3f29b7291dfee2c",
"score": "0.5253176",
"text": "def destroy\n @wiki = Wiki.find(params[:id])\n @wiki.destroy\n\n respond_to do |format|\n format.html { redirect_to wikis_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b5cdc1a374a88123eac8cac349cfa31b",
"score": "0.5252798",
"text": "def wiki_params\n params.require(:wiki).permit(:title, :page_id)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "03f2da2ebf5dd2691a8c2e87c498da5a",
"score": "0.5250819",
"text": "def put(path, params={})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "f8f6458df769ae1b587e6843cba216d7",
"score": "0.52504987",
"text": "def set_wikipage\n @wikipage = Wikipage.find(params[:id])\n end",
"title": ""
},
{
"docid": "cbc6488e93be12b33b2dde6adba3e4ff",
"score": "0.5244492",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbc6488e93be12b33b2dde6adba3e4ff",
"score": "0.5244492",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbc6488e93be12b33b2dde6adba3e4ff",
"score": "0.5244492",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbc6488e93be12b33b2dde6adba3e4ff",
"score": "0.5244492",
"text": "def update\n respond_to do |format|\n if @story.update(story_params)\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "496c2796ef049221622ff21443bd82d3",
"score": "0.5234325",
"text": "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7079b057de4e62d34a1e09f0a80cfc82",
"score": "0.5229533",
"text": "def create\n @wikifile = Wikifile.new(wikifile_params)\n\n respond_to do |format|\n if @wikifile.save\n format.html { redirect_to wikifiles_path, notice: 'Wikifile was successfully created.' }\n format.json { render :show, status: :created, location: @wikifile }\n else\n format.html { render :new }\n format.json { render json: @wikifile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae7de48b6c88df0c1c5272f312e9acec",
"score": "0.5229255",
"text": "def set_wiki_post\n @wiki_post = WikiPost.find(params[:id])\n end",
"title": ""
},
{
"docid": "0bf570f93f81535f1f6f9f2a01e1e627",
"score": "0.5225162",
"text": "def put(path, params = {})\n request(:put, path, params)\n end",
"title": ""
},
{
"docid": "0bf570f93f81535f1f6f9f2a01e1e627",
"score": "0.5225162",
"text": "def put(path, params = {})\n request(:put, path, params)\n end",
"title": ""
}
] |
49cd3ed2daf30f1788343b88be96d0ae
|
submit follow user request
|
[
{
"docid": "d331e404f0f51b8a3da6ae2b564d4ac4",
"score": "0.0",
"text": "def fu\r\n @follow = FollowUser.new(:user_id => @u_id, :second_user_id => params[:id])\r\n if @follow.save\r\n redirect_to follow_path\r\n end\r\n @follow = FollowUser.where(user_id: @u_id, second_user_id: params[:id])\r\n if @follow[0].destroy\r\n redirect_to follow_path\r\n end\r\n end",
"title": ""
}
] |
[
{
"docid": "a72b0ad68699a26ec4bb0a216996adfd",
"score": "0.7630949",
"text": "def submit\n self.oaw_follow(params[:follow])\n self.oaw_unfollow(params[:unfollow])\n end",
"title": ""
},
{
"docid": "d33e5a63056fac536664bdc2791ca5c7",
"score": "0.73980045",
"text": "def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"title": ""
},
{
"docid": "c7b3d79d6c9492432ccd491befc3d9a3",
"score": "0.7265495",
"text": "def follow\n\n end",
"title": ""
},
{
"docid": "28b6c6126255caeae3f7e9291b623b82",
"score": "0.7255337",
"text": "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end",
"title": ""
},
{
"docid": "406cf1c83a50492f12baee7b800bd54f",
"score": "0.7197916",
"text": "def follow_user\n\t\tauthenticate_current_user\n\t\t# add the current user to the user they followed list of followers\n\t\tUser.find(params.user_id).followers.push(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend",
"title": ""
},
{
"docid": "1570205a8e3faa7b5e16d1f49cdb155c",
"score": "0.7145842",
"text": "def follow_user\n output = ''\n if params[:user_id].present?\n x = Notification.add_follow_user(current_user.id, params[:user_id])\n if x\n output = 'success!'\n else\n output = \"error: #{x.errors.full_message}\"\n end\n else\n output = 'please provide a user to follow'\n end\n\n respond_to do |format|\n format.json { render json: output.to_json }\n end\n end",
"title": ""
},
{
"docid": "24e016d941aefc660b2ae3b7bcbd930b",
"score": "0.711866",
"text": "def follow(followee_handle)\n HTTParty.post(\"#{@api_path}/users/follow/#{@handle}/#{@password}/#{followee_handle}\")\n end",
"title": ""
},
{
"docid": "119a817109a2b161cf19cc9a7827b90e",
"score": "0.7066173",
"text": "def follow\r\n \r\n @followu = FollowUser.where(user_id: @u_id)\r\n @followt = FollowThread.where(user_id: @u_id)\r\n end",
"title": ""
},
{
"docid": "06f8770b248829e561d96708bb05f0f5",
"score": "0.706351",
"text": "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_with @user\n #no worked are needed. Sidekiq suppoerts delayed mailer by default.\n UserMailer.delay.follower_confirmation(current_user, @user)\n end",
"title": ""
},
{
"docid": "1d7dd19b113aafcd89f208f6806f4911",
"score": "0.70012504",
"text": "def follow\n \n # Get the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Create and save a new follow, with the current user as the follower\n follow = Follow.new\n follow.follower_id = current_user.id\n follow.followee_id = @user.id\n follow.save!\n \n # Send an email to the user being followed\n UserMailer.deliver_follow(current_user, @user)\n \n # Redirect back to the profile of the user being followed\n flash[:notice] = \"You are now following #{@user.login}.\"\n redirect_to user_profile_url(:user_login => @user.login)\n end",
"title": ""
},
{
"docid": "57bc6fbe72b9e39800d853d9f89a2694",
"score": "0.69947976",
"text": "def create\n if Sidewalks::Informants::Twitter.client.\n follow(params[:user][:provider_screen_name])\n\n flash[:notice] = \"User was followed.\"\n end\n\n redirect_to admin_users_path\n end",
"title": ""
},
{
"docid": "dd40e6c81d9ad1bfeb43b03d968b6fd2",
"score": "0.69753355",
"text": "def follow(user_or_params)\n args = [user_or_params]\n post path_from_args('notifications/follow', args), params_from_args(args).merge({:post => {}})\n end",
"title": ""
},
{
"docid": "d1e3e4bd16a1fe7bae5cd7cf89917ad3",
"score": "0.6932439",
"text": "def follow\n\t\t@most_active_users.each do |user|\n\t\t\tpath = \"https://github.com/%s/followers\" % [user]\n\t\t\tnavigate(path)\n\n\t\t\tDEFAULT_NUMBER_PAGES.times do |page|\n\t\t\t\tfollow_button = find_many_elements_by_xpath(@follow_xpath)\n\t\t\t\tfollow_button.each { |follow_element| follow_element.submit; sleep 1 }\n\n\t\t\t\tnext_button = find_by_link_text('Next')\n\t\t\t\tnext_button.nil? ? break : next_button.click\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7847a0efc8b4e225cef96d0298bddb42",
"score": "0.6914411",
"text": "def follow(user)\n\tout_followings.create(to_id: user.id)\nend",
"title": ""
},
{
"docid": "48644937670adf7a9e6032e0bdaf52dd",
"score": "0.6877701",
"text": "def follow(user)\n self.following << user\n ActionLog.log_other(self.id, \"follow\", user) \n end",
"title": ""
},
{
"docid": "29048fedb9df9670875ba1962695169d",
"score": "0.68749744",
"text": "def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\n end",
"title": ""
},
{
"docid": "bc2b915331f30a6094343ff97e8e4dc4",
"score": "0.6859987",
"text": "def follow\n return render_error(400, \"must provide a twitter user to follow\") unless params[:twitter_user_name]\n auth = current_user.first_provider(\"twitter\")\n return render_error(404, \"user #{current_user.id} does not have a valid twitter authentication\") unless auth and !auth.blank? and auth.oauth_token and auth.oauth_secret\n \n # Do the follow asynchronously\n ShelbyGT_EM.next_tick do\n c = APIClients::TwitterClient.build_for_token_and_secret(auth.oauth_token, auth.oauth_secret)\n begin\n c.friendships.create! :screen_name => params[:twitter_user_name]\n rescue => e\n Rails.logger.error \"Twitter Follow Failed. Shelby user: #{current_user.id}. Trying to follow: #{params[:twitter_user_name]}. Error: #{e}\"\n end\n end\n \n @status = 200\n render 'v1/blank'\n end",
"title": ""
},
{
"docid": "4c12e00785a1f75d305593c7a067a4be",
"score": "0.68525696",
"text": "def follow_user\n user = User.find(params[:user_id])\n authorize! :follow, user\n current_user.follow(user)\n render_success_message(\"You are following #{user.full_name(false)}\")\n end",
"title": ""
},
{
"docid": "ae9ebcb0f2141006fcebf1a8d34b3cfa",
"score": "0.6845126",
"text": "def follow(user)\n user.add_follower(self)\n self\n end",
"title": ""
},
{
"docid": "138c187e424fec23cf7e01261035e10a",
"score": "0.6841906",
"text": "def set_follow\n @user_auth = auth_user\n @user_followed = User.find(params[:follow_user_id])\n end",
"title": ""
},
{
"docid": "7b4b18fb1f9d04059cc5c98968a227de",
"score": "0.6825742",
"text": "def follow\n requested_profile.follow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile, :format => params[:format]\n end",
"title": ""
},
{
"docid": "b8bebbba3c2536659888030f53c170fc",
"score": "0.6822182",
"text": "def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end",
"title": ""
},
{
"docid": "6d5990c19b30a07feb116c883b3bdff4",
"score": "0.68217754",
"text": "def accept_request\n @user = User.friendly.find(params[:user_id])\n @follow = Follow.find_by followable_id: current_user.id, follower_id: @user.id\n @follow.status = 1\n if @follow.save\n @user.add_notifications(\" has accepted your <strong>friend request</strong>.\", \n \" a accepté ta <strong>demande d'ami</strong>.\",\n current_user , nil, nil, Notification.type_notifications[:friend_request], nil)\n render :json => {:success => true}\n else \n render :json => {:success => false}\n end \n \n end",
"title": ""
},
{
"docid": "cb143078cb4de0b1f621f11c53c85026",
"score": "0.6818667",
"text": "def follow_autofollow_users(user)\n if determine_signup_flow_type == :buyer\n Users::AutofollowJob.enqueue(user.id)\n end\n end",
"title": ""
},
{
"docid": "e716eea1ba9e008d82191b79779d8063",
"score": "0.68074787",
"text": "def follow_user\n\t\t# determine whos following who\n \t@follower = current_user\n @following = User.find_by_login(params[:username])\n @user = @following\n\n\t\t# if trying to follow self, return error\n if @follower.id == @following.id\n gflash :error => \"Invalid request!\"\n redirect_back_or_default('/')\n end\n\t\t\n\t\t# see if user is already being followed\n exist = Follow.find(:first, :conditions => {:follower_id => @follower.id, :following_id => @following.id})\n\n if !exist\n\t\t\t# doesnt exist, follow the user\n @follow = @follower.follow_followings.build(:following_id => @following.id)\n @follow.save\n\n\t\t\t# send message about new follower\n @message = @follower.sent_messages.build(:receiver_id => @following.id, :description => \"You have a new follower! A user with the name of <a href='/profile/#{@follower.login}'>#{@follower.login}</a> is now following you!\")\n @message.save\n\n\t\t\t# automatically replace the html to show the new message and inbox unread message number using ajax so\n\t\t\t# refreshing the page is not necessary, i.e. automatically update number of unread messages in inbox, etc.\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => @following.id, :unread => true})\n @num_unread = @unread_messages.count\n render :juggernaut => {:type => :send_to_client, :client_id => @following.id} do |page|\n page.insert_html :top, :main_content, :partial => 'base/new_message', :object => @message\n page.visual_effect :fade, :no_message, :duration => 2\n page.replace :inbox_link, :partial => 'update_inbox_link', :object => @num_unread\n page.insert_html :top, :messages, :partial => 'base/insert_message', :object => @message\n page.visual_effect :highlight, \"message_#{@message.id}\", :duration => 5\n \t end\n\n\t\t\t# show pop up regarding follow success\n gflash :success => \"You are now following #{@following.login}!\"\n else\n gflash :error => \"You are already following #{@following.login}!\"\n end\n redirect_to :action => 'profile', :username => @following.login\n end",
"title": ""
},
{
"docid": "32734538a7efe8c1936854ca19ca00fb",
"score": "0.6795156",
"text": "def follow!(user)\n\t\tfollowed << user \n\tend",
"title": ""
},
{
"docid": "aa4063cbb695e25675ea9270d5fa98b3",
"score": "0.6763745",
"text": "def follow!(user)\n\t\tfollowed << user\n\tend",
"title": ""
},
{
"docid": "2d1f85560c36a0d55deec2497ae36a8c",
"score": "0.67602634",
"text": "def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end",
"title": ""
},
{
"docid": "8feb0e91d2223055e83ec43cc586f1cb",
"score": "0.67490906",
"text": "def follow(user)\n active_follows.create(followed_id: user.id)\n \n end",
"title": ""
},
{
"docid": "1d77b8bc4cfd508e4493db2451030bb0",
"score": "0.6733408",
"text": "def follow\n userToFollow = User.find_by_id(params[:id])\n begin\n if userToFollow\n @currentUser.follow_user(userToFollow)\n flash[:notice] = \"#{userToFollow} followed successfully\"\n end\n rescue Exception => e\n flash[:notice] = e.message\n end\n redirect_to(session[:last_page])\n end",
"title": ""
},
{
"docid": "1e32e6d981e1405f644b61d5fdd45684",
"score": "0.67309815",
"text": "def follow\n who = User.find(params[:id])\n @current_user.follow(who)\n render :text => \"you are now following #{who.username}\"\n end",
"title": ""
},
{
"docid": "dc18d1c1c9eebeb2b192fd7bbe995903",
"score": "0.6728863",
"text": "def follow\n check_user_id_is_present\n\n user = User.find_by_id(params[:user_id])\n\n if params[:movie].present?\n movie = Movie.find_by_title(params[:movie])\n\n if user.movies.include? movie\n render json: { response: 'Already followed' }, status: :ok\n end\n\n user.movies << movie\n elsif params[:genre].present?\n genre = Genre.find_by_name(params[:genre])\n\n if genre.nil?\n render json: { response: 'Genre not found' }, status: :not_found\n end\n\n user.genres << genre\n elsif params[:star].present?\n star = Star.find_by_name(params[:star])\n\n if star.nil?\n render json: { response: 'Movie not found' }, status: :bad_request\n end\n\n star.users << user\n end\n\n render json: { response: 'Done' }, status: :ok\n end",
"title": ""
},
{
"docid": "246953794a1fb80529eeb3b53da5cfc4",
"score": "0.6721542",
"text": "def follow\n if current_user\n update_and_decorate # Generate a FeedEntryDecorator as @feed_entry and prepares it for editing\n if current_user.follows? @user\n current_user_or_guest.followees.delete @user\n msg = \"You've just been unplugged from'#{@user.handle}'.\"\n else\n current_user_or_guest.followees << @user\n msg = \"You're now connected with '#{@user.handle}'.\"\n end\n current_user.save\n @user.save\n if post_resource_errors(current_user)\n render :errors\n else\n flash[:popup] = msg\n render :follow\n end\n else\n flash[:alert] = \"Sorry, you need to be logged in to follow someone.\"\n render :errors\n end\n end",
"title": ""
},
{
"docid": "27e3f4ce2c50a7d78a9ac829c5b306b1",
"score": "0.6704609",
"text": "def follow(user)\n\t self[:following].push(user.id)\n\t\tself.save\n end",
"title": ""
},
{
"docid": "0f4e8433c86af18a3910cf18997fea99",
"score": "0.6700849",
"text": "def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"title": ""
},
{
"docid": "262a42fed4e322726b3623ae0988c7b2",
"score": "0.6699043",
"text": "def follow\n # if params[:followage] && (['User','Cube', 'Post'].include?(params[:followage][:followed_type]))\n # @parent = Object.const_get(params[:followage][:followed_type]).find(params[:followage][:followed_id])\n # current_user.follow!(@parent, :record => true)\n # end\n\n current_user.follow!(@parent, :record => true)\n\n ## IMPORTANT! Km analytics are on 'record_follow' method of the User class, as we need to prevent recording multiple-follows\n Analytics.km_follow(current_user, @parent)\n \n respond_to do |format|\n format.html { redirect_to @parent }\n format.js { render :layout => false }\n end \n end",
"title": ""
},
{
"docid": "7850c0e079cec134a21d319ff9876189",
"score": "0.66849726",
"text": "def follow(user)\n user.add_follower(self)\n self\n end",
"title": ""
},
{
"docid": "f958da7a98360b982ad543fa2fa83d1d",
"score": "0.668284",
"text": "def follow\n twitter = Twitter::Base.new(TWITTER_USER, TWITTER_PASSWORD)\n begin\n twitter.create_friendship(twitter_id)\n twitter.follow(twitter_id)\n rescue Twitter::AlreadyFollowing => following\n logger.warn \"Failed to follow #{twitter_id}; we're already following them.\"\n end\n twitter.d(twitter_id, \"http://workon.cyberfox.com/user/#{access_key} to view recent tasks. 'd workon {task}' to add, 'd workon done' to finish. ~2min response time.\")\n end",
"title": ""
},
{
"docid": "a67499687f5c80ccce0e927e3debc150",
"score": "0.6680632",
"text": "def follow\n if (!current_user.friends.exists?(params[:id]))\n fs = Friendship.new(user_id: current_user.id, friend_id: params[:id])\n if fs.save\n redirect_to user_url(params[:id]), notice: \"Now you can read this user's posts in your friends feed.\"\n else\n flash.alert = \"Something went wrong. You cannot follow this user.\"\n redirect_to user_url(params[:id])\n end\n end\n end",
"title": ""
},
{
"docid": "83bb60791ca06d98078adf2c23de5631",
"score": "0.66528285",
"text": "def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end",
"title": ""
},
{
"docid": "508ab196b082ec8450f7071beb1ec473",
"score": "0.6646828",
"text": "def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end",
"title": ""
},
{
"docid": "97533408b4d809deba3cd1674588e87e",
"score": "0.66436243",
"text": "def follow_params\n params.permit(:requestor, :following)\n end",
"title": ""
},
{
"docid": "9a77fa3a1847363dae489249d98a0d72",
"score": "0.66316736",
"text": "def follow\n # if not authenticate can't follow raise 400 error\n if @user_auth.nil?\n raise ActionController::MethodNotAllowed, 'Vous n\\'êtes pas connecté'\n elsif @user_auth.id != @user_followed.id\n follow = Follow.new(follower_user_id: @user_auth.id, followed_user_id: @user_followed.id)\n if follow.save\n redirect_back fallback_location: '/', notice: \"Vous avez bien follow #{@user_followed.name}\"\n else\n redirect_back fallback_location: '/', error: \"Impossible de follow l'utilisateur\"\n end\n else\n redirect_back fallback_location: '/', error: 'Vous ne pouvez pas vous auto follow'\n end\n end",
"title": ""
},
{
"docid": "c542ce35df09d7c07b3addf6c436edba",
"score": "0.66307837",
"text": "def followUser(userToFollow)\n @followers << userToFollow\n end",
"title": ""
},
{
"docid": "83b5e836049ac5777a6d3377a99a9d88",
"score": "0.6626515",
"text": "def accept_follow_request(id)\n !perform_request(:post, \"/api/v1/follow_requests/#{id}/authorize\").nil?\n end",
"title": ""
},
{
"docid": "a0a4f6baf98e8f02d5566469ae50428c",
"score": "0.66174215",
"text": "def add_follower\n if (@user = find(User, params[:user_id])).is_a?(User)\n current_user.follow(@user)\n redirect_to @user, notice: \"Now you are following #{@user.username}!, and you can read his personal articles and comments!\"\n end\n end",
"title": ""
},
{
"docid": "9a4fba24d67065a973c974d752c687e2",
"score": "0.6613798",
"text": "def follow(user)\n user.followers << self\n self\n end",
"title": ""
},
{
"docid": "f3cbba56b11f11ce170b1a5d9d8aeb75",
"score": "0.6607055",
"text": "def follow(user)\n user.followers << self\n end",
"title": ""
},
{
"docid": "aafa95197ea03e4112fb065cc4402ccd",
"score": "0.6600454",
"text": "def follow(user_id)\n follower.create(followed_id: user_id)\n end",
"title": ""
},
{
"docid": "1dbef583430364046e007ce1bb49084e",
"score": "0.65756696",
"text": "def follow\n \t\n \t@follow = Follow.new\n \t@follow.follower = session[:id]\n \t@follow.followee = params[:aid]\n \tif @follow.save\n\t \t#@follow.update_attribute(:follower, session[:id])\n\t \t#@follow.update_attribute(:followee, params[:aid])\n\t \t@fol_name = Account.find(params[:aid])\n\t \tflash[:success] = \"You are now following\" + @fol_name.first_name + \" \" + @fol_name.last_name + \".\"\n\t \t\n\t \t\n\t \t#if request.xhr?\n\t \t\trender 'accounts/follow'\n \t\t#else\n\t \t#\tredirect_to :controller => :main, :action => :searching\n \t\t#end\n \tend\n \t\n end",
"title": ""
},
{
"docid": "edd398e6d736a051fd62ea06a21b871b",
"score": "0.6564409",
"text": "def follow(other_user)\n active_follows.create(followed_id: other_user.id)\n end",
"title": ""
},
{
"docid": "39ef0a243fcfb8174af392826ced786c",
"score": "0.65625566",
"text": "def create\n @follow = current_user.follows.new(follow_params)\n @user = User.where(\"id = ?\", @follow.following )\n respond_to do |format|\n if @follow.save\n format.html { redirect_back fallback_location: root_path, notice: 'You are now following this user!' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02a5cde9f2cd5c0c332480c4764fdf1f",
"score": "0.6548433",
"text": "def follow\n\t\t@twitter = Twitter::Client.new(\n\t\t\t:oauth_token => @bot.tw_token,\n\t\t\t:oauth_token_secret => @bot.tw_secret\n\t\t)\n\n\t\t@tweet = Tweet.find(params[:tweet])\n\n\t\t@twitter.follow(@tweet.tw_usuario)\n\t\t@tweet.estado = 1\n\t\t@tweet.save\n\n\t\tmensaje = \"Se sigue a \" + @tweet.tw_usuario\n\t\tredirect_to(bot_tweets_path(@bot), notice: mensaje)\n\tend",
"title": ""
},
{
"docid": "7b58df6b34811a73cf9285d51574b226",
"score": "0.65459806",
"text": "def friend_request(other_user)\n\tif other_user.present?\n\t\trelationship = get_relationship(other_user)\n\t\t\n\t\tif !relationship\n\t\t\trelationships.create(followed_id: other_user.id, friend_status: 'PENDING', follow1: false, follow2: false)\n\t\tend\n\tend\n end",
"title": ""
},
{
"docid": "f31d586a5f9b7db3f86090402eca27c7",
"score": "0.6535806",
"text": "def toggle_follow\n #user.toggle_follow!(celebrity) process 22, comment out this one\n #current_user.toggle_follow!(:user_id) process 44, comment out this one\n current_user.toggle_follow!(@post.user) #to get user object of the poster who post something 4\n redirect_to :back #66\n end",
"title": ""
},
{
"docid": "f089883f47851b150efec6e8ab81186e",
"score": "0.653239",
"text": "def follow \n @user = User.find_by_id(params[:id])\n if @user and current_user.follow(@user)\n flash[:notice] = \"You are now following #{@user.login}\"\n redirect_to home_path()\n elsif @user\n flash[:notice] = \"Already following\"\n redirect_to user_path(@user.login)\n else\n redirect_to home_path()\n end\n end",
"title": ""
},
{
"docid": "d3bda7d7ea892270275286f204ff2b93",
"score": "0.648527",
"text": "def follow_params\n params.require(:follow).permit(:user_id, :following)\n end",
"title": ""
},
{
"docid": "7e71dee0953238acb42cd645704a3430",
"score": "0.6481614",
"text": "def follow(user)\n Friend.add_follower(self, user)\n end",
"title": ""
},
{
"docid": "d27569f73877a3225168b85a8fbc4870",
"score": "0.647959",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "d27569f73877a3225168b85a8fbc4870",
"score": "0.647959",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "d27569f73877a3225168b85a8fbc4870",
"score": "0.647959",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "d27569f73877a3225168b85a8fbc4870",
"score": "0.647959",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "d27569f73877a3225168b85a8fbc4870",
"score": "0.647959",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "d27569f73877a3225168b85a8fbc4870",
"score": "0.647959",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "22be9a868ef12e7da85f4583a747b335",
"score": "0.6470606",
"text": "def follow(user)\n active_relationships.create(followed_id: user.id)\n end",
"title": ""
},
{
"docid": "df47e9184fc2f370da9863caae9bd80c",
"score": "0.6468458",
"text": "def create\n current_account.follow(@account)\n # TODO: Set up a mailer for notifying accounts of new followers\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n\n end",
"title": ""
},
{
"docid": "7e77fa8e5a07815812f1c525fa28c0e9",
"score": "0.64622045",
"text": "def create\n @user = User.new(params[:user])\n @user.role = 'influencer'\n # Account approved\n @user.approved = true\n # Assign twitter credentials\n @user.twitter_linked = true\n @user.twitter_screen_name = session['twitter_screen_name']\n @user.twitter_uid = session['twitter_uid']\n @user.twitter_token = session['twitter_token']\n @user.twitter_secret = session['twitter_secret']\n\n if @user.save\n # Set the referrer commission\n if session[:referrer_id]\n @user.update_attribute(:referrer_commission, 5)\n end\n # Clear session values\n session[:referrer_id] = session['twitter_screen_name'] = session['twitter_uid'] = session['twitter_token'] = session['twitter_secret'] = nil\n # Login user\n sign_in(:user, @user)\n\n @influencer = current_user.influencer\n\n if @influencer.audience.followers < 1000\n @influencer.update_attribute( :approved , false)\n @influencer.update_attribute(:need_approval , true)\n @influencer.mail_need_approval\n else\n @influencer.update_attribute( :approved , true)\n @influencer.update_attribute(:need_approval , false)\n end\n\n # Complete profiles\n redirect_to action: :step_2\n else\n @referrer = User.where(:id => session[:referrer_id]).first if session[:referrer_id]\n render action: :new\n end\n end",
"title": ""
},
{
"docid": "029fc6e8e5afebbc12f545211c198e96",
"score": "0.64618456",
"text": "def follow_user(user)\n return @mouth.follow(user)\n end",
"title": ""
},
{
"docid": "8e0e082675f474e395c4e6443f9acde2",
"score": "0.6456132",
"text": "def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\t@follower.follows << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend",
"title": ""
},
{
"docid": "a2f1ff45b509eee8688dfae24815257c",
"score": "0.6455003",
"text": "def user_follows \n if user_signed_in?\n Rails.logger.debug { \"The user to be followed is #{params[:id]}\" }\n user = User.find(id: params[:id])\n user.follows << current_user\n end\n end",
"title": ""
},
{
"docid": "f74c66f3c864c9b106df33e218758caa",
"score": "0.64529055",
"text": "def follow! followee\n return if following? followee\n following << followee\n save\n followee.followers << self\n followee.save\n end",
"title": ""
},
{
"docid": "c78038a63d7442ee0ff83b093c11ee0c",
"score": "0.64487994",
"text": "def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "096b7f5f8a8f7d08dd0d61ac412cc0a7",
"score": "0.64401704",
"text": "def reply_pos\n puts 'aw yeah!!!!'\n # byebug\n # we've got user from cookie\n # we're passing in the 2nd user from follow_params[:user2]\n ret_errors=[]\n half_follow_a = Follow.new(follower_id: decode_jwt(cookies.signed[:jwt])[\"user_id\"], followee_id: follow_params[:user2])\n if !half_follow_a.save\n ret_errors.push(\"Failure in the first half of follow. \")\n end\n\n if !!ret_errors\n render json: {ret_errors: ret_errors}\n else\n render json: {friend_request: \"friendship established\"}\n end\n end",
"title": ""
},
{
"docid": "069ed8c5350830dc8dea94ca777b7c32",
"score": "0.6428662",
"text": "def follow!(user)\n relationships.create!(:followed_id => user.id)\n end",
"title": ""
},
{
"docid": "91a13b03a0d4f6432b9d6722c76d232c",
"score": "0.6408044",
"text": "def remote_follow(uri)\n perform_request_with_object(:post, '/api/v1/follows', { uri: uri },\n Mastodon::Account)\n end",
"title": ""
},
{
"docid": "f22b3a837d44c468bfc9c5226238376e",
"score": "0.6397227",
"text": "def create\n\t\t@user = User.find(params[:followed_id])\n\t\tcurrent_user.follow(@user)\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @user }\n\t\t\tformat.js\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6e28f0bacede11a2a6b18a912891d67a",
"score": "0.6394408",
"text": "def follow\n @twitter = Twitter::Client.new(\n :oauth_token => @bot.tw_token,\n :oauth_token_secret => @bot.tw_secret\n )\n\n @tweet = Tweet.find(params[:tweet])\n\n @twitter.follow(@tweet.tw_usuario)\n @tweet.estado = 1\n @tweet.save\n\n mensaje = \"Se sigue a \" + @tweet.tw_usuario\n redirect_to(bot_tweets_path(@bot), notice: mensaje)\n end",
"title": ""
},
{
"docid": "a02139e589c2939fa40499a7c10ecd24",
"score": "0.63901544",
"text": "def user_follow_button user, size = nil, options={}\n return ''.html_safe if user == User.current_or_guest\n if size.is_a? Hash\n size, options = nil, size\n end\n do_label = options.delete :label\n label = ''\n if User.current_or_guest.follows? user\n if options.delete :removable\n label = \" Unfollow\" if do_label\n button_to_submit label,\n follow_user_path(user),\n 'glyph-minus',\n size,\n method: 'post',\n title: \"Unfollow #{user.handle}\",\n class: \"follow-button\",\n id: dom_id(user)\n else\n label = ' Following' if do_label\n sprite_glyph(:check,\n options[:size],\n title: \"Following #{user.handle}\",\n class: \"follow-button\",\n id: dom_id(user)) + label\n end\n else\n label = \" Follow\" if do_label\n button_to_submit label,\n follow_user_path(user),\n 'glyph-plus',\n size,\n method: 'post',\n title: \"Follow #{user.handle}\",\n class: \"follow-button\",\n id: dom_id(user)\n end\n end",
"title": ""
},
{
"docid": "8dd7ded0e79c514b5090cd3a9c5b6a35",
"score": "0.6389216",
"text": "def ft\r\n @follow = FollowThread.new(:user_id => @u_id, :athread_id => params[:id])\r\n\t if @follow.save\r\n\t\tredirect_to follow_path\r\n\t end\r\n end",
"title": ""
},
{
"docid": "177bb9337b90476181defce92286a494",
"score": "0.6382347",
"text": "def follow(target)\n link = self.user_follows.where(\"following_id = ?\",target.id).first\n if link == nil\n imperative_follow(target)\n end\n true\n end",
"title": ""
},
{
"docid": "bb5d9db5ef5d3d354f416799dda1585e",
"score": "0.6380311",
"text": "def create\n current_user.follow(@user)\n redirect_back fallback_location: \"/\"\n end",
"title": ""
},
{
"docid": "687fda1ade399073646fbb7eb6983c68",
"score": "0.63708645",
"text": "def follow(other_user)\n following << other_user\n end",
"title": ""
},
{
"docid": "51e30e62d009f68ce66ec3a8a6bbe8ad",
"score": "0.6370022",
"text": "def follow(user_id)\n followee_relationships.create(followee_id: user_id)\n end",
"title": ""
},
{
"docid": "f4b3b8dc7ca923c805798b1dab74bbb6",
"score": "0.6353389",
"text": "def follow\n follow = User.where(:username => params[:id]).first\n @current_user.friends << follow\n redirect_to user_path( follow.username )\n end",
"title": ""
},
{
"docid": "1cd336977589f1d15e2561043e472832",
"score": "0.63278854",
"text": "def following\n if current_user \n params[ :type ] = \"following\" if params[ :type ] .nil?\n @result = User.set_relation( params[ :id ] , current_user , params[ :type ] )\n render :layout => false\n else\n render \"misc/need_authentication\"\n end\n end",
"title": ""
},
{
"docid": "279ca0d007db99138695f1689d9d3ac9",
"score": "0.632044",
"text": "def follow(user_a,user_b)\n\t\t#This method deletes the follow relationship in the database\n\t\tuser_a.follow(user_b)\n\n\t\tif REDIS.exists(user_a.handle+\"_relations\")\n\t\t\tREDIS.sadd(user_a.handle+\"_relations\", params[:userid])\n\t\tend\n\t\tif REDIS.exists(user_a.handle+\"_num_following\")\n\t\t\tREDIS.incr(user_a.handle+\"_num_following\")\n\t\tend\n\t\tif REDIS.exists(user_b.handle+\"_num_followers\")\n\t\t\tREDIS.incr(user_b.handle+\"_num_followers\")\n\t\tend\n\tend",
"title": ""
},
{
"docid": "dfedc90640f77bcf7e0723563eba7283",
"score": "0.6306623",
"text": "def confirm_follow\n req = Net::HTTP::Post.new(@uri, initheader = {'Content-Type' => 'application/json'})\n req.body = {'queue': 'USER', 'method': 'confirm_follow', 'user_id': '2', '_id': ''}.to_json\n res = Net::HTTP.start(@uri.hostname, @uri.port) do |http|\n http.request(req)\n end\n return res.body\nend",
"title": ""
},
{
"docid": "a7db994d3c768d21d59d09b3b7a8e31e",
"score": "0.6304953",
"text": "def follow!( follow_nick, follow_address, password )\n follow follow_nick, follow_address\n push password\n end",
"title": ""
},
{
"docid": "ea16a4919c32bceae3279e9d6a88b25d",
"score": "0.6301748",
"text": "def follow(other_user_id)\n \tuser_to_follow = User.find_by(id: other_user_id)\n followee_followerships.create(followee_id: user_to_follow.id)\n end",
"title": ""
},
{
"docid": "ec37e4a406a4674d9c3d0f6a8aa43063",
"score": "0.6301738",
"text": "def create\n @follow = Follow.new()\n @follow.luser_id = current_user.luser.id\n fluser = Luser.find(:first, :conditions => {:name => params[:username]})\n @follow.following_luser_id = fluser.id\n \n current = Follow.find(:first, :conditions => {:luser_id => current_user.luser.id, \n :following_luser_id => fluser.id })\n \n respond_to do |format|\n if current != nil\n current.destroy\n format.json { head :no_content }\n elsif @follow.save\n recieving_user = Luser.find(@follow.following_luser_id)\n Notification.add(@follow, nil,\"follow\", recieving_user, current_user.luser)\n LuserMailer.new_follower(User.find(fluser.user_id), current_user.luser).deliver\n format.html { redirect_to @follow, notice: 'You are now following ' + fluser.name }\n format.json { render json: @follow, status: :created, location: @follow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "026b657768a0f093b784d70357b7a536",
"score": "0.63010186",
"text": "def follow(*followees)\n perform_followable_action(:follow, followees)\n end",
"title": ""
},
{
"docid": "9f7107bc87a25b05da38a3285aa03d55",
"score": "0.6300494",
"text": "def create\n @artist = params[:artist_id]\n @artist_name = artist_name(@artist)\n @follower = Follow.create(artist_id: @artist, artist_name: @artist_name, user_id: params[:user_id])\n\n if @follower.save\n flash[:notice] = \"You're now following #{@artist_name}\"\n redirect_to user_path(current_user)\n else\n flash[:error] = \"Failed to follow, please try again.\"\n redirect_to user_path(current_user)\n end\n end",
"title": ""
},
{
"docid": "0db3cd6038c7b703d027d1f7097682bd",
"score": "0.62989146",
"text": "def follow(user_id, follow_status)\n following_relationships.create(following_id: user_id, follow_status: follow_status)\n end",
"title": ""
},
{
"docid": "0db3cd6038c7b703d027d1f7097682bd",
"score": "0.62987214",
"text": "def follow(user_id, follow_status)\n following_relationships.create(following_id: user_id, follow_status: follow_status)\n end",
"title": ""
},
{
"docid": "6e5e7746fbb389efb83aaa985eb1d442",
"score": "0.62922406",
"text": "def follow_fb_friends\n follow_fb_friends_action.delay\n end",
"title": ""
},
{
"docid": "fe5c524fbf43a5907bfb0d1e80e5cd37",
"score": "0.6290466",
"text": "def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end",
"title": ""
},
{
"docid": "614c8330e5271912a1f8ba59cb279049",
"score": "0.62886775",
"text": "def create\n @user = User.find(params[:following_id])\n current_user.follow(@user)\n respond_to do |format|\n format.html {}\n format.js \n end\n end",
"title": ""
},
{
"docid": "bb93de444e9ad9129063a9f95953e667",
"score": "0.62860954",
"text": "def follow\n followable_uid = unsafe_params[\"followable_uid\"]\n fail \"Followable uid needs to be a non-empty string\" unless followable_uid.is_a?(String) && followable_uid != \"\"\n\n followable = item_from_uid(followable_uid)\n follower = @context.user\n if followable.accessible_by?(@context) && %w(discussion challenge).include?(followable.klass)\n follower.follow(followable)\n render json: {\n followable_uid: followable_uid,\n follower_uid: follower.uid,\n follow_count: followable.followers_by_type_count(follower.class.name),\n }\n else\n fail \"You do not have permission to follow this object\"\n end\n end",
"title": ""
},
{
"docid": "29c3482f4554fbce07dbc48145a1c68e",
"score": "0.6285358",
"text": "def follow(user_id)\n if self.id != user_id && active_follow.find_by(following_id: user_id) == nil\n active_follow.create!(following_id: user_id)\n end\n end",
"title": ""
},
{
"docid": "ceed69f1a68ccd2711dab883aa711f08",
"score": "0.62848765",
"text": "def follow! followee\n following << followee\n save\n followee.followers << self\n followee.save\n end",
"title": ""
},
{
"docid": "baa753a111961fab9eb34a88b1dd249c",
"score": "0.6278594",
"text": "def create\n @leader = User.find(params[:user_id])\n @leader.user_followers.create(:follower_id => current_user.id)\n\n saved = @leader.save\n respond_to do |format|\n if saved\n flash[:notice] = 'You are now following '.concat(@leader.login)\n end\n format.html { redirect_to user_tweets_path(@leader) }\n if saved\n format.xml { render :xml => @leader, :status => :created, :location => @leaders }\n else\n format.xml { render :xml => @leader.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
9087297ea63d593d6e404743f9a0d955
|
note that pixels per radian is for full raster must apply conversion based on shooting resolution!
|
[
{
"docid": "633a58b3beeafa3dd918318bd1bffc0c",
"score": "0.5098602",
"text": "def create_rokinon_distortion_map(tilt_offset, output_basename, output_dir)\n output_x = 1920 # output resolution\n output_y = 1080 # output resolution\n max_theta = PI / 2.0 # sets half width of output warp file\n# THIS ONLY WORKS WHEN THE OUTPUT IMAGE IS SQUARE!!! SEE LINES BELOW\n# THAT USE THIS VALUE FOR AZIMUTH AND POLAR CALCULATION\n# changed this so it's 360 in yaw and 180 in pitch, yikes, hardcoded below\n\n pixels_per_radian = 613.14\n radian_offset = tilt_offset * PI / 180.0\n pixel_tilt_offset = radian_offset * pixels_per_radian\n half_color_value = 32768\n color_scale = 25.0\n x_center, y_center = [output_x/2.0 - 0.5, output_y/2.0 - 0.5]\n img = Image.new(output_x,output_y) # defaults to 16-bit image\n x_size = img.columns\n y_size = img.rows\n (0...x_size).each do |x|\n (0...y_size).each do |y|\n # x, y is the output pixel coordinates\n dx = x - x_center # find distance from distortion center\n dy = y - y_center\n # convert to angular values in spherical coords\n azimuth = (dx / output_x ) * 4 * max_theta # fraction of total range, convert from pixels to radians\n polar = (dy / output_y ) * 2 * max_theta\n # convert to 3D cartesian space\n # point is unit vector at x,y,z\n # on surface of unit sphere\n # x vector is azimuth = PI/2 polar = 0\n # y vector is azimuth = 0 polar = 0\n # z vector is polar = PI/2\n cart_x = sin(azimuth) * cos(polar)\n cart_y = cos(azimuth) * cos(polar)\n cart_z = sin(polar)\n # calculate pixel coords in fisheye space\n psi = atan2(cart_z, cart_x)\n x_z_hyp = sqrt(cart_x**2 + cart_z**2)\n theta = atan(x_z_hyp/cart_y)\n # calculate pixels / degree\n # this is where fisheye distortion equation matters\n # we're using an equisolid angle projection, though\n # so it's linear\n r = theta * pixels_per_radian\n input_x = x_center + r * cos(psi) # note that using x_center / y_center implies source image is centered\n input_y = y_center + pixel_tilt_offset + r * sin(psi) # makes no assumptions about absolute source resolution, though\n delta_x = x - input_x\n delta_y = y - input_y\n # max calculation values for debugging\n # color calculations\n red = color_scale * delta_x + half_color_value\n green = color_scale * delta_y + half_color_value\n img.pixel_color(x, y, Pixel.new(red, green, half_color_value) )\n end\n end\n # NOTE scale to use in AE is half_color_value / color_scale; in this case ~1311.1\n img.write(output_dir + \"/\" + output_basename + \"_\" + tilt_offset.to_s + \".tiff\")\nend",
"title": ""
}
] |
[
{
"docid": "826447b7a2af81d5b35b2beb91dd994c",
"score": "0.6070055",
"text": "def pixels; end",
"title": ""
},
{
"docid": "8a3d9d5d88c8e7c74f2be41b6e26da02",
"score": "0.6045502",
"text": "def pixels_to_raster(px, py, zoom)\n map_size = @tile_size << zoom\n [px, map_size - py]\n end",
"title": ""
},
{
"docid": "0d0f2b464a76ee6b277c160924503dba",
"score": "0.5867087",
"text": "def pixelate\n\t\t\tmax_level = @post.resolution_level - 1\n\t\t\tmax_resolution = 2**max_level;\n\n\t\t\timg = Magick::ImageList.new(@post.image.path(:medium))\n\t\t\tstep = img.columns / max_resolution\n\t\t\ttemplate = Magick::Image.new(step, step)\n\t\t\tpixel_matrices = Array.new(max_level + 1)\n\n\t\t\t# Initialize 3D array: [level][row][col]\n\t\t\tfor level in 0..max_level do\n\t\t\t\tpixel_matrices[level] = level == max_level ? Array.new(2**level) { Array.new(2**level) } : nil\n\t\t\tend\n\n\t\t\tfor r in 0...max_resolution do\n\t\t\t\tfor c in 0...max_resolution do\n\t\t\t\t\t# Cut image into blocks\n\t\t\t\t\tblock = img.export_pixels_to_str( c * step, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t r * step,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t step,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t step )\n\t\t\t\t\taverage_pixel = template.import_pixels(0,0,step, step, \"RGB\", block).scale(1,1).pixel_color(0,0)\n\n\t\t\t\t\t# Translate red,green,blue value into 8-bit depth from 16-bit depth (default RMagick)\n\t\t\t\t\tpixel_matrices[max_level][r][c] = [average_pixel.red, average_pixel.green, average_pixel.blue].map! { |x| convert_16bit_to_8bit_with_damping(x) }\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Compute the remaining levels\n\t\t\tfor level in max_level.downto(1) do\n\t\t\t\taverage = Array.new(2**(level-1)) { Array.new(2**(level-1)) { Array.new(3, 0.0) } }\n\t\t\t\tfor r in 0...2**level do\n\t\t\t\t\tfor c in 0...2**level do\n\t\t\t\t\t\taverage[r / 2][c / 2][0] += pixel_matrices[level][r][c][0] / 4\n\t\t\t\t\t\taverage[r / 2][c / 2][1] += pixel_matrices[level][r][c][1] / 4\n\t\t\t\t\t\taverage[r / 2][c / 2][2] += pixel_matrices[level][r][c][2] / 4\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tpixel_matrices[level-1] = Array.new(average)\n\t\t\tend\n\t\t\t@post.pixel_matrices = pixel_matrices\n\t\t\t@post.save\n\t\tend",
"title": ""
},
{
"docid": "f58a3de8d5601b9925e7adbbb7585008",
"score": "0.58392024",
"text": "def to_pixel(**options) = convert_to('pixel', **options)",
"title": ""
},
{
"docid": "262710a8fabfcaf69dd8b57e9be812c0",
"score": "0.5751006",
"text": "def pixel? = unit == 'pixel'",
"title": ""
},
{
"docid": "e103ea1fb1a087ac91a688c9e85cc5e8",
"score": "0.57409614",
"text": "def to_pixel_per_meter(**options) = convert_to('pixel-per-meter', **options)",
"title": ""
},
{
"docid": "86e5654cf5a3e273025b62a1e71e27ed",
"score": "0.56624144",
"text": "def read_row radius\n @image.format('png')\n p = ChunkyPNG::Image.from_io(StringIO.new(@image.to_blob))\n a = (0...p.width).to_a.map{ |x| p[x, radius] }\n end",
"title": ""
},
{
"docid": "4505cf11324383e2dfeb8c643af8b756",
"score": "0.56266695",
"text": "def mm2pixel(mm1_value)\n return mm1_value * mm_unit;\n end",
"title": ""
},
{
"docid": "c39ca1a9be05150ac3080cf3c355a60c",
"score": "0.5619916",
"text": "def pixel_size; size.x * size.y; end",
"title": ""
},
{
"docid": "b91f8ac3caee310e70a53b806bf5cad2",
"score": "0.5604444",
"text": "def compute_radius radius\n angle = Math.atan(Y_DIM/X_DIM) - Math.atan( (Y_DIM - D_DIST * (OUTER - radius)) / X_DIM)\n @image = MiniMagick::Image.open(@original_path)\n crop_square\n rotate angle\n depolarize\n resize\n read_row radius\n end",
"title": ""
},
{
"docid": "6fdeac2c779c0fdf10fa4950d33a912b",
"score": "0.5590534",
"text": "def size\n @size ||= raster_size\n end",
"title": ""
},
{
"docid": "eb7a477627c52a394c337216873b584d",
"score": "0.5548071",
"text": "def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end",
"title": ""
},
{
"docid": "0fb27648f9e2ec7de67ed6dcf76b1acc",
"score": "0.55282855",
"text": "def get_image_from_pixels(pixels, dimension, map, depth, mime_type); end",
"title": ""
},
{
"docid": "cab0ecc2be9220d7237cd46fd42ca2f4",
"score": "0.5521043",
"text": "def size_calculation(file_name)\n\t\t#file_name = \"file:///home/frakinho/image_manipulation/server_serial_port/app/assets/images/coisa.jpg\"\n\t original = Magick::Image::read(file_name).first\n\t\t\n\t\tpath_debug = get_path_without_image_name(file_name)\n\t \n\n\t #Copy for debug mod\n\t image = original\n\n\t #Apply Fitler twice for remove a max of noise \n\t image = image.median_filter(radius=3)\n\t image = image.median_filter(radius=3)\n\t \timage.write(\"#{path_debug}first_filter.jpg\")\n\t image = image.edge(radius=2)\n\t \timage.write(\"#{path_debug}edge.jpg\")\n\n\t image.image_type = Magick::BilevelType\n\t image.write(\"#{path_debug}BileveType.jpg\")\n\t image = image.median_filter(radius=1)\n\t image.write(\"#{path_debug}last_filter.jpg\")\n\n\t \t# Get Bounding_box\n\t\tbound = image.bounding_box\n\n\t\t#Calculate value in CM\n\t #Value top in CM\n\t # 237 is a variable value, depend the distance between table and camera\n\t value_width_cm = ((bound.width) * 21) / 380.0\n\t #Value of height\n\t value_height_cm = ((bound.height) * 21) / 380.0\n\n\n\t # Debug MOD \n\t\tif ServerSerialPort::Application.config.my_app.debug\n\t\t gc_1 = Magick::Draw.new\n\t\t gc_1.stroke(\"gray50\")\n\t\t gc_1.fill_opacity(0)\n\t\t gc_1.rectangle(bound.x, bound.y, bound.x+bound.width, bound.y+bound.height)\n\t\t gc_1.stroke(\"red\")\n\t\t gc_1.circle(bound.x, bound.y, bound.x+2, bound.y+2)\n\t\t gc_1.circle(bound.x+bound.width, bound.y, bound.x+bound.width+2, bound.y+2)\n\t\t gc_1.circle(bound.x, bound.y+bound.height, bound.x+2, bound.y+bound.height+2)\n\t\t gc_1.circle(bound.x+bound.width, bound.y+bound.height, bound.x+bound.width+2, bound.y+bound.height+2)\n\t\t gc_1.fill(\"white\")\n\t\t gc_1.stroke(\"transparent\")\n\t\t gc_1.text(bound.x-15, bound.y-5, \"\\'#{bound.x},#{bound.y}\\'\")\n\t\t gc_1.text(bound.x+(bound.width/2),bound.y-15,\"#{value_width_cm}\")\n\t\t gc_1.text(bound.x - 15,(bound.height / 2),\"#{value_height_cm}\")\n\t\t gc_1.text(bound.x+bound.width-15, bound.y-5, \"\\'#{bound.x+bound.width},#{bound.y}\\'\")\n\t\t gc_1.text(bound.x-15, bound.y+bound.height+15, \"\\'#{bound.x},#{bound.y+bound.height}\\'\")\n\t\t gc_1.text(bound.x+bound.width-15, bound.y+bound.height+15, \"\\'#{bound.x+bound.width},#{bound.y+bound.height}\\'\")\t \n\t\t gc_1.draw(original)\n\t\t original.write(\"#{path_debug}bounding.jpg\")\n\t\t\n\t\tend\n\t\timage_crop = original.crop(bound.x, bound.y, bound.width, bound.height)\n\t\timage_crop = image_crop.rotate(90)\n\t\n\t\timage_crop.write(\"#{path_debug}image_crop.jpg\")\n\n\n\n\t return value_width_cm,value_height_cm\n\tend",
"title": ""
},
{
"docid": "4cb570d1ee8a725a874da62a23c50ca0",
"score": "0.5504164",
"text": "def image_pixels(image_path)\n image = Magick::Image.from_blob(File.read(image_path)).first\n sx, sy = image.columns, image.rows\n \n grid = Array.new(sy) { Array.new }\n x, y = 0, 0\n image.each_pixel do |pixel|\n grid[y].concat [pixel.red, pixel.green, pixel.blue].map { |channel|\n ((255 * channel) / Magick::QuantumRange).to_i\n }\n x += 1\n if x == sx\n x = 0\n y += 1\n end\n end\n grid\nend",
"title": ""
},
{
"docid": "7e8679902e12fbe7957bf35134120cbb",
"score": "0.54887176",
"text": "def pixel_per_meter? = unit == 'pixel-per-meter'",
"title": ""
},
{
"docid": "ceec9baf239a96c77c1c338d2ed60d68",
"score": "0.54836035",
"text": "def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(pixmap.frame);\r\n pixmap.frame = (pixmap.frame + 1) % (pixmap.sprite.images.length);\r\n canvas.add(img, pixmap.x, pixmap.y);\r\n end\r\n end \r\n end",
"title": ""
},
{
"docid": "8beeae4478528875e28f004897cbb484",
"score": "0.54747844",
"text": "def pixel\n return ($game_system == nil ? 1 : 2 ** $game_system.pixel_rate)\n end",
"title": ""
},
{
"docid": "042c99b185778e31b168c4f1f5e4524a",
"score": "0.53811777",
"text": "def scale_by_pixels(dimensions)\n out_pixels = sqrt(options[:width] * options[:height]).truncate\n src_pixels = sqrt(dimensions[0] * dimensions[1]).truncate\n out_pixels / src_pixels.to_f\n end",
"title": ""
},
{
"docid": "2d49409a595f1c3495e154f57c29b7c1",
"score": "0.53657717",
"text": "def extent\n @size.map{|i| i * @pixels}\n end",
"title": ""
},
{
"docid": "8a6074e1ca30b45a6751384a248a37b1",
"score": "0.5360955",
"text": "def pixel_intensity(pixel)\n (306 * (pixel.red & MAX_QUANTUM) + 601 * (pixel.green & MAX_QUANTUM) + 117 * (pixel.blue & MAX_QUANTUM)) / 1024\n end",
"title": ""
},
{
"docid": "8e4ec3cca6618ddb39ac668734c21934",
"score": "0.53396195",
"text": "def redify(file, range, off)\n \n Magick::Image.read(file)[0].each_pixel do |pixel|\n pixel.each do |r,g,b|\n ary.bsearch {|x| block } → elem # find matching X in array, apply block...\n \n end\n end \nend",
"title": ""
},
{
"docid": "69c4a8f05113b0da4d789ccbaf2bb0f2",
"score": "0.528966",
"text": "def makeImage\n for i in 0...@width\n ti = 2.0*Math::PI*i/ImageWidth.to_f\n for j in 0...@height\n tj = 2.0*Math::PI*j/ImageHeight.to_f\n\n $image[3 * (@height * i + j)] = 127*(1.0 + Math::sin(ti))\n $image[3 * (@height * i + j) +1] = 127*(1.0 + Math::cos(2*tj))\n $image[3 * (@height * i + j) +2] = 127*(1.0 + Math::cos(ti+tj))\n end\n end\n end",
"title": ""
},
{
"docid": "819a692193a2b6724b6396dbfc053342",
"score": "0.5261017",
"text": "def pixel_x; @x / PIXEL_WIDTH; end",
"title": ""
},
{
"docid": "819a692193a2b6724b6396dbfc053342",
"score": "0.5261017",
"text": "def pixel_x; @x / PIXEL_WIDTH; end",
"title": ""
},
{
"docid": "ef1a4185cf59a5bd1e23c51556cd7154",
"score": "0.52590317",
"text": "def g2r(n)\n\tn*(Math::PI/180)\nend",
"title": ""
},
{
"docid": "0001946ea96d57659fbcbd875bce659c",
"score": "0.52221876",
"text": "def unified_rgb_value(number)\n if defined?(Magick::QuantumDepth)\n return (Magick::QuantumDepth == 16) ? (number / 256) : number\n else\n return (Magick::QuantumRange == 65535) ? (number / 256) : number\n end\n end",
"title": ""
},
{
"docid": "fddedc65ffc95e5eaa05fe1ac456687a",
"score": "0.52168584",
"text": "def fullwidth\n return self.bitmap.width.to_f * self.zoom_x\n end",
"title": ""
},
{
"docid": "bcc18c2a1c097b88dc894e8721ada949",
"score": "0.5212992",
"text": "def raster_line\n @cr[4] << 1 | @cr[3][7]\n end",
"title": ""
},
{
"docid": "cd8bcea343a273ea3dc7a853c7aed1f4",
"score": "0.5205861",
"text": "def upRes(file_path)\t\n\t\toriginal_image = Magick::Image.read(file_path) { self.density = \"300.0x300.0\" }\n\t\toriginal_image.each do |image|\n\t\t\t image = image.resample(300.0, 300.0)\n\t\t\t image.write(file_path) { self.quality = 100 }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2336f133d8383b8a4e68e08473bdbab1",
"score": "0.5203166",
"text": "def polar\n Image.run_cmplx(self) { |x| x.complex :polar }\n end",
"title": ""
},
{
"docid": "73f23b74a9e76a41a16f35bb46ad5910",
"score": "0.51653457",
"text": "def axis_inches axis, tile, pixel\n @offset[axis] + tile*@tile_interval[axis] + pixel*@scale[axis]\n end",
"title": ""
},
{
"docid": "73f23b74a9e76a41a16f35bb46ad5910",
"score": "0.51653457",
"text": "def axis_inches axis, tile, pixel\n @offset[axis] + tile*@tile_interval[axis] + pixel*@scale[axis]\n end",
"title": ""
},
{
"docid": "211bffb4909cb0a3ebd048f373a4a843",
"score": "0.5162108",
"text": "def pixel_width\n @sensor_width / @width_in_pixels\n end",
"title": ""
},
{
"docid": "1bf6a07a2b776f569baeecf9779d22e5",
"score": "0.5161438",
"text": "def normalize(inputs)\n return inputs.map{|pixel|\n pixel/256.0\n }\n end",
"title": ""
},
{
"docid": "9a77ac92dff696459ae3abbbe9eb379f",
"score": "0.51486224",
"text": "def rgb\n h = self.h\n s = self.s\n l = self.l\n # Some simple corrections for h, s and l. */\n h = h % 360\n h += 360 if (h < 0)\n s = [0, [s, 1].min].max\n l = [0, [l, 1].min].max\n \n # From FvD 13.37, CSS Color Module Level 3 \n m2 = (l <= 0.5) ? (l * (1 + s)) : (l + s - l * s)\n m1 = 2 * l - m2\n v=lambda {|h1|\n if (h1 > 360)\n h1 -= 360\n elsif (h1 < 0)\n h1 += 360\n end\n \n \n return m1 + (m2 - m1) * h1 / 60.0 if (h1 < 60.0)\n return m2 if (h1 < 180.0) \n return m1 + (m2 - m1) * (240.0 - h1) / 60.0 if (h1 < 240.0)\n return m1\n }\n \n vv=lambda {|h1| (v.call(h1) * 255).round}\n Rubyvis.rgb(vv.call(h + 120), vv.call(h), vv.call(h - 120), a)\n \n end",
"title": ""
},
{
"docid": "8eb51ee018a7948f362131d05cdb2932",
"score": "0.51443017",
"text": "def megapixel? = unit == 'megapixel'",
"title": ""
},
{
"docid": "d4e02d0607723e079d6f3f4ee68b9ac6",
"score": "0.51410896",
"text": "def pixels(i)\r\n i.get_pixels \r\n end",
"title": ""
},
{
"docid": "4c87cfb4ec5896d0bd53ce8d1ab37ad6",
"score": "0.51305383",
"text": "def pixels_for(points)\n points = [points] unless points.is_a?(Array)\n \n build_request do |xml|\n xml.LLToPix {\n xml.LatLngCollection {\n LatLngCollection.new(points).build xml\n }\n set_map_state xml\n set_display_state xml\n authenticate xml\n }\n end\n \n remote_call(:map)\n \n coll = @response['LLToPixResponse']['PointCollection']\n \n pixels = []\n if coll['X'].is_a?(Array)\n coll['X'].each_index do |i|\n pixels << [coll['X'][i], coll['Y'][i]]\n end\n else\n pixels << [coll['X'], coll['Y']]\n end\n \n pixels.each do |pixel|\n pixel[0] = pixel[0].to_i - Tile::OUTER_SIZE/2 - MapQuest::Tile::ORIGINAL_X_OFFSET\n pixel[1] = pixel[1].to_i - Tile::OUTER_SIZE/2 - MapQuest::Tile::ORIGINAL_Y_OFFSET\n end\n \n pixels\n end",
"title": ""
},
{
"docid": "60fa8d9c7ab9716d0e3a2194fc0db446",
"score": "0.5119563",
"text": "def rlat\n # lat * PI / 180\n self.lat * 0.01745329251994\n end",
"title": ""
},
{
"docid": "f496f7dca857e87949504c7bbc6503f7",
"score": "0.5113942",
"text": "def radius\n \twidth / 2\n end",
"title": ""
},
{
"docid": "7f64b453cda4b80672a2255c2d19d85d",
"score": "0.5105513",
"text": "def convert_to_img\n\t\t\t`gs -sDEVICE=png16m '-r#{OCR::MIN_DENSITY}' -o '#{@image}' '#{@input_file}'`\n\t\tend",
"title": ""
},
{
"docid": "9b432ada0df0d35642411bb9883773a8",
"score": "0.50901026",
"text": "def pixels_from_coordinate(x)\n return pixels_per_coordinate * x\n end",
"title": ""
},
{
"docid": "e9e66eeb04b1853b2f45d0879770532c",
"score": "0.5079541",
"text": "def computeProjection\n w,h = @type==:vertical ? [@image.width, @image.height] : [@image.height, @image.width]\n mw,mh = @type==:vertical ? [@image.width, @image.height-@image.borders.bottom] : [@image.height, @image.width-@image.borders.right]\n content_mask = Array.new(w){[false, 0]}\n\n w.times do |a|\n obj_height = 0\n gap = 0\n (h-mh).times do |b|\n x,y = @type==:vertical ? [a,b] : [b,a]\n idx = @image.index(x, y)\n #p [idx, w, h, mh, a, b, x, y, @image.width, @image.height]\n if @data[idx] <= @threshold\n obj_height += 1\n obj_height += gap if gap <= @image.min_obj_size\n gap = 0\n else\n gap += 1\n content_mask[a] = [true, b] if obj_height > @image.min_obj_size\n obj_height = 0\n end\n end\n end\n\n content_mask\n end",
"title": ""
},
{
"docid": "bf9beac4c8e72e848ceab7208555fdd8",
"score": "0.5077292",
"text": "def sky_diffuse_irradiance\n @diffuse_horizontal_irradiance * (anisotropy_index * geometric_factor + \n (1 - anisotropy_index) * ((BigDecimal('1') + bigdecimal_cos(degree_to_radian(@surface_tilt))) / BigDecimal('2')) * anisotropic_correction_factor)\n end",
"title": ""
},
{
"docid": "6f46d6cdbadb761107f08806acf43c8d",
"score": "0.5073123",
"text": "def depolarize\n @image.run_command(\"convert\", @image.path, \"-virtual-pixel Black -distort DePolar 0\", @image.path)\n end",
"title": ""
},
{
"docid": "019a39263898c4074a4e31b918ba16bd",
"score": "0.50694555",
"text": "def anisotropy_index\n @direct_normal_irradiance / extraterrestrial_irradiance\n end",
"title": ""
},
{
"docid": "a1f02f8c01c7b994ff66f075f9f87f81",
"score": "0.5060458",
"text": "def fit_sprite(s, r)\n s.x, s.y = r.x, r.y\n s.zoom_x, s.zoom_y = r.width, r.height\n end",
"title": ""
},
{
"docid": "b9e53bd2c212c535c251025a11b62df7",
"score": "0.5052842",
"text": "def output_tranformed_pixels\n\t\tstring_of_pixels = @pixels.join(\"\")\n\t\tresult = string_of_pixels.scan(/.{1,9}/).join(\"\\n\")\n\t\t#puts result\n\t\tputs result\n\t\tresult\n\tend",
"title": ""
},
{
"docid": "ec147c689771fb5a693122bfce5eba1a",
"score": "0.50427705",
"text": "def largura_em_pixels\n if self.posicao == HORIZONTAL\n (self.largura.to_f / 100.to_f) * MULTIPLICADOR_PIXELS\n else\n (self.comprimento.to_f / 100.to_f) * MULTIPLICADOR_PIXELS\n end\n end",
"title": ""
},
{
"docid": "02b5c4c0708a6bc2ef016e6fdbb0542c",
"score": "0.5027182",
"text": "def pixelwidth\n end",
"title": ""
},
{
"docid": "d7b1ba4f4fc9394456b8fe24662459dd",
"score": "0.50226057",
"text": "def set_one_pixel(pixelno,r,g,b)\n# puts \"Set one pixel length packetdata in \" + @@packetdata.size.to_s\n pixelno = pixelno % @@numpixels\n if r < 256 then\n temp = [r]\n @@packetdata[pixelno * 3] = temp.pack(\"C\")\n end\n if g < 256 then\n temp = [g]\n @@packetdata[(pixelno * 3) + 1] = temp.pack(\"C\")\n end\n if b < 256 then\n temp = [b]\n @@packetdata[(pixelno * 3) + 2] = temp.pack(\"C\") \n end \nend",
"title": ""
},
{
"docid": "38c3ba34337879d26bdb318776f5fe1f",
"score": "0.5018051",
"text": "def reconstructed_scanline\n @reconstructed_scanline = []\n @filtered.each do |byte|\n recon = case @type\n when 0\n none(byte)\n when 1\n sub(byte)\n when 2\n up(byte)\n when 3\n average(byte)\n when 4\n paeth(byte)\n end\n\n @reconstructed_scanline << (recon % 256)\n @position += 1\n end\n\n @reconstructed_scanline\n end",
"title": ""
},
{
"docid": "f038a996a96815f9691871026424d830",
"score": "0.50165766",
"text": "def test_grid_to_spherical_55_00_12_45\n assert_almost_equal [12.75, 55.00], Mercator.grid_to_spherical(6097106.672, 356083.438, @datum, @projection)\n end",
"title": ""
},
{
"docid": "fdbd11cbf8800b976141accbcf29429e",
"score": "0.50081795",
"text": "def rounding_error\n dif = (@y-rmagick_img.rows) + (@x-rmagick_img.columns)\n\n if dif > 0 && dif < 10 then\n rmagick_img.resize!(@x, @y)\n end\n end",
"title": ""
},
{
"docid": "dd69ff31c91a68ec6b88bca460339398",
"score": "0.49867722",
"text": "def to_megapixel(**options) = convert_to('megapixel', **options)",
"title": ""
},
{
"docid": "a02a5539c2b23362a89582b52e1700b5",
"score": "0.49832353",
"text": "def initialize(pixels)\n @red = @green = @blue = 0\n pixels.each do |pixel|\n @red += pixel.red.to_f / pixels.length\n @green += pixel.green.to_f / pixels.length\n @blue += pixel.blue.to_f / pixels.length\n end\n end",
"title": ""
},
{
"docid": "22b21e526b537fcbe0f19d2a939b27a6",
"score": "0.4966283",
"text": "def scale_degrees\n \n end",
"title": ""
},
{
"docid": "f20e2ca338d6637d48e843c105b69b74",
"score": "0.495514",
"text": "def pixel_color_f(c, r)\n c1, c2 = c.floor, c.ceil\n r1, r2 = r.floor, r.ceil\n return pixel_color(c, r) if c1 == c2 && r1 == r2\n \n fq11 = pixel_color(c1, r1)\n fq12 = pixel_color(c1, r2)\n fq21 = pixel_color(c2, r1)\n fq22 = pixel_color(c2, r2)\n\n Pixel.new(\n Interplolate.bilinear(c, r, fq11.red, fq12.red, fq21.red, fq22.red),\n Interplolate.bilinear(c, r, fq11.green, fq12.green, fq21.green, fq22.green),\n Interplolate.bilinear(c, r, fq11.blue, fq12.blue, fq21.blue, fq22.blue),\n )\n end",
"title": ""
},
{
"docid": "f039497556a0bdafd702fa6f4bad995a",
"score": "0.49527916",
"text": "def rectangular\n [re, im]\n end",
"title": ""
},
{
"docid": "551c8c0e469b9b093d2b1174cf429539",
"score": "0.49338308",
"text": "def build_reduced_land_mass_image(x, y, zoom, accuracy_pixels, overwrite = false)\n land_mass_tile_path = LandMassTile.tile_path(x, y, zoom, accuracy_pixels)\n \n # exit if file already exists\n return false if (!overwrite && File.exists?(land_mass_tile_path))\n \n begin\n # build up square of 4 children tiles\n child_tiles = (0..1).map { |this_x| (0..1).map { |this_y| OpenStruct.new(:x => this_x+x*2, :offset_x => this_x, :y => this_y+y*2, :offset_y => this_y, :zoom => zoom+1) } }.flatten(1)\n \n reduce_tiles = child_tiles.select do |tile| \n tile.accuracy_pixels = accuracy_pixels \n tile.path = LandMassTile.tile_path(tile.x, tile.y, tile.zoom, tile.accuracy_pixels)\n tile.exists = File.exists?(tile.path)\n tile.img = Magick::Image.read(tile.path).first if tile.exists\n tile.exists # remove image if tile does not exist\n end\n \n stitch_tiles = child_tiles.select do |tile| \n tile.accuracy_pixels = accuracy_pixels * 2\n tile.path = LandMassTile.tile_path(tile.x, tile.y, tile.zoom, tile.accuracy_pixels)\n tile.exists = File.exists?(tile.path)\n tile.img = Magick::Image.read(tile.path).first if tile.exists\n tile.exists # remove image if tile does not exist\n end unless reduce_tiles.length == 4\n \n if (reduce_tiles.length == 4)\n # We are building a land mass tile from children with the same number of pixels in the tile\n # which means we need to \"squeeze\" 4 tiles into 1\n new_tile = Magick::Image.new(AppConfig.gmap_tile_size / accuracy_pixels * 2, AppConfig.gmap_tile_size / accuracy_pixels * 2) do\n self.background_color = \"transparent\"\n end\n \n child_tile_size = new_tile.columns / 2\n reduce_tiles.each do |tile|\n raise \"Tile#{tile.path} is incorrectly #{tile.img.columns} wide / high\" if ( (tile.img.columns != child_tile_size) || (tile.img.rows != child_tile_size) ) \n pixels = tile.img.export_pixels(0, 0, tile.img.columns, tile.img.rows, \"RGBA\")\n new_tile.import_pixels(tile.offset_x * child_tile_size, tile.offset_y * child_tile_size, tile.img.columns, tile.img.rows, \"RGBA\", pixels)\n end\n \n # now resize down to single tile size\n reduced_tile = new_tile.resize(AppConfig.gmap_tile_size / accuracy_pixels, AppConfig.gmap_tile_size / accuracy_pixels)\n \n reduced_tile.write land_mass_tile_path\n elsif (stitch_tiles.length == 4)\n # We are building a land mass tile from children with a lower accuracy level i.e. we need to \n # build up this tile by stitching 4 children tiles together\n \n new_tile = Magick::Image.new(AppConfig.gmap_tile_size / accuracy_pixels, AppConfig.gmap_tile_size / accuracy_pixels) do\n self.background_color = \"transparent\"\n end\n \n child_tile_size = new_tile.columns / 2\n stitch_tiles.each do |tile|\n raise \"Tile#{tile.path} is incorrectly #{tile.img.columns} wide / high\" if ( (tile.img.columns != child_tile_size) || (tile.img.rows != child_tile_size) ) \n pixels = tile.img.export_pixels(0, 0, tile.img.columns, tile.img.rows, \"RGBA\")\n new_tile.import_pixels(tile.offset_x * child_tile_size, tile.offset_y * child_tile_size, tile.img.columns, tile.img.rows, \"RGBA\", pixels)\n end\n \n new_tile.write land_mass_tile_path\n else\n reduce_tiles_info = reduce_tiles.map{|c| \"#{c.x}:#{c.y} zm #{c.zoom}\" }.join(',')\n stitch_tiles_info = stitch_tiles.map{|c| \"#{c.x}:#{c.y} zm #{c.zoom}\" }.join(',')\n SLogger.warn(\"Could not reduce land mass image for position as not all children tiles exist. Tile #{x}:#{y} (zoom #{zoom}). Reduce tiles: #{reduce_tiles_info}. Stitch tiles: #{stitch_tiles_info}\")\n false\n end\n \n rescue Exception => e\n SLogger.warn(\"Could not save reduced land mass image for position #{x}:#{y} (zoom #{zoom}). Error '#{e.message}'\")\n false\n end\n end",
"title": ""
},
{
"docid": "2c3fd4e16a354b2da2ea2afd6a701f07",
"score": "0.49330786",
"text": "def circleArea(r)\n PI * r ** 2 \nend",
"title": ""
},
{
"docid": "2daf8fc5047eddba9b9be8d56acfbf28",
"score": "0.49304983",
"text": "def pixels\n input_file.lines.map do |line|\n line.chars.map { |c| !!(c =~ /\\S/) }\n end\nend",
"title": ""
},
{
"docid": "8bb3862e7349ece6affd8ce963683203",
"score": "0.49267414",
"text": "def zoom\n `#@native.devicePixelRatio`\n end",
"title": ""
},
{
"docid": "12b4e075c93fd6befb17458dd52f8e0d",
"score": "0.49234635",
"text": "def point_convertor(point)\n point.map do |coordonate|\n (coordonate * 255).to_i\n end\n end",
"title": ""
},
{
"docid": "f1807724696a9bf85080d6ad8ea38dc0",
"score": "0.49210206",
"text": "def t_r(r,size)\n r * Math::sqrt(((size)-2).to_f / (1 - r**2))\n end",
"title": ""
},
{
"docid": "4f5dec211ddb3b7a04a550b8c2c93583",
"score": "0.4920623",
"text": "def radius=(r); @@R = r; end",
"title": ""
},
{
"docid": "61078ccabff304918a87de09641408bc",
"score": "0.49020624",
"text": "def get_square(lat,lon)\n return [ ((lat * 100.0).round)/100.0,\n ((lon * 100.0).round)/100.0 ]\n \nend",
"title": ""
},
{
"docid": "69a565f730d53979086534552d4f7618",
"score": "0.48892853",
"text": "def get_pixels(map=\"RGB\")\n raise ArgumentError, \"Invalid map value\" unless [\"RGB\", \"RGBA\"].include?(map)\n convert = MiniMagick::Tool::Convert.new\n convert << path\n convert.depth(8)\n convert << \"#{map}:-\"\n\n # Do not use `convert.call` here. We need the whole binary (unstripped) output here.\n shell = MiniMagick::Shell.new\n output, * = shell.run(convert.command)\n\n pixels_array = output.unpack(\"C*\")\n pixels = pixels_array.each_slice(map.length).each_slice(width).to_a\n\n # deallocate large intermediary objects\n output.clear\n pixels_array.clear\n\n pixels\n end",
"title": ""
},
{
"docid": "f4bc5b2caad5f72f178d41adc14fd2f9",
"score": "0.48784465",
"text": "def meters_to_pixels(mx, my, zoom)\n res = resolution(zoom)\n px = (mx + @origin_shift) / res\n py = (my + @origin_shift) / res\n [px, py]\n end",
"title": ""
},
{
"docid": "a25ab422ae6b29d297ccd6af03d0743f",
"score": "0.48709098",
"text": "def draw\r\n @image.bmp.draw(@x - @radius, @y- @radius, 1)\r\n end",
"title": ""
},
{
"docid": "78d9f50b52e906c9ce51b1c617bab12b",
"score": "0.48675323",
"text": "def ir_hidratos \n\t\t@hidratos_ir = hidratos\n\t\t@ir_hidratos = (@hidratos_ir/260.to_f)*100\n\t\t@ir_hidratos.round(1)\n\tend",
"title": ""
},
{
"docid": "01767f29243c8dec2ed4f645e5ec2176",
"score": "0.48571154",
"text": "def pixel_to_array(pixel, precision=QuantumRange)\n\treturn [(pixel.red*precision/QuantumRange),(pixel.green*precision/QuantumRange),(pixel.blue*precision/QuantumRange)]\nend",
"title": ""
},
{
"docid": "10710c116f8ffe0212c7739dd7c02ea0",
"score": "0.48562577",
"text": "def circle(radius)\n pixels = []\n \n @width.times do |x|\n row = Array.new(@height, nil)\n \n @height.times do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f/@density) - @x_offset\n yy = f_halfcircle(xx, radius)\n yt = yy + @y_offset\n yb = -yy + @y_offset\n\n if (yt >= y && yt < y + 1) || (yb >= y && yb < y + 1)\n pixel = 1\n end\n end\n row[y] = pixel\n end\n pixels << row\n end\n \n PNM.create(pixels.transpose.reverse!, {:type => :pbm})\n end",
"title": ""
},
{
"docid": "1494f1ebfab658d02491371d24f9aa4d",
"score": "0.48391026",
"text": "def rmagik_info(file)\n puts \"- - - - - :rmagik-S\"\n puts file\n puts \">> Checking for oversized file > 430px wide\"\n img = Magick::Image::read(file).first\n puts \"Geometry: #{img.columns}x#{img.rows} - #{img.columns.class}x#{img.rows.class}\"\n\n if img.columns > 430 # resize to 430 wide\n \n scale = (430.0 / img.columns.to_f).round(6) # calculate scaling factor for image\n \n puts \"RESIZING before copying x#{scale}\"\n \n file_large = file.sub(File.extname(file), '_LRG.jpg') # copy to image_name_LRG.jpg\n FileUtils.cp( file, \"scratch/#{file_large}\")\n \n img_430 = img.scale(scale)\n \n img_430.write(file)\n \n end\n \n #img = Magick::Image::read(file).first\n #puts \" Format: #{img.format}\"\n #puts \" Geometry: #{img.columns}x#{img.rows}\"\n #puts \" Class: \" + case img.class_type\n # when Magick::DirectClass\n # \"DirectClass\"\n # when Magick::PseudoClass\n # \"PseudoClass\"\n # end\n #puts \" Depth: #{img.depth} bits-per-pixel\"\n #puts \" Colors: #{img.number_colors}\"\n #puts \" Filesize: #{img.filesize}\"\n #puts \" Resolution: #{img.x_resolution.to_i}x#{img.y_resolution.to_i} \"+\n # \"pixels/#{img.units == Magick::PixelsPerInchResolution ?\n # \"inch\" : \"centimeter\"}\"\n #if img.properties.length > 0\n # puts \" Properties:\"\n # img.properties { |name,value|\n # puts %Q| #{name} = \"#{value}\"|\n # }\n #end\n puts \"- - - - - :rmagik-E\"\nend",
"title": ""
},
{
"docid": "f39de77f35d2a670582729e26da573ab",
"score": "0.48326325",
"text": "def bitmap\n @bitmap\n end",
"title": ""
},
{
"docid": "0215a68557aa7cc39d42956b82ff32cf",
"score": "0.48310354",
"text": "def normalized_size\n\t\t\ttile_size(max_level) * @unit_size\n\t\tend",
"title": ""
},
{
"docid": "c701d5936e6bf6e49c3fc0691f872293",
"score": "0.48289877",
"text": "def pixel_rate=(val)\n if val > 5\n @pixel_rate = 5\n elsif val < 0\n @pixel_rate = 0\n else\n @pixel_rate = val\n end\n end",
"title": ""
},
{
"docid": "8dc38570326aef51409947b89eb9d650",
"score": "0.48251134",
"text": "def in_polar_coordinates\n return [] unless recognized_format?\n radius_data.map.with_index { |r, i| [i * 2 * Math::PI / radius_data.size, r] }\n end",
"title": ""
},
{
"docid": "4e651cb9e9c657d45e3120e1147c1bc3",
"score": "0.48174644",
"text": "def trim_data\n self.angular_resolution = self.angular_resolution.round(3)\n self.magnitude = self.magnitude.round(3)\n end",
"title": ""
},
{
"docid": "1e1c1538dcf5d0dc00d6e944cff05542",
"score": "0.4817222",
"text": "def r; self.color.r end",
"title": ""
},
{
"docid": "3a509e92e0aa8549b12a505e568ce7e6",
"score": "0.48129278",
"text": "def pixels_to_meters(px, py, zoom)\n res = resolution(zoom)\n mx = px * res - @origin_shift\n my = py * res - @origin_shift\n [mx, my]\n end",
"title": ""
},
{
"docid": "6cc70b6abd3992be3adf010f2fef5025",
"score": "0.4812249",
"text": "def test_load_8bit_interlaced_paletted\n img = Imgrb::Image.new(\"test/png_test_suite/basi3p08.png\")\n assert INDEXED_8BIT_DEPALETTED_R_ROWS == img.get_channel(0).rows\n assert INDEXED_8BIT_DEPALETTED_G_ROWS == img.get_channel(1).rows\n assert INDEXED_8BIT_DEPALETTED_B_ROWS == img.get_channel(2).rows\n end",
"title": ""
},
{
"docid": "78346ccc75d02f3104751f0b183c6283",
"score": "0.4809755",
"text": "def pixel\n image_name_list = get_image_name_list ELEMENTS_PATH\n image_name_list.each { |image_name| minimize(image_name) }\n end",
"title": ""
},
{
"docid": "670d9de99ae4fc80ffe83c9a8f61b51d",
"score": "0.48016158",
"text": "def rm_edgy_x() (ppu_x * reg_radius).round + 5 end",
"title": ""
},
{
"docid": "029a450bdeea8e566b88a78141ac2056",
"score": "0.48004124",
"text": "def to_foorth_r\r\n self.rationalize\r\n end",
"title": ""
},
{
"docid": "42d523e3d122d779cca4d1e9a959a385",
"score": "0.48003548",
"text": "def gear_inches\n\tratio * (rim + (tire * 2))\nend",
"title": ""
},
{
"docid": "c38773098786be4bebd5b4ef4647d338",
"score": "0.47989208",
"text": "def irmonograsas\n vag=(grasasmono * 100) / 70\n vag.round(2)\n end",
"title": ""
},
{
"docid": "6150fb89c8021e3761102cdc6e5a050c",
"score": "0.47963277",
"text": "def calc_native_res_zoom(image_source)\n\t\timage = get_image(image_source)\n\t\tside_length = calc_side_length(image)\n\t\tzoom = log2(side_length)-log2(TILE_SIZE)\n\t\tzoom = 0 if zoom < 0\n\t\tzoom\n\tend",
"title": ""
},
{
"docid": "c7f4715b9ea20552b6fcfa6ef5ab720a",
"score": "0.47886398",
"text": "def to_abgr_stream\n pixels.pack(\"V*\")\n end",
"title": ""
},
{
"docid": "f33f18697578310161adb26e1d89c380",
"score": "0.4785046",
"text": "def encode_png_pixels_to_scanline_truecolor_8bit(pixels)\n pixels.pack(\"x\" + (\"NX\" * width))\n end",
"title": ""
},
{
"docid": "55881606d4389e308d28d8ed113368b8",
"score": "0.4781804",
"text": "def image(p,fp)\n if o.lentille ## Cas des lentilles\n return 10000 if p == -fp\n return p*fp/(p+fp) \n else ## Cas des miroirs\n return 10000 if p == -fp\n return p*(-fp)/(p+fp)\n end\n end",
"title": ""
},
{
"docid": "dafbe5f6f86c690cf4bd7274f8f2e130",
"score": "0.4779696",
"text": "def max_resolution; end",
"title": ""
},
{
"docid": "2f9ff3093e82e968ea1b4610f87065ea",
"score": "0.47711363",
"text": "def optimized_image(image,x,y)\n return image.variant(resize_to_fill: [x,y]).processed\n end",
"title": ""
},
{
"docid": "e6fda9122634788c55965194e5731581",
"score": "0.47687212",
"text": "def to_rgb_stream\n pixels.pack(\"NX\" * pixels.length)\n end",
"title": ""
},
{
"docid": "74b265dd17eebef5ac2e597a9c5bc862",
"score": "0.47642103",
"text": "def snap_to_bitmap\n @viewport&.snap_to_bitmap || Bitmap.new(16, 16)\n end",
"title": ""
},
{
"docid": "ce5761d3f1a76afa34a51ca70f0d8522",
"score": "0.4761927",
"text": "def pixels\n \n return width.to_i * height.to_i\n \n end",
"title": ""
},
{
"docid": "bdca114d8f0d8b062f16f9cf51faeee8",
"score": "0.47618625",
"text": "def min_max\n @min_max ||= raster_min_max\n end",
"title": ""
},
{
"docid": "4de3c0435a5a974fba5fe90122351891",
"score": "0.4758498",
"text": "def draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend",
"title": ""
},
{
"docid": "6816dc52e872d0198e548d9e9af60db8",
"score": "0.4754179",
"text": "def extract_pixel_size\n output_message = extract_raster_info(webmercator_filepath)\n matches = output_message.match(/pixel size = \\((.*)?,/i)\n raise TiffToSqlConversionError.new(\"Error obtaining raster pixel size: #{output_message}\") unless matches[1]\n matches[1].to_f\n end",
"title": ""
}
] |
b0cf5749cf614da3c84c1e2e1685a6f7
|
Displays all the Zendesk search options.
|
[
{
"docid": "9ba815788f5152c29f336eb93a63e979",
"score": "0.5936587",
"text": "def search_menu\n resources = @storage_instance.resources\n @cli.choose do |menu|\n menu.prompt = 'search: Select option'\n\n count = 0\n resources.each do |resource|\n menu.choice \"Press #{count += 1} to search #{resource}.\" do\n get_search_input(resource.to_s)\n end\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "9e71cec6814ee99197d7eb71abc65db2",
"score": "0.6615198",
"text": "def show\n\n if (@search.provider.match(/\\ASearchProvider::/) && SearchProvider::Provider.subclasses.include?(@search.provider.to_s.constantize) )\n @provider_options = @search.provider.constantize.options\n else\n @provider_options = []\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @search }\n end\n end",
"title": ""
},
{
"docid": "30c97310df95bb5192c5096b421847c4",
"score": "0.6474261",
"text": "def options\n @search_options\n end",
"title": ""
},
{
"docid": "ef230b2524e1644a54066f57e6aa343a",
"score": "0.6366256",
"text": "def index\n if(params[:search] && params[:search]!=\"\")\n @vietnameses = Vietnamese.admin_search(params[:search]).paginate(:page => params[:page], :per_page => 12)\n else\n @vietnameses = Vietnamese.paginate(:page => params[:page], :per_page => 12)\n end\n end",
"title": ""
},
{
"docid": "0cb4f2dedc013dc897fabae07aff3772",
"score": "0.6321063",
"text": "def index\n # if we have query params, make an array for the options of the second dropdown\n # byebug\n @campaigns = Campaign.search(params[:campaign])\n \n end",
"title": ""
},
{
"docid": "9d91c9e6c7e29b94466a6923aac33400",
"score": "0.6308732",
"text": "def search_fields\n Blacklight.search_field_options_for_select\n end",
"title": ""
},
{
"docid": "2cbfb33f7e6016727a144d27444c5354",
"score": "0.6299112",
"text": "def index\n if params[:search]\n @adoptions = Adoption.search(params[:search]).order(\"created_at DESC\").paginate(page: params[:page], per_page: 10)\n else\n @adoptions = Adoption.all.order('created_at DESC').paginate(page: params[:page], per_page: 10)\n end \n end",
"title": ""
},
{
"docid": "55f9cac59180f863bbc85316f50cb8ef",
"score": "0.6279351",
"text": "def render_search_results(options={})\n default_options = {\n :show_result_count => true,\n :show_heading => true\n }\n render 'alchemy/search/results', :options => default_options.merge(options)\n end",
"title": ""
},
{
"docid": "527f48fb33da6579cb9db2104338fe75",
"score": "0.6267768",
"text": "def search_options\n\n designer_role = Role.find_by_name('Designer')\n @designers = designer_role.users.sort_by { |u| u.last_name }\n @platforms = Platform.find(:all, :order => :name)\n @projects = Project.get_projects\n @review_types = ReviewType.get_review_types\n \n if (@logged_in_user && @logged_in_user.is_designer?)\n @designer = @logged_in_user\n else\n @designer = nil\n end\n\n end",
"title": ""
},
{
"docid": "8e80e20ad99f6087c8cb812beeba0f13",
"score": "0.6263448",
"text": "def index\n @search = SicossContractMode.search(params[:search])\n @sicoss_contract_modes = @search.page(params[:page]).per(10)\n flash.now[:notice] = t('flash.actions.index.notice') if @sicoss_contract_modes.empty?\n respond_with(@sicoss_contract_modes)\n end",
"title": ""
},
{
"docid": "944ccb28849689f7eb78e095eab2e890",
"score": "0.6247166",
"text": "def show\n get_options\n end",
"title": ""
},
{
"docid": "02d9614dfc6cc25a09dd6e949de74530",
"score": "0.6246968",
"text": "def all\n\t\t\tadvanced_search([])\n\t\tend",
"title": ""
},
{
"docid": "ddd5f49e81ee8c3a1f86af08085c5488",
"score": "0.6235252",
"text": "def options\n order = params[:order]\n if order == 'name'\n order = 'arcades.name, frequentships_count desc' \n elsif order == 'favorites'\n order = 'frequentships_count desc'\n elsif order == 'games'\n order = 'playables_count desc'\n elsif current_session.addressed_in?\n order = 'distance'\n else\n order = 'arcades.name, frequentships_count desc'\n end\n\n search = params[:search]\n search = \"%\" + search if search and params[:search].length >= 2\n\n collection_options = {}\n collection_options[:page] = params[:page] || 1\n collection_options[:per_page] = params[:per_page] if params[:per_page]\n collection_options[:order] = order\n collection_options[:include] = {:address => [:region, :country]} \n collection_options[:conditions] = ['arcades.name like ?', \"#{search}%\"] unless search.blank?\n if current_session.addressed_in?\n collection_options[:origin] = current_session.address\n collection_options[:within] = current_session.arcade_range if !parent? && current_session.arcade_range !=0\n end\n collection_options\n end",
"title": ""
},
{
"docid": "b7ead43c56b158d4c1ab74f08a221afe",
"score": "0.6213385",
"text": "def search_option\n super\n end",
"title": ""
},
{
"docid": "8a7ea062241bbeb872b12b575362ba89",
"score": "0.6195158",
"text": "def display_filtered_search_results(search); end",
"title": ""
},
{
"docid": "8a7ea062241bbeb872b12b575362ba89",
"score": "0.6195158",
"text": "def display_filtered_search_results(search); end",
"title": ""
},
{
"docid": "38f215a2f74cb7ce5b712eedf1932e92",
"score": "0.6190942",
"text": "def all_search_filter_options\n [\n {\n html_element: :search,\n display_name: \"Add to general search\",\n }\n ]\n end",
"title": ""
},
{
"docid": "a740ad77cf55e05d3b45db60d083b418",
"score": "0.6185401",
"text": "def show\n @device_types = DeviceType.all\n @channels = Channel.bss_title_id_search(params[:search])\n @clip_type.view_options = params\n end",
"title": ""
},
{
"docid": "c0322e7680ff4e92cae010012011a390",
"score": "0.6179026",
"text": "def show_search_list\n\t\t\t sdk_dir_arr.each { |dir| puts dir }\n\t\t\tend",
"title": ""
},
{
"docid": "05ab76d5b4d8eaae76cb49a7d53689b2",
"score": "0.6151317",
"text": "def search_fields\n search_field_options_for_select\n end",
"title": ""
},
{
"docid": "05ab76d5b4d8eaae76cb49a7d53689b2",
"score": "0.6151317",
"text": "def search_fields\n search_field_options_for_select\n end",
"title": ""
},
{
"docid": "f52a2089b3920e87b55d0d68993a2a40",
"score": "0.6146979",
"text": "def search\n\t\t@orders = buscar(params[:provider])\n\t\trender 'index'\n\tend",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.61329204",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.61329204",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.61329204",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "9f52389d61663cdbf9eddfee4261bca9",
"score": "0.61329204",
"text": "def index\n @options = Option.all\n end",
"title": ""
},
{
"docid": "554ff2bc9b841cfb2d6dcbdd855ea350",
"score": "0.61131966",
"text": "def search_options\r\n SearchBuilder.new(@cat, @loc, @page, @sz, request.remote_ip).search_options(@url, site)\r\n end",
"title": ""
},
{
"docid": "cbb751277e9581d370cc252f4477fd1e",
"score": "0.6103694",
"text": "def display\n initial_value = options[:search] && options[:search][:column] == column_name.to_s ? options[:search][:query] : ''\n <<-HTML.strip_heredoc\n <form method='get' action=\"?\">\n <label for='search'>#{column_name.to_s.split('_').join(\" \").titleize}</label>\n <input type='text' name=\"tm_#{options[:name]}[search][query]\" value=\"#{initial_value}\"/>\n <input type='hidden' name=\"tm_#{options[:name]}[search][column]\" value=\"#{column_name}\"/>\n <input type='hidden' name=\"tm_#{options[:name]}[new_search]\" value=\"true\"/>\n #{create_other_fields options}\n <input id='search' type='submit' value='Search' />\n </form>\n HTML\n\n end",
"title": ""
},
{
"docid": "c39ae52b82c7a8d20a30a5f47ec625d4",
"score": "0.60870236",
"text": "def search( show_name, options = {} )\n endpoint = options[:detailed] ? '/full_search.php' : '/search.php'\n self.class.get( endpoint, query: { show: show_name } )\n end",
"title": ""
},
{
"docid": "666353f2662b76a03fc77fabde161c20",
"score": "0.60845375",
"text": "def options\n search = params[:search]\n search = \"%\" + search if search and params[:search].length >= 2\n\n collection_options = {}\n collection_options[:include] = :game if parent_type == :arcade || parent_type == :profile\n collection_options[:page] = params[:page] || 1\n collection_options[:per_page] = params[:per_page] || Game::PER_PAGE\n collection_options[:order] = params[:order] || 'games.name'\n if search == '#'\n collection_options[:conditions] = ['games.name regexp \"^[0-9]+\"']\n elsif !search.blank?\n collection_options[:conditions] = ['(games.name like ? OR games.name like ?)', \"#{search}%\", \"#{search.downcase}%\"]\n end\n \n unless administrator?\n collection_options[:conditions] = ['games.pending=?', false]\n end\n\n collection_options\n end",
"title": ""
},
{
"docid": "4476a8aeb62f5cfa7ace57f5da106c13",
"score": "0.6078605",
"text": "def search\n\n @power_generators = PowerGenerator.search_by_name(params['search']).page(params['page'])\n flash.now[:search] = \"Pesquisando por: #{params['search']}\"\n\n render :index\n end",
"title": ""
},
{
"docid": "7639f32b1b5007ce00fd66f79eef37ec",
"score": "0.60785913",
"text": "def index\n @halalfoodhunt_seos = HalalfoodhuntSeo.all\n @search = Ecommer.ransack(params[:q])\n @search.sorts = 'created_at DESC' if @search.sorts.empty?\n @ecommers = @search.result.where(draft: false)\n @qualifying_type = QualifyingType.all\n end",
"title": ""
},
{
"docid": "d9e80889807eabe5a91cb10468fadb8c",
"score": "0.60767925",
"text": "def index\n\t\t@search_for = Search_option.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @med_posts }\n end\n end",
"title": ""
},
{
"docid": "4f07f2521dafa0c0042acfbd6921a1ad",
"score": "0.60752875",
"text": "def search(options = {})\n get_from_bigtincan_api \"/search\", options\n end",
"title": ""
},
{
"docid": "0c44e1499ca138fe68c07a1e86dd57cc",
"score": "0.6073835",
"text": "def show\n @title = \"Show Query\"\n @query = Query.find(params[:id])\n @filters = @query.selected_filters\n params[:results_mode] ||= 'preview'\n result_order = VwcAllCombined::RESULT_ORDER.dup.\n keep_if{|fld| @query.selected_fields.include?(fld.to_s) } # because some dbs (incl postgres) won't let me sort on a field that's not in the select-distinct list\n results = VwcAllCombined.search(@filters).relation.\n select(\"DISTINCT #{@query.selected_fields.join(', ')}\").\n order(result_order)\n @count = VwcAllCombined.count_me(results.to_sql)\n case params[:results_mode]\n when 'full-html'\n @results = results.paginate :page => params[:page], \n :total_entries => @count, \n :per_page => 50\n when 'full-csv'\n @results = results\n respond_to do |format|\n format.csv\n format.html { params[:results_mode] = 'preview'; redirect_to params }\n end\n else # includes 'preview' - ie, default to preview mode\n @results = results.limit(12)\n end\n end",
"title": ""
},
{
"docid": "615170e2a4343795f07030dadcc4bb60",
"score": "0.60639226",
"text": "def index\n @title = t('view.providers.index_title')\n @searchable = true\n @providers = Provider.filtered_list(params[:q]).order('firm_name DESC').\n page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"title": ""
},
{
"docid": "e3f2f60b2ab7cd328e548528406b8d24",
"score": "0.60615116",
"text": "def index\n #@contract_modes = ContractMode.all\n @search = ContractMode.search(params[:search])\n @contract_modes = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @contract_modes }\n end\n end",
"title": ""
},
{
"docid": "aceb5fe31eed7b1a5f2b7f0f5e141a67",
"score": "0.60412145",
"text": "def index\n # temporary to show past searches\n @searches = Search.all\n\n # allows search form to load on index page (basically taken from /searches/new)\n # @search = Search.new\n\n end",
"title": ""
},
{
"docid": "04bda45348987137c06639ecdfd6218e",
"score": "0.6032285",
"text": "def display\n on DisplayScheduleOfClasses do |page|\n page.term.select @term\n page.select_type_of_search(@type_of_search)\n case @type_of_search\n when \"Course\" then page.course_search_parm.set @course_search_parm\n when \"Instructor\" then instructor_lookup(@instructor_principal_name)\n when \"Department\" then department_lookup(@department_long_name)\n when \"Title & Description\" then page.title_description_search_parm.set @keyword\n else raise \"ScheduleOfClasses - search type not recognized\"\n end\n\n page.show\n end\n end",
"title": ""
},
{
"docid": "4ec20c3fe9c1d3a82b3ce3b5a24270b8",
"score": "0.603087",
"text": "def show\n set_index_options\n end",
"title": ""
},
{
"docid": "bea7dd4982c70ca54d5b7e5aea335064",
"score": "0.60227317",
"text": "def search\n Log.add_info(request, params.inspect)\n\n list\n render(:action => 'list')\n end",
"title": ""
},
{
"docid": "bea7dd4982c70ca54d5b7e5aea335064",
"score": "0.60227317",
"text": "def search\n Log.add_info(request, params.inspect)\n\n list\n render(:action => 'list')\n end",
"title": ""
},
{
"docid": "bea7dd4982c70ca54d5b7e5aea335064",
"score": "0.60227317",
"text": "def search\n Log.add_info(request, params.inspect)\n\n list\n render(:action => 'list')\n end",
"title": ""
},
{
"docid": "bea7dd4982c70ca54d5b7e5aea335064",
"score": "0.60227317",
"text": "def search\n Log.add_info(request, params.inspect)\n\n list\n render(:action => 'list')\n end",
"title": ""
},
{
"docid": "f15eddf77aae549521059475af38c86a",
"score": "0.6022175",
"text": "def index\n search_term = params[:search].to_s.strip\n resources = find_resources(search_term)\n resources = apply_collection_includes(resources)\n resources = order.apply(resources)\n resources = resources.page(params[:page]).per(records_per_page)\n page = Administrate::Page::Collection.new(dashboard, order: order)\n\n render locals: {\n resources: resources,\n search_term: search_term,\n page: page,\n show_search_bar: show_search_bar?\n }\n end",
"title": ""
},
{
"docid": "baa6548bfaa07250fb8fd6ef526bf6dd",
"score": "0.60054016",
"text": "def search(options = {})\n get 'index', params: options.merge!({page: 1, per_page: 30})\n end",
"title": ""
},
{
"docid": "75f3895f4ca186fb5d2cf768347d1502",
"score": "0.5998271",
"text": "def index\n @searchvs = Searchv.all\n end",
"title": ""
},
{
"docid": "1f59b98036177e5d828e008daf5e6315",
"score": "0.5994597",
"text": "def index\n @opts = Opt.all\n end",
"title": ""
},
{
"docid": "a2372b79f3ae6dd7eb7308b0143d3bd9",
"score": "0.5983766",
"text": "def render_search_form(options={})\n default_options = {\n :html5 => false,\n :class => 'fulltext_search',\n :id => 'search'\n }\n render :partial => 'alchemy/search/form', :locals => {:options => default_options.merge(options), :search_result_page => find_search_result_page}\n end",
"title": ""
},
{
"docid": "027e17e82c983316af94e84fee48f196",
"score": "0.597852",
"text": "def show\n @clip_types = ClipType.search(params[:search])\n @folder.view_options = params\n end",
"title": ""
},
{
"docid": "e7f0e4ae972361eb1991dd4f9b9d62bc",
"score": "0.5977416",
"text": "def search\n # Create grouped optrions for administrative_area select tag\n @opt1 = Address.select('distinct country, administrative_area_level_1')\n @opt1_grouped = @opt1.each_with_object({}) do |f, options|\n (options[f.country] ||= []) << [f.administrative_area_level_1]\n end\n @opt2 = Address.select('distinct administrative_area_level_1, locality')\n @opt2_grouped = @opt2.each_with_object({}) do |f, options|\n (options[f.administrative_area_level_1] ||= []) << [f.locality]\n end\n\n country = params[:country] || nil\n administrative_area = params[:administrative_area] || nil\n locality = params[:locality] || nil\n property_type = params[:property_type] || nil\n # Joining addresses table to properties table by a single associated model\n # for searching sorted with 'created_at'\n @property = Property.joins(:address)\n .where('country LIKE ?'\\\n\t\t\t\t\t\t\t'and administrative_area_level_1 LIKE ?'\\\n\t\t\t\t\t\t\t'and locality LIKE ?'\\\n\t\t\t\t\t\t\t'and property_type LIKE ?',\n \"%#{country}%\", \"%#{administrative_area}%\", \"%#{locality}%\", \"%#{property_type}%\")\n .page(params[:page])\n .order('created_at DESC')\n render action: 'index'\n end",
"title": ""
},
{
"docid": "58f41e7afb8461bcab481a0857ca8bce",
"score": "0.59740746",
"text": "def index\n @plans = @enterprise.plans\n filter_by_query if params[:q].present?\n end",
"title": ""
},
{
"docid": "dbff2343501918fa1543aa2b0b84bf58",
"score": "0.5965827",
"text": "def index\n @title = \"Others\"\n\n @keywords = params[:q]\n if @keywords && !@keywords.empty?\n @listings = Listing.other.active.search_tank(@keywords, :page => params[:page], :per_page => 25)\n else\n @listings = Listing.other.active.page(params[:page]).per(25)\n end\n\n end",
"title": ""
},
{
"docid": "b57956233eefac10c2cbd6c964b615a5",
"score": "0.5961282",
"text": "def index\n @q = Setting.active.ransack(params[:q])\n @settings = @q.result.page(params[:page]).per(15)\n end",
"title": ""
},
{
"docid": "3bb0f2db39145ba1b607a2f52247df49",
"score": "0.5959341",
"text": "def index\r\n @search = Provider.search(params[:q])\r\n @providers = @search.result\r\n end",
"title": ""
},
{
"docid": "d2a454b65d59ae40968c0f804b9c68c8",
"score": "0.59488773",
"text": "def options\n collection_options = {}\n search = params[:search]\n order = params[:order]\n\n # Order\n order = case params[:order]\n when 'name' then 'profiles.display_name' \n when 'arcades' then 'frequentships_count desc'\n when 'games' then 'favoriteships_count desc'\n else (current_session.addressed_in? && !parent?) ? 'distance' : 'profiles.display_name'\n end\n\n # Conditions\n collection_options[:conditions] = \"profiles.active = true\"\n if search == '#'\n collection_options[:conditions] += ' AND profiles.display_name regexp \"^[0-9]+\"'\n elsif !search.blank?\n collection_options[:conditions] += \" AND (profiles.display_name like '#{search}%' OR profiles.display_name like '#{search.downcase}%')\"\n end\n \n # If on the main profiles page where we map out profiles, include their addresses\n if !parent?\n collection_options[:conditions] += ' AND addresses.id IS NOT NULL' if params[:action] == 'index'\n collection_options[:include] = {:address => [:region, :country]}\n if current_session.addressed_in?\n collection_options[:origin] = current_session.address\n collection_options[:within] = current_session.profile_range if current_session.profile_range != 0\n end\n end\n\n # Usual params\n collection_options[:page] = params[:page] || 1\n collection_options[:per_page] = params[:per_page] if params[:per_page]\n collection_options[:order] = order\n\n collection_options\n end",
"title": ""
},
{
"docid": "689379063ca949591e055d49b60adec7",
"score": "0.5931798",
"text": "def index\n if(params[:search_headliner_boxes])\n @headliner_boxes = HeadlinerBox.search params[:search_headliner_boxes], :page => params[:page], :per_page => 10, :order => 'publish_date DESC'\n else\n @headliner_boxes = HeadlinerBox.paginate( :per_page => 10, :page => params[:page], :order => 'publish_date DESC' )\n end\n render 'shared/admin/index.js.erb'\n end",
"title": ""
},
{
"docid": "3fb0d7f7ce27eb75e7904a44ec47806c",
"score": "0.5928929",
"text": "def index\n @q = @feasibilities.search params[:q]\n @feasibilities = @q.result.page(params[:page])\n end",
"title": ""
},
{
"docid": "c30273f60c9265f05291dfd14ce4df64",
"score": "0.5928431",
"text": "def display_search_results\n js = '<script type=\"text/javascript\">;'\n js << get_search_results_javascript\n js << '</script>'\n js\n end",
"title": ""
},
{
"docid": "aa18e0be31d15232fce445744f62690c",
"score": "0.5917224",
"text": "def advanced_search_result\n @students ||= params[:students]\n @search ||= params[:search]\n @general_setting = GeneralSetting.first\n render 'advanced_search_result', layout: false\n end",
"title": ""
},
{
"docid": "6f09053bae7bc77c6a84cbdfa2d0fa65",
"score": "0.59114665",
"text": "def index\n @halalfoodhunt_seos = HalalfoodhuntSeo.all\n @search = OnlineGrocer.ransack(params[:q])\n @search.sorts = 'created_at DESC' if @search.sorts.empty?\n @online_grocers = @search.result.where(draft: false)\n @qualifying_type = QualifyingType.all\n end",
"title": ""
},
{
"docid": "28d18c3a3f523749c42c20676e5bc2b5",
"score": "0.59113896",
"text": "def index\n if params[:field].present? && params[:keyword].present?\n @organizers = Organizer.all.where([\"#{params[:field]} like ?\", \"%#{params[:keyword]}%\"]).page(params[:page]).per(params[:per])\n else\n @organizers = Organizer.all.page(params[:page]).per(params[:per])\n end\n\n end",
"title": ""
},
{
"docid": "a97794bbb411ed25bbb4dd3ca0f79dbd",
"score": "0.5909445",
"text": "def product_search_form_for(options)\n options = {\n :form_class => \"search\",\n :field => \"query[]\",\n :field_id => \"sidesearch\"\n }.merge(options)\n search_form_for(options)\n end",
"title": ""
},
{
"docid": "9b1f750149d92dc09b86bba9f9231556",
"score": "0.59067947",
"text": "def index\n @title = \"Search Results\"\n \n @test = params[:search] #used for hiding of results, if there are none.\n unless (@test.nil?)\n addr = @test[\"address_contains\"]\n @test[\"address_contains\"] = List.street_endings(addr)\n end\n \n @search = List.search(params[:search]).paginate(:page => params[:results_page], :per_page => 5)\n \n @lists = @search.all\n @no_results = List.no_results(@lists) \n \n #reset the search parameter\n @search = List.search(params[:search]);\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lists }\n end\n end",
"title": ""
},
{
"docid": "1974f702e74006171ae41240b0a4b0ea",
"score": "0.5890235",
"text": "def display_search(search)\n if command = command_set.find_command_for_help(search)\n display_command(command)\n else\n display_filtered_search_results(search)\n end\n end",
"title": ""
},
{
"docid": "6209cac428449d04adc95ebd2c203834",
"score": "0.58848953",
"text": "def index\n @halalfoodhunt_seos = HalalfoodhuntSeo.all\n @search = Supplier.ransack(params[:q])\n @search.sorts = 'created_at DESC' if @search.sorts.empty?\n @suppliers = @search.result.where(draft: false)\n @qualifying_type = QualifyingType.all\n end",
"title": ""
},
{
"docid": "49cd4ded8ce83f4bf6bd685a118ac8cf",
"score": "0.58846205",
"text": "def index\n @advanced_searches = AdvancedSearch.all\n end",
"title": ""
},
{
"docid": "00917f573e833ed574d14c57a3067483",
"score": "0.5878608",
"text": "def show_all\n \n end",
"title": ""
},
{
"docid": "00917f573e833ed574d14c57a3067483",
"score": "0.5878608",
"text": "def show_all\n \n end",
"title": ""
},
{
"docid": "25231f9c3d7d53ee228d724394320961",
"score": "0.5873742",
"text": "def index\n if params[:commit].present?\n @display = ''\n @button_search_text='Hide Search'\n @button_search_data='open'\n else\n @display = 'display: none;'\n @button_search_text='Show Search'\n @button_search_data='close'\n end\n\n\n @meetingtypes = Meetingtype\n @meetingtypes = @meetingtypes.where(\"name ilike '%#{params[:filter_name]}%'\") if params[:filter_name].present?\n @meetingtypes=@meetingtypes.paginate(:page => params[:page]).all()\n @filter_name_val =params[:filter_name] if params[:filter_name].present?\n end",
"title": ""
},
{
"docid": "d1dd8e86757f920469197b7f5e5b3182",
"score": "0.5866348",
"text": "def index\n @flexible_searches = ransack_result\n # @fields = FIELDS\n # @headers = HEADERS\n end",
"title": ""
},
{
"docid": "fe40c685e7edf2bbc3ba154e0a40c852",
"score": "0.5863469",
"text": "def index\n @page_title = t('titles.search_results')\n @query = params[:query]\n allowed_punctuation = [\"/\",\"-\"]\n @query = sanitize_param_value(@query, allowed_punctuation) if @query.present?\n authorize_query!(@query)\n\n pdf_only_search_results? ? search_pdf_only : search_site_only\n\n end",
"title": ""
},
{
"docid": "f2b079726c389b05d70bd6977b561946",
"score": "0.586168",
"text": "def index\n if params[:search]\n @discoverers = Discoverer.simple_search(params[:search])\n else\n @discoverers = Discoverer.all\n end\n @discoverers = @discoverers.paginate(:page => params[:page], :per_page => 50)\n end",
"title": ""
},
{
"docid": "b370d31b003f4e0422e69103047850c5",
"score": "0.5860666",
"text": "def index\n @plans = Plan.order(popularity: :desc)\n if params[:search].present?\n # @plans = Plan.search(params[:search]).order(\"created_at DESC\")\n #@search = Plan.search do\n # fulltext params[:search]\n # order_by :popularity, :desc\n # paginate :page => params[:page] || 1, :per_page => 10\n #end\n @plans = @plans.search(params[:search].strip)\n #redirect_to plans_path\n end\n @plans = @plans.paginate(:page => params[:page], :per_page => 10)\n end",
"title": ""
},
{
"docid": "ae16f939681762c1593c35b8e7202ab2",
"score": "0.5856642",
"text": "def index\n @website_options = WebsiteOption.all\n end",
"title": ""
},
{
"docid": "fbfc6e459ea3389826999f54db38c8d4",
"score": "0.585565",
"text": "def display_filtered_search_results(search)\n groups = search_hash(search, command_groups)\n\n if groups.size > 0\n display_index(groups)\n else\n display_filtered_commands(search)\n end\n end",
"title": ""
},
{
"docid": "1c6f8febafc5e8ac39c6ae5561591a16",
"score": "0.5849617",
"text": "def index\n @skus = Sku.all\n\n if params[:q] != nil\n @search_name_cont = params[:q][:name_cont]\n @search_barcode_cont = params[:q][:barcode_cont]\n end\n @search = Sku.search(params[:q])\n @skus = @search.result.includes(:brand, :category).order('created_at desc').paginate(:page => params[:page], :per_page => 15)\n end",
"title": ""
},
{
"docid": "090d6c730137c5f11f52efb75786e04b",
"score": "0.5849106",
"text": "def index\n @search = SicossReductionZone.search(params[:search])\n @sicoss_reduction_zones = @search.page(params[:page]).per(10)\n\n flash.now[:notice] = t('flash.actions.index.notice') if @sicoss_reduction_zones.empty?\n respond_with(@sicoss_reduction_zones)\n end",
"title": ""
},
{
"docid": "f52f5fbf8a8885fd6fea792ea908568b",
"score": "0.5847356",
"text": "def index\n @schools = School.search(params[:search]).page(params[:page])\n @search_form = true\n end",
"title": ""
},
{
"docid": "bb11d2249002ed32d31cf463506008bf",
"score": "0.58411694",
"text": "def index\n @search = Countrylanguage.search do\n fulltext params[:q]\n order_by sort_column, sort_direction\n paginate :page => params[:page], :per_page => params[:per_page]\n end\n @countrylanguages = prepare_api_collection(@search)\n respond_to do |format|\n format.json { render json: @countrylanguages }\n format.xml { render xml: @countrylanguages }\n end\n end",
"title": ""
},
{
"docid": "a98b8f61d006d2aca4795dbed2f043a8",
"score": "0.58376193",
"text": "def view_fees_structure\n @search_query = params[:query]\n end",
"title": ""
},
{
"docid": "879c25d0e94aaa38b97f52203e7413ce",
"score": "0.5836092",
"text": "def index\n @title = t('view.clients.index_title')\n @searchable = true\n @clients = Client.filtered_list(params[:q]).order('firm_name DESC').\n page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"title": ""
},
{
"docid": "af00a8ebab72d21b362b3ba0cddeedf9",
"score": "0.58357626",
"text": "def index\n authorize! :index, Campaign\n @admin_campaigns = Admin::Campaign.accessible_by(current_ability, :read)\n @admin_campaigns = @admin_campaigns.search(params[:search]) unless params[:search].blank?\n @admin_campaigns = @admin_campaigns.order(\"#{sort_column} #{sort_direction}\") unless sort_column.blank?\n @admin_campaigns = @admin_campaigns.paginate(page: params[:page], per_page: params[:per_page] || 100)\n end",
"title": ""
},
{
"docid": "fe044fa2cf03ad24b994bf705614228a",
"score": "0.5835715",
"text": "def index\n @suggestions_box_hotels = SuggestionsBoxHotel.all\n end",
"title": ""
},
{
"docid": "be926d25a5c4a182469dcabcc18e1846",
"score": "0.5834133",
"text": "def index\n if params[:mode] == 'select'\n if @library\n @shelves = @library.shelves\n else\n @shelves = Shelf.real\n end\n render :partial => 'select_form'\n return\n else\n sort = {:sort_by => 'name', :order => 'asc'}\n #case params[:sort_by]\n #when 'name'\n # sort[:sort_by] = 'name'\n #end\n sort[:order] = 'desc' if params[:order] == 'desc'\n\n query = @query = params[:query].to_s.strip\n page = params[:page] || 1\n library = @library if @library\n\n search = Shelf.search(:include => [:library]) do\n fulltext query if query.present?\n paginate :page => page.to_i, :per_page => Shelf.per_page\n if library\n with(:library).equal_to library.name\n order_by :position, :asc\n end\n order_by sort[:sort_by], sort[:order]\n facet :library\n end\n @shelves = search.results\n @library_facet = search.facet(:library).rows\n @library_names = Library.select(:name).collect(&:name)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @shelves }\n end\n end",
"title": ""
},
{
"docid": "e417e48614491f135a695651c09c484d",
"score": "0.58237934",
"text": "def index\n @vendors = current_user.vendors.order_by_name\n @vendors = @vendors.search_results(params[:search]) if params[:search].present?\n end",
"title": ""
},
{
"docid": "1b2385160b55196cec9d3f23c3e598e5",
"score": "0.58217627",
"text": "def index\n @search = Country.search do\n fulltext params[:q]\n order_by sort_column, sort_direction\n paginate :page => params[:page], :per_page => params[:per_page]\n end\n @countries = prepare_api_collection(@search)\n\n respond_to do |format|\n format.json { render json: @countries }\n format.xml { render xml: @countries }\n end\n end",
"title": ""
},
{
"docid": "42b5c2e3b168288ae3eddd8a54f941c8",
"score": "0.58194697",
"text": "def index\n @q = (params[:search].blank? ? RemoteControlCenter : RemoteControlCenter.search(params[:search])).ransack(params[:q])\n\n @remote_control_centers = @q.result.page(params[:page])\n\n @countries = (params[:search].blank? ? RemoteControlCenter : @remote_control_centers).pluck(:country).compact.sort.uniq\n end",
"title": ""
},
{
"docid": "e71b60c8000a5a1b2c9f53708c4fb949",
"score": "0.5815446",
"text": "def index\n # define search using ransack gem\n @search = Program.search(params[:q])\n @programs = @search.result\n # @programs = Program.all\n end",
"title": ""
},
{
"docid": "575145e85d69e88dc484258bd82ae942",
"score": "0.5815407",
"text": "def show\n\tload_filter_params\n\t\n\t@list_companies = Company.order(name: :asc)\n\t@list_kind_of_services = KindOfService.order(name: :asc)\n end",
"title": ""
},
{
"docid": "1c1d7b384f9dc0c3f7869978d94c4e9e",
"score": "0.58148426",
"text": "def index\n if params[:search]\n @query = params[:search]\n @listings = Listing.search(@query)\n render '_search'\n else\n @listings = Listing.all\n end\n end",
"title": ""
},
{
"docid": "443ab06b131a1a4ea10a802968b374aa",
"score": "0.58110386",
"text": "def display_filtered_commands(search); end",
"title": ""
},
{
"docid": "a46a741291a2b278f943aef395253c9e",
"score": "0.58087987",
"text": "def contents_of_search_by\r\n self.send('search_by_options')\r\n end",
"title": ""
},
{
"docid": "d0c0845c4a212a7c31bbe3cc972b0fee",
"score": "0.5804728",
"text": "def index\n @search = Influencer.where(:approved => true).apply_filters(@campaign)\n @search = Influencer.apply_default_sort(@campaign, @search) if params[:search].blank? || params[:search][:meta_sort].blank?\n @search = @search.search(params[:search])\n @influencers = @search.page(params[:page]).per(20)\n end",
"title": ""
},
{
"docid": "42c1b1bd5700e4e473999e088affff75",
"score": "0.58025503",
"text": "def display_search_form\n os = OrderSearch.new(@session)\n os.display_all_fields_except(:mem_region)\n html = os.to_form(url(:look_for_memberships), \n true,\n \"Find matches\",\n '')\n\n values = {\n 'done' => url(:tidy_up)\n }\n\n @data.payment.add_to_hash(values)\n\n standard_page(\"Search for Matching Payment\",\n values,\n SEARCH_PAGE,\n PAYMENT_SUMMARY,\n html)\n end",
"title": ""
},
{
"docid": "73446c666696498a1fc980204f6d2334",
"score": "0.58018434",
"text": "def index\n @search_query = params[:search]\n @city_query = params[:city]\n @groups = Group.all\n @groups_found = Group.search(@search_query, @city_query)\n @ruby = Group.search_tab(\"ruby\")\n @react = Group.search_tab(\"react\")\n @javascript = Group.search_tab(\"javascript\")\n @python = Group.search_tab(\"python\")\n @php = Group.search_tab(\"php\")\n @c = Group.search_tab(\"c++\")\n\n end",
"title": ""
},
{
"docid": "e1ee0afc1d7d95f48b908a448fa96804",
"score": "0.5798914",
"text": "def index\n @providers = Provider.confirmed.search(params[:search])\n end",
"title": ""
},
{
"docid": "2c0b2b39f71122a7a3982998ed75a639",
"score": "0.5798787",
"text": "def display_search(search); end",
"title": ""
},
{
"docid": "2c0b2b39f71122a7a3982998ed75a639",
"score": "0.5798787",
"text": "def display_search(search); end",
"title": ""
},
{
"docid": "9924a84308ff75c1eba45972dee4c1cc",
"score": "0.57972425",
"text": "def show(name)\n @api.search_show name\n end",
"title": ""
},
{
"docid": "99c0680afbcce4057a74c4feccf25c30",
"score": "0.579591",
"text": "def search\n @title = params[:controller].camelize.demodulize.tableize.singularize.capitalize + ' Search' \n @model, @search_stat = Commonx::CommonxHelper.search(params)\n @results_url = 'search_results_' + params[:controller].camelize.demodulize.tableize.downcase + '_path'\n @erb_code = find_config_const('search_params_view')\n end",
"title": ""
}
] |
db515cdcf3f439f1e4cf566d59e99ec6
|
POST /m_authorities POST /m_authorities.json
|
[
{
"docid": "851a6d6ba9898bd810c159a2bc20b592",
"score": "0.62494826",
"text": "def create\n @m_authority = MAuthority.new(params[:m_authority])\n\n respond_to do |format|\n if @m_authority.save\n format.html { redirect_to :controller => \"m_authorities\", :action => \"index\" }\n #format.html { redirect_to @m_authority }\n format.json { render json: @m_authority, status: :created, location: @m_authority }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_authority.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "86617bbc5b922a58b41f7c02b0bf44d0",
"score": "0.64662117",
"text": "def authorizations(params = {})\n scope 'default'\n post('authorizations/', params)\n end",
"title": ""
},
{
"docid": "33bc11975cd0aaae12d0cae2d0d5fe01",
"score": "0.62113917",
"text": "def index\n @authorities = Authority.all\n end",
"title": ""
},
{
"docid": "33bc11975cd0aaae12d0cae2d0d5fe01",
"score": "0.62113917",
"text": "def index\n @authorities = Authority.all\n end",
"title": ""
},
{
"docid": "fba48ecf39851eda992b85281602a211",
"score": "0.6059958",
"text": "def apply_authorities(env)\n DogBiscuits.config.authorities_add_new.each do |authority_name|\n term = authority_name.to_s.singularize.to_sym\n next unless env.attributes.key? term\n env.attributes[term].each do |attr|\n add_new(authority_name.to_s, attr)\n end\n end\n end",
"title": ""
},
{
"docid": "447dbf3728247ab960c6d73e64aa93b9",
"score": "0.6023104",
"text": "def authorities=(authorities)\n AuthorityRole.delete_all(:role_name => self.name)\n if authorities\n for authority in authorities\n AuthorityRole.new(:role_name => self.name,\n :authority_name => authority.name).save\n end\n end\n end",
"title": ""
},
{
"docid": "bd1f46e8174394efc3e72e5b6f5ae9f6",
"score": "0.5948975",
"text": "def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end",
"title": ""
},
{
"docid": "e5ab6e47b9d64d3643b3434dd7adcfc7",
"score": "0.5916746",
"text": "def index\n authors = Author.where('name LIKE ?', \"%#{params['term']}%\").order(:name)\n authors = authors.map { |e| { id: e.id, value: e.name } }\n authors << { id: -1, value: TOO_MANY_MESSAGE } if authors.size >= TOO_MANY\n render json: authors\n end",
"title": ""
},
{
"docid": "36a5fc16b51c4321332544c23a8b6277",
"score": "0.5915171",
"text": "def get_authors_by_personality\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits]\n e = params[:E] # Optional - and must be y, n or o. Extraversion personality trait. \n s = params[:S] # Optional - and must be y, n or o. Emotional Stability personality trait. \n a = params[:A] # Optional - and must be y, n or o. Agreeableness personality trait. \n c = params[:C] # Optional - and must be y, n or o. Conscientiousness personality trait. \n o = params[:O] # Optional - and must be y, n or o. Openness personality trait. \n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"e:#{e}\"\n puts \"s:#{s}\"\n puts \"a:#{a}\"\n puts \"c:#{c}\"\n puts \"o:#{o}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/authors_by_personality.json?count=#{count}&timeline=#{timeline}&Extraversion=#{e}&EmotionalStability=#{s}&Agreeableness=#{a}&Conscientiousness=#{c}&Openness=#{o}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end",
"title": ""
},
{
"docid": "c95686b3559675d71fe8f526f7880071",
"score": "0.5905684",
"text": "def create\n request = Request.post('authorizations/request', 'v2', params)\n response = Response.new(request)\n update_attributes(response.serialize)\n\n response.success?\n end",
"title": ""
},
{
"docid": "f3f4097f79a154d9cd8db8f8a2797881",
"score": "0.58747303",
"text": "def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end",
"title": ""
},
{
"docid": "2ec5e441b4c19bac741eccb6e5426e99",
"score": "0.58448666",
"text": "def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"title": ""
},
{
"docid": "4e2666110f7f698eb3a20afaaebebef5",
"score": "0.58391094",
"text": "def create\n @book = Book.new(book_params)\n #for author_id in params[:authors_ids]\n # @book.authors << Author.find(author_id)\n #end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "928b01859c14f71b37fd06221f244abf",
"score": "0.57171243",
"text": "def create\n\n authors=params[:book][:author_book_ids]\n @book = Book.new(book_params.except(:author_book_ids))\n respond_to do |format|\n if @book.save\n if authors.present?\n authors.each do |a|\n @book.authors << Author.find(a)\n end\n end\n format.html { redirect_to @book, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7d2719f8b21760fb2639f5eb399e812d",
"score": "0.57152",
"text": "def save\n response = if @id.nil?\n Cloud.instance.post ['cloud-service-auth', 'accounts', @account.id, 'authorities'], self\n else\n raise 'editing authorities not supported'\n # @cloud.put [\"cloud-service-auth\", \"principals\", @id], self\n end\n apply_data(response.body)\n self\n end",
"title": ""
},
{
"docid": "e7c3d3f91c70bd7d4c77f0dddb9e8842",
"score": "0.5712116",
"text": "def add_authorities(authorities=nil)\n if authorities.class == Set && !block_given?\n @j_del.java_method(:addAuthorities, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(authorities.map { |element| element }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling add_authorities(authorities)\"\n end",
"title": ""
},
{
"docid": "6ccc8b9f9786be2e326d20797827597d",
"score": "0.57068324",
"text": "def create\n @company_authority = CompanyAuthority.new(company_authority_params)\n\n if @company_authority.save\n render json: @company_authority, status: :created, location: @company_authority\n else\n render json: @company_authority.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6400d09e6e72d4611f93089691ccdf8d",
"score": "0.5690833",
"text": "def create\n @author = Author.new(author_params)\n respond_to do |format|\n begin\n sql = \"INSERT INTO AUTHOR\n ( Author_name )\n VALUES (\\\"#{params[:author][:Author_name]}\\\")\"\n ActiveRecord::Base.connection.execute(sql)\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\")\n format.html { redirect_to authors_path, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n rescue => error\n flash.now[:alert] = error.message\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3a8d29c8003ea7fa65960c12f5cb8767",
"score": "0.56421095",
"text": "def identities\n render json: current_user.identities\n end",
"title": ""
},
{
"docid": "66958988b29aa8043356087c45216569",
"score": "0.56106555",
"text": "def create\n @authority = Authority.new(authority_params)\n\n respond_to do |format|\n if @authority.save\n format.html { redirect_to @authority, notice: 'Authority was successfully created.' }\n format.json { render :show, status: :created, location: @authority }\n else\n format.html { render :new }\n format.json { render json: @authority.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7d9f39fa1f6d48af754b6246abef03d",
"score": "0.5601511",
"text": "def create\n @authority = Authority.new(authority_params)\n\n respond_to do |format|\n if @authority.save\n session[:last_authority_id] = @authority.id\n format.html { redirect_to authority_url(@authority), notice: \"Authority was successfully created.\" }\n format.json { render :show, status: :created, location: @authority }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @authority.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e1a3efc914880cd7ea43e29f2480fd7",
"score": "0.5593423",
"text": "def author\n url = @json['user']['meta']['author']\n data = client.get url\n client.factory.create(GoodData::Membership, data)\n end",
"title": ""
},
{
"docid": "ca7aa34ea5707bf9124bd3e0c8841060",
"score": "0.5592479",
"text": "def create\n @author = Author.new(author_params)\n\n if @author.save\n render :show, status: :created, location: api_v1_author_url(@author)\n else\n render json: { error: @author.errors }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "17368338a7e42d16277083f1336b6f7c",
"score": "0.55717045",
"text": "def auttor_params\n params.require(:auttor).permit(:authorid, :authorname)\n end",
"title": ""
},
{
"docid": "1887f1ce3020deae94245102bf7bb0e1",
"score": "0.5556331",
"text": "def create(*args)\n require_authentication\n arguments(args) do\n sift(VALID_AUTH_PARAM_NAMES)\n end\n\n post_request(\"/authorizations\", arguments.params)\n end",
"title": ""
},
{
"docid": "74c08549690c551fe890346a076d9d18",
"score": "0.55506265",
"text": "def new\n @m_authority = MAuthority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_authority }\n end\n end",
"title": ""
},
{
"docid": "a4fb31a1b8a2bbd23876b4c02b50dba0",
"score": "0.55131197",
"text": "def author_identities_set\n author_identities.map do |ident|\n normalize_author_identity(ident.first_name, ident.middle_name || 'None',\n ident.last_name, ident.institution || 'None')\n end.to_s\n end",
"title": ""
},
{
"docid": "9f6637b18f8972e08d6cccb2530b4827",
"score": "0.5498986",
"text": "def post_amenities\n return if @amenities.nil?\n\n if @amenities.empty?\n Rentlinx.client.unpost_amenities_for(self)\n else\n Rentlinx.client.post_amenities(@amenities)\n end\n end",
"title": ""
},
{
"docid": "3d7ccc32018546ee31b940cfa1cddce9",
"score": "0.5479918",
"text": "def create\n @references_author = References::Author.new(references_author_params)\n\n respond_to do |format|\n if @references_author.save\n format.html { redirect_to @references_author, notice: 'Author was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_author }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9969c93591a4e22f844c8f6bd5d39124",
"score": "0.5479649",
"text": "def create\n @author = Author.new(allowed_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae442e95644e5baa4d00d3fa76a86dd0",
"score": "0.5473578",
"text": "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"title": ""
},
{
"docid": "8391a77353eae7b1d8c3139c31205813",
"score": "0.5454799",
"text": "def create\n @author = Author.new(author_params)\n author_attributes\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "858ac7b31c3dc222b4db4488abf0e431",
"score": "0.5444825",
"text": "def create\n author = Author.create!(author_params)\n auth_token = AuthenticateAuthor.new(author.email, author.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"title": ""
},
{
"docid": "45fe6279891c3fbcfcfa59fd6cb4c07c",
"score": "0.5431058",
"text": "def authors\n\t#params[:diff] = params[:diff].eql?\"true\"\n \trespond_in_format Marginalia.authors(params[:id],params[:diff])\n end",
"title": ""
},
{
"docid": "a01fd82838fe9274da6cf0610724bda4",
"score": "0.5420588",
"text": "def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a01fd82838fe9274da6cf0610724bda4",
"score": "0.5420588",
"text": "def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a01fd82838fe9274da6cf0610724bda4",
"score": "0.5420588",
"text": "def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a01fd82838fe9274da6cf0610724bda4",
"score": "0.5420588",
"text": "def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "776096af60bfc16feb98b58980a5ef6a",
"score": "0.54164326",
"text": "def update_authorizations(role_ids)\n role_ids = role_ids.map {|i| i.to_i }\n roles = self.roles.collect(&:id) # get current role ids\n roles_to_remove = roles - role_ids\n roles_to_add = role_ids - roles\n\n unless roles_to_remove.blank?\n self.authorizations.where(role_id: roles_to_remove).destroy_all\n end\n\n unless roles_to_add.blank?\n roles_to_add.each do |r|\n self.authorizations.create({:role_id => r})\n end\n email_roles_granted(roles_to_add)\n end\n return {:roles_added => roles_to_add, :roles_removed => roles_to_remove}\n end",
"title": ""
},
{
"docid": "19cd0de8faa959926baa392c7de981f4",
"score": "0.5413365",
"text": "def create\n @author = Author.new(params[:author])\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render json: @author, status: :created, location: @author }\n else\n format.html { render action: \"new\" }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1d11031b901d4a2c55420dfd3f6141c5",
"score": "0.54053384",
"text": "def create\n @author = Author.new(params[:author])\n @author.save\n respond_with(@author)\n end",
"title": ""
},
{
"docid": "a7d4fbb128dea5ccadf045cbe9cf5f5f",
"score": "0.53865963",
"text": "def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render action: 'show', status: :created, location: @author }\n else\n format.html { render action: 'new' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15746d8397232698da87698e671b39ee",
"score": "0.53678864",
"text": "def set_authorlist\n @authorlist = Authorlist.find(params[:id])\n end",
"title": ""
},
{
"docid": "70f12b10441e592f62fabb52ad12c91d",
"score": "0.53319025",
"text": "def create\n @author_extra = AuthorExtra.new(params[:author_extra])\n\n respond_to do |format|\n if @author_extra.save\n format.html { redirect_to @author_extra, :notice => 'Author extra was successfully created.' }\n format.json { render :json => @author_extra, :status => :created, :location => @author_extra }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author_extra.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5fcfbba9b7eee636c61ffd88d45a9c29",
"score": "0.5308561",
"text": "def authorlist_params\n params.require(:authorlist).permit(:partcode, :dept, :custcode, :turns, :seq, :priority, :author_custcode)\n end",
"title": ""
},
{
"docid": "50a608a16a05a1e42309c38b13b76eea",
"score": "0.52716035",
"text": "def author_params\n params.require(:author).permit(:fq, :internet_id, :first_name, :last_name, :tenure_status, :scopus_author_id, :author_position, :hindex, :dept_id, :dept_name)\n end",
"title": ""
},
{
"docid": "aaf2683d2ed0c62748384b373a4cb63b",
"score": "0.5256177",
"text": "def author_count\n revisions = Marginalia.revisions(params[:id])\n authors = []\n revisions.collect {|rev| authors << rev['user']}\n authors.uniq!\n render :text => authors.length\n end",
"title": ""
},
{
"docid": "ac70c4701aaf828f9d3f9abafa6f1bc6",
"score": "0.52345204",
"text": "def enter_pahma_authorizations(test_data)\n authorizations = test_data[UseOfCollections::AUTHORIZATION_GRP.name] || [UseOfCollections.empty_authorization]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::AUTHORIZATION_GRP.name)], authorizations)\n authorizations.each_with_index do |auth, index|\n enter_auto_complete(authorized_by_input(index), authorized_by_options(index), auth[UseOfCollections::AUTHORIZED_BY.name], 'PAHMA Persons')\n wait_for_element_and_type(authorization_date_input(index), auth[UseOfCollections::AUTHORIZATION_DATE.name])\n hit_enter\n wait_for_element_and_type(authorization_note_input(index), auth[UseOfCollections::AUTHORIZATION_NOTE.name])\n wait_for_options_and_select(authorization_status_input(index), authorization_status_options(index), auth[UseOfCollections::AUTHORIZATION_STATUS.name])\n end\n end",
"title": ""
},
{
"docid": "66d16691ce638f10247e7aecf9540e55",
"score": "0.5225905",
"text": "def create\n @author = Author.new(params[:author])\n @author.user = @user\n @country = Country.find(params[:author][:country_id])\n respond_to do |format|\n if @author.save\n format.html { redirect_to country_author_path(@country.name,@author), :notice => 'Author was successfully created.' }\n format.json { render :json => @author, :status => :created, :location => @author }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7939a9e3a8ce203959dcb0ab2a715845",
"score": "0.5222243",
"text": "def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end",
"title": ""
},
{
"docid": "4c3545cc9cd71d4816bde9aa09724d8c",
"score": "0.5211147",
"text": "def create\n @modalities = Modality.create!(modality_params)\n json_response(@modalities, :created)\n end",
"title": ""
},
{
"docid": "2f0557e3edb61ede81f0bdd1f03be60a",
"score": "0.5204998",
"text": "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @article = Article.new.from_json(params[:article])\n @article.nb_comments = 0\n @article.publication_date = Time.now\n @article.user_id = @user.id\n respond_to do |format|\n if @article.save\n @article.score = Score.create(:score_pos => 0, :score_neg => 0)\n @article.save\n @author = Author.create(:article_id => @article.id, :user_id => @user.id, :job => \"author\")\n @author.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "50182a11143ce456168b97e9fe9ddadd",
"score": "0.51974547",
"text": "def create\n authorize Inquiry\n @inquiry = Inquiry.new(inquiry_params)\n @inquiry.creator_id=current_user.id\n\n User.transaction do\n if @inquiry.save\n role=current_user.add_role(Role::ORGANIZER, @inquiry)\n @inquiry.user_roles << role.role_name\n role.save!\n render :show, status: :created, location: @inquiry\n else\n render json: {errors:@inquiry.errors.messages}, status: :unprocessable_entity\n end\n end\n end",
"title": ""
},
{
"docid": "bb7295134d819e63e33430634b0ef2f3",
"score": "0.5181255",
"text": "def create\n params[:mentions].each do |men_params|\n men_params = men_params.permit(:ticker_id, :positive_count, :negative_count, :neutral_count)\n @mention = Mention.new(men_params)\n @mention.save\n end\n respond_to do |format|\n msg = { :status => :ok, :message => \"Success!\", :html => '<b></b>' }\n format.html do\n redirect_to '/'\n end\n format.json { render :json => msg }\n end\n end",
"title": ""
},
{
"docid": "aa0b50fdad74bc8b5f92b9938f011bf8",
"score": "0.5170998",
"text": "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end",
"title": ""
},
{
"docid": "35f32a0cab066b62dba80d7d8d1af572",
"score": "0.5168011",
"text": "def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end",
"title": ""
},
{
"docid": "f31395f440d46243d5a6f5e2c8393001",
"score": "0.5167143",
"text": "def create\n @map_author = MapAuthor.new(params[:map_author])\n\n respond_to do |format|\n if @map_author.save\n format.html { redirect_to([:admin, @map_author], :notice => 'Map author was successfully created.') }\n format.xml { render :xml => @map_author, :status => :created, :location => @map_author }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f495cd4bfda92d02d69170c65ff5a0ba",
"score": "0.5161427",
"text": "def create\n @publication = Publication.new()\n pubmed_id = params[:publication][:pubmed_id]\n pubmed_id = nil if pubmed_id.blank?\n doi = params[:publication][:doi]\n doi = nil if doi.blank?\n result = get_data(@publication, pubmed_id, doi)\n @publication.contributor = current_user \n respond_to do |format|\n if @publication.save\n result.authors.each do |author|\n pa = PublicationAuthor.new()\n pa.publication = @publication\n pa.first_name = author.first_name\n pa.last_name = author.last_name\n pa.save\n end\n \n #Make a policy\n policy = Policy.create(:name => \"publication_policy\", :sharing_scope => 3, :access_type => 1, :use_custom_sharing => true, :contributor => current_user)\n @publication.asset.policy = policy\n policy.save\n @publication.asset.save\n #add managers (authors + contributor)\n @publication.asset.creators.each do |author|\n policy.permissions << Permission.create(:contributor => author, :policy => policy, :access_type => 4)\n end\n #Add contributor\n @publication.asset.policy.permissions << Permission.create(:contributor => @publication.contributor.person, :policy => policy, :access_type => 4)\n \n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(edit_publication_url(@publication)) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "282ec128cb311260297d322efb730248",
"score": "0.5158348",
"text": "def index\n render json: @authority.all\n end",
"title": ""
},
{
"docid": "28e1acd980fe2565ce00d422d2530581",
"score": "0.5153961",
"text": "def author_params\n params.require(:author).permit(:name, :poetry_header, :about_text, :friendly_header, :order_number,\n :author_id, :additional_info, :last_poem_placeholder, :need_placeholder,\n :title, :subtitle)\n end",
"title": ""
},
{
"docid": "3870a0dbf864a79571177e2e620644b2",
"score": "0.5152844",
"text": "def update_mentors\n authorize!\n @mentors = User.mentors_list(params[:administrator_id])\n respond_to do |format|\n format.js {}\n end\n end",
"title": ""
},
{
"docid": "86c9b53f0b2e933d226a93e4254eb185",
"score": "0.5147398",
"text": "def create\n Author.create(\n name: params[:name],\n dob: params[:dob],\n gender: params[:gender],\n has_pseudonym: params[:has_pseudonym])\n redirect_to '/authors'\n end",
"title": ""
},
{
"docid": "a09d1ef245e58faa69999ca77393ca01",
"score": "0.5142303",
"text": "def create(*args)\n raise_authentication_error unless authenticated?\n arguments(args) do\n assert_required :note, :scopes\n end\n\n post_request('/authorizations', arguments.params)\n end",
"title": ""
},
{
"docid": "bc1cb2e79c29e25806a50e8464c41bbb",
"score": "0.51410747",
"text": "def create\n @article = Article.new(params[:article].except(:author_list))\n if @article.save\n @article.author_list = params[:article][:author_list]\n success = @article.save\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n logger.debug @article.errors.inspect\n end",
"title": ""
},
{
"docid": "39793deeb1729b0ad9a5c2f8aad660a4",
"score": "0.51390994",
"text": "def new\n @user = current_user\n @author = Author.new\n @countries = Country.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @author }\n end\n end",
"title": ""
},
{
"docid": "aa88f3e3fdbd5299273d8430974090ad",
"score": "0.513689",
"text": "def review_authors # :norobots:\n pass_query_params\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n @authors = @object.authors\n parent = @object.parent\n if @authors.member?(@user) || @user.in_group?(\"reviewers\")\n @users = User.all(order: \"login, name\")\n new_author = params[:add] ? User.find(params[:add]) : nil\n if new_author && !@authors.member?(new_author)\n @object.add_author(new_author)\n flash_notice(\"Added #{new_author.legal_name}\")\n # Should send email as well\n end\n old_author = params[:remove] ? User.find(params[:remove]) : nil\n if old_author && @authors.member?(old_author)\n @object.remove_author(old_author)\n flash_notice(\"Removed #{old_author.legal_name}\")\n # Should send email as well\n end\n else\n flash_error(:review_authors_denied.t)\n redirect_with_query(controller: parent.show_controller,\n action: parent.show_action, id: parent.id)\n end\n end",
"title": ""
},
{
"docid": "24e92f1501fa06d445c184eae551e777",
"score": "0.5136601",
"text": "def authorship_params\n params.require(:authorship).permit(:user_id, :article_id)\n end",
"title": ""
},
{
"docid": "80115a0efdbb1f1125388f6066512192",
"score": "0.5130797",
"text": "def to_authoring_hash\n hash = to_hash\n hash[:id] = id\n hash[:linked_interactive_id] = linked_interactive_id\n hash[:linked_interactive_type] = linked_interactive_type\n hash[:aspect_ratio] = aspect_ratio\n hash[:interactive_item_id] = interactive_item_id\n hash[:linked_interactive_item_id] = linked_interactive_item_id\n # Note that linked_interactives is independent from linked_interactive_id and linked_interactive_type fields\n hash[:linked_interactives] = linked_interactives_list\n hash\n end",
"title": ""
},
{
"docid": "225fc8f434aff03deeccff0acc016333",
"score": "0.5124768",
"text": "def authorities\r\n ptr = Api.proj_get_authorities_from_database(self.context)\r\n Strings.new(ptr)\r\n end",
"title": ""
},
{
"docid": "49c2d0611b2e2aa473bac31b4014b307",
"score": "0.5117321",
"text": "def author_params\n params.require(:author).permit(:name, :biography, :github_issue_id)\n end",
"title": ""
},
{
"docid": "3d80cb464f099906b21aa0633496764b",
"score": "0.509373",
"text": "def author_params\n params.require(:author).permit(:Author_name)\n end",
"title": ""
},
{
"docid": "7f7851f7daddc70a1eaea87509dde112",
"score": "0.50935495",
"text": "def enter_authorizations(test_data)\n authorizations = test_data[UseOfCollections::AUTHORIZATION_GRP.name] || [UseOfCollections.empty_authorization]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::AUTHORIZATION_GRP.name)], authorizations)\n authorizations.each_with_index do |auth, index|\n enter_auto_complete(authorized_by_input(index), authorized_by_options(index), auth[UseOfCollections::AUTHORIZED_BY.name], 'Local Persons')\n wait_for_element_and_type(authorization_date_input(index), auth[UseOfCollections::AUTHORIZATION_DATE.name])\n hit_enter\n wait_for_element_and_type(authorization_note_input(index), auth[UseOfCollections::AUTHORIZATION_NOTE.name])\n wait_for_options_and_select(authorization_status_input(index), authorization_status_options(index), auth[UseOfCollections::AUTHORIZATION_STATUS.name])\n end\n end",
"title": ""
},
{
"docid": "136326e8f16100ea468494894dc9f86b",
"score": "0.5086213",
"text": "def author_request # :norobots:\n pass_query_params\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n return unless request.method == \"POST\"\n subject = param_lookup([:email, :subject], \"\")\n content = param_lookup([:email, :content], \"\")\n (@object.authors + UserGroup.reviewers.users).uniq.each do |receiver|\n AuthorEmail.build(@user, receiver, @object, subject, content).deliver\n end\n flash_notice(:request_success.t)\n redirect_with_query(controller: @object.show_controller,\n action: @object.show_action, id: @object.id)\n end",
"title": ""
},
{
"docid": "a58359df5a9aed680f6ede540860cfcf",
"score": "0.50802946",
"text": "def create\n author = Author.create(params[:author])\n redirect_to(author)\n end",
"title": ""
},
{
"docid": "0f4de63ccec57b76b224740742e191b1",
"score": "0.5076221",
"text": "def author_params\n params.require(:author).permit(:given_name, :family_name)\n end",
"title": ""
},
{
"docid": "0f4de63ccec57b76b224740742e191b1",
"score": "0.5076221",
"text": "def author_params\n params.require(:author).permit(:given_name, :family_name)\n end",
"title": ""
},
{
"docid": "47beb898c75121b2790888994d77ffd0",
"score": "0.5075954",
"text": "def author_params\n params.require(:author).permit(:first_name, :last_name)\n end",
"title": ""
},
{
"docid": "c915660a38ed35d988a9cf380ef56320",
"score": "0.5075655",
"text": "def authority_params\n params.require(:authority).permit(:user_id, :service_id)\n end",
"title": ""
},
{
"docid": "8b120d6ac8eb2bf2e83cc4099853ccdc",
"score": "0.50747097",
"text": "def index\n @authorizations = Authorization.all\n end",
"title": ""
},
{
"docid": "8b120d6ac8eb2bf2e83cc4099853ccdc",
"score": "0.50747097",
"text": "def index\n @authorizations = Authorization.all\n end",
"title": ""
},
{
"docid": "2f69c4e665f0a8b5eab6f72fc576f9b8",
"score": "0.50652474",
"text": "def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d4a9872d06c4a41da68d66b3c1f9bf1",
"score": "0.50628644",
"text": "def author_params\n params.require(:author).permit(:name, :email_address, :bio, :password, :password_confirmation, :authorization_token, :authorized, :profile_image)\n end",
"title": ""
},
{
"docid": "1658ac5072f84b360f2dc6cee0100023",
"score": "0.5052739",
"text": "def author_params\n params.require(:data).permit({attributes: [:first_name, :last_name]})\n end",
"title": ""
},
{
"docid": "37ee45f66bfe7db715729d8bfd0b6e8d",
"score": "0.50498474",
"text": "def create\n# authorize! :create, Observation\n @observation = Observation.new(observation_params)\n @classroom = @observation.classroom\n @principals = User.with_role(:principal)\n @specialists = User.with_role(:specialist)\n if current_user.has_role? :admin\n if !params[:observation][:specialist].nil?\n @observation.specialist = params[:observation][:specialist]\n elsif !params[:observation][:principal].nil?\n @observation.principal = params[:observation][:principal]\n end\n \n elsif current_user.has_role? :principal\n @observation.principal_id = current_user.id\n else\n @observation.specialist_id = current_user.id\n end\n \n respond_to do |format|\n if @observation.save\n format.html { redirect_to observation_observation_form_index_url(@observation), notice: 'Observation was started.' }\n format.json { render :show, status: :created, location: @observation }\n else\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "208413047d6d3af4985878220f823692",
"score": "0.5044094",
"text": "def create(attrs, user = @@default_user)\n @attributes = send_request(\n \"organizations/#{attrs[:organization_id] || attrs['organization_id']}/roles\", :post\n ) do |req|\n req.body = {\n auth_token: user.auth_token\n }.merge(attrs.except(:organization_id, 'organization_id'))\n end\n end",
"title": ""
},
{
"docid": "0fb35ebed83b6afa3c11dff0b31d82a3",
"score": "0.5038461",
"text": "def author_params\r\n params.require(:author).permit(:name)\r\n end",
"title": ""
},
{
"docid": "d2cb47eb88c76556e6ae16cac0b5778e",
"score": "0.5037479",
"text": "def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end",
"title": ""
},
{
"docid": "ed0e244533765e2fc3e996767ca492d0",
"score": "0.5034363",
"text": "def author_params\n params.require(:author).permit(:name)\n end",
"title": ""
},
{
"docid": "ed0e244533765e2fc3e996767ca492d0",
"score": "0.5034363",
"text": "def author_params\n params.require(:author).permit(:name)\n end",
"title": ""
},
{
"docid": "3bd9ded645e1245a22fd5588b611bdc5",
"score": "0.5031037",
"text": "def authority_params\n params.require(:authority).permit(:authorizable_id, :authorizable_type, :role_id, :authorized_for_id, :authorized_for_type, :valid_from, :valid_until)\n end",
"title": ""
},
{
"docid": "8717252788d98d49e4d6e35df62952bc",
"score": "0.5028874",
"text": "def get_related_authors\n tag = params['query']\n\n @articles = get_articles(tag) # gets all articles of this author\n # puts 'ARTICLES'\n # ap @articles\n\n @related_articles = []\n @authors = []\n\n # for each of the author's articles, get 1st degree articles and their respective authors\n @articles.each do |article|\n puts \"ARTIClE ID \"\n puts article.arxiv_id\n getRelatedPapers(article.arxiv_id, -1).each do |related|\n\n authors = related.authors\n authors.each do |author|\n\n if !@authors.include?(author)\n @authors << author\n end\n\n end\n end\n end\n \n\n @found = 1\n if @authors == []\n @msg = \"None found, try again...\"\n @found = 0\n end\n\n render \"authors\"\n end",
"title": ""
},
{
"docid": "323e35ef497d5f5f3db6aed8e59a785e",
"score": "0.5023111",
"text": "def create\n @paper_author = PaperAuthor.new(paper_author_params)\n\n respond_to do |format|\n if @paper_author.save\n format.html { redirect_to @paper_author, notice: 'Paper author was successfully created.' }\n format.json { render :show, status: :created, location: @paper_author }\n else\n format.html { render :new }\n format.json { render json: @paper_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbdc93322ab59b4ffec26e80a331467d",
"score": "0.5019969",
"text": "def subauthorities\n SUBAUTHORITIES.keys\n end",
"title": ""
},
{
"docid": "ba94c1d2594668f916d1b9f2375a5afb",
"score": "0.50196975",
"text": "def create\n @opinion = Opinion.new(opinion_params)\n @opinion.authorId = current_user.id\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to opinions_path, notice: 'Opinion was successfully created.' }\n format.json { render :show, status: :created, location: @opinion }\n else\n format.html { render :new }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b93acc9b3a1eea63ae64e5e84f31dbd8",
"score": "0.5017355",
"text": "def author_params\n params.require(:author).permit(:name, :description, :slug)\n end",
"title": ""
},
{
"docid": "b1a23c5212bb18979dea2c47c80943b2",
"score": "0.5002476",
"text": "def create\n @author = Author.new(params[:author])\n @author.conference_confirm = current_conference\n\n if @author.save\n flash[:notice] = \"Author was successfully created\"\n else\n authorships_errors = @author.authorships.map{|as| as.errors.full_messages}.join(' ')\n flash[:error] = \"Failed to create Author #{@author.errors.full_messages} #{authorships_errors}\"\n end\n respond_with @author, :success_action => :back\n end",
"title": ""
},
{
"docid": "9c828997b45db9cd342a213265c9ec4f",
"score": "0.5001575",
"text": "def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8abe64e65fa676b4a2584c08b8591191",
"score": "0.50001746",
"text": "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"title": ""
},
{
"docid": "85ed0140f118234007d9b7596431ee2d",
"score": "0.49993938",
"text": "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end",
"title": ""
},
{
"docid": "f8309e2da4d951593fd51bc7dfcbbd91",
"score": "0.49986696",
"text": "def create\n authorize @organization\n if @organization.update_attributes(tag_list: @tags)\n render :json => @organization.reload.tags, :status => :created\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end",
"title": ""
},
{
"docid": "3cdc323da298ab924500d0953ffca747",
"score": "0.4997542",
"text": "def set_author\n @author = Author.includes(:circulations).where(:admin_id => @current_user.id, :id => params[:id]).first\n end",
"title": ""
}
] |
6808f162249d01e83a1a8302abe38b04
|
Update an existing table Update an existing HubDB table. You can use this endpoint to add or remove columns to the table as well as restore an archived table. Tables updated using the endpoint will only modify the &x60;draft&x60; verion of the table. Use &x60;publish&x60; endpoint to push all the changes to the &x60;published&x60; version. To restore a table, include the query parameter &x60;archived&x3D;true&x60; and &x60;\"archived\": false&x60; in the json body. Note: You need to include all the columns in the input when you are adding/removing/updating a column. If you do not include an already existing column in the request, it will be deleted.
|
[
{
"docid": "1ff5a7886baa6300c4d7a513624234cb",
"score": "0.5954997",
"text": "def update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TablesApi.update_draft_table ...'\n end\n # verify the required parameter 'table_id_or_name' is set\n if @api_client.config.client_side_validation && table_id_or_name.nil?\n fail ArgumentError, \"Missing the required parameter 'table_id_or_name' when calling TablesApi.update_draft_table\"\n end\n # verify the required parameter 'hub_db_table_v3_request' is set\n if @api_client.config.client_side_validation && hub_db_table_v3_request.nil?\n fail ArgumentError, \"Missing the required parameter 'hub_db_table_v3_request' when calling TablesApi.update_draft_table\"\n end\n # resource path\n local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].nil?\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(hub_db_table_v3_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'HubDbTableV3'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"TablesApi.update_draft_table\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TablesApi#update_draft_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
}
] |
[
{
"docid": "fbe1c944110b8a97c0b40d65402254b2",
"score": "0.6354429",
"text": "def update\n if ActiveRecord::Base.connection.tables.include? params[:table]\n table = params[:table].classify.constantize\n row = table.find(params[:row])\n # update row using parsed JSON\n row.update(JSON.parse(request.body.read))\n end\n end",
"title": ""
},
{
"docid": "f86e745ab652b52602ab44ce4933b584",
"score": "0.6146906",
"text": "def update!(**args)\n @automatic_column_names = args[:automatic_column_names] if args.key?(:automatic_column_names)\n @body = args[:body] if args.key?(:body)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @table_id = args[:table_id] if args.key?(:table_id)\n @template_id = args[:template_id] if args.key?(:template_id)\n end",
"title": ""
},
{
"docid": "f86e745ab652b52602ab44ce4933b584",
"score": "0.6146906",
"text": "def update!(**args)\n @automatic_column_names = args[:automatic_column_names] if args.key?(:automatic_column_names)\n @body = args[:body] if args.key?(:body)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @table_id = args[:table_id] if args.key?(:table_id)\n @template_id = args[:template_id] if args.key?(:template_id)\n end",
"title": ""
},
{
"docid": "09f1fe090d3daf269e9b5b98438f2be6",
"score": "0.6071819",
"text": "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table])\n format.json { respond_with_success }\n else\n format.json { respond_with_error }\n end\n end\n end",
"title": ""
},
{
"docid": "065894bb264d39a112e4f3f86e6cd8b3",
"score": "0.606915",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @table = args[:table] if args.key?(:table)\n @values = args[:values] if args.key?(:values)\n end",
"title": ""
},
{
"docid": "fc76a8da44f4828d4b5b030ffbd4c215",
"score": "0.60046804",
"text": "def update!(**args)\n @drop_unknown_fields = args[:drop_unknown_fields] if args.key?(:drop_unknown_fields)\n @state = args[:state] if args.key?(:state)\n @table = args[:table] if args.key?(:table)\n @use_topic_schema = args[:use_topic_schema] if args.key?(:use_topic_schema)\n @write_metadata = args[:write_metadata] if args.key?(:write_metadata)\n end",
"title": ""
},
{
"docid": "5e132e2983868fab3ed14733738a20d4",
"score": "0.597891",
"text": "def update(table, id, attributes) # abstract\n end",
"title": ""
},
{
"docid": "5e132e2983868fab3ed14733738a20d4",
"score": "0.597891",
"text": "def update(table, id, attributes) # abstract\n end",
"title": ""
},
{
"docid": "5a18f318ead0fb4f848df2e58e3f8862",
"score": "0.59684956",
"text": "def update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_input, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TablesApi.update_draft_table ...'\n end\n # verify the required parameter 'table_id_or_name' is set\n if @api_client.config.client_side_validation && table_id_or_name.nil?\n fail ArgumentError, \"Missing the required parameter 'table_id_or_name' when calling TablesApi.update_draft_table\"\n end\n # verify the required parameter 'hub_db_table_v3_input' is set\n if @api_client.config.client_side_validation && hub_db_table_v3_input.nil?\n fail ArgumentError, \"Missing the required parameter 'hub_db_table_v3_input' when calling TablesApi.update_draft_table\"\n end\n # resource path\n local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/draft'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'includeForeignIds'] = opts[:'include_foreign_ids'] if !opts[:'include_foreign_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(hub_db_table_v3_input) \n\n # return_type\n return_type = opts[:return_type] || 'HubDbTableV3' \n\n # auth_names\n auth_names = opts[:auth_names] || ['hapikey', 'oauth2']\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TablesApi#update_draft_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8e58d9e719bb12de3897bca9106a3fff",
"score": "0.5957977",
"text": "def update\r\n @@dbcontroller.update(table_name, convert_to_map)\r\n end",
"title": ""
},
{
"docid": "549103546cd1ce2f4945d7fcda3fa560",
"score": "0.5930095",
"text": "def update(table_name)\n @assert.check_table_name(table_name, @dbh)\n @update_in_progrss = true\n @update = {\n :columns => {},\n :table_name => table_name,\n :condition => {},\n }\n self\n end",
"title": ""
},
{
"docid": "c9947e535158c9bf4c5ef1eb35cf0d29",
"score": "0.5905213",
"text": "def update_draft_table(table_id_or_name, hub_db_table_v3_input, opts = {})\n data, _status_code, _headers = update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_input, opts)\n data\n end",
"title": ""
},
{
"docid": "b046a5acfbd48fe937ca56905f126589",
"score": "0.5894351",
"text": "def update_draft_table(table_id_or_name, hub_db_table_v3_request, opts = {})\n data, _status_code, _headers = update_draft_table_with_http_info(table_id_or_name, hub_db_table_v3_request, opts)\n data\n end",
"title": ""
},
{
"docid": "cf0f5414047cfd10cc26f6507290f40f",
"score": "0.5893598",
"text": "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table])\n format.html { redirect_to admin_table_path(@table), notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06d24b6b85038837879c0a71fed75606",
"score": "0.58336514",
"text": "def update!(**args)\n @force = args[:force] if args.key?(:force)\n @table_uri = args[:table_uri] if args.key?(:table_uri)\n end",
"title": ""
},
{
"docid": "64e7b80e5acd11f26d0d8d7e95a66fbc",
"score": "0.5822668",
"text": "def update(table, options)\r\n raise 'Method update must be overridden'\r\n end",
"title": ""
},
{
"docid": "4c6968339cc4a45b76cd4265ca604eed",
"score": "0.5816708",
"text": "def update!(**args)\n @attribution = args[:attribution] if args.key?(:attribution)\n @attribution_link = args[:attribution_link] if args.key?(:attribution_link)\n @base_table_ids = args[:base_table_ids] if args.key?(:base_table_ids)\n @column_properties_json_schema = args[:column_properties_json_schema] if args.key?(:column_properties_json_schema)\n @columns = args[:columns] if args.key?(:columns)\n @description = args[:description] if args.key?(:description)\n @is_exportable = args[:is_exportable] if args.key?(:is_exportable)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @sql = args[:sql] if args.key?(:sql)\n @table_id = args[:table_id] if args.key?(:table_id)\n @table_properties_json = args[:table_properties_json] if args.key?(:table_properties_json)\n @table_properties_json_schema = args[:table_properties_json_schema] if args.key?(:table_properties_json_schema)\n end",
"title": ""
},
{
"docid": "fd5ea4059be257c31dd5f149f0f34b2d",
"score": "0.57872486",
"text": "def update!(**args)\n @headers = args[:headers] if args.key?(:headers)\n @rows = args[:rows] if args.key?(:rows)\n end",
"title": ""
},
{
"docid": "fd5ea4059be257c31dd5f149f0f34b2d",
"score": "0.57872486",
"text": "def update!(**args)\n @headers = args[:headers] if args.key?(:headers)\n @rows = args[:rows] if args.key?(:rows)\n end",
"title": ""
},
{
"docid": "ab3747c01c7efc6b70717dede17f72c8",
"score": "0.5783392",
"text": "def update!(**args)\n @identifying_fields = args[:identifying_fields] if args.key?(:identifying_fields)\n @table_reference = args[:table_reference] if args.key?(:table_reference)\n end",
"title": ""
},
{
"docid": "ab3747c01c7efc6b70717dede17f72c8",
"score": "0.5783392",
"text": "def update!(**args)\n @identifying_fields = args[:identifying_fields] if args.key?(:identifying_fields)\n @table_reference = args[:table_reference] if args.key?(:table_reference)\n end",
"title": ""
},
{
"docid": "b674d4729404de9821165b7c93b53fd8",
"score": "0.57642156",
"text": "def update\n @new_table = NewTable.find(params[:id])\n\n respond_to do |format|\n if @new_table.update_attributes(params[:new_table])\n format.html { redirect_to @new_table, :notice => 'New table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @new_table.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "38201db9b51dcc08055a09a594befa47",
"score": "0.57369524",
"text": "def update\n data_table = DataTable.find(params[:id])\n\n respond_to do |format|\n if data_table.update_attributes(params[:data_table])\n format.json { render json: response_hash(data_table) }\n else\n format.json { render json: data_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9fff7a353a661ac0ffe395d09ea85fd2",
"score": "0.57366186",
"text": "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table])\n format.html { redirect_to tables_path, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7876a68b2e089e2274cf29e6905bb587",
"score": "0.57116586",
"text": "def table_update(conn, object_doc, collection_name)\n # Obtain current version and increase it in the document that we are about to save\n uuid = unpack_uuid(object_doc['@uuid'])\n version = object_doc['@version']\n\n object_doc['@version'] = version + 1\n begin\n result = conn.exec_prepared(\"update:#{collection_name}\", [uuid, version, JSON.generate(object_doc)])\n if result.cmd_tuples() < 1\n raise Error.new('No rows updated')\n end\n rescue Exception => e\n # restore previous version\n object_doc['@version'] = version\n raise e\n end\n object_doc\n end",
"title": ""
},
{
"docid": "8a5ef0fd1765d76728d1d3bcda6e1041",
"score": "0.5711379",
"text": "def update_table\n yield\n reset_column_information\n end",
"title": ""
},
{
"docid": "8a5ef0fd1765d76728d1d3bcda6e1041",
"score": "0.5711379",
"text": "def update_table\n yield\n reset_column_information\n end",
"title": ""
},
{
"docid": "984c0e2927c85445bb6091e64dae8882",
"score": "0.57071024",
"text": "def update!(**args)\n @base_table = args[:base_table] if args.key?(:base_table)\n @sql_query = args[:sql_query] if args.key?(:sql_query)\n @view_type = args[:view_type] if args.key?(:view_type)\n end",
"title": ""
},
{
"docid": "263c81eef97fe7f8498dd485a0d3de81",
"score": "0.56802595",
"text": "def update!(**args)\n @storage_path = args[:storage_path] if args.key?(:storage_path)\n @table = args[:table] if args.key?(:table)\n end",
"title": ""
},
{
"docid": "263c81eef97fe7f8498dd485a0d3de81",
"score": "0.56802595",
"text": "def update!(**args)\n @storage_path = args[:storage_path] if args.key?(:storage_path)\n @table = args[:table] if args.key?(:table)\n end",
"title": ""
},
{
"docid": "40ac57ae592b8fbd12629ad1818af923",
"score": "0.5667559",
"text": "def update(table, columns, values)\n @query += \"UPDATE #{table} SET\"\n columns.each do |column|\n @query += \" #{column} = ?,\"\n end\n @query[@query.length-1] = ' '\n values.each do |values|\n @values << values\n end\n return self\n end",
"title": ""
},
{
"docid": "546d0af3449ac5824ae07f0103b52378",
"score": "0.56636924",
"text": "def update!(**args)\n @attribution = args[:attribution] if args.key?(:attribution)\n @attribution_link = args[:attribution_link] if args.key?(:attribution_link)\n @base_table_ids = args[:base_table_ids] if args.key?(:base_table_ids)\n @columns = args[:columns] if args.key?(:columns)\n @description = args[:description] if args.key?(:description)\n @is_exportable = args[:is_exportable] if args.key?(:is_exportable)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @sql = args[:sql] if args.key?(:sql)\n @table_id = args[:table_id] if args.key?(:table_id)\n end",
"title": ""
},
{
"docid": "cf2476b752e3231cc695a1f52b67d37f",
"score": "0.56470764",
"text": "def update!(**args)\n @column_headers = args[:column_headers] if args.key?(:column_headers)\n @kind = args[:kind] if args.key?(:kind)\n @rows = args[:rows] if args.key?(:rows)\n end",
"title": ""
},
{
"docid": "d6b9ac1469ee4cb39b4011a424ca9c85",
"score": "0.5635098",
"text": "def update!(**args)\n @initial_splits = args[:initial_splits] if args.key?(:initial_splits)\n @table = args[:table] if args.key?(:table)\n @table_id = args[:table_id] if args.key?(:table_id)\n end",
"title": ""
},
{
"docid": "2191f225719e9294c48af5102d188b3a",
"score": "0.56230885",
"text": "def update\n @table =Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table])\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "87366289f94bf321e5f6363e77b72cd8",
"score": "0.5617985",
"text": "def update!(**args)\n @column_id = args[:column_id] if args.key?(:column_id)\n @table_index = args[:table_index] if args.key?(:table_index)\n end",
"title": ""
},
{
"docid": "87366289f94bf321e5f6363e77b72cd8",
"score": "0.5617985",
"text": "def update!(**args)\n @column_id = args[:column_id] if args.key?(:column_id)\n @table_index = args[:table_index] if args.key?(:table_index)\n end",
"title": ""
},
{
"docid": "4825a160fdb3097bd6af4f918292c38a",
"score": "0.56097275",
"text": "def update(id, data)\n adapter.exec_prepared(\"update_#{table_name}\", update_sql(id, data.keys), *data.values)\n end",
"title": ""
},
{
"docid": "f87d556822cd70f3279762e095fdbd69",
"score": "0.55957335",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @index = args[:index] if args.key?(:index)\n @key_set = args[:key_set] if args.key?(:key_set)\n @partition_options = args[:partition_options] if args.key?(:partition_options)\n @table = args[:table] if args.key?(:table)\n @transaction = args[:transaction] if args.key?(:transaction)\n end",
"title": ""
},
{
"docid": "9f9b07f2d4b50f39119310dab7e0e8d7",
"score": "0.55864275",
"text": "def update!(**args)\n @spreadsheet_id = args[:spreadsheet_id] if args.key?(:spreadsheet_id)\n @table_range = args[:table_range] if args.key?(:table_range)\n @updates = args[:updates] if args.key?(:updates)\n end",
"title": ""
},
{
"docid": "9f9b07f2d4b50f39119310dab7e0e8d7",
"score": "0.55864275",
"text": "def update!(**args)\n @spreadsheet_id = args[:spreadsheet_id] if args.key?(:spreadsheet_id)\n @table_range = args[:table_range] if args.key?(:table_range)\n @updates = args[:updates] if args.key?(:updates)\n end",
"title": ""
},
{
"docid": "138fe31c05b91b61277f183b1518770c",
"score": "0.5584248",
"text": "def update!(**args)\n @backup = args[:backup] if args.key?(:backup)\n @table_id = args[:table_id] if args.key?(:table_id)\n end",
"title": ""
},
{
"docid": "cf4b26a38a769833c233750f75f0954e",
"score": "0.5570757",
"text": "def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c4eea76a7825e589964aeb5a7c8c5c31",
"score": "0.5558123",
"text": "def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c4eea76a7825e589964aeb5a7c8c5c31",
"score": "0.5558123",
"text": "def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ced08228ee6f99c7fac0db0f0aa265a",
"score": "0.5556713",
"text": "def update!(**args)\n @table_source_type = args[:table_source_type] if args.key?(:table_source_type)\n @table_spec = args[:table_spec] if args.key?(:table_spec)\n @view_spec = args[:view_spec] if args.key?(:view_spec)\n end",
"title": ""
},
{
"docid": "8ced08228ee6f99c7fac0db0f0aa265a",
"score": "0.5556713",
"text": "def update!(**args)\n @table_source_type = args[:table_source_type] if args.key?(:table_source_type)\n @table_spec = args[:table_spec] if args.key?(:table_spec)\n @view_spec = args[:view_spec] if args.key?(:view_spec)\n end",
"title": ""
},
{
"docid": "8ced08228ee6f99c7fac0db0f0aa265a",
"score": "0.5556713",
"text": "def update!(**args)\n @table_source_type = args[:table_source_type] if args.key?(:table_source_type)\n @table_spec = args[:table_spec] if args.key?(:table_spec)\n @view_spec = args[:view_spec] if args.key?(:view_spec)\n end",
"title": ""
},
{
"docid": "035d0bf9e013d3b0ed0315296f6be617",
"score": "0.5551975",
"text": "def update_entity(table_name, entity)\r\n raise WAZ::Tables::InvalidTableName, table_name unless WAZ::Storage::ValidationRules.valid_table_name?(table_name)\r\n response = execute(:put, \"#{table_name}(PartitionKey='#{entity[:partition_key]}',RowKey='#{entity[:row_key]}')\", {}, default_headers.merge({'If-Match' => '*'}) , generate_payload(table_name, entity))\r\n return parse_response(response)\r\n end",
"title": ""
},
{
"docid": "d236052472f69e8d515fd1263a84dbbc",
"score": "0.5544498",
"text": "def update(table, attributes, options = {})\n sql_query = \"UPDATE `#{database_name}`.`#{table}` SET\"\n sql_query << \" #{hash_to_sql(attributes)}\"\n if options[:where]\n sql_query << \" \" + build_where_string(options[:where])\n end\n with_mysql do |mysql|\n query_on_connection(mysql, sql_query)\n mysql.affected_rows\n end\n end",
"title": ""
},
{
"docid": "5309bef28cced8de47ea874e37e50ab5",
"score": "0.55416006",
"text": "def update!(**args)\n @data = args[:data] if args.key?(:data)\n @table = args[:table] if args.key?(:table)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "5309bef28cced8de47ea874e37e50ab5",
"score": "0.55416006",
"text": "def update!(**args)\n @data = args[:data] if args.key?(:data)\n @table = args[:table] if args.key?(:table)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "344332d3abbb219050d39fd94d4954d5",
"score": "0.55330116",
"text": "def update!(**args)\n @database = args[:database] if args.key?(:database)\n @kind = args[:kind] if args.key?(:kind)\n @table = args[:table] if args.key?(:table)\n @uri = args[:uri] if args.key?(:uri)\n end",
"title": ""
},
{
"docid": "8aac5b72b3a8c5937483e7ac48748aa0",
"score": "0.5531335",
"text": "def update(body)\n raise ArgumentError unless body.is_a?(Hash)\n\n api.put('', body, 'application/json')\n end",
"title": ""
},
{
"docid": "28ee5f04fac6f5dfe20c20203a818128",
"score": "0.551214",
"text": "def update ( *tabs )\n _getGenericQuery 'update', *tabs\n end",
"title": ""
},
{
"docid": "085842691feb3a7f6d29e111f509146a",
"score": "0.549935",
"text": "def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: \"Table was successfully updated.\" }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d97219b854674bd3e4895322c75d979c",
"score": "0.5486132",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @kind = args[:kind] if args.key?(:kind)\n @rows = args[:rows] if args.key?(:rows)\n end",
"title": ""
},
{
"docid": "d97219b854674bd3e4895322c75d979c",
"score": "0.5486132",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @kind = args[:kind] if args.key?(:kind)\n @rows = args[:rows] if args.key?(:rows)\n end",
"title": ""
},
{
"docid": "d1a3b37081b9960d1008ba808606a089",
"score": "0.5469975",
"text": "def update!(**args)\n @data_rows = args[:data_rows] if args.key?(:data_rows)\n @headers = args[:headers] if args.key?(:headers)\n end",
"title": ""
},
{
"docid": "8055ff50f7f92d8c1e3777109dadd8b8",
"score": "0.5458806",
"text": "def update(transaction, table_name, update, proj = {})\n Kernel.raise NotImplementedError\n end",
"title": ""
},
{
"docid": "13ea0605985168f512f2dbb0f5173a98",
"score": "0.5449865",
"text": "def update!(**args)\n @base_column = args[:base_column] if args.key?(:base_column)\n @column_id = args[:column_id] if args.key?(:column_id)\n @column_json_schema = args[:column_json_schema] if args.key?(:column_json_schema)\n @column_properties_json = args[:column_properties_json] if args.key?(:column_properties_json)\n @description = args[:description] if args.key?(:description)\n @format_pattern = args[:format_pattern] if args.key?(:format_pattern)\n @graph_predicate = args[:graph_predicate] if args.key?(:graph_predicate)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @type = args[:type] if args.key?(:type)\n @valid_values = args[:valid_values] if args.key?(:valid_values)\n @validate_data = args[:validate_data] if args.key?(:validate_data)\n end",
"title": ""
},
{
"docid": "23ea2ec6ae7459f9f1c748473cb560ac",
"score": "0.5449432",
"text": "def update\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname){\"params=#{params}\"}\n\t\tLOG.debug(fname){\"ui_table_params=#{ui_table_params}\"}\n\t\t#LOG.debug(fname){params[\"ui_column_ids\"].zip(params[\"rank\"])}\n\t\trespond_to do |format|\n\t\t\tcols=@ui_table.ui_columns_exists?(params[:ui_table][:ui_columns])\n\t\t\tif cols\n\t\t\t\tif @ui_table.update(params[:ui_table])\n\t\t\t\t\tformat.html { redirect_to @ui_table, notice: 'Ui table was successfully updated. update rank of columns=#{st}' }\n\t\t\t\t\tformat.json { render :show, status: :ok, location: @ui_table }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :edit }\n\t\t\t\t\tformat.json { render json: @ui_table.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @ui_table.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d5ba7becc8e3ded2f6a86d4d11f7e5b2",
"score": "0.544572",
"text": "def update\n prevent_non_admin\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to [@event, @session, @table], notice: 'Table was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session, @table] }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8b429f21de0f7e99b3392f99e31f880c",
"score": "0.54420584",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @index = args[:index] if args.key?(:index)\n @key_set = args[:key_set] if args.key?(:key_set)\n @limit = args[:limit] if args.key?(:limit)\n @partition_token = args[:partition_token] if args.key?(:partition_token)\n @resume_token = args[:resume_token] if args.key?(:resume_token)\n @table = args[:table] if args.key?(:table)\n @transaction = args[:transaction] if args.key?(:transaction)\n end",
"title": ""
},
{
"docid": "d1cb945a2988c5272d16dafa8ff30006",
"score": "0.5437314",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end",
"title": ""
},
{
"docid": "d1cb945a2988c5272d16dafa8ff30006",
"score": "0.5437314",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end",
"title": ""
},
{
"docid": "d1cb945a2988c5272d16dafa8ff30006",
"score": "0.5437314",
"text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end",
"title": ""
},
{
"docid": "3e88d2f72c6f6c76b6cfee607febf611",
"score": "0.5432982",
"text": "def update\n respond_to do |format|\n if @old_table.update(old_table_params)\n format.html { redirect_to @old_table, notice: 'Old table was successfully updated.' }\n format.json { render :show, status: :ok, location: @old_table }\n else\n format.html { render :edit }\n format.json { render json: @old_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc970386a1ae6e9b5761d05fb1865832",
"score": "0.54314417",
"text": "def patch_table dataset_id, table_id, options = {}\n execute(\n api_method: @bigquery.tables.patch,\n parameters: { projectId: @project, datasetId: dataset_id,\n tableId: table_id },\n body_object: patch_table_request(options)\n )\n end",
"title": ""
},
{
"docid": "1cf3087b076ae3c5da72cbcd16b2e2c3",
"score": "0.5430014",
"text": "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table])\n flash[:notice] = 'Table was successfully updated.'\n format.html { redirect_to(@table) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @table.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6bb551f54a5cb83ce386cc34f4bfad88",
"score": "0.53898394",
"text": "def update\n respond_to do |format|\n if @admin_table.update(admin_table_params)\n format.html { redirect_to @admin_table, notice: 'Admin table was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_table }\n else\n format.html { render :edit }\n format.json { render json: @admin_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c3dc73e724380725bb5affa4e2f7c31",
"score": "0.5365898",
"text": "def update\n respond_to do |format|\n if @my_table.update(my_table_params)\n format.html { redirect_to table_path(@my_table.id), notice: 'My table was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_table }\n else\n format.html { render :edit }\n format.json { render json: @my_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1527fd004e90299ce10def47bd44b499",
"score": "0.53535986",
"text": "def update!(**args)\n @end_key = args[:end_key] if args.key?(:end_key)\n @end_time = args[:end_time] if args.key?(:end_time)\n @name = args[:name] if args.key?(:name)\n @node_cpu_usage_percent = args[:node_cpu_usage_percent] if args.key?(:node_cpu_usage_percent)\n @start_key = args[:start_key] if args.key?(:start_key)\n @start_time = args[:start_time] if args.key?(:start_time)\n @table_name = args[:table_name] if args.key?(:table_name)\n end",
"title": ""
},
{
"docid": "6e80c4450b98e12e3bbb777d674a4f40",
"score": "0.5341454",
"text": "def update!(**args)\n @column_header = args[:column_header] if args.key?(:column_header)\n @data = args[:data] if args.key?(:data)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"title": ""
},
{
"docid": "6e80c4450b98e12e3bbb777d674a4f40",
"score": "0.5341454",
"text": "def update!(**args)\n @column_header = args[:column_header] if args.key?(:column_header)\n @data = args[:data] if args.key?(:data)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"title": ""
},
{
"docid": "2fe7eb475c81def0b0f387227876687f",
"score": "0.53288656",
"text": "def update\n respond_to do |format|\n if @table_bottle.update(table_bottle_params)\n format.html { redirect_to @table_bottle, notice: 'Table bottle was successfully updated.' }\n format.json { render :show, status: :ok, location: @table_bottle }\n else\n format.html { render :edit }\n format.json { render json: @table_bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26288c4c3ca29c4238c0e6ff156bbd17",
"score": "0.53251743",
"text": "def update!(**args)\n @dataset_id = args[:dataset_id] if args.key?(:dataset_id)\n @table_id = args[:table_id] if args.key?(:table_id)\n end",
"title": ""
},
{
"docid": "26288c4c3ca29c4238c0e6ff156bbd17",
"score": "0.5324682",
"text": "def update!(**args)\n @dataset_id = args[:dataset_id] if args.key?(:dataset_id)\n @table_id = args[:table_id] if args.key?(:table_id)\n end",
"title": ""
},
{
"docid": "207bb880e23adb8302c0db2bfc0f1164",
"score": "0.5316993",
"text": "def update\n if @rtable.update(rtable_params)\n render json: @rtable\n else\n render json: @rtable.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "993787f64f82ee14751e54d0bff46a5c",
"score": "0.53162146",
"text": "def update\n respond_to do |format|\n if @custom_table.update(custom_table_params)\n format.html { redirect_to @custom_table, notice: 'Custom table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @custom_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "66f5b2ca3b97127df78c39482da807b4",
"score": "0.531232",
"text": "def update_record(database, table, values, old_key = nil)\n connections[database].update_record(table, values, old_key)\n end",
"title": ""
},
{
"docid": "4ba1102ff6ff870ebff57f216dfa2524",
"score": "0.5309046",
"text": "def exec_update(sql, name, binds)\n if sql =~ /\\AUPDATE (.*) SET (.*)\\z/\n sql = \"ALTER TABLE #{$1} UPDATE #{$2}\"\n end\n exec_update_original(sql, name, binds)\n end",
"title": ""
},
{
"docid": "a417eb8c44e754fff5a584544e0e5d88",
"score": "0.5308034",
"text": "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @tables = args[:tables] if args.key?(:tables)\n end",
"title": ""
},
{
"docid": "a417eb8c44e754fff5a584544e0e5d88",
"score": "0.5308034",
"text": "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @tables = args[:tables] if args.key?(:tables)\n end",
"title": ""
},
{
"docid": "3daa130dd1cf82996cc24e553009fcb5",
"score": "0.53026414",
"text": "def update!(**args)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "3daa130dd1cf82996cc24e553009fcb5",
"score": "0.53026414",
"text": "def update!(**args)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "202ade02d701ad7b3451c3c4f1c0d771",
"score": "0.5291156",
"text": "def update!(**args)\n @endpoint_uri = args[:endpoint_uri] if args.key?(:endpoint_uri)\n @headers = args[:headers] if args.key?(:headers)\n end",
"title": ""
},
{
"docid": "4e09393ff47e1765d0721dd5addd1053",
"score": "0.5287243",
"text": "def update\n respond_to do |format|\n if @tablename.update(tablename_params)\n format.html { redirect_to @tablename, notice: 'Tablename was successfully updated.' }\n format.json { render :show, status: :ok, location: @tablename }\n else\n format.html { render :edit }\n format.json { render json: @tablename.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0b1087d773b2778aa2ae6bc17a2cc611",
"score": "0.5285514",
"text": "def update(table_name, value_hash, where_conditions = \"\")\n # Compute the WHERE clause.\n where_conditions = \"where #{where_conditions}\" if where_conditions.length > 0\n\n # Work out the SET clause\n escaped_values = []\n value_hash.each{|k, v| \n escaped_values << \"#{k}=#{(v.is_a? String) ? escape(v) : v.to_s}\" \n }\n\n return execute(\"update `#{table_name}` set #{escaped_values.join(\", \")} #{where_conditions};\")\n end",
"title": ""
},
{
"docid": "1436c10ba19d509e3e92d3f8ce01f0b8",
"score": "0.52817655",
"text": "def update\n @table_header = TableHeader.find(params[:id])\n\n respond_to do |format|\n if @table_header.update_attributes(params[:table_header])\n format.html { redirect_to @table_header, notice: 'Table header was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table_header.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e387a6ba42f9238716b4694171f1f85",
"score": "0.5281678",
"text": "def update\n @hr_table = HrTable.find(params[:id])\n\n respond_to do |format|\n if @hr_table.update_attributes(params[:hr_table])\n format.html { redirect_to @hr_table, notice: 'Hr table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hr_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94a09ab6fe652d3bf31a224e803ec9c7",
"score": "0.5270167",
"text": "def update\n @data_table = DataTable.find(params[:id])\n\n respond_to do |format|\n if @data_table.update_attributes(params[:data_table])\n format.html { redirect_to admin_data_table_path(@data_table), notice: 'Data table was successfully updated.' }\n format.json { head :no_content }\n else\n @data_table.fields_build\n format.html { render :edit, :locals => { :data_table => @data_table } }\n format.json { render json: @data_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab8602421ea45c4f79a9ce23ca245b40",
"score": "0.52673024",
"text": "def update!(**args)\n @action = args[:action] if args.key?(:action)\n @input_schema = args[:input_schema] if args.key?(:input_schema)\n @output_schema = args[:output_schema] if args.key?(:output_schema)\n end",
"title": ""
},
{
"docid": "06e1ffc8e68f8061f67ae1ee7d81c928",
"score": "0.5265677",
"text": "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n @bindings = args[:bindings] if args.key?(:bindings)\n end",
"title": ""
},
{
"docid": "dddc32cb65ea99db8cfb8a8ed5cd0523",
"score": "0.52602893",
"text": "def update(connection, *args)\n commit(connection, \"update\", *args)\n end",
"title": ""
},
{
"docid": "a4596d7471eead2f075662ea98d14613",
"score": "0.52543664",
"text": "def update(key_value_col, *key_value_cols)\n raise TypeError.new(\"#{key_value_col.inspect} is not type of Hash\") unless key_value_col.kind_of? Hash\n if (key_value_cols)\n invalid_cols = key_value_cols.select{|c| !c.is_a? Hash }\n raise TypeError.new(\"#{invalid_cols.join(', ')} are not type of Hash\") unless invalid_cols.size == 0\n end\n full_path = full_resource_path '/update'\n all_key_values = [key_value_col] + key_value_cols\n query_params = MaropostApi.set_query_params\n \n MaropostApi.put_result(full_path, {:record => all_key_values}, query_params)\n end",
"title": ""
},
{
"docid": "d972ce95dda6fb4b2b79a0a9e0221ba2",
"score": "0.52535206",
"text": "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end",
"title": ""
},
{
"docid": "d972ce95dda6fb4b2b79a0a9e0221ba2",
"score": "0.52535206",
"text": "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end",
"title": ""
},
{
"docid": "d972ce95dda6fb4b2b79a0a9e0221ba2",
"score": "0.52535206",
"text": "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end",
"title": ""
},
{
"docid": "d972ce95dda6fb4b2b79a0a9e0221ba2",
"score": "0.52535206",
"text": "def update!(**args)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end",
"title": ""
}
] |
f2722875d3acf8c157c8f1c401d1139d
|
returns the local project directory
|
[
{
"docid": "174d853e6f8ab59b3e23a81f1b4277b6",
"score": "0.71558505",
"text": "def path\n @path ||= @project.dir.path\n end",
"title": ""
}
] |
[
{
"docid": "5779713d0c083420d8df562401d05129",
"score": "0.8262279",
"text": "def project_dir\n config.project_dir\n end",
"title": ""
},
{
"docid": "e03e663ae63e40706eefe6a28ca1d975",
"score": "0.77350706",
"text": "def project_dir\n File.expand_path(\"#{fetch_dir}/#{relative_path}\")\n end",
"title": ""
},
{
"docid": "79946e55507e2e38f72b235928489aca",
"score": "0.7636298",
"text": "def get_project_path\n return File.absolute_path File.join(root_dir, src)\n end",
"title": ""
},
{
"docid": "fa6738044286a40e8e4c43faeef15540",
"score": "0.762277",
"text": "def get_local_dir\n return @resource[:local_dir]\n end",
"title": ""
},
{
"docid": "3a9e40c7fbb9221242d620883fdd6242",
"score": "0.7571757",
"text": "def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"title": ""
},
{
"docid": "6d16d1f6cfbcbef9c2cf0d7834d4bae9",
"score": "0.7495453",
"text": "def golang_project_dirname\n DeliveryGolang::Helpers.golang_project_dirname(node)\n end",
"title": ""
},
{
"docid": "9601d4187fc3e49765c7a955b9a1df4e",
"score": "0.7490239",
"text": "def project_root\n File.expand_path(\"#{__dir__}/..\")\n end",
"title": ""
},
{
"docid": "b58b8328ef083a1454c715b127704e30",
"score": "0.7420175",
"text": "def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end",
"title": ""
},
{
"docid": "81a3b2bbe010712653dd48adefe23138",
"score": "0.7279147",
"text": "def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"title": ""
},
{
"docid": "81a3b2bbe010712653dd48adefe23138",
"score": "0.7279147",
"text": "def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"title": ""
},
{
"docid": "5f07fa10685b97ecce3f54770a465dde",
"score": "0.7252865",
"text": "def workspace_folder\n @pwd\n end",
"title": ""
},
{
"docid": "70ad3e7aad1fa19249ecfcdb0c997bce",
"score": "0.72259575",
"text": "def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"title": ""
},
{
"docid": "9e2bd2a9d4b2a635e0866486a48a689d",
"score": "0.7186538",
"text": "def dir\n File.dirname(__FILE__)\n end",
"title": ""
},
{
"docid": "c3537341e98ee2db82154e0f58ef5418",
"score": "0.7182404",
"text": "def current_directory\n File.expand_path @current_directory\n end",
"title": ""
},
{
"docid": "230118af926f09f4a5b7c71509282b8c",
"score": "0.71760446",
"text": "def build_dir\n File.expand_path(\"#{Config.build_dir}/#{project.name}\")\n end",
"title": ""
},
{
"docid": "c13c7f7be9493a684032c7ea96e5b881",
"score": "0.7175388",
"text": "def working_dir\n ENV['PWD'] || Dir.pwd\n end",
"title": ""
},
{
"docid": "f8367bc4c2edbed1a869692c499e4664",
"score": "0.7134165",
"text": "def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end",
"title": ""
},
{
"docid": "2f1bda3b2a8f27bfe9f700d0d1c3a36e",
"score": "0.7131686",
"text": "def root\n File.dirname __dir__\n end",
"title": ""
},
{
"docid": "2f1bda3b2a8f27bfe9f700d0d1c3a36e",
"score": "0.7131686",
"text": "def root\n File.dirname __dir__\n end",
"title": ""
},
{
"docid": "0a1aea347cd94ca25a935819eb2d68f1",
"score": "0.7127071",
"text": "def root\n File.dirname __dir__\n end",
"title": ""
},
{
"docid": "f11427395cb3f9574f3c481646c26148",
"score": "0.71110445",
"text": "def project_dir(lang = \"en\")\n File.join(self.source_dir,self.rez_base,ResourceSquasher.project_name,lang)\n end",
"title": ""
},
{
"docid": "9f09a1fed4576b55f45929a134d0cee7",
"score": "0.7084357",
"text": "def dir\n @working_directory\n end",
"title": ""
},
{
"docid": "ad3ba510beb456a5e86ad2a3c488810a",
"score": "0.7080826",
"text": "def subdir\n if core_project? or 'profile' == proj_type\n return @local_path.parent.relative_path_from(@platform.local_path + (proj_type + 's'))\n else\n return @local_path.parent.relative_path_from(@platform.local_path + @platform.contrib_path + (proj_type + 's'))\n end\n end",
"title": ""
},
{
"docid": "b1a6bea9ed29d2ec9b5c27eafa6f0fc7",
"score": "0.706759",
"text": "def project_root_dir\n File.expand_path(File.join(File.dirname(__FILE__), '..'))\nend",
"title": ""
},
{
"docid": "40c800fae69b6cbd2bd7108db563765c",
"score": "0.7060602",
"text": "def project_root; end",
"title": ""
},
{
"docid": "40c800fae69b6cbd2bd7108db563765c",
"score": "0.7060602",
"text": "def project_root; end",
"title": ""
},
{
"docid": "0cd60eb888a3bd555b966f3c1557f738",
"score": "0.70487124",
"text": "def source_dir\n @config.source_dir\n end",
"title": ""
},
{
"docid": "a63bf309b7c71e03e6600a639b36f3e4",
"score": "0.70441645",
"text": "def source_dir\n Dir.pwd\nend",
"title": ""
},
{
"docid": "8fa0352e63a63d91bd01edabd24160bc",
"score": "0.70184684",
"text": "def integration_cwd\n root.to_s\n end",
"title": ""
},
{
"docid": "109fdcec9dee9329cf8bdabfc2ba2c9a",
"score": "0.7012533",
"text": "def root; Pathname(__dir__).parent; end",
"title": ""
},
{
"docid": "2798f85139fd770d89a21f7df46a4573",
"score": "0.701157",
"text": "def getwd\n Dir.getwd\n end",
"title": ""
},
{
"docid": "735dc6953952ad22e4b5f8459784ddce",
"score": "0.6996735",
"text": "def cwd\n return cd(\"\").to_s\n end",
"title": ""
},
{
"docid": "6158c0e6ae055d5cef93928e079eb898",
"score": "0.6982406",
"text": "def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"title": ""
},
{
"docid": "aac76df45a6e051000c56be09c1355ad",
"score": "0.6954373",
"text": "def root\n Pathname.new(File.dirname(__dir__))\n end",
"title": ""
},
{
"docid": "4305b116803b876ff49aead229c70e92",
"score": "0.6916512",
"text": "def getWorkingDir\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"title": ""
},
{
"docid": "a7bb538554e29a32e61182ad70f73e24",
"score": "0.69022137",
"text": "def cwd\n Dir.getwd\n end",
"title": ""
},
{
"docid": "ac345eb34b3127f0c9b305a95123ec81",
"score": "0.6896436",
"text": "def locate\r\n File.dirname(__FILE__)\r\n end",
"title": ""
},
{
"docid": "ac345eb34b3127f0c9b305a95123ec81",
"score": "0.6896436",
"text": "def locate\r\n File.dirname(__FILE__)\r\n end",
"title": ""
},
{
"docid": "20d43f3911924611df0ca9e94d68bea2",
"score": "0.68931264",
"text": "def GetProjectDirectoryRelativeBaseDirectory(projectRelativePath)\n return FormatXmlPath(StripFilenameFromPath(projectRelativePath))\n end",
"title": ""
},
{
"docid": "e3f88a33eac5539bd388e287c6eacfff",
"score": "0.6890512",
"text": "def containing_directory\n path.dirname\n end",
"title": ""
},
{
"docid": "8e4308945f85f08711873aebc323c29a",
"score": "0.686479",
"text": "def root\n File.expand_path(File.dirname(__dir__))\n end",
"title": ""
},
{
"docid": "ace8c4cd15a4319e3dc3031285af8c6e",
"score": "0.6863648",
"text": "def getWorkingDir\n if(@workingDir != nil)\n return @workingDir\n end\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"title": ""
},
{
"docid": "b8c2f898a91c15e80f6b8dfaa2fece7e",
"score": "0.686048",
"text": "def current_dir; end",
"title": ""
},
{
"docid": "e46ef9e4639581188f3d2c07a7e7fe41",
"score": "0.6857064",
"text": "def root\n Dir.pwd\n end",
"title": ""
},
{
"docid": "1405d6c85b71559e3932c068299702f9",
"score": "0.6842596",
"text": "def project_name\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end",
"title": ""
},
{
"docid": "010ae8df1a6ab84992859300fb6f1d0a",
"score": "0.68285286",
"text": "def root\n settings[:basedir]\n end",
"title": ""
},
{
"docid": "62dc6ec73c9a2b9ab177fe86f4020144",
"score": "0.6814459",
"text": "def root\n File.dirname(__FILE__)\n end",
"title": ""
},
{
"docid": "c6599b8844b84ac2870d7f2aebef08f1",
"score": "0.677507",
"text": "def build_root()\n \"#{project_root}/build\"\n end",
"title": ""
},
{
"docid": "04bee87ae5466ae5f358bc72d70b9ac5",
"score": "0.6773038",
"text": "def path\n project\n end",
"title": ""
},
{
"docid": "5e0689c8b2fc406322f31aecedca6fe8",
"score": "0.6763324",
"text": "def project_root\n this_file_path.ascend do |p|\n rakefile = p.join( 'Rakefile' )\n return p if rakefile.exist?\n end\n end",
"title": ""
},
{
"docid": "5a7999320a518cdab1a12ecbdbcc10eb",
"score": "0.67591023",
"text": "def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end",
"title": ""
},
{
"docid": "bde6520eac5c811e889cf716399030d0",
"score": "0.6731316",
"text": "def get_app_dir(deploy_to)\n \"#{deploy_to}/current/\"\n end",
"title": ""
},
{
"docid": "92648133561d0ab88a26e71b324b5049",
"score": "0.67301476",
"text": "def install_dir\n Crate.project.install_dir\n end",
"title": ""
},
{
"docid": "c13ba303e6731b0f91d5fa0d0fdd231e",
"score": "0.67247474",
"text": "def base_directory\n File.expand_path(File.join(File.dirname(__FILE__), '..'))\n end",
"title": ""
},
{
"docid": "c6af88d000c408ae4756b3beb8f9ecf7",
"score": "0.6721696",
"text": "def base_path\n Dir.pwd + \"/\"\n end",
"title": ""
},
{
"docid": "dfd6c67ec7f4b9a6b8df8eeacb318629",
"score": "0.67155427",
"text": "def working_dir\n return nil if !repo || !user\n return \"#{Bini.data_dir}/repos/#{user}/#{repo}\"\n end",
"title": ""
},
{
"docid": "3fab1756230b0ca9f5449b9840267a67",
"score": "0.67104995",
"text": "def siteroot\n \"/var/www/gforge-projects\"\n end",
"title": ""
},
{
"docid": "9bd6cd1491bb57bbb1182e6a95b22a67",
"score": "0.6710188",
"text": "def current_working_directory; @rye_current_working_directory; end",
"title": ""
},
{
"docid": "3e85dd46f2ce438e023d3a53a4415fa0",
"score": "0.6709576",
"text": "def directory\n File.dirname @path\n end",
"title": ""
},
{
"docid": "f0b6e8d9d768067fe218e9e2bef082dd",
"score": "0.6706517",
"text": "def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"title": ""
},
{
"docid": "fe0d6a22a5493192846aa8e579df9d52",
"score": "0.6702082",
"text": "def dir_base\n File.expand_path(File.dirname(__FILE__)+\"/../..\")\n end",
"title": ""
},
{
"docid": "f8ce511232d0df138771d1acdc143ea8",
"score": "0.66976804",
"text": "def current_dir\n File.dirname(file_path)\n end",
"title": ""
},
{
"docid": "b32d2bebcd207d76c42e6a3ef815f790",
"score": "0.6690937",
"text": "def localstate_default_directory\n default_dir = File.join( Config::CONFIG['localstatedir'], basedir )\n return default_dir if is_tyrant_root?( default_dir )\n return nil\n end",
"title": ""
},
{
"docid": "b07eb8773dd61cc08a1d8eb2563fa6e7",
"score": "0.6680906",
"text": "def dir\n File.expand_path( File.join( File.dirname( File.expand_path(__FILE__) ), '..' ) )\n end",
"title": ""
},
{
"docid": "c69db9cdb927417da9103c1e97d525f9",
"score": "0.6677956",
"text": "def project_root()\n return @project_root_path if @project_root_path\n \n @project_root_path = Common::find_root_of(\"tiapp.xml\", Common::project_path)\n end",
"title": ""
},
{
"docid": "41bfbad278371c90522c6dfc5582c994",
"score": "0.6672593",
"text": "def project_name\n return config['project_name'] if config['project_name']\n # using Dir.pwd will return something like: \n # /var/www/apps/staging.sweetspot.dm/releases/20061006155448\n # instead of\n # /var/www/apps/staging.sweetspot.dm/current\n pwd = ENV['PWD'] || Dir.pwd\n #another hack..ugh. If using standard capistrano setup, pwd will be the 'current' symlink.\n pwd = File.dirname(pwd) if File.symlink?(pwd)\n File.basename(pwd)\n end",
"title": ""
},
{
"docid": "4e3f5681bfd4edcc87f1c0acc3f2614d",
"score": "0.6671021",
"text": "def source_dir_of(selection)\n if workspace_dir?(selection)\n ws.root_dir\n elsif (pkg_set = find_package_set(selection))\n pkg_set.user_local_dir\n else\n resolve_package(selection).srcdir\n end\n end",
"title": ""
},
{
"docid": "c3a571902c33eeef7a10d8d6f20898cc",
"score": "0.6667181",
"text": "def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"title": ""
},
{
"docid": "a5628e87ae65c5d95bea47c243c2cac0",
"score": "0.6648998",
"text": "def build_directory\n File.expand_path(config['build_directory'])\n end",
"title": ""
},
{
"docid": "98a1214a9fe69a4d775f43c1a14a5f3f",
"score": "0.6647725",
"text": "def work_dir; end",
"title": ""
},
{
"docid": "4d2b7af76edb17cfc22dcf32b7c42537",
"score": "0.66456884",
"text": "def working_directory\n @options[:working_directory]\n end",
"title": ""
},
{
"docid": "d6efa3f95c6bad28254807096ce89098",
"score": "0.664109",
"text": "def directory\n File.dirname(@path) + '/'\n end",
"title": ""
},
{
"docid": "b7d6583c85a11ca768fe5e27397db2c1",
"score": "0.6638307",
"text": "def rootDir\n if @workflow[:root_dir]\n OpenStudio.toPath(@workflow[:root_dir])\n else\n OpenStudio.toPath(@osw_dir)\n end\n end",
"title": ""
},
{
"docid": "73a9a75a482f43b93c61e287ed3fb375",
"score": "0.6635989",
"text": "def dir\n Rails.root.join(ROOT, type, name).to_s\n end",
"title": ""
},
{
"docid": "fc68198e713127472152701efece577a",
"score": "0.6634751",
"text": "def path\n application? ? application_path : local_path\n end",
"title": ""
},
{
"docid": "ed310a2d4e4eecc4244d5558c1091a22",
"score": "0.663028",
"text": "def directory\n @directory ||= site.in_source_dir(\n File.join(container, relative_directory)\n )\n end",
"title": ""
},
{
"docid": "5a1f6613258571ea45fe8fb244328163",
"score": "0.66277415",
"text": "def prefixed_working_directory\n return self.storage.prefixed_working_directory\n end",
"title": ""
},
{
"docid": "5341ecd64267f4b14895cc955cd74143",
"score": "0.6626357",
"text": "def base_dir\n return Gem.dir unless loaded_from\n @base_dir ||= if default_gem? then\n File.dirname File.dirname File.dirname loaded_from\n else\n File.dirname File.dirname loaded_from\n end\n end",
"title": ""
},
{
"docid": "12318354395c02ed0a216489af4084a3",
"score": "0.6616366",
"text": "def root_dir\n ManageIQ::Providers::Lenovo::Engine.root.join(\"content/ansible_runner\")\n end",
"title": ""
},
{
"docid": "a2901fc5c3cd867ca7c85696fd69063c",
"score": "0.66108143",
"text": "def dir\n # config.repos_dir + @name\n end",
"title": ""
},
{
"docid": "fc2a48885bea3fe73f167f77efafbf88",
"score": "0.6610109",
"text": "def my_dir\n File.dirname(__FILE__)\nend",
"title": ""
},
{
"docid": "a39989f461167d881fdf13e07009fa31",
"score": "0.65878993",
"text": "def target_dir\n return @target_dir ? @target_dir : Dir.home\n end",
"title": ""
},
{
"docid": "44cf2bd89f1e17779b7d6423847c70a6",
"score": "0.65876085",
"text": "def full_path_to_remote_dir\n (remote_dir[0] == ?/ ? remote_dir : \"$(pwd)/#{remote_dir}\").chomp('/')\n end",
"title": ""
},
{
"docid": "a65b1cf61cfd3f75443013805fcae1e9",
"score": "0.65863615",
"text": "def project_path\n \"#{Dir.home}/viewcumber/\"\nend",
"title": ""
},
{
"docid": "5055aed1534066fdd4549aa97f1c1527",
"score": "0.65805066",
"text": "def cwd\n @target.is_a?(String) && File.directory?(@target) ? @target : \"./\"\n end",
"title": ""
},
{
"docid": "f45639ff4ec7b933692781922842fcef",
"score": "0.6573511",
"text": "def __dir__\n File.expand_path('..', __FILE__)\n end",
"title": ""
},
{
"docid": "5a9e0088f471b98266db5f5281dfd342",
"score": "0.6571559",
"text": "def exec_env_directory\n filename.dirname.to_s\n end",
"title": ""
},
{
"docid": "d119d0f528eb7bfcc041be60bea32e82",
"score": "0.65593266",
"text": "def dir\n File.dirname(self.path)\n end",
"title": ""
},
{
"docid": "9e579e9f4aafd397b9dae518f89b5b31",
"score": "0.6551485",
"text": "def gem_dir\n if File.directory?(dir = File.join(working_dir, 'gems'))\n dir\n end\n end",
"title": ""
},
{
"docid": "9e579e9f4aafd397b9dae518f89b5b31",
"score": "0.6551485",
"text": "def gem_dir\n if File.directory?(dir = File.join(working_dir, 'gems'))\n dir\n end\n end",
"title": ""
},
{
"docid": "2eb677dbd266ba85974a4757d785f88b",
"score": "0.6546072",
"text": "def srcdir_root\n @srcdir\n end",
"title": ""
},
{
"docid": "40d632c4d6b8fd9d8269a300f54bc49b",
"score": "0.653997",
"text": "def modules_home\n FilePath.new(@build_dir, \"modules\").ensure_directory\n end",
"title": ""
},
{
"docid": "602f88a5a70de52b48d3ad968bbe4ad8",
"score": "0.65382075",
"text": "def source_package_dir\n Settings.source_dir #% [@program, @version]\n end",
"title": ""
},
{
"docid": "602f88a5a70de52b48d3ad968bbe4ad8",
"score": "0.65382075",
"text": "def source_package_dir\n Settings.source_dir #% [@program, @version]\n end",
"title": ""
},
{
"docid": "1325b6d487212cf9e6d68846597fa909",
"score": "0.6530107",
"text": "def srcdir_root\n @srcdir\n end",
"title": ""
},
{
"docid": "1325b6d487212cf9e6d68846597fa909",
"score": "0.6530107",
"text": "def srcdir_root\n @srcdir\n end",
"title": ""
},
{
"docid": "4acfe0bfa56381993cf07d6777207783",
"score": "0.65258515",
"text": "def root_dir\n self.class.plays_dir.join script_name\n end",
"title": ""
},
{
"docid": "553017c4e35b37ee90051942ef17e1b7",
"score": "0.6519447",
"text": "def primary_repo_base_dir\n File.expand_path(\n setting(:relative_path_to_primary_repo),\n base_dir(:rtfile_dir)\n ).sub(/\\/?\\z/, '') + '/'\n end",
"title": ""
},
{
"docid": "dc639b5c2d90cd32ac487a686847dd72",
"score": "0.65021914",
"text": "def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end",
"title": ""
},
{
"docid": "dc639b5c2d90cd32ac487a686847dd72",
"score": "0.65021914",
"text": "def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end",
"title": ""
}
] |
d994f8e93f289b604d02128411133022
|
Returns the nonbase, nonpseudoelement selectors in this sequence.
|
[
{
"docid": "81dc724a899a3d5505be75b6e7e6972d",
"score": "0.0",
"text": "def rest\n @rest ||= Set.new(members - [base] - pseudo_elements)\n end",
"title": ""
}
] |
[
{
"docid": "d1f9fdc2cf9785859fd25893b1a49f69",
"score": "0.6683125",
"text": "def standard_xpath_nots\n \"[not(self::did)][not(self::c)][not(self::c02)][not(self::c03)][not(self::c04)][not(self::c05)][not(self::c06)][not(self::c07)][not(self::c08)][not(self::c09)][not(self::c10)][not(self::c11)][not(self::c12)]\"\n end",
"title": ""
},
{
"docid": "1c9344d8bc431d49c2897dfb9d67c881",
"score": "0.6329894",
"text": "def selectors\n @selectors ||= []\n end",
"title": ""
},
{
"docid": "290fb94372342344e4479c9917ec6852",
"score": "0.6156979",
"text": "def all_selectors\n specified_selectors + inferred_selectors\n end",
"title": ""
},
{
"docid": "43be8e919afa8b1ad3ec1137a21046ea",
"score": "0.58330506",
"text": "def selectors\n self.class.selectors\n end",
"title": ""
},
{
"docid": "0cdf0b8352686a7332b487093b162f78",
"score": "0.58317006",
"text": "def selector_sequences(node)\n node.parsed_rules.members.inject([]) { |selectors, sequence| selectors << optimize_sequence(sequence) }\n end",
"title": ""
},
{
"docid": "873f0292d464d1ffc7628abbd96099a9",
"score": "0.5649826",
"text": "def non_assignment_selector\n string_selector[NON_ASSIGN_RANGE]\n end",
"title": ""
},
{
"docid": "4963d6da045b9a055b5ed16653543ce3",
"score": "0.5574081",
"text": "def create_dummy_selectors\n (dummy_selectors_from_considered_rows + dummy_selectors_from_integrations).uniq\n end",
"title": ""
},
{
"docid": "aa58443bff4aba655a5b7c61547b2465",
"score": "0.55567646",
"text": "def group_selectors(seq); end",
"title": ""
},
{
"docid": "a4819c35d0905eb7aa648c1357ea4f39",
"score": "0.55548024",
"text": "def trimmed_selectors\n @orig_selector_args.reject { |k,v| k == :proc }\n end",
"title": ""
},
{
"docid": "a4819c35d0905eb7aa648c1357ea4f39",
"score": "0.55548024",
"text": "def trimmed_selectors\n @orig_selector_args.reject { |k,v| k == :proc }\n end",
"title": ""
},
{
"docid": "f74abc24676e8ff70deaf89816a7ed8f",
"score": "0.55389774",
"text": "def li_selectors\n LI_SELECTORS.join(\",\")\n end",
"title": ""
},
{
"docid": "f47c4c97450bd45e0eb296523d9a002c",
"score": "0.54740703",
"text": "def simple_selectors(selector); end",
"title": ""
},
{
"docid": "49a215736edfd65d7ff058bba3f41bb9",
"score": "0.54622763",
"text": "def all_unfiltered(selector)\n nodes = []\n native.find(selector).each { |node| nodes << self.class.new(driver, node) }\n nodes\n end",
"title": ""
},
{
"docid": "60594fc7094a1190950b42c494850c7e",
"score": "0.5457353",
"text": "def create_dummy_selectors\n (dummy_selectors_from_rows + dummy_selectors_from_integrations).uniq\n end",
"title": ""
},
{
"docid": "65f2fe998e808ad1bfd8488002c5e628",
"score": "0.53874224",
"text": "def notations\n children().select {|node| node.kind_of?(REXML::NotationDecl)}\n end",
"title": ""
},
{
"docid": "555c34c596e5cae5e8910155e8515025",
"score": "0.53038025",
"text": "def selectors\n reused_instance.map(&:first)\n end",
"title": ""
},
{
"docid": "c0e2db08beedbed25d72c8b9d5afb948",
"score": "0.52542233",
"text": "def parse_pseudo_selector\n allowed = %w{root nth-child nth-last-child nth-of-type nth-last-of-type\n first-child last-child first-of-type last-of-type\n only-child only-of-type empty only-text not eps}\n return false if not @lexer.get or @lexer.get.type != :colon\n trace = @lexer.trace\n @lexer.next!\n\n return terminate \"pseudo selector\", trace if not @lexer.get or @lexer.get.type != :text\n pseudo = @lexer.get.value\n return terminate \"pseudo selector\", trace unless allowed.include? pseudo\n @lexer.next!\n\n arg = nil\n if @lexer.get and @lexer.get.type == :left_parenthesis\n @lexer.next!\n arg = parse_pseudo_arg pseudo\n return terminate \"pseudo selector\", trace if not arg\n end\n\n found :pseudo, [pseudo.to_sym,arg]\n true\n end",
"title": ""
},
{
"docid": "bdb259321dee02b1516d960b8142ee8f",
"score": "0.521375",
"text": "def bare_selector_from(selector)\n # Add more clean up stuff here, e.g. stuff like @keyframe (Deadweight implemented this)?\n remove_pseudo_classes_from(selector)\n end",
"title": ""
},
{
"docid": "bdb259321dee02b1516d960b8142ee8f",
"score": "0.521375",
"text": "def bare_selector_from(selector)\n # Add more clean up stuff here, e.g. stuff like @keyframe (Deadweight implemented this)?\n remove_pseudo_classes_from(selector)\n end",
"title": ""
},
{
"docid": "001db34b189f048eee400b0ab6a56026",
"score": "0.5203152",
"text": "def superselector?(their_sseq, parents = [])\n case normalized_name\n when 'matches', 'any'\n # :matches can be a superselector of another selector in one of two\n # ways. Either its constituent selectors can be a superset of those of\n # another :matches in the other selector, or any of its constituent\n # selectors can individually be a superselector of the other selector.\n (their_sseq.selector_pseudo_classes[normalized_name] || []).any? do |their_sel|\n next false unless their_sel.is_a?(Pseudo)\n next false unless their_sel.name == name\n selector.superselector?(their_sel.selector)\n end || selector.members.any? do |our_seq|\n their_seq = Sequence.new(parents + [their_sseq])\n our_seq.superselector?(their_seq)\n end\n when 'has', 'host', 'host-context', 'slotted'\n # Like :matches, :has (et al) can be a superselector of another\n # selector if its constituent selectors are a superset of those of\n # another :has in the other selector. However, the :matches other case\n # doesn't work, because :has refers to nested elements.\n (their_sseq.selector_pseudo_classes[normalized_name] || []).any? do |their_sel|\n next false unless their_sel.is_a?(Pseudo)\n next false unless their_sel.name == name\n selector.superselector?(their_sel.selector)\n end\n when 'not'\n selector.members.all? do |our_seq|\n their_sseq.members.any? do |their_sel|\n if their_sel.is_a?(Element) || their_sel.is_a?(Id)\n # `:not(a)` is a superselector of `h1` and `:not(#foo)` is a\n # superselector of `#bar`.\n our_sseq = our_seq.members.last\n next false unless our_sseq.is_a?(SimpleSequence)\n our_sseq.members.any? do |our_sel|\n our_sel.class == their_sel.class && our_sel != their_sel\n end\n else\n next false unless their_sel.is_a?(Pseudo)\n next false unless their_sel.name == name\n # :not(X) is a superselector of :not(Y) exactly when Y is a\n # superselector of X.\n their_sel.selector.superselector?(CommaSequence.new([our_seq]))\n end\n end\n end\n when 'current'\n (their_sseq.selector_pseudo_classes['current'] || []).any? do |their_current|\n next false if their_current.name != name\n # Explicitly don't check for nested superselector relationships\n # here. :current(.foo) isn't always a superselector of\n # :current(.foo.bar), since it matches the *innermost* ancestor of\n # the current element that matches the selector. For example:\n #\n # <div class=\"foo bar\">\n # <p class=\"foo\">\n # <span>current element</span>\n # </p>\n # </div>\n #\n # Here :current(.foo) would match the p element and *not* the div\n # element, whereas :current(.foo.bar) would match the div and not\n # the p.\n selector == their_current.selector\n end\n when 'nth-child', 'nth-last-child'\n their_sseq.members.any? do |their_sel|\n # This misses a few edge cases. For example, `:nth-child(n of X)`\n # is a superselector of `X`, and `:nth-child(2n of X)` is a\n # superselector of `:nth-child(4n of X)`. These seem rare enough\n # not to be worth worrying about, though.\n next false unless their_sel.is_a?(Pseudo)\n next false unless their_sel.name == name\n next false unless their_sel.arg == arg\n selector.superselector?(their_sel.selector)\n end\n else\n throw \"[BUG] Unknown selector pseudo class #{name}\"\n end\n end",
"title": ""
},
{
"docid": "3ddf6fae60ce0eb9a6d320ed2cb70064",
"score": "0.5135327",
"text": "def unify(sels)\n return if type == :element && sels.any? do |sel|\n sel.is_a?(Pseudo) && sel.type == :element &&\n (sel.name != name || sel.arg != arg || sel.selector != selector)\n end\n super\n end",
"title": ""
},
{
"docid": "ee2fccce75eed5535b7e8f570b4cd9fe",
"score": "0.51110023",
"text": "def get_full_selector\n raise UnknownError if @selectors.nil?\n if @selectors.is_a?(Array)\n # Creates a list of selectors {Array<String, Sass::Script::Tree::node>} separated by a comma\n # and returns the list without the last, trailing comma\n @selectors.inject([]) { |rule, selector| rule << [selector.to_sass, ','] }.flatten[0..-2]\n else\n [@selectors.to_sass].flatten\n end\n end",
"title": ""
},
{
"docid": "79f7172475e11307cd93811d70546819",
"score": "0.5091567",
"text": "def css4_name_selectors\n @name.map do |n|\n \"[href*='#{n.downcase}' i]\"\n end\n end",
"title": ""
},
{
"docid": "230b7428abd32f4edfc0977fb51d024d",
"score": "0.5064612",
"text": "def unify(sels)\n return if type == :element && sels.any? do |sel|\n sel.is_a?(Pseudo) && sel.type == :element &&\n (sel.name != self.name || sel.arg != self.arg)\n end\n super\n end",
"title": ""
},
{
"docid": "93f8ee41a49906905f7bbe17c5a41f07",
"score": "0.50270057",
"text": "def parse_additional_selectors\n found = false\n found = true while parse_pseudo_selector or parse_id_selector \\\n or parse_class_selector or parse_attr_selector \\\n or parse_parent_selector\n found\n end",
"title": ""
},
{
"docid": "60fc1027df1d77c1eecc6e133f2bc806",
"score": "0.50242734",
"text": "def selectors \n CrawlerSelectorsDecorator.new(@selectors)\n end",
"title": ""
},
{
"docid": "cc62434c47d9f0da354470015035f712",
"score": "0.49744588",
"text": "def not\n Nodes::Not.new self\n end",
"title": ""
},
{
"docid": "cc62434c47d9f0da354470015035f712",
"score": "0.49744588",
"text": "def not\n Nodes::Not.new self\n end",
"title": ""
},
{
"docid": "24d81511eaff8d003a942df11ce45df9",
"score": "0.49513036",
"text": "def first_pseudo_selector(seq)\n case seq\n when Sass::Selector::AbstractSequence\n seq.members.find { |m| first_pseudo_selector(m) }\n when Sass::Selector::Pseudo\n seq\n else # eg, String\n nil\n end\n end",
"title": ""
},
{
"docid": "c795453a3a83476b7465d019c5cbbed8",
"score": "0.49428982",
"text": "def select_all(target, negated=nil)\n use_selector(AllSelector.new(target, negated))\n end",
"title": ""
},
{
"docid": "e8923b64ea74177f52ef93722d6d1c31",
"score": "0.49232328",
"text": "def descendants\n self.select \"*\"\n end",
"title": ""
},
{
"docid": "7588a2b2c98bcd709a7d06e1fe2c0876",
"score": "0.49140692",
"text": "def nonwords\n @nonwords ||= %w(& of in the and).map{|w| w.to_sym}.to_set\n end",
"title": ""
},
{
"docid": "d79e595d9f1506e160c31535898ec395",
"score": "0.4891563",
"text": "def labels\n\tlabels = []\n\t(imap.list('', \"*\")||[]).each { |e|\n\t\tunless e.attr.include?(:Noselect)\n\t\t labels << e.name\n\t\tend\n\t}\n\tlabels\n end",
"title": ""
},
{
"docid": "d4b6e18771026333130f8398ff955e82",
"score": "0.48779425",
"text": "def superselector?(seq); end",
"title": ""
},
{
"docid": "9ef7bddb2649ee7f3213784e6f830065",
"score": "0.48670927",
"text": "def simple_selector(statement, values, can_negate = true)\n tag_name = nil\n attributes = []\n pseudo = []\n negation = []\n\n # Element name. (Note that in negation, this can come at\n # any order, but for simplicity we allow if only first).\n statement.sub!(/^(\\*|[[:alpha:]][\\w\\-]*)/) do |match|\n match.strip!\n tag_name = match.downcase unless match == \"*\"\n @source << match\n \"\" # Remove\n end\n\n # Get identifier, class, attribute name, pseudo or negation.\n while true\n # Element identifier.\n next if statement.sub!(/^#(\\?|[\\w\\-]+)/) do |match|\n id = $1\n if id == \"?\"\n id = values.shift\n end\n @source << \"##{id}\"\n id = Regexp.new(\"^#{Regexp.escape(id.to_s)}$\") unless id.is_a?(Regexp)\n attributes << [\"id\", id]\n \"\" # Remove\n end\n\n # Class name.\n next if statement.sub!(/^\\.([\\w\\-]+)/) do |match|\n class_name = $1\n @source << \".#{class_name}\"\n class_name = Regexp.new(\"(^|\\s)#{Regexp.escape(class_name)}($|\\s)\") unless class_name.is_a?(Regexp)\n attributes << [\"class\", class_name]\n \"\" # Remove\n end\n\n # Attribute value.\n next if statement.sub!(/^\\[\\s*([[:alpha:]][\\w\\-]*)\\s*((?:[~|^$*])?=)?\\s*('[^']*'|\"[^*]\"|[^\\]]*)\\s*\\]/) do |match|\n name, equality, value = $1, $2, $3\n if value == \"?\"\n value = values.shift\n else\n # Handle single and double quotes.\n value.strip!\n if (value[0] == ?\" || value[0] == ?') && value[0] == value[-1]\n value = value[1..-2]\n end\n end\n @source << \"[#{name}#{equality}'#{value}']\"\n attributes << [name.downcase.strip, attribute_match(equality, value)]\n \"\" # Remove\n end\n\n # Root element only.\n next if statement.sub!(/^:root/) do |match|\n pseudo << lambda do |element|\n element.parent.nil? || !element.parent.tag?\n end\n @source << \":root\"\n \"\" # Remove\n end\n\n # Nth-child including last and of-type.\n next if statement.sub!(/^:nth-(last-)?(child|of-type)\\((odd|even|(\\d+|\\?)|(-?\\d*|\\?)?n([+\\-]\\d+|\\?)?)\\)/) do |match|\n reverse = $1 == \"last-\"\n of_type = $2 == \"of-type\"\n @source << \":nth-#{$1}#{$2}(\"\n case $3\n when \"odd\"\n pseudo << nth_child(2, 1, of_type, reverse)\n @source << \"odd)\"\n when \"even\"\n pseudo << nth_child(2, 2, of_type, reverse)\n @source << \"even)\"\n when /^(\\d+|\\?)$/ # b only\n b = ($1 == \"?\" ? values.shift : $1).to_i\n pseudo << nth_child(0, b, of_type, reverse)\n @source << \"#{b})\"\n when /^(-?\\d*|\\?)?n([+\\-]\\d+|\\?)?$/\n a = ($1 == \"?\" ? values.shift :\n $1 == \"\" ? 1 : $1 == \"-\" ? -1 : $1).to_i\n b = ($2 == \"?\" ? values.shift : $2).to_i\n pseudo << nth_child(a, b, of_type, reverse)\n @source << (b >= 0 ? \"#{a}n+#{b})\" : \"#{a}n#{b})\")\n else\n raise ArgumentError, \"Invalid nth-child #{match}\"\n end\n \"\" # Remove\n end\n # First/last child (of type).\n next if statement.sub!(/^:(first|last)-(child|of-type)/) do |match|\n reverse = $1 == \"last\"\n of_type = $2 == \"of-type\"\n pseudo << nth_child(0, 1, of_type, reverse)\n @source << \":#{$1}-#{$2}\"\n \"\" # Remove\n end\n # Only child (of type).\n next if statement.sub!(/^:only-(child|of-type)/) do |match|\n of_type = $1 == \"of-type\"\n pseudo << only_child(of_type)\n @source << \":only-#{$1}\"\n \"\" # Remove\n end\n\n # Empty: no child elements or meaningful content (whitespaces\n # are ignored).\n next if statement.sub!(/^:empty/) do |match|\n pseudo << lambda do |element|\n empty = true\n for child in element.children\n if child.tag? || !child.content.strip.empty?\n empty = false\n break\n end\n end\n empty\n end\n @source << \":empty\"\n \"\" # Remove\n end\n # Content: match the text content of the element, stripping\n # leading and trailing spaces.\n next if statement.sub!(/^:content\\(\\s*(\\?|'[^']*'|\"[^\"]*\"|[^)]*)\\s*\\)/) do |match|\n content = $1\n if content == \"?\"\n content = values.shift\n elsif (content[0] == ?\" || content[0] == ?') && content[0] == content[-1]\n content = content[1..-2]\n end\n @source << \":content('#{content}')\"\n content = Regexp.new(\"^#{Regexp.escape(content.to_s)}$\") unless content.is_a?(Regexp)\n pseudo << lambda do |element|\n text = \"\"\n for child in element.children\n unless child.tag?\n text << child.content\n end\n end\n text.strip =~ content\n end\n \"\" # Remove\n end\n\n # Negation. Create another simple selector to handle it.\n if statement.sub!(/^:not\\(\\s*/, \"\")\n raise ArgumentError, \"Double negatives are not missing feature\" unless can_negate\n @source << \":not(\"\n negation << simple_selector(statement, values, false)\n raise ArgumentError, \"Negation not closed\" unless statement.sub!(/^\\s*\\)/, \"\")\n @source << \")\"\n next\n end\n\n # No match: moving on.\n break\n end\n\n # Return hash. The keys are mapped to instance variables.\n {:tag_name=>tag_name, :attributes=>attributes, :pseudo=>pseudo, :negation=>negation}\n end",
"title": ""
},
{
"docid": "e921e3b732e32f6af008b7184f3b8ff8",
"score": "0.48628747",
"text": "def _simple_selector\n\n _save = self.pos\n while true # choice\n\n _save1 = self.pos\n while true # sequence\n _save2 = self.pos\n _tmp = match_string(\"::\")\n unless _tmp\n _tmp = true\n self.pos = _save2\n end\n unless _tmp\n self.pos = _save1\n break\n end\n _tmp = apply(:_element_name)\n unless _tmp\n self.pos = _save1\n break\n end\n while true\n\n _save4 = self.pos\n while true # choice\n _tmp = apply(:_HASH)\n break if _tmp\n self.pos = _save4\n _tmp = apply(:_class)\n break if _tmp\n self.pos = _save4\n _tmp = apply(:_attrib)\n break if _tmp\n self.pos = _save4\n _tmp = apply(:_pseudo)\n break if _tmp\n self.pos = _save4\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n _save5 = self.pos\n\n _save6 = self.pos\n while true # choice\n _tmp = apply(:_HASH)\n break if _tmp\n self.pos = _save6\n _tmp = apply(:_class)\n break if _tmp\n self.pos = _save6\n _tmp = apply(:_attrib)\n break if _tmp\n self.pos = _save6\n _tmp = apply(:_pseudo)\n break if _tmp\n self.pos = _save6\n break\n end # end choice\n\n if _tmp\n while true\n \n _save7 = self.pos\n while true # choice\n _tmp = apply(:_HASH)\n break if _tmp\n self.pos = _save7\n _tmp = apply(:_class)\n break if _tmp\n self.pos = _save7\n _tmp = apply(:_attrib)\n break if _tmp\n self.pos = _save7\n _tmp = apply(:_pseudo)\n break if _tmp\n self.pos = _save7\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save5\n end\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_simple_selector unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "eadc0baed7942a2ad68493ddf41d1d57",
"score": "0.485442",
"text": "def potential_selector_ends\n useful = parameters.select { |p| p.paramType != \"path\" } # not in URL path\n required = useful.select { |u| u.required == true }\n optionals = useful.select { |u| u.required == false }\n\n if optionals.length == 0\n [useful]\n else\n [required, optionals]\n end\n end",
"title": ""
},
{
"docid": "d9e9f656a882bb952bcccefe67a9be04",
"score": "0.4845998",
"text": "def should_not_have(*selector_keys)\n run_protected do\n selector_keys.each { |key| assert_element_not_present @selectors[key] } \n end\n end",
"title": ""
},
{
"docid": "15e538a5636999872e1d683d68a440c7",
"score": "0.48447162",
"text": "def selector()\n selector = @tag.clone\n if @classes.length\n classes.each {|cls| selector << '.' << cls}\n end\n \n unless @id.nil?\n selector << '#' << @id\n end\n \n return selector\n end",
"title": ""
},
{
"docid": "1a50a9784db1f642383f685fad6ce0c1",
"score": "0.48414046",
"text": "def deputy_nodes\n nodes = document.css(\"table tr:nth-child(4) table tr\")\n nodes = nodes[4..-1]\n end",
"title": ""
},
{
"docid": "dede5b311dc70ac586342686f9f9620e",
"score": "0.4838975",
"text": "def pseudoplan_with_nonbasis_items\n @pseudoplan_with_nonbasis_items ||= compose_nonbasis_pseudoplan\n end",
"title": ""
},
{
"docid": "0bdd7cd753721c77974f9ec43c294ee3",
"score": "0.4836202",
"text": "def parse\n last_elem = :any\n\n while t = @parser.next\n case t.type\n when :element\n @selectors << ElementSelector.new(t.value)\n last_elem = t.value\n when :attribute\n @selectors << AttributeSelector.new(*t.value)\n when :namespace\n @selectors << NamespaceSelector.new(t.value)\n when :parent\n @selectors << ParentSelector.new\n when :pseudo\n @selectors <<\n case t.value[0]\n when :not then NotSelector.new(t.value[1])\n when :eps then EpsilonSelector.new(t.value[1])\n when :root then RootSelector.new\n\n when :\"nth-child\" then NthChildSelector.new(t.value[1], false)\n when :\"nth-last-child\" then NthChildSelector.new(t.value[1], true)\n when :\"first-child\" then NthChildSelector.new([0,1], false)\n when :\"last-child\" then NthChildSelector.new([0,1], true)\n\n when :\"nth-of-type\" then NthOfTypeSelector.new(t.value[1], false, last_elem)\n when :\"nth-last-of-type\" then NthOfTypeSelector.new(t.value[1], true, last_elem)\n when :\"first-of-type\" then NthOfTypeSelector.new([0,1], false, last_elem)\n when :\"last-of-type\" then NthOfTypeSelector.new([0,1], true, last_elem)\n\n when :\"only-child\" then OnlyChildSelector.new\n when :\"only-of-type\" then OnlyOfTypeSelector.new(last_elem)\n when :empty then EmptySelector.new\n when :\"only-text\" then OnlyTextSelector.new\n end\n when :child\n @selectors << ChildSelector.new\n last_elem = :any\n when :descendant\n @selectors << DescendantSelector.new\n last_elem = :any\n when :follower\n @selectors << FollowerSelector.new\n last_elem = :any\n when :predecessor\n @selectors << PredecessorSelector.new\n last_elem = :any\n when :reverse_neighbour\n @selectors << ReverseNeighbourSelector.new\n last_elem = :any\n when :neighbour\n @selectors << NeighbourSelector.new\n last_elem = :any\n when :or\n @or = t.value\n when :tail\n raise CSSParsingError.new(@parser.last_failure[:what], @parser.last_failure[:descriptive])\n end\n end\n end",
"title": ""
},
{
"docid": "3a9b5a6eff733201c725b16b88309a4e",
"score": "0.48330835",
"text": "def pseudo_class_selector_message; end",
"title": ""
},
{
"docid": "23cc789375a9ffd08abea9569e160c4c",
"score": "0.4826373",
"text": "def extract_selector_elements\n extract_elements 'single-option'\n end",
"title": ""
},
{
"docid": "80f5268e201ec1eb780da92d86bbf163",
"score": "0.4820272",
"text": "def disjuncts\n\t\treturn self.disjunct_strings.collect do |dstr|\n\t\t\tif dstr.nil?\n\t\t\t\tnil\n\t\t\telse\n\t\t\t\tdstr.split\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9505e9ed9de7542d98b24f2cf4322c89",
"score": "0.48112386",
"text": "def get_elements(css_query, text, output = nil)\n els = elements(*[css_query, output].compact)\n case text\n when String then els.reject {|t| !t.contains?(text) }\n when Regexp then els.reject {|t| !t.matches?(text) }\n else []\n end\n end",
"title": ""
},
{
"docid": "c350f2511733873af766cb0721df4621",
"score": "0.47897944",
"text": "def sequence_selector\n\t\t\t\t\tnil\n\t\t\t\tend",
"title": ""
},
{
"docid": "5568e22a41b08e641f6be8a526656cc3",
"score": "0.47769898",
"text": "def selector\n\t sel = \"\"\n\t if @parent && @parent.getId()\n \t sel += @parent.selector()\n\t end\n\t sel += node()\n\t return sel\n end",
"title": ""
},
{
"docid": "d27fc8d84fe78b349a74fd071291dd60",
"score": "0.47752765",
"text": "def as_select_values\n User::table.select(where:\"options NOT LIKE '0%'\", colonnes:[:pseudo]).collect do |uid, udata|\n [uid, udata[:pseudo]]\n end\n end",
"title": ""
},
{
"docid": "1f2ead1c42f689af1e1bfa1db516ad24",
"score": "0.4758291",
"text": "def GetAllNonDialUpInterfaces\n non_dial_up_interfaces = []\n Builtins.foreach(GetAllKnownInterfaces()) do |interface|\n if Ops.get(interface, \"type\") != \"dial_up\"\n non_dial_up_interfaces = Builtins.add(\n non_dial_up_interfaces,\n Ops.get(interface, \"id\", \"\")\n )\n end\n end\n\n deep_copy(non_dial_up_interfaces)\n end",
"title": ""
},
{
"docid": "be7482ab9739c2daadc425545270d691",
"score": "0.4725559",
"text": "def parse_selectors!(selectors) # :nodoc:\n @selectors = selectors.split(',').map do |s|\n s.gsub!(/\\s+/, ' ')\n s.strip!\n s\n end\n end",
"title": ""
},
{
"docid": "28bfbdb3fae22495ee041c7429fed014",
"score": "0.47214374",
"text": "def ignoring_patterns\n @ignoring_patterns.to_a\n end",
"title": ""
},
{
"docid": "f570852de8255e855675d83772f0a240",
"score": "0.47203758",
"text": "def sites_and_selectors\n [\n ['ITC', 'http://itc.ua/', '.articles header', 'h1.post-title a', 'h1.post-title a'] #,\n # ['livejournal', 'http://valerii.livejournal.com/feed', '.b-lenta-item', '.b-lenta-item-title a', '.b-lenta-item-title a']\n ]\n end",
"title": ""
},
{
"docid": "36930250c074aaf46edb9e8ee2440b54",
"score": "0.47145328",
"text": "def parse_selectors!(selectors) # :nodoc:\n @selectors = selectors.split(',').map { |s| s.strip }\n end",
"title": ""
},
{
"docid": "b6e4f7be477fc0a41439f72dfed4cd14",
"score": "0.46931735",
"text": "def default_ignored_network_patterns\n []\n end",
"title": ""
},
{
"docid": "50b71c9e13f9dd41655189e76e053c07",
"score": "0.4691969",
"text": "def reject_ignored(elements)\n elements\n .reject { |e| e.to_s =~ /:ignore/ }\n .reject { |e| e.to_s =~ /color='#999999'/ }\n end",
"title": ""
},
{
"docid": "2d4eb9fdaeae2487beee44e6dfe9d416",
"score": "0.4687218",
"text": "def descendants\n self.select \"*\"\n end",
"title": ""
},
{
"docid": "d2c679567a30b65380824915b4fa425f",
"score": "0.46862406",
"text": "def nodes_except(node)\n @nodes.select { |n| n != node }\n end",
"title": ""
},
{
"docid": "f4d0776c47c223b277b08c1d46b94dfe",
"score": "0.46860874",
"text": "def selector\n slice(0...index(:__s))\n end",
"title": ""
},
{
"docid": "307be3ea928c8906a20fe5b48704f3ab",
"score": "0.46821275",
"text": "def select_nanites\n names = []\n @nanites.each do |name, state|\n names << [name, state] if yield(name, state)\n end\n names\n end",
"title": ""
},
{
"docid": "b9a0f4064624aadc8f22fd08f122f259",
"score": "0.46819693",
"text": "def visit_Squeel_Nodes_Not(o, parent)\n Arel::Nodes::Not.new(visit(o.expr, parent))\n end",
"title": ""
},
{
"docid": "69394c0ecf58116bfaae6f0bafc515a0",
"score": "0.46807936",
"text": "def invisible?\n # :not() is a special case—if you eliminate all the placeholders from\n # it, it should match anything.\n name != 'not' && @selector && @selector.members.all? {|s| s.invisible?}\n end",
"title": ""
},
{
"docid": "f4ec29f80c820ccf94a4184502d856d5",
"score": "0.46789506",
"text": "def selector\n @selector = @outer_has_tag ? @outer_has_tag.selector : ''\n\n @selector << \"//#{@tag}#{id_selector}#{class_selector}\"\n @selector << @attributes.map{|a, v| \"[@#{a}=\\\"#{v}\\\"]\"}.join\n end",
"title": ""
},
{
"docid": "ac3b8aaacad0ee1ae2f0d1ad422d83d2",
"score": "0.46748",
"text": "def get_non_pruned\n @qq.select { |q| !pruned?(q) }\n end",
"title": ""
},
{
"docid": "65314d61586f8ac808a9c4babc430fac",
"score": "0.46712893",
"text": "def immediate_descendants\n return [] unless (element = self.childAtIndex 0)\n while element and element.kind != NSXMLElementKind\n element = element.nextSibling\n end\n return [element] + element.next_siblings unless element.nil?\n []\n end",
"title": ""
},
{
"docid": "41611c5285ac588a06a683b7c1ac5837",
"score": "0.4664669",
"text": "def descendants\n without_self self_and_descendants\n end",
"title": ""
},
{
"docid": "725221d195c0c81e44eddae1ffa8c359",
"score": "0.4661177",
"text": "def should_not_be(*selector_keys)\n run_protected do\n selector_keys.each { |key| assert_eval @selectors[key], false }\n end\n end",
"title": ""
},
{
"docid": "2aef1ad8933238d7df6b29fe9a19567e",
"score": "0.4660119",
"text": "def immediate_descendants\n return [] unless (element = self.childAtIndex 0)\n while element and element.kind != NSXMLElementKind\n element = element.nextSibling\n end\n return [element] + element.next_siblings unless element.nil?\n []\n end",
"title": ""
},
{
"docid": "0a30ab780fcede5467ff297e5d14ef48",
"score": "0.46583015",
"text": "def start_selector(selectors)\n end",
"title": ""
},
{
"docid": "2ec0a573cae841640e749b003ac0a3f0",
"score": "0.46504456",
"text": "def descendants\n without_self self_and_descendants\n end",
"title": ""
},
{
"docid": "d0ff667ea5da9d516e6753b385f2068e",
"score": "0.4635593",
"text": "def find_nodes(target_types, ignoring = [])\n result = []\n look_for_types(target_types, ignoring) { |exp| result << exp }\n result\n end",
"title": ""
},
{
"docid": "53a0dd00f75c44ff679f2cf20de80449",
"score": "0.46337062",
"text": "def superselector?(cseq); end",
"title": ""
},
{
"docid": "0e6ec2bcf3c3c0d0f149b1a37826a1ea",
"score": "0.4621711",
"text": "def start_selector(selectors)\n count = 0\n selectors.each do |s|\n name = s.to_css\n valid = false\n begin\n @validator.valid_selector?(name,s)\n valid = true\n rescue Exception => e\n if @inline\n @errors << ScanMessage.new(ScanMessage::ERROR_CSS_TAG_SELECTOR_NOTFOUND,@tag,name)\n else\n @errors << ScanMessage.new(ScanMessage::ERROR_STYLESHEET_SELECTOR_NOTFOUND,@tag,name)\n end\n \n end\n if valid\n if count > 0\n clean << \", \"\n end\n clean << name\n count += 1\n else\n # not allowed selector\n if @inline\n @errors << ScanMessage.new(ScanMessage::ERROR_CSS_TAG_SELECTOR_DISALLOWED,@tag,name)\n else\n @errors << ScanMessage.new(ScanMessage::ERROR_STYLESHEET_SELECTOR_DISALLOWED,@tag,name)\n end\n end\n end\n if count > 0\n clean << \" {\\n\"\n @selector_open = true\n end\n end",
"title": ""
},
{
"docid": "76fbc2202f851fc12a0823cc82ca5a9e",
"score": "0.46216145",
"text": "def to_s\n @__selectors.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "6f1ad3cbe385a1ee413ab5221c691d58",
"score": "0.46147087",
"text": "def optimize_sequence(selector)\n selector.members.inject([]) do |final, sequence|\n if sequence.is_a?(Sass::Selector::SimpleSequence)\n baskets = {\n Sass::Selector::Universal => [],\n Sass::Selector::Element => [],\n Sass::Selector::Id => [],\n Sass::Selector::Class => [],\n Sass::Selector::Placeholder => [],\n Sass::Selector::Pseudo => []\n }\n sequence.members.each_with_index do |simple, i|\n last = i + 1 == sequence.members.length\n if !last && sequence.members[i + 1].is_a?(Sass::Selector::Attribute)\n baskets[simple.class] << simple.to_s + sequence.members[i + 1].to_s\n sequence.members.delete_at(i + 1)\n else\n baskets[simple.class] << simple.to_s\n end\n end\n final << baskets.values.inject([]) { |partial, b| partial + b.uniq.sort }.join('')\n else\n final << sequence.to_s\n end\n end.join(' ')\n end",
"title": ""
},
{
"docid": "b877df12bef267c931789a146016af46",
"score": "0.46093422",
"text": "def no_items(css: '.no-items', **opt)\n end",
"title": ""
},
{
"docid": "19dc42e2bdda55bf7b5164b505f44acd",
"score": "0.46085146",
"text": "def illegal_bases\n self.scan(/[^atgcu]/).sort.uniq\n end",
"title": ""
},
{
"docid": "db736e98c4921e7656dbb60970403854",
"score": "0.46073666",
"text": "def descendants\n without_self self_and_descendants\n end",
"title": ""
},
{
"docid": "db736e98c4921e7656dbb60970403854",
"score": "0.46073666",
"text": "def descendants\n without_self self_and_descendants\n end",
"title": ""
},
{
"docid": "f25f8cdbb5b667af0d7a5b926e9f9747",
"score": "0.46051708",
"text": "def get_elements css_query, filters\n els = elements(css_query)\n case filters[:text]\n when String then els.reject! {|t| !t.should_contain(filters[:text]) }\n when Regexp then els.reject! {|t| !t.should_match(filters[:text]) }\n end\n case filters[:html]\n when String then els.reject! {|t| !t.html_should_contain(filters[:html]) }\n when Regexp then els.reject! {|t| !t.html_should_match(filters[:html]) }\n end\n els\n end",
"title": ""
},
{
"docid": "aa351fd1c3a0bba68dabcc83bdaced83",
"score": "0.4601959",
"text": "def visit_not(node); end",
"title": ""
},
{
"docid": "70b752cbc07977246c3eacf0bbe11174",
"score": "0.45995742",
"text": "def skippers\n\t\t\t#@rules.select{ |_,rule| rule.type == :skipper }\n\t\t\t@skippers ||= @rules.select{ |_,rule| rule.type == :skipper }\n\t\t\t@skippers\n\t\tend",
"title": ""
},
{
"docid": "48ecb7fa18f0013352bc6ee39d9bcd35",
"score": "0.45993137",
"text": "def find_descendants(selector)\n # Interface method\n end",
"title": ""
},
{
"docid": "a2b2e1093cef74cd45650d2b44d238ca",
"score": "0.4598604",
"text": "def ids_for_selectors(unresolved_selectors)\n # Need the select at the start and at the end to stop extra columns being returned (eg. branch name, environment name)\n unresolved_selectors\n .collect{ |selector| self.select(Sequel[:versions][:id]).for_selector(selector).select(:id) }\n .reduce(&:union)\n end",
"title": ""
},
{
"docid": "7f609ed63dc2029861439f06ceac282b",
"score": "0.45864514",
"text": "def elements_not_ready(nodes)\n delay = []\n nodes.each do |n|\n next if node.state == \"ready\"\n delay << \"Node node.name\"\n end\n delay\n end",
"title": ""
},
{
"docid": "7088aacf8136d81e5e889ad124934ef8",
"score": "0.45852745",
"text": "def element_selector_string\n return @parent.element_selector_string\n end",
"title": ""
},
{
"docid": "16fc64ecfc481fb38f3526c789f2be1a",
"score": "0.45805213",
"text": "def normal_labels\n\t imap_xlist.reject { |label|\n\t\tlabel.attr.include?(:Noselect) or label.attr.any? { |flag| gmail_label_types.include?(flag) }\n\t }.map { |label|\n\t\tlabel.name\n\t }\n end",
"title": ""
},
{
"docid": "72a69d2a09d1fbc2637b3583c5fd9950",
"score": "0.45790988",
"text": "def unregistered_predicates\n preds = registered_predicates\n preds << RDF.type\n predicates.select { |p| !preds.include? p }\n end",
"title": ""
},
{
"docid": "245a9a9390d56989636fa3fc1626c620",
"score": "0.45727652",
"text": "def find_selector(sel_str)\n res = []\n \n full_selector = self.selector\n par = @parent\n while par\n full_selector << par.selector\n par = par.parent\n end\n \n test_regex = HTMLUtils.selector_to_regex sel_str\n \n # Recursively search children and apply selector to each\n def test_element(element, parent_selector, test_regex, results)\n curr_selector = parent_selector + \" #{element.selector}\"\n \n if test_regex =~ curr_selector\n results.push element\n end\n \n element.children.each do |child|\n test_element(child, curr_selector, test_regex, results)\n end\n end\n \n test_element(self, full_selector, test_regex, res)\n \n return res\n end",
"title": ""
},
{
"docid": "190082526956f7d75c0cac6084047497",
"score": "0.45708787",
"text": "def _pseudo\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\":\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\":\")\n unless _tmp\n _tmp = true\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_IDENT)\n break if _tmp\n self.pos = _save2\n\n _save3 = self.pos\n while true # sequence\n _tmp = apply(:_FUNCTION)\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save3\n break\n end\n _save4 = self.pos\n\n _save5 = self.pos\n while true # sequence\n _tmp = apply(:_IDENT)\n unless _tmp\n self.pos = _save5\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save5\n end\n break\n end # end sequence\n\n unless _tmp\n _tmp = true\n self.pos = _save4\n end\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = match_string(\")\")\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_pseudo unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "c05bbbe6e5a4e971fb483137f96f34b8",
"score": "0.4550304",
"text": "def all_disjunctive_subsets\n RLSM::ArrayExt::powerset(@elements).select { |s| subset_disjunctive? s }\n end",
"title": ""
},
{
"docid": "978532441c55f3024a608d8f3a5ce579",
"score": "0.45431027",
"text": "def unmet\n subset(select { |g| !g.met? })\n end",
"title": ""
},
{
"docid": "d807c168e2b703808c1e361c0e3bb76f",
"score": "0.45425045",
"text": "def siblings\n without_self self_and_siblings\n end",
"title": ""
},
{
"docid": "d807c168e2b703808c1e361c0e3bb76f",
"score": "0.45425045",
"text": "def siblings\n without_self self_and_siblings\n end",
"title": ""
},
{
"docid": "e8c5a3a9c65e280e8d2ed0bf5be63f47",
"score": "0.45407322",
"text": "def no_pickers\n ['trait', 'image_views', 'people', 'associations','chromatograms','morphbank_images', 'distributions', 'object_relationships', 'news', 'measurements', 'ontology', 'protocols', 'tags', 'figures'] \n end",
"title": ""
},
{
"docid": "281e1afa5c7fcb540186b5b53eaf97a4",
"score": "0.45276046",
"text": "def ignore_has_selector_errors\n Cornucopia::Util::Configuration.instance.configurations.ignore_has_selector_errors\n end",
"title": ""
},
{
"docid": "01cc1e075afdb1172970a3f4addeced1",
"score": "0.4522195",
"text": "def without_generators\n self.class.new(self.reject{|e| e.generator? })\n end",
"title": ""
},
{
"docid": "94ab2f96fbbbb96015c7ae407840033e",
"score": "0.45217806",
"text": "def not_nested\n self.class.new(select { |e| e.parent_element_id.nil? })\n end",
"title": ""
},
{
"docid": "55983fbad4a978b766b0a821f396c2c7",
"score": "0.45215443",
"text": "def patterns(options = {})\n if i = test_instance\n pats = i.patterns\n if options[:ignore] && pats\n pats.reject { |p| [options[:ignore]].flatten.include?(p) }\n else\n []\n end\n else\n []\n end\n end",
"title": ""
},
{
"docid": "c66d1dc8c3f716723b4b768634a9fd95",
"score": "0.45165136",
"text": "def to_selector(from)\n self.get_item(from, :selectors) do #if not matches\n # If a selector can't be found the argument is returned\n from \n end\n end",
"title": ""
},
{
"docid": "15dfb53a08b95279bd22065974825895",
"score": "0.45061228",
"text": "def find_rule_sets(selectors, media_types = :all)\n rule_sets = []\n\n selectors.each do |selector|\n selector = selector.gsub(/\\s+/, ' ').strip\n each_rule_set(media_types) do |rule_set, _media_type|\n if !rule_sets.member?(rule_set) && rule_set.selectors.member?(selector)\n rule_sets << rule_set\n end\n end\n end\n\n rule_sets\n end",
"title": ""
}
] |
09207dc90e3ed83d59f9fdf29f1a0edc
|
Create a new +RTeX::Document+ in either the current directory (default) or a specified, preexisting directory. The +content+ parameter should contain the document source. The +options+ hash may contain: [+:processor+] Executable with which to output the document (default: 'pdflatex') [+:preprocessor+] Executable to use during preprocessing (particularly for longer documents containing a tableofcontents or bibliography section (default: 'latex') [+:preprocess+] Either a boolean specifying whether to preprocess the input file(s), or an integer for the number of times to preprocess (default: false / 0) [+:tmpdir+] Location of temporary directory (default: +Dir.getwd+) [+:shell_redirect+] Option redirection for shell output, e.g. +"> /dev/null 2>&1"+ (default: +nil+). [+:command_prefix+] String (or array) of environment variable settings for the +:processor+ and +:preprocessor+ commands.
|
[
{
"docid": "3c81cdf99302f875853a5fca42ac92cf",
"score": "0.5595098",
"text": "def initialize(content, options={})\n @options = self.class.options.merge(options)\n if @options[:processed]\n @source = content\n else\n @erb = ERB.new(content)\n end\n end",
"title": ""
}
] |
[
{
"docid": "6d1683e82bd90605cf1da1b93f9427e9",
"score": "0.5837966",
"text": "def render_document(input, outdir, outname, format, vars, config=nil)\r\n\r\n #TODO: Clarify the following\r\n # on Windows, Tempdir contains a drive letter. But drive letter\r\n # seems not to work in pandoc -> pdf if the path separator ist forward\r\n # slash. There are two options to overcome this\r\n #\r\n # 1. set tempdir such that it does not contain a drive letter\r\n # 2. use Dir.mktempdir but ensure that all provided file names\r\n # use the platform specific SEPARATOR\r\n #\r\n # for whatever Reason, I decided for 2.\r\n\r\n tempfile = input\r\n tempfilePdf = \"#{@tempdir}/x.TeX.md\".to_osPath\r\n tempfileHtml = \"#{@tempdir}/x.html.md\".to_osPath\r\n outfile = \"#{outdir}/#{outname}\".to_osPath\r\n outfilePdf = \"#{outfile}.pdf\"\r\n outfileDocx = \"#{outfile}.docx\"\r\n outfileHtml = \"#{outfile}.html\"\r\n outfileRtf = \"#{outfile}.rtf\"\r\n outfileLatex = \"#{outfile}.latex\"\r\n outfileText = \"#{outfile}.txt\"\r\n outfileSlide = \"#{outfile}.slide.html\"\r\n\r\n if vars.has_key? :frontmatter\r\n latexTitleInclude = \"--include-before-body=#{vars[:frontmatter].esc}\"\r\n else\r\n latexTitleInclude\r\n end\r\n\r\n #todo: make config required, so it can be reduced to the else part\r\n if config.nil? then\r\n latexStyleFile = File.dirname(File.expand_path(__FILE__))+\"/../../resources/default.wortsammler.latex\"\r\n latexStyleFile = File.expand_path(latexStyleFile).to_osPath\r\n css_style_file = File.dirname(File.expand_path(__FILE__))+\"/../../resources/default.wortsammler.css\"\r\n css_style_file = File.expand_path(css_style_file).to_osPath\r\n else\r\n latexStyleFile = config.stylefiles[:latex]\r\n css_style_file = config.stylefiles[:css]\r\n end\r\n\r\n\r\n toc = \"--toc\"\r\n toc = \"\" if vars[:usetoc]==\"nousetoc\"\r\n\r\n if vars[:documentclass]==\"book\"\r\n option_chapters = \"--chapters\"\r\n else\r\n option_chapter = \"\"\r\n end\r\n\r\n begin\r\n vars_string=vars.map.map{|key, value| \"-V #{key}=#{value.esc}\"}.join(\" \")\r\n rescue\r\n require 'pry';binding.pry\r\n end\r\n\r\n @log.info(\"rendering #{outname} as [#{format.join(', ')}]\")\r\n\r\n supported_formats=[\"pdf\", \"latex\", \"frontmatter\", \"docx\", \"html\", \"txt\", \"rtf\", \"slide\"]\r\n wrong_format=format - supported_formats\r\n wrong_format.each{|f|@log.error(\"format not supported: #{f}\")}\r\n\r\n begin\r\n\r\n if format.include?(\"frontmatter\") then\r\n\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n\r\n cmd=\"pandoc -S #{tempfilePdf.esc} --latex-engine xelatex #{vars_string} --ascii -o #{outfileLatex.esc}\"\r\n `#{cmd}`\r\n end\r\n\r\n\r\n if (format.include?(\"pdf\") | format.include?(\"latex\")) then\r\n @log.debug(\"creating #{outfileLatex}\")\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n\r\n cmd=\"pandoc -S #{tempfilePdf.esc} #{toc} --standalone #{option_chapters} --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfileLatex.esc} #{latexTitleInclude}\"\r\n `#{cmd}`\r\n end\r\n\r\n\r\n if format.include?(\"pdf\") then\r\n @log.debug(\"creating #{outfilePdf}\")\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n #cmd=\"pandoc -S #{tempfilePdf.esc} #{toc} --standalone #{option_chapters} --latex-engine xelatex --number-sections #{vars_string}\" +\r\n # \" --template #{latexStyleFile.esc} --ascii -o #{outfilePdf.esc} #{latexTitleInclude}\"\r\n cmd=\"xelatex -halt-on-error -interaction nonstopmode -output-directory=#{outdir.esc} #{outfileLatex.esc}\"\r\n #cmdmkindex = \"makeindex \\\"#{outfile.esc}.idx\\\"\"\r\n\r\n latex=LatexHelper.new.set_latex_command(cmd).setlogger(@log)\r\n latex.run(outfileLatex)\r\n\r\n messages=latex.log_analyze(\"#{outdir}/#{outname}.log\")\r\n\r\n removeables = [\"toc\", \"aux\", \"bak\", \"idx\", \"ilg\", \"ind\" ]\r\n removeables << \"log\" unless messages > 0\r\n\r\n\r\n removeables << \"latex\" unless format.include?(\"latex\")\r\n removeables = removeables.map{|e| \"#{outdir}/#{outname}.#{e}\"}.select{|f| File.exists?(f)}\r\n removeables.each{|e| \r\n @log.debug \"removing file: #{e}\"\r\n FileUtils.rm e\r\n }\r\n end \r\n\r\n if format.include?(\"html\") then\r\n #todo: handle css\r\n @log.debug(\"creating #{outfileHtml}\")\r\n\r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n\r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileHtml.esc}\"\r\n\r\n `#{cmd}`\r\n end\r\n\r\n if format.include?(\"docx\") then\r\n #todo: handle style file\r\n @log.debug(\"creating #{outfileDocx}\")\r\n\r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n\r\n cmd=\"pandoc -S #{tempfileHtml.esc} #{toc} --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileDocx.esc}\"\r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileDocx.esc}\"\r\n `#{cmd}`\r\n end\r\n\r\n if format.include?(\"rtf\") then\r\n @log.debug(\"creating #{outfileRtf}\")\r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n\r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileRtf.esc}\"\r\n `#{cmd}`\r\n end\r\n\r\n if format.include?(\"txt\") then\r\n @log.debug(\"creating #{outfileText}\")\r\n\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfileHtml)\r\n\r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -t plain -o #{outfileText.esc}\"\r\n `#{cmd}`\r\n end\r\n\r\n if format.include?(\"slide\") then\r\n @log.debug(\"creating #{outfileSlide}\")\r\n\r\n ReferenceTweaker.new(\"slide\").prepareFile(tempfile, tempfilePdf)\r\n #todo: hanlde stylefile\r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --number-sections #{vars_string}\" +\r\n \" --ascii -t dzslides --slide-level 2 -o #{outfileSlide.esc}\"\r\n `#{cmd}`\r\n end\r\n rescue Exception => e\r\n @log.error \"failed to perform #{cmd}, \\n#{e.message}\"\r\n @log.error e.backtrace.join(\"\\n\")\r\n #TODO make a try catch block kere\r\n end\r\n nil\r\n end",
"title": ""
},
{
"docid": "df23bbaf4452d94ae31c0649d5ba9b3f",
"score": "0.5632073",
"text": "def document(options=nil)\n options ||= {}\n\n # TODO: get rid of options (?) originally they were used for commanline overrides,\n # but that's not being used anymore, and it's probably better that way.\n title = options['title'] || self.title\n output = options['output'] || self.output\n main = options['main'] || self.main\n template = options['template'] || self.template\n files = options['files'] || self.files\n exclude = options['exclude'] || self.exclude\n #adfile = options['adfile'] || self.adfile\n extra = options['extra'] || self.extra\n root = options['root'] || self.root\n\n # NOTE: Due to a bug in RDOC this needs to be done so that\n # alternate templates can be used.\n begin\n gem('rdoc')\n #gem(templib || template)\n rescue LoadError\n end\n\n require 'rdoc/rdoc'\n\n #output = File.expand_path(output)\n\n # you can specify more than one possibility, first match wins\n #adfile = [adfile].flatten.compact.find do |f|\n # File.exist?(f)\n #end\n\n main = Dir.glob(main, File::FNM_CASEFOLD).first\n\n include_files = files.to_list.uniq\n exclude_files = exclude.to_list.uniq\n\n if mfile = project.manifest_file\n exclude_files << mfile.basename.to_s # TODO: I think base name should retun a string?\n end\n\n filelist = amass(include_files, exclude_files)\n filelist = filelist.select{ |fname| File.file?(fname) }\n\n if outofdate?(output, *filelist) or force?\n status \"Generating #{output}\"\n\n #target_main = Dir.glob(target['main'].to_s, File::FNM_CASEFOLD).first\n #target_main = File.expand_path(target_main) if target_main\n #target_output = File.expand_path(File.join(output, subdir))\n #target_output = File.join(output, subdir)\n\n argv = []\n argv.concat(extra.split(/\\s+/))\n argv.concat ['--op', output]\n argv.concat ['--main', main] if main\n argv.concat ['--template', template] if template\n argv.concat ['--title', title] if title\n\n exclude_files.each do |file|\n argv.concat ['--exclude', file]\n end\n\n argv = argv + filelist #include_files\n\n rdoc_target(output, include_files, argv)\n #rdoc_insert_ads(output, adfile)\n\n touch(output)\n else\n status \"WebRI RDocs are current (#{output}).\"\n end\n end",
"title": ""
},
{
"docid": "38435a4ed53f163fb35783888f1e0529",
"score": "0.548367",
"text": "def create(options)\n document = build(options)\n document.save\n document\n end",
"title": ""
},
{
"docid": "73ea0fe1c287200822773d4d1581dcca",
"score": "0.5405782",
"text": "def preconfigure\n argv = []\n argv.concat [\"-D\"] if $DEBUG\n argv.concat [\"-q\"]\n argv.concat [\"-r\"]\n argv.concat [\"-o\", store]\n argv.concat [\"--markup\", markup] if markup\n #argv.concat [\"--write-options\"] #if save\n argv.concat scripts\n #argv.concat ['-', *documents] unless documents.empty?\n\n rdoc = ::RDoc::RDoc.new\n $stderr.puts('rdoc ' + argv.join(' ')) if $DEBUG\n\n rdoc.document(argv)\n end",
"title": ""
},
{
"docid": "9d0d64a313758df11cefc7323f8bed73",
"score": "0.5356022",
"text": "def create_document(options = {})\n make(OSA::AdobePhotoshopCS5::Document, nil, nil, {\n }.merge(options))\n end",
"title": ""
},
{
"docid": "f70349cff04c4328d048d92676136b99",
"score": "0.52652866",
"text": "def initialize(content, options={})\n self.content = content\n @options = options\n @vars = (@options[:vars] ||= {})\n if @options[:custom_command_class]\n @options[:custom_commands] = @options[:custom_command_class].new(self, @options[:extra])\n end\n @custom_commands = @options[:custom_commands]\n @shielded_commands = (@options[:shielded_commands] ||= [])\n @allowed_commands = @options[:allowed_commands]\n end",
"title": ""
},
{
"docid": "e1fcb5389ae149c7ffaa5fc70072736e",
"score": "0.52563506",
"text": "def initialize( options )\n\t\t@options = options\n\t\t@options.diagram = false\n\n\t\ttemplate = @options.template || 'darkfish'\n\n\t\ttemplate_dir = $LOAD_PATH.map do |path|\n\t\t\tFile.join path, GENERATOR_DIR, 'template', template\n\t\tend.find do |dir|\n\t\t\tFile.directory? dir\n\t\tend\n\n\t\traise RDoc::Error, \"could not find template #{template.inspect}\" unless\n\t\t\ttemplate_dir\n\n\t\t@template_dir = Pathname.new File.expand_path(template_dir)\n\n\t\t@basedir = Pathname.pwd.expand_path\n\tend",
"title": ""
},
{
"docid": "a9a25c5ac06088943fcb743da29ef4e9",
"score": "0.5208904",
"text": "def initialize(options={})\n begin # attempt to get a source file from the user\n print \"Enter source file (xml): \"\n @xmlfile = File.new(gets.chomp)\n rescue Exception => e\n puts e.message\n end\n \n # turn the file into an xml tree document\n @xmldoc = Document.new(@xmlfile)\n \n # define the root element\n @root = @xmldoc.root\n \n if options[:include_head]\n @html = \"<html>\\n<head><link rel='stylesheet' type='text/css' \" +\n \"href='style.css' />\\n</head>\\n\"\n else \n @html = \"\"\n end\n end",
"title": ""
},
{
"docid": "f4b41fdf1f89dedc76699b95165c9ec8",
"score": "0.5186126",
"text": "def initialize(options = DEFAULT_OPTIONS)\n require \"murdoc\"\n self.options = options\n rescue LoadError\n raise \"You should install murdoc gem in order to produce documentation\"\n end",
"title": ""
},
{
"docid": "04d11f3a40f4cea02645cbe7b01cf7f7",
"score": "0.5185612",
"text": "def create(options)\n API::request(:post, 'entity_documents', options)\n end",
"title": ""
},
{
"docid": "9d6938996eadb029840f631e541eeebe",
"score": "0.5164387",
"text": "def document content, format: nil, language: nil\n content = content.to_gs_url if content.respond_to? :to_gs_url\n if content.is_a? Document\n # Create new document with the provided format and language\n Document.from_source content.source, @service,\n format: (format || content.format),\n language: (language || content.language)\n else\n Document.from_source content, @service, format: format,\n language: language\n end\n end",
"title": ""
},
{
"docid": "e33d78789067a56816c1ccf343db7405",
"score": "0.5125248",
"text": "def render(options = {})\n r = renderer(options)\n html = r.render('document', self, :header => @header, :preamble => @preamble)\n end",
"title": ""
},
{
"docid": "291b69e0feb089feccd79a60a12715f2",
"score": "0.51226336",
"text": "def initialize(source, options = {})\n @document = Document.new(source, options)\n @options = options\n end",
"title": ""
},
{
"docid": "51958521178445199655c68ffcb40a26",
"score": "0.5116971",
"text": "def initialize(options) #:not-new:\n @options = options\n \n # TODO - make this a command-line option\n @gen_qualified = true\n \n # TODO - make this a command-line option\n @gen_unqualified = false\n \n # TODO - make this a command-line option\n @output = File.open(\"tags.rdoc\", 'w')\n \n # TODO - make this a command-line option\n @dump = nil # File.open(\"rdoc.dump\", 'w')\n \n # TODO - make this a command-line option\n @verbose = nil\n \n #pp options\n end",
"title": ""
},
{
"docid": "c3cdf2b3c11e05efb0ad0fa9c24bf074",
"score": "0.5033296",
"text": "def initialize(options={})\n options.each do |k,v|\n __send__(\"#{k}=\", v)\n end\n\n @paths ||= []\n\n @output ||= DEFAULT_OUTPUT\n @title ||= DEFAULT_TITLE\n @css ||= DEFAULT_CSS\n\n if File.directory?(@output)\n @output = File.join(@output, 'qed.html')\n end\n\n @format ||= File.extname(@output).sub('.','')\n\n if @paths.empty?\n #dir = Dir['{test/demos,demos,demo}'].first || DEFAULT_PATH\n #@paths = File.join(dir, '**', '*')\n abort \"No files to document.\"\n end\n end",
"title": ""
},
{
"docid": "1584b5fd4c4f968c9c83ddc3b42d8dea",
"score": "0.5015543",
"text": "def generate\n tempfile = nil\n unless @options[:outdir] || @options[:outfile]\n tempfile = Tempfile.new(\"htmldoc.temp\")\n @options[:outfile] = tempfile.path\n end\n execute\n if @result[:bytes]\n if tempfile\n File.open(tempfile.path, \"rb\") { |f| f.read }\n else\n true\n end\n else\n false\n end\n ensure\n if tempfile\n tempfile.close\n @options[:outfile] = nil\n end\n @tempfiles.each { |t| t.close }\n end",
"title": ""
},
{
"docid": "294e2fcde86f42a10f02dc35225c0df0",
"score": "0.50018513",
"text": "def initialize(path=nil, options={})\n @path = path && Pathname(path)\n @options = options\n\n @content = options.fetch(:content) { self.path && self.path.read }\n @root = options.fetch(:root) { self.path && self.path.dirname }\n\n @templates = options.fetch(:templates) { manifest.templates || \"templates\" }\n @stylesheets = options.fetch(:stylesheets) { manifest.stylesheets || \"stylesheets\" }\n @scripts = options.fetch(:scripts) { manifest.scripts || \"scripts\" }\n end",
"title": ""
},
{
"docid": "07344d69d78f3dead082b1fb25762dd8",
"score": "0.5001711",
"text": "def rdoc(content)\n markup = RDoc::Markup::ToHtml.new\n markup.convert(process_content(content))\n end",
"title": ""
},
{
"docid": "36fd364dacd2310af868d61e7da500b0",
"score": "0.49994516",
"text": "def file_to_docx(path, options = nil)\t\t\n\t\t\thtml_to_docx(read_file(path), options)\n\t\tend",
"title": ""
},
{
"docid": "6f279cf461e075a41ee80edcf94b2b66",
"score": "0.4963614",
"text": "def generateDocument(input, outdir, outname, format, vars, editions=nil, snippetfiles=nil, frontmatter=nil, config=nil)\r\n\r\n # combine the input files\r\n\r\n temp_filename = \"#{@tempdir}/x.md\".to_osPath\r\n temp_frontmatter = \"#{@tempdir}/xfrontmatter.md\".to_osPath unless frontmatter.nil?\r\n collect_document(input, temp_filename)\r\n collect_document(frontmatter, temp_frontmatter) unless frontmatter.nil?\r\n\r\n # process the snippets\r\n\r\n if not snippetfiles.nil?\r\n snippets={}\r\n snippetfiles.each{|f|\r\n if File.exists?(f)\r\n type=File.extname(f)\r\n case type\r\n when \".yaml\"\r\n x=YAML.load(File.new(f))\r\n when \".xlsx\"\r\n x=load_snippets_from_xlsx(f)\r\n else\r\n @log.error(\"Unsupported File format for snipptets: #{type}\")\r\n x={}\r\n end\r\n snippets.merge!(x)\r\n else\r\n @log.error(\"Snippet file not found: #{f}\")\r\n end\r\n }\r\n\r\n replace_snippets_in_file(temp_filename, snippets)\r\n end\r\n\r\n vars_frontmatter=vars.clone\r\n vars_frontmatter[:usetoc] = \"nousetoc\"\r\n\r\n\r\n if editions.nil?\r\n # there are no editions\r\n unless frontmatter.nil? then\r\n render_document(temp_frontmatter, tempdir, temp_frontmatter, [\"frontmatter\"], vars_frontmatter)\r\n vars[:frontmatter] = \"#{tempdir}/#{temp_frontmatter}.latex\"\r\n end\r\n render_document(temp_filename, outdir, outname, format, vars, config)\r\n else\r\n # process the editions\r\n editions.each{|edition_name, properties|\r\n edition_out_filename = \"#{outname}_#{properties[:filepart]}\"\r\n edition_temp_frontmatter = \"#{@tempdir}/#{edition_out_filename}_frontmatter.md\" unless frontmatter.nil?\r\n edition_temp_filename = \"#{@tempdir}/#{edition_out_filename}.md\"\r\n vars[:title] = properties[:title]\r\n\r\n if properties[:debug]\r\n process_debug_info(temp_frontmatter, edition_temp_frontmatter, edition_name.to_s) unless frontmatter.nil?\r\n process_debug_info(temp_filename, edition_temp_filename, edition_name.to_s)\r\n lvars=vars.clone\r\n lvars[:linenumbers] = \"true\"\r\n unless frontmatter.nil? # frontmatter\r\n lvars[:usetoc] = \"nousetoc\"\r\n render_document(edition_temp_frontmatter, @tempdir, \"xfrontmatter\", [\"frontmatter\"], lvars)\r\n lvars[:usetoc] = vars[:usetoc] || \"usetoc\"\r\n lvars[:frontmatter] = \"#{@tempdir}/xfrontmatter.latex\"\r\n end\r\n render_document(edition_temp_filename, outdir, edition_out_filename, [\"pdf\", \"latex\"], lvars, config)\r\n else\r\n unless frontmatter.nil? # frontmatter\r\n filter_document_variant(temp_frontmatter, edition_temp_frontmatter, edition_name.to_s)\r\n render_document(edition_temp_frontmatter, @tempdir, \"xfrontmatter\", [\"frontmatter\"], vars_frontmatter)\r\n vars[:frontmatter]=\"#{@tempdir}/xfrontmatter.latex\"\r\n end\r\n filter_document_variant(temp_filename, edition_temp_filename, edition_name.to_s)\r\n render_document(edition_temp_filename, outdir, edition_out_filename, format, vars, config)\r\n end\r\n }\r\n end\r\n end",
"title": ""
},
{
"docid": "28b02a22bcbf9d8d9b2226e64cb4619b",
"score": "0.49611798",
"text": "def add_document(content, rel_x, rel_y, width, height)\n new_doc = Document.new(x_pixel_to_screen(rel_x), y_pixel_to_screen(rel_y),\n width, height,\n content)\n new_doc.base_z = @base_z\n new_doc.gui_theme = @gui_theme\n add_child(new_doc)\n new_doc\n end",
"title": ""
},
{
"docid": "a1fa1227e36a39567ecab43c7dcaf5df",
"score": "0.4950169",
"text": "def content(options={})\n return @content unless @content.nil?\n \n options = { :page => self }.merge(options)\n for name, value in options\n eval \"#{name.to_s} = options[name]\"\n end\n\n site.stats.record(self.class.name.split('::').last, source_path) do\n case self.source_ext\n when '.md', '.markdown'\n @content = Maruku.new(self.source_content).to_html\n when '.haml'\n Haml::Engine.new(self.source_content, :filename => source_path).render(binding)\n when '.erb'\n erb = ERB.new self.source_content, nil, '-'\n erb.filename = source_path\n erb.result(binding)\n when '.html'\n self.source_content\n else\n raise ArgumentError, \"Unsupported format: #{self.source_path}\"\n end\n end\n end",
"title": ""
},
{
"docid": "1e5c40ac8eb9051ca451a7d7e1beeb3f",
"score": "0.4944064",
"text": "def create_document(filename, content = \"\") # content is optional\n File.open(file_path(filename), \"w\") do |file|\n file.write(content)\n end\nend",
"title": ""
},
{
"docid": "40243ee4cb4fe6a1601e596937e87a4c",
"score": "0.4912024",
"text": "def build(options)\n document = new\n document.attributes = Hash(options).select do |key, _value|\n document.respond_to? :\"#{key}=\"\n end\n document\n end",
"title": ""
},
{
"docid": "71da39e3866f4ac6f094110b46632d72",
"score": "0.49060437",
"text": "def AssembleDocument template, answers, settings = nil, billingRef = nil\n TryWithoutAndWithPackage do |uploadPackage|\n AssembleDocumentImpl(template, answers, settings, billingRef, uploadPackage)\n end\n end",
"title": ""
},
{
"docid": "919b2347aa1eff384b9eee627b4e342b",
"score": "0.48793948",
"text": "def run(content, params={})\n PandocRuby.convert(content, params)\n end",
"title": ""
},
{
"docid": "68c0b243e92031b7d810f772f6e873bb",
"score": "0.48590425",
"text": "def initialize(document, options = {})\n @document = document\n @text = options[:text]\n end",
"title": ""
},
{
"docid": "3aa33914ab57e478b53ee9053aeb99a8",
"score": "0.48579052",
"text": "def initialize(store, options)\n @store = store\n @mandb_section = sanitize_mandb_section(\n options.mandb_section || \"3-rdoc\",\n )\n @output_directory = File.expand_path(File.join(options.op_dir, \"man#{mandb_section.split('-').first}\"))\n FileUtils.mkdir_p output_directory\n end",
"title": ""
},
{
"docid": "b9207d7d81111adb160ed39e25303dad",
"score": "0.48469242",
"text": "def initialize(options = {}, root = nil, &block)\n if root\n @doc = root.document\n @parent = root\n else\n @parent = @doc = related_class(\"Document\").new\n end\n\n @context = nil\n @arity = nil\n @ns = nil\n\n options = DEFAULT_DOCUMENT_OPTIONS.merge(options)\n options.each do |k, v|\n @doc.send(:\"#{k}=\", v)\n end\n\n return unless block\n\n @arity = block.arity\n if @arity <= 0\n @context = eval(\"self\", block.binding)\n instance_eval(&block)\n else\n yield self\n end\n\n @parent = @doc\n end",
"title": ""
},
{
"docid": "b23b5f8413b8e994f67f644251d491c1",
"score": "0.48446617",
"text": "def initialize\n @force = arguments[FORCE] == \"1\" ? true : false\n @syntax = arguments[SYNTAX]\n @extension = \".#{arguments[EXTENSION]}\"\n @output_dir = arguments[OUTPUT_DIR]\n @input_file = arguments[INPUT_FILE]\n @css_file = arguments[CSS_FILE]\n @template_path = arguments[TEMPLATE_PATH]\n @template_default = arguments[TEMPLATE_DEFAULT]\n @template_ext = arguments[TEMPLATE_EXT]\n @root_path = arguments[ROOT_PATH]\n @root_path = \"./\" if @root_path == \"-\"\n raise \"Must be markdown\" unless syntax == 'markdown'\n end",
"title": ""
},
{
"docid": "ce502a14806926a8695d509695ece86c",
"score": "0.48250982",
"text": "def set_document(options)\n @document = Compta::GeneralBook.new(options)\n end",
"title": ""
},
{
"docid": "1bde9721c97a40f341b50f1286104a6a",
"score": "0.48115113",
"text": "def exec(options)\n generate_content(options)\n\n ret = true\n #Login only if we need to\n if (options[:diff] || options[:update])\n login(options)\n end\n if (options[:diff])\n ret &= diff_page if instance_variable_get('@generated_content')\n ret &= diff_files if instance_variable_get('@files')\n end\n if (options[:print])\n print\n end\n if (options[:update])\n update_page if instance_variable_get('@generated_content')\n update_files if instance_variable_get('@files')\n end\n return ret\n end",
"title": ""
},
{
"docid": "68f61e017fe93ffd3f266e686cb18c88",
"score": "0.47984925",
"text": "def content\n\n # Handle case where user passes the full path\n #\n file = @options['template'] || default_template\n\n if file\n file.sub(/^_templates\\//, '')\n file = File.join(source, '_templates', file) if file\n if File.exist? file\n parse_template File.open(file).read\n elsif @options['template']\n abort \"No #{@options['type']} template found at #{file}\"\n else\n parse_template default_content\n end\n else\n parse_template default_content\n end\n end",
"title": ""
},
{
"docid": "e8b885bfc7504c78e554d661c58ac62d",
"score": "0.4787004",
"text": "def initialize(options)\n @options = options\n @documents = []\n @classes = {}\n end",
"title": ""
},
{
"docid": "ef22c44e8cfc14d289ef1193174b97cc",
"score": "0.47817057",
"text": "def convert()\n FileUtils.mkdir_p(options[:output_dir])\n\n # A invocação de pandoc passando parâmetro como --before-body necessita\n # de ser realizado através de arquivos, portanto, serão criados arquivos\n # temporários para sua execução\n pretextual_tempfile = Tempfile.new('pretextual')\n postextual_tempfile = Tempfile.new('postextual')\n begin\n pretextual(pretextual_tempfile)\n postextual(postextual_tempfile)\n textual(pretextual_tempfile,postextual_tempfile)\n\n ensure\n pretextual_tempfile.close\n pretextual_tempfile.unlink\n postextual_tempfile.close\n postextual_tempfile.unlink\n end\n end",
"title": ""
},
{
"docid": "87e10ea039ffcf92c8d318e09a067c35",
"score": "0.4776604",
"text": "def content\n\n # Handle case where user passes the full path\n #\n file = @options['template'] || default_template\n\n if file\n file.sub!(/^_templates\\//, '')\n file = File.join(site.source, '_templates', file) if file\n if File.exist? file\n parse_template File.open(file).read.encode('UTF-8')\n elsif @options['template']\n abort \"No #{@options['type']} template found at #{file}\"\n else\n parse_template default_front_matter\n end\n else\n parse_template default_front_matter\n end\n end",
"title": ""
},
{
"docid": "0e0d1dcb62a986e7338914f5864a478e",
"score": "0.47709605",
"text": "def initialize(options) #:not-new:\n @options = options\n @ri_writer = RDoc::RI::Writer.new \".\"\n @markup = RDoc::Markup.new\n @to_flow = RDoc::Markup::ToFlow.new\n\n @generated = {}\n end",
"title": ""
},
{
"docid": "8ef4e552adaaf9186e3cefa8e513b304",
"score": "0.47668582",
"text": "def new(url, options = {})\n Document.new(url, options)\n end",
"title": ""
},
{
"docid": "8ef4e552adaaf9186e3cefa8e513b304",
"score": "0.47668582",
"text": "def new(url, options = {})\n Document.new(url, options)\n end",
"title": ""
},
{
"docid": "d2a264b6b2b605a0c53852863f3a26eb",
"score": "0.47599477",
"text": "def run(args)\n # parse the options\n options = Options.new.parse(args)\n \n # get output buffer\n buffer = STDOUT\n if options.output_file\n buffer = File.new(options.output_file, \"w\")\n end\n \n source = File.read(options.template_file)\n dialect = options.template_dialect\n braces = options.template_brace\n context = options.context_object\n context = {options.context_name => context} unless options.context_name.nil?\n template = WLang::file_template(options.template_file, options.template_dialect, braces)\n \n if options.verbosity>1\n puts \"Instantiating #{options.template_file}\"\n puts \"Using dialect #{dialect}\"\n puts \"Block delimiters are \" << Template::BLOCK_SYMBOLS[braces].inspect\n puts \"Context is \" << context.inspect\n end\n \n buffer << template.instantiate(context || {})\n \n # Flush and close if needed\n if File===buffer\n buffer.flush\n buffer.close\n end\n end",
"title": ""
},
{
"docid": "c261f161f5e2ae0c1f06edb00b03734f",
"score": "0.47591403",
"text": "def export_docx(options)\n input_base_dir = config.compute_base_dir(options['base-dir'] || :content_dir)\n input_file_selector = config.compute_file_selector(options['file-selector'] || :all_files)\n input_file_extension = config.compute_file_extension(options['file-extension'] || :at_extension)\n Repositext::Cli::Utils.read_files(\n config.compute_glob_pattern(\n input_base_dir,\n input_file_selector,\n input_file_extension\n ),\n options['file_filter'],\n nil,\n \"Exporting AT files to DOCX\",\n options\n ) do |content_at_file|\n Process::Export::Docx.new(\n content_at_file,\n content_at_file.corresponding_docx_export_filename,\n config.kramdown_parser(:kramdown),\n config.kramdown_converter_method(:to_docx),\n config.docx_font_names\n ).export\n end\n\n validate_docx_post_export(options)\n end",
"title": ""
},
{
"docid": "7c09150281441f69be08f06a078c083e",
"score": "0.47581917",
"text": "def initialize(options)\n @format = DEFAULT_FORMAT\n @readme = Dir['README*'].first\n @source = false\n @use_cache = false\n @markup = nil\n @scripts = []\n @documents = []\n\n options.each do |k,v|\n __send__(\"#{k}=\", v)\n end\n end",
"title": ""
},
{
"docid": "acfe41ce53708e8eb4f6cef0642b9b24",
"score": "0.4753921",
"text": "def render_doc_to(doc, out_stream, **opts)\n options = OpenStruct.new(opts)\n filename = options.filename\n data = options.data\n tm = options.template_manager\n tm ||= begin\n p = [Dir.getwd]\n p.unshift options.directory if EDST::Util.is_present?(options.directory)\n TemplateManager.new paths: p\n end\n\n ctx = Context.new(document: doc,\n template_manager: tm,\n options: options,\n filename: filename,\n data: data)\n doc.children.unshift EDST::AST.new(:comment, value: filename) if options.debug if filename\n out_stream << tm.render_template(options.template || default_template_name, ctx)\n\n ctx\n end",
"title": ""
},
{
"docid": "a0c2af92db3d3c827625da50ecaf8969",
"score": "0.4749325",
"text": "def initialize( store, options )\n\t\t@store = store\n\t\t@options = options\n\t\t$DEBUG_RDOC = $VERBOSE || $DEBUG\n\n\t\tself.log.debug \"Setting up generator for %p with options: %p\" % [ @store, @options ]\n\n\t\textend( FileUtils::Verbose ) if $DEBUG_RDOC\n\t\textend( FileUtils::DryRun ) if options.dry_run\n\n\t\t@base_dir = Pathname.pwd.expand_path\n\t\t@template_dir = DATADIR\n\t\t@output_dir = Pathname( @options.op_dir ).expand_path( @base_dir )\n\n\t\t@template_cache = {}\n\t\t@files = nil\n\t\t@classes = nil\n\t\t@search_index = {}\n\n\t\tInversion::Template.configure( :template_paths => [self.template_dir + 'templates'] )\n\tend",
"title": ""
},
{
"docid": "9fc4dfb40477df7107ddefa9408ce1f0",
"score": "0.47337756",
"text": "def initialize(source, options = {})\n @source = File.expand_path(source)\n @path = File.basename(source)\n @port = options[:port] || DEFAULT_PORT\n @markdown = Markdown.new(options[:parse], options[:render])\n initialize_template\n initialize_assets(options)\n initialize_destination\n end",
"title": ""
},
{
"docid": "cad6e0e44e31f57f7ed75c4757eabb0a",
"score": "0.47334996",
"text": "def execute(options = {})\n input_files = get_input_files(options)\n # we want to avoid printing the binary file\n input_files.delete_if do |file|\n File.binary?(file.gsub(/^\\./, options[:base_dir]))\n end\n\n if input_files.empty?\n puts \"No file found for your option: #{options}\"\n return\n end\n\n to_htmls(input_files, options)\n generated_files = input_files.map { |f| \"#{f}.xhtml\" }\n index_file = \"./index.html\"\n IndexHtml.htmlify generated_files, base_dir: options[:base_dir],\n output: index_file,\n drop_ext: true\n generated_files << index_file if options[:index]\n output_file = \"vim_printer_#{File.basename(File.expand_path(options[:base_dir]))}.tar.gz\"\n AgileUtils::FileUtil.tar_gzip_files(generated_files, output_file)\n AgileUtils::FileUtil.delete(generated_files)\n FileUtils.rm_rf(index_file) if options[:index]\n puts \"Your output file is '#{File.absolute_path(output_file)}'\"\n end",
"title": ""
},
{
"docid": "bfb5b924c7f201bc62dff07f0a0a2b7c",
"score": "0.47081667",
"text": "def createDocument(srcPath)\n $LOG.debug \"GdlDocBuilder::createDocument( #{srcPath} )\"\n\n # Setup context object builder\n ctxBuilder = ContextParser.new(@context)\n ctxBuilder.setFlag(@options)\n\n statusMsg \"Creating context based on src file [ #{srcPath} ].\"\n\n ctxBuilder.parse(srcPath)\n\n printMetrics(@context)\n=begin\n statusMsg \"Parsing external variable definitions.\"\n\n parseExternalVarDefs(@context)\n\n\n\n statusMsg \"Parsing rule data (#{ctxBuilder.context.rules.size.to_s} rules).\"\n\n ruleBuilder = RuleParser.new(@context)\n ruleBuilder.setFlag(@options)\n\n @context.rules.each do |key, rule|\n rule.src = ruleBuilder.parse(rule.xml)\n print \".\"\n end # rules.each\n puts\n=end\n\n # ctxBuilder.dumpResults\n\n # Create output file and output src.\n statusMsg \"Generating document.\"\n\n gdlDoc = GdlDoc.new(srcPath, @context)\n gdlDoc.setOptions(@options)\n\n genFile = gdlDoc.generate\n\n statusMsg \"Document created: #{genFile}\"\n\n #genFile = gdlDoc.generateRenameList\n\n #statusMsg \"Rename list document created: #{genFile}\"\n\n end",
"title": ""
},
{
"docid": "e6c733871f473a108a220297f1d2d802",
"score": "0.46830982",
"text": "def clone_with(content, options={}, parent=nil)\n template = self.clone\n template.content = content\n template.options.deep_merge!(options)\n template.parent = parent if parent\n template\n end",
"title": ""
},
{
"docid": "0f45ab980ee5b04419ef7c55458c2900",
"score": "0.4674863",
"text": "def render_xml(context, properties = {})\n # If just one hash is given, make an one-element array out of it.\n unless context.kind_of?(Array)\n context = [context]\n end\n\n # initialize DOM\n @document = Sablon::DOM::Model.new(Zip::File.open(@path))\n \n # Copy original template document.\n word_doc = @document.zip_contents[\"word/document.xml\"]\n orig_content = word_doc.dup\n \n # Process whole docx with first (or only) context.\n env = Sablon::Environment.new(self, context.shift)\n env.section_properties = properties\n process(env)\n\n # Process document.xml for further context hashs.\n @document.current_entry = \"word/document.xml\"\n context.each do |curr_context|\n # Duplicate document.xml.\n curr_content = orig_content.dup\n \n # Process document.xml under current context.\n env = Sablon::Environment.new(self, curr_context)\n env.section_properties = properties\n process_document(curr_content, env)\n\n # Append current document body to word_doc.\n append_body(curr_content.at_xpath(\".//w:body\"))\n end\n \n # Repair some weird issues.\n repair_document(word_doc)\n end",
"title": ""
},
{
"docid": "28a2255f7b67d54ecc3ae122f391f0c0",
"score": "0.46726573",
"text": "def initialize(source, options = {})\n @options = options\n @dialect = @options.delete(:dialect) || WLang::Html\n @dialect_instance = @dialect.new(options, self)\n @compiler = Compiler.new(dialect_instance)\n @source = Source.new(source, self).with_front_matter(yaml_front_matter?)\n @compiled = to_ruby_proc\n end",
"title": ""
},
{
"docid": "06e4213ed0022770386b28492b2c1b7a",
"score": "0.46684763",
"text": "def initialize(options = {})\n @contents = ''\n start options\n end",
"title": ""
},
{
"docid": "b6c96ea9a89e370c23786160466ef0bf",
"score": "0.4664958",
"text": "def generate\n options = generate_text_options\n text = Word::Text.new({}, [@text_fragment])\n if options\n Word::Run.new({}, [options, text])\n else\n Word::Run.new({}, [text])\n end\n end",
"title": ""
},
{
"docid": "8213677c1386a5ed6d5b261c673afad4",
"score": "0.46621475",
"text": "def content\n return @content if @content\n raise CommandError, \"Only one of --out, --in, --doc and CODE_OBJECT may be specified.\" if bad_option_combination?\n\n content = case\n when opts.present?(:o)\n pry_output_content\n when opts.present?(:i)\n pry_input_content\n when opts.present?(:d)\n code_object_doc\n else\n code_object_source_or_file\n end\n\n @content ||= restrict_to_lines(content, line_range)\n end",
"title": ""
},
{
"docid": "1cf598a8f59c83bcdd24bbcc2a1a80aa",
"score": "0.46558434",
"text": "def initialize(options={})\n @options = @@default_options.merge(options)\n @content = \"\"\n @command_options = \"\"\n @user_password = nil\n @tempfiles = []\n end",
"title": ""
},
{
"docid": "796c2a033953bb00771d2509c7c7e09f",
"score": "0.46539637",
"text": "def generate\n command = []\n command << @asdoc_path\n command << @asdoc_extra_opts\n command << \"-source-path #{@source_paths.join(\" \")}\"\n \n @library_paths.each do |library_path|\n command << \"-library-path #{library_path}\"\n end\n command << \"-doc-sources #{@source_paths.join(\" \")}\"\n command << \"-output #{@output_dir}\" \n process(command)\n end",
"title": ""
},
{
"docid": "afc8e6965982ed7837a09c5fbcd4e3cc",
"score": "0.46505186",
"text": "def create_doc(path , doc_id , o = {})\n `mkdir -p #{path}` if !File.exist?(path)\n template = ERB.new(IO.read(to_path(\"doc_pd.rxml\")))\n File.open(\"#{path}/#{doc_id}.xml\", \"w\"){|f| f.puts template.result(binding)}\n puts \"[create_doc] #{doc_id} file created\"\nend",
"title": ""
},
{
"docid": "1f5c53c4c1a62048e284bfa10525bde1",
"score": "0.46461803",
"text": "def setup(options = {})\n unless options[:root]\n raise ArgumentError, \"no :root path given\"\n end\n\n unless File.directory? options[:root]\n raise ArgumentError, \"no such directory: #{options[:root]}\"\n end\n\n @path = File.expand_path(\"nodes\", options[:root])\n FileUtils.mkdir @path unless File.directory? @path\n\n nil\n end",
"title": ""
},
{
"docid": "2adb8f885832ec7980654a11b61e089d",
"score": "0.4643899",
"text": "def rdoc_target(output, input, argv=[])\n #if outofdate?(output, *input) or force?\n rm_r(output) if exist?(output) and safe?(output) # remove old rdocs\n\n #rdocopt['op'] = output\n\n #if template == 'hanna'\n # cmd = \"hanna #{extra} \" + [input, rdocopt].to_console\n #else\n # cmd = \"rdoc #{extra} \" + [input, rdocopt].to_console\n #end\n\n #argv = (\"#{extra}\" + [input, rdocopt].to_console).split(/\\s+/)\n\n if verbose? or dryrun?\n puts \"webri \" + argv.join(\" \")\n #sh(cmd) #shell(cmd)\n else\n cmd = \"webri \" + argv.join(\" \")\n puts cmd #if trace?\n #rdoc = ::RDoc::RDoc.new\n #rdoc.document(argv)\n #silently do\n sh(cmd) #shell(cmd)\n #end\n end\n #else\n # puts \"RDocs are current -- #{output}\"\n #end\n end",
"title": ""
},
{
"docid": "0577aca830a25533a4300f7bf289b294",
"score": "0.46426272",
"text": "def setup_document(root)\n Prawn::Document.new(document_options(root))\n end",
"title": ""
},
{
"docid": "ba9112adf10102840ee168adbe5b8434",
"score": "0.46374354",
"text": "def process_document(content, env)\n processors = Template.get_processors(\"word/document.xml\")\n processors.each { |processor| processor.process(content, env) }\n end",
"title": ""
},
{
"docid": "fc7f328bc0f4e84ed4edf4453b44ddab",
"score": "0.46314657",
"text": "def initialize(options = {})\n with_options(options, { :asdoc_path => \"asdoc\", :output_dir => \"doc/asdoc\" }) \n \n @source_paths = source_paths(@src_dirs, @lib_dir)\n raise ArgumentError, \"There aren't any valid source directories to compile\" if @source_paths.empty?\n \n @library_paths = []\n if @lib_dir and File.directory?(@lib_dir)\n @library_paths << escape(@lib_dir) \n end\n @library_paths << \"#{frameworks_dir}/libs\"\n @library_paths << \"#{frameworks_dir}/libs/air\"\n @library_paths << \"#{frameworks_dir}/locale/en_US\"\n end",
"title": ""
},
{
"docid": "32ef80d7280d61669574f99b90b85d25",
"score": "0.46312943",
"text": "def create(doc, options = {})\n\n document = {}\n if doc.is_a? Hash\n unless doc[:uri] || doc[:text]\n raise\n end\n document = doc\n elsif doc.is_a? String\n if doc =~ /^http:\\/\\//\n document[:uri] = doc\n else\n document[:text] = doc\n end\n end\n\n # Ensure we get content_data as well\n options[:include_content] = true\n\n body = { :page => document.merge!(:options => options) }\n api_url = \"/collections/#{self.collection.attributes[:token]}/pages/\"\n response = @muddyit.send_request(api_url, :post, {}, body.to_json)\n return Muddyit::Collections::Collection::Pages::Page.new(@muddyit, response['page'].merge!(:collection => self.collection))\n end",
"title": ""
},
{
"docid": "3be9e3ef0855a3cbb8f01a1623f70847",
"score": "0.46300048",
"text": "def create_document request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_document_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Firestore::V1::Document.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "db0d28886d01a49f64121ab348bef060",
"score": "0.46209535",
"text": "def initialize(document, options)\n @document, @options = document, options\n end",
"title": ""
},
{
"docid": "b9fc7181fb043abcfc0414d4f1fc7c74",
"score": "0.46067852",
"text": "def initialize options #:not-new:\n @options = options\n @store = RDoc::RI::Store.new '.'\n @old_siginfo = nil\n @current = nil\n end",
"title": ""
},
{
"docid": "281b5c90eaeab2ae899a7ad7fe7bfa05",
"score": "0.4606774",
"text": "def createDocument(srcFile)\r\n\r\n # Setup context object builder\r\n ctxBuilder = ContextParser.new(@context)\r\n ctxBuilder.setFlag(@options)\r\n\r\n statusMsg \"Creating guideline context.\"\r\n\r\n ctxBuilder.parse(srcFile)\r\n\r\n printMetrics(@context)\r\n\r\n\r\n\r\n statusMsg \"Parsing external variable definitions.\"\r\n\r\n parseExternalVarDefs(@context)\r\n\r\n\r\n\r\n statusMsg \"Parsing rule data (#{ctxBuilder.context.rules.size.to_s} rules).\"\r\n\r\n ruleBuilder = RuleParser.new(@context)\r\n ruleBuilder.setFlag(@options)\r\n\r\n @context.rules.each do |key, rule|\r\n rule.src = ruleBuilder.parse(rule.xml)\r\n print \".\"\r\n end # rules.each\r\n puts\r\n\r\n\r\n# ctxBuilder.dumpResults\r\n\r\n\r\n # Create output file and output src.\r\n statusMsg \"Generating document.\"\r\n\r\n gdlDoc = GdlDoc.new(srcFile, @context)\r\n gdlDoc.setOptions(@options)\r\n\r\n genFile = gdlDoc.generate\r\n\r\n statusMsg \"Document created: #{genFile}\"\r\n\r\n genFile = gdlDoc.generateRenameList\r\n\r\n statusMsg \"Rename list document created: #{genFile}\"\r\n\r\n end",
"title": ""
},
{
"docid": "fca219b5ad5f495a724c21f69b99165a",
"score": "0.4596322",
"text": "def create_document\n if template.metadata['subject'].casecmp('ela').zero? || template.prereq?\n @document = Document.actives.find_or_initialize_by(file_id: downloader.file_id)\n else\n @document = template.foundational? ? find_core_document : find_fs_document\n id_field = template.foundational? ? :foundational_file_id : :file_id\n\n @expand_document ||= @document.present?\n\n @document[id_field] = downloader.file_id if @document.present?\n @document ||= Document.actives.find_or_initialize_by(id_field => downloader.file_id)\n end\n end",
"title": ""
},
{
"docid": "4ff0e48dec1090267965dc07fa471ca4",
"score": "0.45960146",
"text": "def initialize(content, vars={})\n Papyrus.load_command_classes\n @content = content\n @template = Template.new(self, vars)\n @stack = [ @template ]\n end",
"title": ""
},
{
"docid": "68308270ec7aa741878732eb26d06675",
"score": "0.45840186",
"text": "def get_content(options = nil)\n text_to_parse = all_text\n \n if (!options.nil?)\n # if xsl_file option is specified, execute transformation\n if (!options[:xsl_file].nil?)\n text_to_parse = xslt_transform(file_path, options[:xsl_file])\n end\n end\n \n # create document object\n document = REXML::Document.new text_to_parse\n \n # get content\n if ((mime_subtype == \"html\") or \n ((mime_subtype == \"xml\") and (!options.nil?) and (!options[:xsl_file].nil?)))\n content = document.elements['//body'].elements\n elsif ((mime_subtype == \"xml\") or (mime_subtype == \"hnml\"))\n content = document.root.elements\n end\n \n # adjust/replace items path\n content.each { |i| wrapItem i }\n \n # return content\n return content\n end",
"title": ""
},
{
"docid": "96eb126d86ffd387f8f03e2df14a3c94",
"score": "0.45817572",
"text": "def initialize( repo, options )\n @repo = repo\n @filename = options[:filename]\n @directory = options[:directory]\n @content = ''\n if options[:content]\n @content = options[:content]\n elsif File.exists?( absolute_path )\n @content = File.open( absolute_path, 'r' ).read\n end\n end",
"title": ""
},
{
"docid": "b0a71a5f3669a8e8eb4dd8e7b3be06cb",
"score": "0.4578781",
"text": "def initialize(filename, options={}, deprecated_file_warning=:error, deprecated_tmpdir_root=nil)\r\n if Hash === options\r\n packed = options[:packed]\r\n file_warning = options[:file_warning] || :error\r\n tmpdir_root = options[:tmpdir_root]\r\n else\r\n warn 'Supplying `packed`, `file_warning`, or `tmpdir_root` as separate arguments to `Roo::OpenOffice.new` is deprecated. Use an options hash instead.'\r\n packed = options\r\n file_warning = deprecated_file_warning\r\n tmpdir_root = deprecated_tmpdir_root\r\n end\r\n\r\n file_type_check(filename,'.ods','an Roo::OpenOffice', file_warning, packed)\r\n make_tmpdir(tmpdir_root) do |tmpdir|\r\n filename = download_uri(filename, tmpdir) if uri?(filename)\r\n filename = unzip(filename, tmpdir) if packed == :zip\r\n #TODO: @cells_read[:default] = false\r\n @filename = filename\r\n unless File.file?(@filename)\r\n raise IOError, \"file #{@filename} does not exist\"\r\n end\r\n self.class.extract_content(tmpdir, @filename)\r\n @doc = load_xml(File.join(tmpdir, \"roo_content.xml\"))\r\n end\r\n super(filename, options)\r\n @formula = Hash.new\r\n @style = Hash.new\r\n @style_defaults = Hash.new { |h,k| h[k] = [] }\r\n @style_definitions = Hash.new\r\n @comment = Hash.new\r\n @comments_read = Hash.new\r\n end",
"title": ""
},
{
"docid": "2873dcdb8b2880311b18205ea6824e27",
"score": "0.45752928",
"text": "def make_document\n if @pdoc\n return\n end\n @pdoc = Prawn::Document.new(\n :info=>@info,\n :left_margin=>0,:top_margin=>0,:right_margin=>0,:bottom_margin=>0,\n :compress => @compression,\n :skip_page_creation=>true\n )\n # Now that there's a document,\n # Update any font families temporarily stashed away locally\n # puts \"In make_document, @temp_font_families is '#{readable_hash(@temp_font_families)}'\"\n @pdoc.font_families.update(@temp_font_families)\n # puts \"In make_document, @pdoc.font_families is '#{readable_hash(@pdoc.font_families)}'\"\n # Because the FPDF tutorial uses this, many people are in the\n # habit. Also, it makes the tutorials work...\n #if ! @temp_font_families.has_key? 'Arial'\n # @pdoc.font_families['Arial'] = @pdoc.font_families['Helvetica']\n #end\n end",
"title": ""
},
{
"docid": "47fe141963d8849bfb2e13d5152ab782",
"score": "0.45708376",
"text": "def run(args)\n rdoc = RDocCommand.new\n commands[:rdoc] = rdoc if !commands[:rdoc]\n commands[:help] = DefaultHelpCommand.new(rdoc) if !commands[:help]\n begin\n config = parse_config\n global_options,command,options,arguments = parse_options(args,config)\n proceed = true\n proceed = @@pre_block.call(global_options,command,options,arguments) if @@pre_block \n if proceed\n command = commands[:help] if !command\n command.execute(global_options,options,arguments)\n @@post_block.call(global_options,command,options,arguments) if @@post_block \n end\n rescue Exception => ex\n regular_error_handling = true\n regular_error_handling = @@error_block.call(ex) if @@error_block\n\n if regular_error_handling\n puts \"error: #{ex.message}\"\n end\n end\n end",
"title": ""
},
{
"docid": "521f1bcd9fbdb8c79ed1649c1ec67a31",
"score": "0.45694882",
"text": "def initialize( content_or_path, vars = {} )\n # debugger # if content_or_path =~ /xhtml/\n @vars = vars\n\n if content_or_path.is_a?( FunWith::Files::FilePath ) # && content.file?\n @path = content_or_path\n make_children # only directly creates first level. Rest are handled by recursion\n else\n @path = nil\n @content = content_or_path\n end\n end",
"title": ""
},
{
"docid": "3974d41205d34c0bc27f8fd50ca57ec7",
"score": "0.45636615",
"text": "def document(options = {})\n cache = FileStoreWithExpiration.new(\"tmp/cache/web_service_result/#{self.class.to_s}\")\n cache_key = options[:extension] ? \"#{@id.to_s}#{options[:extension]}\" : @id.to_s\n @raw = cache.fetch(cache_key, {:expires_in => self.class.cache_lifetime}.merge(options)) do\n connection.get(constructed_path(options[:extension]))\n end\n self.class.encapsulate_data(@raw)\n end",
"title": ""
},
{
"docid": "e9cc104ee648ee6c45d86750b5540a36",
"score": "0.4563619",
"text": "def initialize(options = {})\n self.definitions_dir = options[:definitions_dir]\n self.documentation_dir = options[:documentation_dir]\n @templates_folder = File.expand_path(\"../templates/#{self.class.name.split(\"::\").last.downcase}\", File.dirname(__FILE__))\n end",
"title": ""
},
{
"docid": "e6f1a4f521159dad5d5fd06129caa13e",
"score": "0.4563092",
"text": "def validate_content(options)\n options['report_file'] ||= config.compute_glob_pattern(\n 'content_dir/validation_report_file'\n )\n reset_validation_report(options, 'validate_content')\n file_specs = config.compute_validation_file_specs(\n primary: 'content_dir/all_files', # for reporting only\n at_files: 'content_dir/at_files',\n pt_files: 'content_dir/pt_files',\n repositext_files: 'content_dir/repositext_files'\n )\n Repositext::Validation::Content.new(\n file_specs,\n {\n 'kramdown_validation_parser_class' => config.kramdown_parser(:kramdown_validation)\n }.merge(options)\n ).run\n end",
"title": ""
},
{
"docid": "215c985d44b714c31f7cb604c6f238aa",
"score": "0.45580873",
"text": "def rdoc(*files)\n require 'rdoc/rdoc'\n\n options = Hash===files.last ? files.pop : {}\n options.rekey!(&:to_s)\n\n options['title'] ||= options.delete('T')\n\n options['debug'] = options['debug'] #|| debug?\n options['quiet'] = options['quiet'] #|| quiet?\n options['verbose'] = options['verbose'] #|| verbose?\n\n # apply pom (todo?)\n #options['title'] ||= metadata.title\n\n options = DEFAULT_RDOC_OPTIONS.merge(options)\n\n locally do\n rdoc = RDoc::RDoc.new\n opts = options.to_argv + files\n $stderr.puts(\"rdoc \" + opts.join(' ')) if ($VERBOSE || $DEBUG)\n disable_warnings do\n rdoc.document(options.to_argv + files)\n end\n end\n end",
"title": ""
},
{
"docid": "18e7cfb6ca2993068b75748daf0894f9",
"score": "0.454647",
"text": "def setup_for(options)\n raise ArgumentError, \":model was nil, expected a ActiveRecord::Base subclass\" if options[:model].nil?\n # FIXME: not DRY, duplicated from ActiveRecord::Base#to_activerecord_proxy\n self.setObjectClass( Object.const_get(\"#{options[:model].to_s}Proxy\") )\n self.setContent(options[:content]) unless options[:content].nil?\n end",
"title": ""
},
{
"docid": "0d43046b67b3061dffa838a3b19b58c1",
"score": "0.45399886",
"text": "def run_rdoc(options, files)\n options = options.join(' ') if options.is_a? Array\n files = files.join(' ') if files.is_a? Array\n system(\"rdoc #{options} #{files}\")\nend",
"title": ""
},
{
"docid": "0d43046b67b3061dffa838a3b19b58c1",
"score": "0.45399886",
"text": "def run_rdoc(options, files)\n options = options.join(' ') if options.is_a? Array\n files = files.join(' ') if files.is_a? Array\n system(\"rdoc #{options} #{files}\")\nend",
"title": ""
},
{
"docid": "8b92bcdd609545cdd5feaf893ff3b62a",
"score": "0.45335335",
"text": "def process(processor, content, *args)\n document = Nokogiri::XML(content)\n processor_instance=processor.new(document)\n begin \n xml_document=processor_instance.process(*args).to_xml(indent: 0, save_with: 0)\n ensure\n @errors=processor_instance.errors\n end\n xml_document\n end",
"title": ""
},
{
"docid": "26a3efbe74dd59deedb7dbd79c4c6e5c",
"score": "0.4528894",
"text": "def import_docx(options)\n options['report_file'] ||= config.compute_glob_pattern(\n :docx_import_dir, :validation_report_file, ''\n )\n options['append_to_validation_report'] = false\n reset_validation_report(options, 'import_docx')\n validate_docx_pre_import(options)\n convert_docx_to_at(options)\n fix_normalize_trailing_newlines(options)\n fix_adjust_gap_mark_positions(options)\n # fix_normalize_editors_notes(\n # options.merge({ 'base-dir' => :idml_import_dir, 'file-extension' => :at_extension })\n # )\n options['append_to_validation_report'] = true\n # fix_convert_abbreviations_to_lower_case(options) # run after merge_record_marks...\n # fix_normalize_subtitle_mark_before_gap_mark_positions(\n # options.merge({ 'base-dir' => :staging_dir, 'file-extension' => :at_extension })\n # )\n fix_normalize_trailing_newlines(options)\n copy_docx_import_to_content(options)\n # Run post_import validation after docx.at file has been copied into\n # content. This is so that the validation console prints out the content\n # AT file path which is where corrections have to be made.\n # We want to be able to open content AT file with single click in editor.\n validate_docx_post_import(options)\n # Make sure that any newly created content AT files also have a\n # data.json file.\n # Deactivate st_sync for this new file by default\n fix_add_initial_data_json_file(\n options.merge(\n 'initial_only_data_json_settings' => { 'st_sync_active' => false }\n )\n )\n fix_insert_record_mark_into_all_at_files(options)\n options['report_file'] ||= config.compute_glob_pattern(\n :content_dir, :validation_report_file, ''\n )\n options['append_to_validation_report'] = false\n reset_validation_report(options, 'import_docx')\n validate_content(options.merge('run_options' => []))\n end",
"title": ""
},
{
"docid": "8464bb658f5bb9d8e9c86be8324c255e",
"score": "0.45232433",
"text": "def content\n file = @options['template']\n file = File.join(source, '_templates', file) if file\n if file \n abort \"No template found at #{file}\" unless File.exist? file\n parse_template Pathname.new(file).read\n else\n parse_template default_content\n end\n end",
"title": ""
},
{
"docid": "f7c7ed84b39d72e7f06d3463ab3b1c51",
"score": "0.45132938",
"text": "def initialize( options={} )\n\n # init logger\n @logger = getLogger( PROGNAME, options )\n @logger.info( \"#{__method__}\" )\n\n # create object, which knows how to generate CloudFormation template json\n @template = Template.new( options ) \n @docu = Docu.new( @template, options )\n end",
"title": ""
},
{
"docid": "1d4600df4e15e5ace570be164e953f6e",
"score": "0.45130524",
"text": "def make_pdf(options = {}) #template_path, pdf_name, landscape=false)\n prince = Princess::Prince.new()\n\n # Sets style sheets on PDF renderer.\n if options[:stylesheet] || options[:stylesheets]\n prince.add_style_sheets(\n *(options.delete(:stylesheets) || [options.delete(:stylesheet)]).to_a.map do |sheet|\n Rails.root.join('public', 'stylesheets', append_suffix(sheet, :css))\n end\n )\n end\n\n #Extract collection for built in templates\n @pdf_collection = options.delete(:collection) if options[:collection]\n @pdf_partial = options.delete(:partial) if options[:partial]\n unless Rails.env == 'test'\n @command_line_args = \"--baseurl=#{request.protocol}#{request.host}#{Rails.env == 'production' ? nil : ':'+(request.port+1).to_s}/\" #http://localhost:3001/\"\n end\n\n # Set RAILS_ASSET_ID to blank string or rails appends some time after\n # to prevent file caching, fucking up local - disk requests.\n ENV[\"RAILS_ASSET_ID\"] = ''\n\n # render html view\n html_string = render_to_string(options)\n # Return the generated PDF file from our html string.\n Timeout::timeout(21) do\n prince.pdf_from_string(html_string, :command_line_args => @command_line_args) \n end\n end",
"title": ""
},
{
"docid": "011d289f65ef2c24fde6d3999c0e35bb",
"score": "0.45100915",
"text": "def construct_document(attrs = nil, options = {})\n execute_callbacks = options.fetch(:execute_callbacks, Threaded.execute_callbacks?)\n with_callbacks(execute_callbacks) { new(attrs) }\n end",
"title": ""
},
{
"docid": "9956f94da6d247f310c34e82a21326c9",
"score": "0.4509581",
"text": "def initialize(path, tmpdir = nil)\n @document = WordToMarkdown::Document.new path, tmpdir\n @converter = WordToMarkdown::Converter.new @document\n converter.convert!\n end",
"title": ""
},
{
"docid": "9956f94da6d247f310c34e82a21326c9",
"score": "0.4509581",
"text": "def initialize(path, tmpdir = nil)\n @document = WordToMarkdown::Document.new path, tmpdir\n @converter = WordToMarkdown::Converter.new @document\n converter.convert!\n end",
"title": ""
},
{
"docid": "9a9610c42e6ea637b3603c9323f18bbc",
"score": "0.45094717",
"text": "def initialize(shomen_document, options={})\n @table = YAML.load(shomen_document)\n @output = options[:output] || 'doc'\n @readme = options[:readme]\n @templates = {}\n end",
"title": ""
},
{
"docid": "9956f94da6d247f310c34e82a21326c9",
"score": "0.45087263",
"text": "def initialize(path, tmpdir = nil)\n @document = WordToMarkdown::Document.new path, tmpdir\n @converter = WordToMarkdown::Converter.new @document\n converter.convert!\n end",
"title": ""
},
{
"docid": "af1e78f9a5e36ac7368eae67969d248f",
"score": "0.45032284",
"text": "def create_file_context(context, options)\n HtmlFile.new(context, options, FILE_DIR)\n end",
"title": ""
},
{
"docid": "dff646fbb16c593e9aac876e9b1248ea",
"score": "0.4501916",
"text": "def transform(options = {})\n opts, text, file, view_context = options.values_at(:opts, :text, :file, :view_context)\n xml_body = text ? text : IO.read(file) \n view_context.headers['Content-Type'] ||= 'application/xml'\n view_context.headers['Encoding'] = 'UTF-8'\n view_context.instance_eval %{\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct! :xml, :version=>\"1.0\", :encoding=>\"UTF-8\"\n #{xml_body}\n return xml.target!\n }\n end",
"title": ""
},
{
"docid": "d8c756da6428924c09092d45055db8ab",
"score": "0.44869855",
"text": "def render(content)\n Variables::interpolate!(content)\n I18n.selectLanguage!(content)\n\n html = Tilt[:markdown].new(nil, nil, @profile) { content }.render\n doc = Nokogiri::HTML::DocumentFragment.parse(html)\n\n Form.render!(doc, @options)\n Fixups.updateClasses!(doc)\n Fixups.updateLinks!(doc)\n Fixups.updateSyntaxHighlighting!(doc)\n Fixups.updateCommandlineBlocks!(doc)\n Fixups.updateImagePaths!(doc, @options)\n Glossary.render!(doc)\n Downloads.scanForFiles!(doc, @options)\n\n # This call must be last in the chain because it separates notes from the\n # content and returns them separately. If it's not last, then the notes\n # won't have all the compilation steps applied to them.\n #\n # must pass in extra context because this will render markdown itself\n Notes.render!(doc, @profile, @options)\n end",
"title": ""
},
{
"docid": "b48fc58914d16f0c458d13a3320136ed",
"score": "0.44864818",
"text": "def build(config)\n config = defaults.merge(config)\n config[\"config_yml\"] = config\n\n config[\"renderer\"] = Hologram::Utils.get_markdown_renderer(config[\"custom_markdown\"])\n config[\"base_path\"] = \".\"\n\n builder = Hologram::DocBuilder.new(config)\n\n if builder.is_valid?\n builder.build\n else\n $stderr.puts builder.errors\n end\n end",
"title": ""
},
{
"docid": "0c1324bd5cf123bdf0428925378b09c2",
"score": "0.44839272",
"text": "def content(prefix = nil, options = nil)\n if options.nil?\n html(prefix)\n else\n save_options_at_prefix(prefix ? prefix.to_s : 'og', options)\n end\n end",
"title": ""
},
{
"docid": "89de547611dc2a33e143ffe7fede533d",
"score": "0.44661555",
"text": "def initialize(options = {})\n # space status output from command\n puts\n\n # required params\n if options[:docs_root].nil?\n puts \"(E) Dash.new: Must construct with hash containing :docs_root\"\n return nil\n end\n if options[:name].nil?\n puts \"(E) Dash.new: Must construct with hash containing :name\"\n return nil\n end\n\n # optional params\n if options[:display_name].nil?\n options[:display_name] = options[:name]\n end\n if !options[:icon].nil?\n if File.exists?(options[:icon])\n @icon = options[:icon]\n elsif File.exists?( File.join(ROOT_PATH, options[:icon]) )\n @icon = File.join(ROOT_PATH, options[:icon])\n else\n puts \"(E) Dash.new: Icon not found (#{options[:icon]})\"\n @icon = nil\n end\n end\n\n @enable_js = (!options[:enable_js].nil?) ? options[:enable_js] : false\n @index_page = (!options[:index_page].nil?) ? options[:index_page] : 'index.html'\n\n @name = options[:name]\n @display_name = options[:display_name]\n @docs_root = File.join(SRC_DOCS_PATH, options[:docs_root])\n @docset_path = File.join(DOCSETS_PATH, \"#{@name}.docset\")\n @docset_contents_path = File.join(@docset_path, 'Contents')\n @docset_resources_path = File.join(@docset_contents_path, 'Resources')\n @docset_documents_path = File.join(@docset_resources_path, 'Documents')\n @docs_dev_branch = 'dev'\n @queries = []\n\n\n if File.exists?(@docset_path)\n backup_path = \"#{@docset_path}.bak\"\n\n puts \"Dash.new: Backing up current docset...\"\n if File.exists?(backup_path)\n FileUtils.rm_r(backup_path, { :force => true })\n end\n\n FileUtils.mv(@docset_path, backup_path, { :force => true })\n puts \" \\`- done!\"\n end\n\n create_docset\n\n @repo = get_docs_repo\n end",
"title": ""
},
{
"docid": "7b21d2013ffc70075057a8c5f422313e",
"score": "0.4462205",
"text": "def initialize(options)\n @libdir = File.dirname(__FILE__) unless @libdir\n options.merge!(default_fonts(options)) { |_, old, new| old || new }.\n merge!(default_file_locations(options)) { |_, old, new| old || new }\n @options = options\n @files_to_delete = []\n @htmlstylesheet_name = options[:htmlstylesheet]\n @wordstylesheet_name = options[:wordstylesheet]\n @standardstylesheet_name = options[:standardstylesheet]\n @header = options[:header]\n @htmlcoverpage = options[:htmlcoverpage]\n @wordcoverpage = options[:wordcoverpage]\n @htmlintropage = options[:htmlintropage]\n @wordintropage = options[:wordintropage]\n @scripts = options[:scripts]\n @scripts_pdf = options[:scripts_pdf]\n @i18nyaml = options[:i18nyaml]\n @ulstyle = options[:ulstyle]\n @olstyle = options[:olstyle]\n @datauriimage = options[:datauriimage]\n @suppressheadingnumbers = options[:suppressheadingnumbers]\n @termdomain = \"\"\n @termexample = false\n @note = false\n @sourcecode = false\n @anchors = {}\n @footnotes = []\n @comments = []\n @in_footnote = false\n @in_comment = false\n @in_table = false\n @in_figure = false\n @seen_footnote = Set.new\n @c = HTMLEntities.new\n @openmathdelim = \"`\"\n @closemathdelim = \"`\"\n @lang = \"en\"\n @script = \"Latn\"\n @maxwidth = 1200\n @maxheight = 800\n @wordToClevels = options[:doctoclevels].to_i\n @wordToClevels = 2 if @wordToClevels == 0\n @htmlToClevels = options[:htmltoclevels].to_i\n @htmlToClevels = 2 if @htmlToClevels == 0\n end",
"title": ""
},
{
"docid": "cba8bf28103d2a7411aebd24375e072d",
"score": "0.4457059",
"text": "def initialize(source, opts={})\n options = Mint.default_options.merge opts\n\n # Loads source and destination, which will be used for\n # all source_* and destination_* virtual attributes.\n super(source, options)\n self.type = :document\n\n # Each of these should invoke explicitly defined method\n self.content = source\n self.layout = options[:layout]\n self.style = options[:style]\n self.style_destination = options[:style_destination]\n\n # The template option will override layout and style choices\n self.template = options[:template]\n\n # Yield self to block after all other parameters are loaded,\n # so we only have to tweak. (We don't have to give up our\n # defaults or re-test blocks beyond them being tweaked.)\n yield self if block_given?\n end",
"title": ""
},
{
"docid": "dca495a04d3b50ddbb26dbf1069e0434",
"score": "0.44560102",
"text": "def create_doc_from_template(source_file_id:, destination_folder_id: nil, destination_file_name:, destination_file_id: nil, query_replace_map:, writer_emails: nil, owner_emails: nil)\n file_id = nil\n Dir.mktmpdir do |dir|\n odt_file = File.join(dir, 'doc.odt')\n content_file = File.join(dir, 'content.xml')\n self.download_document_to_odt(source_file_id, odt_file) || (return false)\n self.drive_shell_command(\"unzip -d #{dir} #{odt_file} content.xml\") || (return false)\n # Do query replace\n query_replace_map.each do |from, to|\n self.drive_shell_command(\"sed -i 's/#{quote_sed_string(from)}/#{quote_sed_string(to)}/g' #{content_file}\") || (return false)\n end\n self.drive_shell_command(\"cd #{dir} ; zip #{odt_file} content.xml\") || (return false)\n file_id = self.upload_odt_to_doc(existing_file_id: destination_file_id, file_name: destination_file_name, path_to_odt: odt_file, writer_emails: writer_emails, owner_emails: owner_emails)\n end\n if destination_folder_id\n self.add_file_to_folder(file_id: file_id, folder_id: destination_folder_id) || (return false)\n end\n return file_id\n end",
"title": ""
}
] |
09ddc6a7715e523f28f7941bd4d5edc6
|
GET /prd_thresholds/new GET /prd_thresholds/new.xml
|
[
{
"docid": "c41a68f9724f6de1a4d57748ca5a092c",
"score": "0.7616998",
"text": "def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end",
"title": ""
}
] |
[
{
"docid": "c79ec7ad7b044fdcd5d504ca05eb2aa3",
"score": "0.72468853",
"text": "def create\n @prd_threshold = PrdThreshold.new(params[:prd_threshold])\n\n respond_to do |format|\n if @prd_threshold.save\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully created.') }\n format.xml { render :xml => @prd_threshold, :status => :created, :location => @prd_threshold }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2dd5ee4f7c80c4baa64a4d4c950528a3",
"score": "0.6596132",
"text": "def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end",
"title": ""
},
{
"docid": "b692fdb86295a7959e006213b58a3325",
"score": "0.6558613",
"text": "def new\n @deposit_threshold = DepositThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit_threshold }\n end\n end",
"title": ""
},
{
"docid": "7b8417686185ef26394a8ce84d92eadc",
"score": "0.63464236",
"text": "def create\n @threshold = Threshold.new(threshold_params)\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }\n format.json { render :show, status: :created, location: @threshold }\n else\n format.html { render :new }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a9fd0b3d7cad7d8fd901734f5012c0fe",
"score": "0.62804323",
"text": "def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8623c71f93c7f947515b2b58b2fa176",
"score": "0.6273885",
"text": "def create\n @deposit_threshold = DepositThreshold.new(params[:deposit_threshold])\n\n respond_to do |format|\n if @deposit_threshold.save\n format.html { redirect_to(@deposit_threshold, :notice => 'DepositThreshold was successfully created.') }\n format.xml { render :xml => @deposit_threshold, :status => :created, :location => @deposit_threshold }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deposit_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34f6852d946cc7b4d3ba854e98af5c14",
"score": "0.6051877",
"text": "def new\n @load_balancer_policy = LoadBalancerPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @load_balancer_policy }\n end\n end",
"title": ""
},
{
"docid": "bca3a5f211f35a647e543de044af12d9",
"score": "0.5928074",
"text": "def show\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end",
"title": ""
},
{
"docid": "cee960f781dbc78312793d659e1fbf9e",
"score": "0.5908451",
"text": "def new\n @catalogs_priority = Catalogs::Priority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end",
"title": ""
},
{
"docid": "85762065e43815000a86de9ed656f08d",
"score": "0.5875929",
"text": "def new\n @pclevel = Pclevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pclevel }\n end\n end",
"title": ""
},
{
"docid": "de09559a17de70f6d29203fb77305083",
"score": "0.5866922",
"text": "def new\n @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"title": ""
},
{
"docid": "98fc5512cee224059451097eb53434c9",
"score": "0.58266115",
"text": "def new\n @task_priority = TaskPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @task_priority }\n end\n end",
"title": ""
},
{
"docid": "b86410b545b3d031c178dc1c70f9be07",
"score": "0.5823545",
"text": "def new\n @prd_attribute = PrdAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json { render :json => @prd_attribute }\n end\n end",
"title": ""
},
{
"docid": "237a0cfc76caf8e3833c3fd773d61b97",
"score": "0.5805517",
"text": "def new\n @lookup_bvmtpercentile = LookupBvmtpercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_bvmtpercentile }\n end\n end",
"title": ""
},
{
"docid": "d164313572481389be3b50430e41ff18",
"score": "0.5771179",
"text": "def new\n @risk_probability = RiskProbability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end",
"title": ""
},
{
"docid": "e622d9c49219f8a0ae0596f8db33b9ce",
"score": "0.57478315",
"text": "def new\n @package = Package.new\n @priority = Priority.find(:all)\n #logger.debug @priority[0]\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @package }\n end\n end",
"title": ""
},
{
"docid": "d7c512cfc3f047fd8c271a2c9fb2d830",
"score": "0.5740769",
"text": "def new\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"title": ""
},
{
"docid": "a6e7436b4bfa6a664b45b43d83350a26",
"score": "0.57319117",
"text": "def new\n @breadcrumb = 'create'\n @ticket_priority = TicketPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_priority }\n end\n end",
"title": ""
},
{
"docid": "3959aaff19204aae6fad2635ef30ef6f",
"score": "0.57237446",
"text": "def new\n @p_stat = PStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p_stat }\n end\n end",
"title": ""
},
{
"docid": "e89961ddd26e8d94dc8f5af6ff1d9fef",
"score": "0.5701305",
"text": "def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end",
"title": ""
},
{
"docid": "71042522bc5cb8910be7eba1d06de061",
"score": "0.56938815",
"text": "def new\n @prizecount = Prizecount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prizecount }\n end\n end",
"title": ""
},
{
"docid": "c75e1fd8650081252df7c4c91d71f2f9",
"score": "0.5689688",
"text": "def new\n @requirement_level = RequirementLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requirement_level }\n end\n end",
"title": ""
},
{
"docid": "a8fcc676f88d659679a5c4f37a770d15",
"score": "0.5593852",
"text": "def create\n @lb_pool = LbPool.new(params[:lb_pool])\n \n respond_to do |format|\n if @lb_pool.save \n flash[:notice] = 'Load Balancer Pool was successfully created.'\n format.html { redirect_to lb_pool_url(@lb_pool) }\n format.xml { head :created, :location => lb_pool_url(@lb_pool) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lb_pool.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cfe2a7add3835ccfa74c7067d7f2c7d4",
"score": "0.55891716",
"text": "def new\n @project_status = ProjectStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_status }\n end\n end",
"title": ""
},
{
"docid": "2c86ecdcfc2315f946a7d2441133cd6d",
"score": "0.55738914",
"text": "def new\n @low_no_cost_improvement = LowNoCostImprovement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @low_no_cost_improvement }\n end\n end",
"title": ""
},
{
"docid": "2a16c73f7e10444acd7cfddc74fe328a",
"score": "0.55425966",
"text": "def update\n @prd_threshold = PrdThreshold.find(params[:id])\n\n respond_to do |format|\n if @prd_threshold.update_attributes(params[:prd_threshold])\n format.html { redirect_to(@prd_threshold, :notice => 'PrdThreshold was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prd_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4c50d602727c36d61222c620899bdbf7",
"score": "0.5538013",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end",
"title": ""
},
{
"docid": "e2a8e18522e28550608b3c5944cbb0cb",
"score": "0.5537272",
"text": "def new\n @weight_percentile = WeightPercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight_percentile }\n end\n end",
"title": ""
},
{
"docid": "f6d2684d69cc981e2f398c9873454d69",
"score": "0.55014926",
"text": "def new\n @feature_status = FeatureStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feature_status }\n end\n end",
"title": ""
},
{
"docid": "989d5370c648c31cd1950cd1cc3fcdca",
"score": "0.54838616",
"text": "def create\n @catalogs_priority = Catalogs::Priority.new(params[:catalogs_priority])\n\n respond_to do |format|\n if @catalogs_priority.save\n format.html { redirect_to(@catalogs_priority, :notice => 'Priority was successfully created.') }\n format.xml { render :xml => @catalogs_priority, :status => :created, :location => @catalogs_priority }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalogs_priority.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63d9feb2ed53a04689f6cc5bb4a76b32",
"score": "0.5480651",
"text": "def new\n @service_checker = ServiceChecker.new(:strict => \"0\", :checker_type => \"0\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_checker }\n end\n end",
"title": ""
},
{
"docid": "0dbb83d065342c1d88ed3320da9f074b",
"score": "0.54715896",
"text": "def new\n @crate_priority = CratePriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crate_priority }\n end\n end",
"title": ""
},
{
"docid": "f8f47de1f353646d63982038bb941d2e",
"score": "0.54704773",
"text": "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"title": ""
},
{
"docid": "39a273d8a9a5cf67ff4546d3298f9865",
"score": "0.54555523",
"text": "def new\n @risk_class = RiskClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @risk_class }\n end\n end",
"title": ""
},
{
"docid": "a83173640f77272bfb6f58a0a65c7e67",
"score": "0.5454847",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"title": ""
},
{
"docid": "beab0767544070f9f207bec1c8afd50a",
"score": "0.5429767",
"text": "def new\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nagios_service_escalation_template }\n end\n end",
"title": ""
},
{
"docid": "905140c84cc279c562ece98d6e150ebd",
"score": "0.54190016",
"text": "def new\n @project_objective = ProjectObjective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_objective }\n end\n end",
"title": ""
},
{
"docid": "899e9c9411f4174b5c690828963157e0",
"score": "0.5402906",
"text": "def create\n @load_balancer_policy = LoadBalancerPolicy.new(params[:load_balancer_policy])\n\n respond_to do |format|\n if @load_balancer_policy.save\n flash[:notice] = 'LoadBalancerPolicy was successfully created.'\n format.html { redirect_to(@load_balancer_policy) }\n format.xml { render :xml => @load_balancer_policy, :status => :created, :location => @load_balancer_policy }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @load_balancer_policy.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b0aeb676c3aa87453f8b4e34859d81c",
"score": "0.5390597",
"text": "def new\n @pcategory = Pcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pcategory }\n end\n end",
"title": ""
},
{
"docid": "40304aae29716fc3dcdfcfd3228087aa",
"score": "0.5389653",
"text": "def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end",
"title": ""
},
{
"docid": "fda3686547ddc0ad9fbe8a92a58e29a4",
"score": "0.53760725",
"text": "def new\n @requirement_priority = RequirementPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @requirement_priority }\n end\n end",
"title": ""
},
{
"docid": "07f59341fc21ca03ece14ad77a5d9e23",
"score": "0.5374689",
"text": "def create\n @risk_probability = RiskProbability.new(params[:risk_probability])\n\n respond_to do |format|\n if @risk_probability.save\n format.html { redirect_to(@risk_probability, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @risk_probability, :status => :created, :location => @risk_probability }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @risk_probability.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3a35a4044bb80d99fa63a49089845dd",
"score": "0.5372926",
"text": "def new\n @range_specification = RangeSpecification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @range_specification }\n end\n end",
"title": ""
},
{
"docid": "278cc721a4f0a7eaf338a9bed4140c3d",
"score": "0.53713197",
"text": "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"title": ""
},
{
"docid": "d8ea74214e44961b9d0ea299ddf00ae2",
"score": "0.5370795",
"text": "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end",
"title": ""
},
{
"docid": "a0c6aba4ea759538d0a3614dcbc76d2c",
"score": "0.53651375",
"text": "def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @production }\n end\n end",
"title": ""
},
{
"docid": "6c111e4a4b46c8861c3cab960f9e8a5e",
"score": "0.53640527",
"text": "def create\n @prd_etc = PrdEtc.new(params[:prd_etc])\n\n respond_to do |format|\n if @prd_etc.save\n format.html { redirect_to(@prd_etc, :notice => 'PrdEtc was successfully created.') }\n format.xml { render :xml => @prd_etc, :status => :created, :location => @prd_etc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_etc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d078c5370eaaeecb5de79b182025c0aa",
"score": "0.5362997",
"text": "def create\n @low_no_cost_improvement = LowNoCostImprovement.new(params[:low_no_cost_improvement])\n\n respond_to do |format|\n if @low_no_cost_improvement.save\n format.html { redirect_to(@low_no_cost_improvement, :notice => 'Low no cost improvement was successfully created.') }\n format.xml { render :xml => @low_no_cost_improvement, :status => :created, :location => @low_no_cost_improvement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @low_no_cost_improvement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3a0da187088455edc0c984cc81c53429",
"score": "0.5358155",
"text": "def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"title": ""
},
{
"docid": "1869320eaa5539b6ae29e1d0b105f351",
"score": "0.53550977",
"text": "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"title": ""
},
{
"docid": "347a1e5cb5616db6ce8ed2b4ff315011",
"score": "0.5346079",
"text": "def new\n normal_id = Priority.find_by_description(\"Normal\")\n @passenger = Passenger.new({:routing_id => params[:routing_id], \n :priority_id => normal_id.id})\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @passenger }\n end\n end",
"title": ""
},
{
"docid": "f3d06a0045d24c45dfe3fa66db3d5277",
"score": "0.53397304",
"text": "def new\n @library_objective = LibraryObjective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library_objective }\n end\n end",
"title": ""
},
{
"docid": "7a70e38fb95698de91fe3358b58eb3ec",
"score": "0.53365016",
"text": "def new\n @service = Service.new\n\n # If a valid type is received, apply to the host to create.\n check_priority_param\n @service.priority = @priority if(!@priority.blank?)\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{@service.probe}/views\"\n\n respond_to do |format|\n format.html\n end\n end",
"title": ""
},
{
"docid": "046c0ed6b71098bb8b9cc7b4cb31f557",
"score": "0.5335799",
"text": "def new\n @req_breakdown = ReqBreakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end",
"title": ""
},
{
"docid": "5c9c85c300047cd61033be86e3ca6395",
"score": "0.5334003",
"text": "def new\n @tps_report = TpsReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tps_report }\n end\n end",
"title": ""
},
{
"docid": "eb8445c89300cb595502407483a5327b",
"score": "0.53267354",
"text": "def new\n @patient_condition = PatientCondition.new\n @conditions = Condition.find(:all)\n @patient_profiles = PatientProfile.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient_condition }\n end\n end",
"title": ""
},
{
"docid": "5968f70b8c20f9986e6ab7247315af88",
"score": "0.53259087",
"text": "def index\n @thresholds = Threshold.all\n end",
"title": ""
},
{
"docid": "f20d33912c18df875443ffc8fc6ced83",
"score": "0.53238076",
"text": "def create\n @pclevel = Pclevel.new(params[:pclevel])\n\n respond_to do |format|\n if @pclevel.save\n flash[:notice] = 'Pclevel was successfully created.'\n format.html { redirect_to(pclevels_url) }\n format.xml { render :xml => @pclevel, :status => :created, :location => @pclevel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pclevel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d4c37cd3dff4252e80cabc4e05794e75",
"score": "0.53191054",
"text": "def new\n @prize = Prize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prize }\n end\n end",
"title": ""
},
{
"docid": "1e7d2fd79abe252f580fc985361fdc12",
"score": "0.5317272",
"text": "def new\n @sleep_log = SleepLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sleep_log }\n end\n end",
"title": ""
},
{
"docid": "053d95d7550ebbfdf29644d328001e92",
"score": "0.53080875",
"text": "def new\n @product_status = ProductStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_status }\n end\n end",
"title": ""
},
{
"docid": "3d6bc91f3f2310d0e859c37c35b626e8",
"score": "0.5305504",
"text": "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"title": ""
},
{
"docid": "3d6bc91f3f2310d0e859c37c35b626e8",
"score": "0.5305033",
"text": "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"title": ""
},
{
"docid": "53fe163cecdde7799ecd953e066e07ec",
"score": "0.53043944",
"text": "def new\n @bp_request = BpRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bp_request }\n end\n end",
"title": ""
},
{
"docid": "6076ce4dba85573ddd784fcb6b0c93f5",
"score": "0.53007156",
"text": "def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end",
"title": ""
},
{
"docid": "7ed6b0e0f780d32829c0c3846087cd7a",
"score": "0.5296934",
"text": "def create\n @reqpriority = Reqpriority.new(reqpriority_params)\n\n respond_to do |format|\n if @reqpriority.save\n format.html { redirect_to @reqpriority, notice: 'Reqpriority was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reqpriority }\n else\n format.html { render action: 'new' }\n format.json { render json: @reqpriority.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "005503f0cb4af04a97c028430c10ccbb",
"score": "0.52943015",
"text": "def new\n @probe = Probe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @probe }\n end\n end",
"title": ""
},
{
"docid": "2fde5540cdb55f86a0273bd9831f881d",
"score": "0.5293027",
"text": "def new\n @product_range = ProductRange.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product_range }\n end\n end",
"title": ""
},
{
"docid": "cefb745137e1c2cc19a586112fd9e7d8",
"score": "0.5291222",
"text": "def new\n @condition_type = ConditionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @condition_type }\n end\n end",
"title": ""
},
{
"docid": "e0980bfe9f8801b394243a06a5fb9662",
"score": "0.5277421",
"text": "def new\n @podval = Podval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @podval }\n end\n end",
"title": ""
},
{
"docid": "2e8a7bb6e87f41fff586079f41d5b658",
"score": "0.5276197",
"text": "def new\n @ticket_type_group = TicketTypeGroup.new( :status => Status.active )\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket_type_group }\n end\n end",
"title": ""
},
{
"docid": "b0e8c00a078e858653bfc05b7596126d",
"score": "0.5274232",
"text": "def new\n @ppos_prerequisite = PposPrerequisite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end",
"title": ""
},
{
"docid": "1257636513eb54033b506ae223018e11",
"score": "0.52669454",
"text": "def destroy\n @prd_threshold = PrdThreshold.find(params[:id])\n @prd_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ac654019380b982a239d494ed1c049cf",
"score": "0.52662385",
"text": "def new\n @current_condition = CurrentCondition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_condition }\n end\n end",
"title": ""
},
{
"docid": "22ec6d15fa96ea35823893e85ff14346",
"score": "0.5262817",
"text": "def new\n @change = @priority.changes.new\n if @priority.has_change?\n flash[:error] = t('changes.new.already_proposed', :priority_name => @priority.change.new_priority.name)\n return\n end\n respond_to do |format|\n format.html # new.html.erb\n format.js {\n render :update do |page|\n page.select('#priority_' + @priority.id.to_s + '_change_form').each {|item| item.remove}\n page.insert_html :top, 'activities', render(:partial => \"new_inline\", :locals => {:change => @change, :priority => @priority})\n page['change_new_priority_name'].focus\n end \n } \n end\n end",
"title": ""
},
{
"docid": "d6db9e8610ac4c66fa1066cc8d7c9942",
"score": "0.52613986",
"text": "def new\n @lr70 = Lr70.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr70 }\n end\n end",
"title": ""
},
{
"docid": "987784140dd8e683f33bf9dbe1783fa0",
"score": "0.5261085",
"text": "def netdev_resxml_new( edit_xml )\n self.properties.each do |p| \n self.send(\"xml_change_#{p}\", edit_xml ) \n end\n end",
"title": ""
},
{
"docid": "4a38ea66a5aabc3ec2432ad90ef0575f",
"score": "0.526079",
"text": "def create\n @ppt_class = PptClass.new(params[:ppt_class])\n params[:ppt_class][:assigned_ppt_node_hq_server] ||= {}\n params[:ppt_class][:assigned_ppt_node_hq_vserver] ||= {}\n \n respond_to do |format|\n if @ppt_class.save\n flash[:notice] = 'Puppet Class was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @ppt_class, :status => :created, :location => @ppt_class }\n else\n messages = '<ul>Error:'\n @ppt_class.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @ppt_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b43d1152becde26d0ae5a63697498838",
"score": "0.5259975",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end",
"title": ""
},
{
"docid": "f92bf1d58dc436b1aa154a6890727d11",
"score": "0.5258947",
"text": "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"title": ""
},
{
"docid": "28aa703cfcf77dc5b874c43b1eaf2ebd",
"score": "0.52570325",
"text": "def new\n @price_rule = PriceRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price_rule }\n end\n end",
"title": ""
},
{
"docid": "87730b58e4d0ebc4ed7fdb1aa878d41a",
"score": "0.5255331",
"text": "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"title": ""
},
{
"docid": "87730b58e4d0ebc4ed7fdb1aa878d41a",
"score": "0.5255331",
"text": "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"title": ""
},
{
"docid": "87730b58e4d0ebc4ed7fdb1aa878d41a",
"score": "0.5255331",
"text": "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"title": ""
},
{
"docid": "7da2134bc4594eb7fa9eea51e45634ee",
"score": "0.52502996",
"text": "def new\n @trace = Trace.new(params[:trace])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end",
"title": ""
},
{
"docid": "486b69acb7a9678b04bd65a5e4aeb340",
"score": "0.5248218",
"text": "def new\n @trace = Trace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end",
"title": ""
},
{
"docid": "b275e9412b5ddb51519d621a105d1d45",
"score": "0.52475286",
"text": "def new\n @scale = Scale.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scale }\n end\n end",
"title": ""
},
{
"docid": "48e3b01eaca34db327faab928aebf66e",
"score": "0.5246746",
"text": "def new\n @ort = OtrunkReportTemplate.find(:all).map {|ort| [ort.name, ort.id]}\n @report.public = true\n @report.user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report }\n end\n end",
"title": ""
},
{
"docid": "f1df88e3ddb2985fe360b6bfb00d787c",
"score": "0.5246642",
"text": "def new\n @requirement_map = RequirementMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requirement_map }\n end\n end",
"title": ""
},
{
"docid": "0892426d60a18dd9d36d3d8f2f574a63",
"score": "0.524277",
"text": "def new\n @release_status = ReleaseStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @release_status }\n end\n end",
"title": ""
},
{
"docid": "c77e5997c87e2d3ac9f4c3ac8fec32ae",
"score": "0.52377594",
"text": "def new\n @print_job_status = PrintJobStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @print_job_status }\n end\n end",
"title": ""
},
{
"docid": "376dcfb0cb3b578bd5f31cdf2c0e3144",
"score": "0.52358985",
"text": "def create\n @ptbudget = Ptbudget.new(params[:ptbudget])\n\n respond_to do |format|\n if @ptbudget.save\n flash[:notice] = 'Ptbudget was successfully created.'\n format.html { redirect_to(@ptbudget) }\n format.xml { render :xml => @ptbudget, :status => :created, :location => @ptbudget }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ptbudget.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "75e513744dd23280aaffb8bd048503d5",
"score": "0.523036",
"text": "def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"title": ""
},
{
"docid": "86191d1fe4f78d1d8d840c182d4b6504",
"score": "0.52300066",
"text": "def new\n @pageview = Pageview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pageview }\n end\n end",
"title": ""
},
{
"docid": "b6b12f9a1df5c6ca5420128146977d53",
"score": "0.52285415",
"text": "def new\n @config_xml = ConfigXml.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @config_xml }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"title": ""
},
{
"docid": "afcfc8269e8222795f2bb9fe21dc838d",
"score": "0.52130246",
"text": "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"title": ""
},
{
"docid": "d13ea6efa82792587ddf5e8291a36761",
"score": "0.5204668",
"text": "def new\n @active_status = ActiveStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @active_status }\n end\n end",
"title": ""
},
{
"docid": "c96da2971879be341f67dda230498e8c",
"score": "0.5195073",
"text": "def create\n @task_priority = TaskPriority.new(task_priority_params)\n\n respond_to do |format|\n if @task_priority.save\n flash[:notice] = 'TaskPriority was successfully created.'\n format.html { redirect_to(@task_priority) }\n format.xml { render xml: @task_priority, status: :created, location: @task_priority }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @task_priority.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7abd4982c652a00f2b1a803841c35eec",
"score": "0.5191778",
"text": "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @badge }\n end\n end",
"title": ""
},
{
"docid": "f3343cc85d4c6f09efb9c1628336263a",
"score": "0.51908344",
"text": "def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end",
"title": ""
}
] |
1a36b23deb9b015a6e4cbdf12b7400b0
|
Gets all the values in the current row, column, and cell, and finds values from 1 to 9 that are not already included in the set
|
[
{
"docid": "9fdccef9dce85ba965de947b1ce6a5db",
"score": "0.7214551",
"text": "def possible_values(row, col)\n\t\t((1..9).to_a - (row_values(row) + col_values(col) + cell_values(row, col)).uniq)\n\tend",
"title": ""
}
] |
[
{
"docid": "0d861d1073ab572dbd9944d50e80b467",
"score": "0.7160862",
"text": "def find_possible_cell_numbers(row, col, sodoku)\n possible_nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n used_nums = []\n used_nums << find_row_numbers(row, sodoku)\n used_nums << find_col_numbers(col, sodoku)\n used_nums << find_box_numbers(row, col, sodoku)\n used_nums.flatten!.uniq!\n\n used_nums.each { |num| possible_nums.include?(num) ? possible_nums.delete(num) : nil }\n\n return possible_nums\nend",
"title": ""
},
{
"docid": "c960101e347a01126e6fb3031f2f28ec",
"score": "0.6945784",
"text": "def find_potential_cells\n cells_to_check = Array.new(@cells)\n @cells.each do |c|\n neighbors = cells_neighbors c\n neighbors.each do |n|\n cells_to_check << n\n end\n end\n cells_to_check.uniq\n end",
"title": ""
},
{
"docid": "a9af5801bdb6dd2542e992821616411a",
"score": "0.6734182",
"text": "def available_values\n if value\n Set[]\n else\n @cell_lists.inject(SudokuSolver::VALIDSET) do |result, cellList|\n result - cellList.values\n end\n end\n end",
"title": ""
},
{
"docid": "add27b67f7785250a8089d3cade909e9",
"score": "0.6685678",
"text": "def unique_cells; end",
"title": ""
},
{
"docid": "cf887a51c05d91808e0764d81ea0c9d6",
"score": "0.6632693",
"text": "def possible_locations\n success = false\n sets = [:row,:column,:square]\n nums = (1..9).to_a\n sets.each do |set|\n nums.each do |num|\n cells = get_cells set, num\n solved_values = get_values cells\n unsolved_values = nums - solved_values\n # check if any values only have one possible cell\n unsolved_values.each do |val|\n possible_cells = cells.select {|cell| val.in? cell.possibilities}\n if possible_cells.length == 1\n possible_cells[0].possibilities = [val]\n success = true\n end\n end\n end\n end\n success\n end",
"title": ""
},
{
"docid": "7d7c913f0f8fa3d601700d20a97f78cc",
"score": "0.6554982",
"text": "def candidates\n possible_candidates = []\n @neighbour_cells.flatten.each{ |cell|\n possible_candidates << cell.value \n }\n existing_candidates = (1..9).to_a - possible_candidates.uniq\n end",
"title": ""
},
{
"docid": "4cb6b7ddc7a3d5434698622e50179900",
"score": "0.65537584",
"text": "def possible\n\t\t@cells.inject(Set.new) { |row_set, cell|\n\t\t\trow_set.merge(cell.possible)\n\t\t}\n\tend",
"title": ""
},
{
"docid": "1766b5debc13e8f094df87195bc69da8",
"score": "0.6539356",
"text": "def valid_numbers(r,c, board)\n numbers = Set.new((1..board.length).to_a)\n\n #Check Row\n (0..board[0].length - 1).each do |col|\n if board[r][col] != 0\n numbers.delete board[r][col]\n end\n end\n\n #Check Column\n if !numbers.empty?\n (0..board.length - 1).each do |row|\n if board[row][c] != 0\n numbers.delete board[row][c]\n end\n end\n end\n\n #Check Grid\n if !numbers.empty?\n region_size = Math.sqrt(board.length).to_i\n\n r_multiplier = (r / 3)\n c_multiplier = (c / 3)\n (0...region_size).each do |row|\n (0...region_size).each do |col|\n if board[row + (r_multiplier * region_size) ][col + (c_multiplier * region_size)] != 0\n numbers.delete board[row + (r_multiplier * region_size) ][col + (c_multiplier * region_size)]\n end\n end\n end\n\n end\n\n numbers.to_a\nend",
"title": ""
},
{
"docid": "ee8e3bf2e897e698c8efdbc124839b12",
"score": "0.6476459",
"text": "def scan_row!(candidates, puzzle)\n (0..8).each do |row|\n (0..8).each do |col|\n candidates[\"#{row},#{col}\"].delete_if{|value| puzzle[row].include?(value)} unless candidates[\"#{row},#{col}\"] == nil\n end\n end\n candidates\nend",
"title": ""
},
{
"docid": "7e7d9dd0faecfc9cddcca07c8de519bb",
"score": "0.6473898",
"text": "def get_possible_numbers(x,y)\n numbers = (1..9).to_a\n if @rows[x][y] != 0\n return false\n else\n for digit in @rows[x] do \n # if digit.integer?\n repeated = digit\n # end\n numbers.delete(repeated)\n end\n for col_digit in (0..8) do\n # byebug\n if numbers.include?(@rows[col_digit][y])\n numbers.delete(@rows[col_digit][y])\n # byebug\n else nil\n end\n end\n end\n row_start = (x/3)*3\n col_start = (y/3)*3\n small_board = @rows[row_start..(row_start+3)]\n small_board.each_with_index do |row, index|\n small_board[index] = row[col_start..(col_start+3)]\n end\n small_board.each do |row|\n row.each do |col|\n numbers.delete(col)\n end\n end\n return numbers\n end",
"title": ""
},
{
"docid": "2742c870826bdc81878639caeddc7e47",
"score": "0.6376518",
"text": "def get_possibilities(row, col)\n possibilities = get_row_values(row) + get_col_values(col) + get_box_values(row,col)\n (1..9).to_a - possibilities.uniq\n end",
"title": ""
},
{
"docid": "61068fa9f895d85522e45addd84c7131",
"score": "0.63702595",
"text": "def unassigned_cells\n\t\tto_a.reject { |cell| cell.number }\n\tend",
"title": ""
},
{
"docid": "9a8498f695ce04e782c096d15fc1fb26",
"score": "0.6352252",
"text": "def exclude_preset_numbers\n @grid.each do |filled_cell|\n next unless filled_cell.filled?\n\n pos = filled_cell.pos\n\n full_exclude(pos, filled_cell.to_i)\n end\n end",
"title": ""
},
{
"docid": "68bd76e71808e00bf6486d56da9cdd2e",
"score": "0.63322115",
"text": "def cells_for_value(value)\n Set[*@cells.select { |cell| cell.available_values.include?(value) }]\n end",
"title": ""
},
{
"docid": "94999c0c47709e5420d680921002a853",
"score": "0.6309203",
"text": "def unassigned_cells\n to_a.reject { |cell| cell.number }\n end",
"title": ""
},
{
"docid": "b9832c2d7f06f8823b82889468d654b8",
"score": "0.63044757",
"text": "def available_cells(col = 0, row = 0)\n cells = @cells.each_index.select { |i| @cells[i].nil? }\n cells &= column_elements(col) if col.positive?\n cells &= row_elements(row) if row.positive?\n cells\n end",
"title": ""
},
{
"docid": "bd1dae53fbf40c05ecf6e4b0f68a8ca2",
"score": "0.62459886",
"text": "def find_cells\n for col in 0..@board_size - 1\n for row in 0..@board_size - 1\n @current = @board[col][row]\n @neighbors = check_neighbors(@board, col, row)\n if @current.zero? && @neighbors == 3\n @board[col][row] = 1\n elsif @current == 1 && (@neighbors < 2 || @neighbors > 3)\n @board[col][row] = 0\n else\n @board[col][row] = @current\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d6d0c945173f43408e45a30a76e27fe1",
"score": "0.62231135",
"text": "def clear(row, col)\n cell_check = [[row, col],\n [row+1, col],\n [row-1, col],\n [row, col+1],\n [row, col-1],\n [row+1, col+1],\n [row-1, col-1],\n [row-1, col+1],\n [row+1, col-1]]\n\n\n cell_check.each do |cell|\n if adjacent_mines(cell[0],cell[1]) == 0 && !contains_mine?(cell[0], cell[1])\n return cleared_cells << [cell[0], cell[1]]\n elsif adjacent_mines(cell[0],cell[1]) > 0 && !contains_mine?(cell[0], cell[1])\n return cleared_cells << [cell[0], cell[1]]\n end\n\n if cell[0] < @row_count\n clear(cell[0], cell[1])\n elsif cell[1] < @column_count\n clear(cell[0], cell[1])\n end\n end\n\n # cell_check.each do |cell|\n # if cell[0] > @row_count\n # return cleared_cells\n # elsif cell[1] > @column_count\n # return cleared_cells\n # end\n #\n # if adjacent_mines(row, col) > 0\n # cleared_cells << [row, col]\n # return cleared_cells\n # elsif adjacent_mines(row, col) == 0\n # cleared_cells << [row, col]\n # return cleared_cells\n # end\n # end\n\n cleared_cells\n end",
"title": ""
},
{
"docid": "e98a85effdf0ee6a02ed1a5352baac44",
"score": "0.6216129",
"text": "def scan\n\n unchanged = false\n\n until unchanged\n unchanged = true # board is unchanged unless a cell is changed\n\n min_i = min_j = min_candidates = nil\n min_candidates_size = 10 # bigger than (1..9).size (i.e. the max size of feasible candidates)\n\n self.each_unknown do |i,j|\n\n\n candidates = candidates_for(i,j)\n\n # debug\n # puts \"Candidates for #{i}, #{j}: #{candidates.to_s}\"\n # puts \"row #{i}: #{row(i)}\"\n # puts \"col #{j}: #{column(j)}\"\n # debug_copy = self.clone\n # debug_copy.board[i][j] = 'X'\n # puts debug_copy.to_s\n # puts\n # puts\n\n case candidates.size\n when 0 # if there are no candidates for a given cell, the board is overconstrained\n raise Impossible # .. and thus it is impossible\n when 1 # if there is only one candidate, then it must be the value for that cell\n @board[i][j] = candidates.first # so replace the empty cell\n unchanged = false # and mark the board as changed so we can loop again and see if we can go on\n else # otherwise, there's more than 1 candidates\n # we store them for returning\n # but we only do so if we're not gonna loop again\n # and if the set of candidates is the smallest at this board stage\n if unchanged && (candidates.size < min_candidates_size)\n min_candidates_size = candidates.size\n min_i = i\n min_j = j\n min_candidates = candidates\n end\n end\n end\n end\n\n # return the cell coordinates and the possible candidates\n # this is the minimum set\n return min_i, min_j, min_candidates\n end",
"title": ""
},
{
"docid": "da161425b4d1dc4ad7e3b272f4e9ac3b",
"score": "0.62094504",
"text": "def unsolved_cells\n @rows.flatten.find_all {|c| not c.solved? }\n end",
"title": ""
},
{
"docid": "c6a9b101773b1389fd57163a1d29cf5e",
"score": "0.61897975",
"text": "def get_forbidden_values(cell_id, set)\n cell = @cells[cell_id]\n if set == :row\n set_num = cell.row\n elsif set == :column\n set_num = cell.column\n elsif set == :square\n set_num = cell.square\n else\n raise \"invalid :set\"\n end\n cells_in_set = get_cells(set, set_num)\n get_values(cells_in_set)\n end",
"title": ""
},
{
"docid": "c2effc0a2c576a6110541e9f96580162",
"score": "0.6139833",
"text": "def cell_possibilities row, col\n # Set subtraction FOOOO! It reeks elegance.\n return (AllDigits - (row_digits(row) + col_digits(col) + square_digits(row, col)))\n end",
"title": ""
},
{
"docid": "d52936fcebd4b5592577623355531f19",
"score": "0.61346",
"text": "def scan_col!(candidates, puzzle)\n (0..8).each do |row|\n (0..8).each do |col|\n candidates[\"#{row},#{col}\"].delete_if{|value| puzzle.transpose[col].include?(value)} unless candidates[\"#{row},#{col}\"] == nil\n end\n end\n candidates\nend",
"title": ""
},
{
"docid": "08027a70bd4f756339994d0033be2228",
"score": "0.6106041",
"text": "def actual_cells\n @cells.select {|c| !c.nil?}\n end",
"title": ""
},
{
"docid": "1b7d73f142cb2752b73eea041e1c62e9",
"score": "0.6095656",
"text": "def values\n Set[*@cells.collect { |cell| cell.value }]\n end",
"title": ""
},
{
"docid": "d85916257ea42db817d4d21f896305aa",
"score": "0.60894436",
"text": "def figure_out_cell_numbers\n @board.each do |row|\n row.each do |cell|\n cell.calculate_neighboring_mines(@board, @size)\n end\n end\n\n end",
"title": ""
},
{
"docid": "0a53718a4b5a8c4aba4984f8fef57926",
"score": "0.6077481",
"text": "def uniq_cols\n uniq_ints = (1..9).to_a \n (0..8).each do |col|\n cols = []\n (0..8).each do |row|\n cols << @grid[row][col].value \n end \n return false if cols.sum != 45\n return false if (cols.sort == uniq_ints) == false\n end\n \n return true \n end",
"title": ""
},
{
"docid": "78355f3465413a3e70c520adc08941e9",
"score": "0.60718",
"text": "def uniq_rows\n uniq_ints = (1..9).to_a\n @grid.each do |subArr| \n rows = []\n subArr.each do |tiles|\n rows << tiles.value\n end\n return false if rows.sum != 45\n return false if (rows.sort == uniq_ints) == false\n end \n \n return true \n end",
"title": ""
},
{
"docid": "e4893f3ad71bfb5e10ef4e9f0e9803f0",
"score": "0.60662097",
"text": "def check_free_positions\n solution_array = []\n @board.each_with_index do |x_array, y_iteration|\n x_array.each_with_index do |cell, x_iteration|\n solution_array.push([x_iteration, y_iteration]) if cell.nil?\n end\n end\n solution_array\n end",
"title": ""
},
{
"docid": "f1727105f00a49ae41f26729fb6beaa4",
"score": "0.60624325",
"text": "def determine_cells() @cells.select{ |cell| cell.determine? } end",
"title": ""
},
{
"docid": "2a02546796689af2c52e10525a3dd41d",
"score": "0.60436654",
"text": "def all_cells_cleared?\n (0..(row_count - 1)).each do |row|\n (0..(column_count - 1)).each do |column|\n cell = { row: row, column: column }\n return false unless @mines.include?(cell) || @cleared.include?(cell)\n end\n end\n true\n end",
"title": ""
},
{
"docid": "c0737a59ac03a3cf4da897316353c2df",
"score": "0.6037591",
"text": "def clear_adjacent_cells(row, col)\n \n cells = adjacent_cells(row, col)\n #puts \"Debug: cell: #{row}, #{col} is clearing adjacent_cells: #{cells.to_s}\"\n \n cells.each do |coord|\n\n # puts \"Debug: cell: #{coord[0]}, #{coord[1]} adjacent to #{row}, #{col} is being examined\"\n \n if @mined[coord[0]][coord[1]] == false\n\n #puts \"Debug: cell: #{coord[0]}, #{coord[1]} is being cleared\"\n\n @cleared[coord[0]][coord[1]] = true \n end\n end\n \n end",
"title": ""
},
{
"docid": "13a54b1d1d65a4d42f520ff39dbf6e13",
"score": "0.6023558",
"text": "def find_possible\n @sudoku.unsolved.each do |current|\n row = current.location/9\n column = current.location%9\n check = @sudoku.values_for_location(row, column)\n if check_array(check, current)\n return true\n end\n end\n end",
"title": ""
},
{
"docid": "1ddb336ff1b878b51846040eff2467c8",
"score": "0.6014381",
"text": "def find_basin_at(map, row, col)\n basin = Set.new\n flood_fill_basin(map, basin, row, col)\n basin\n end",
"title": ""
},
{
"docid": "6727902f9da96ae5faf5370b4da9c3ea",
"score": "0.6013938",
"text": "def find_empty_cell()\n\t$value_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tif col.to_i == 0\n\t\t\t\treturn [index_r,index_c]\n\t\t\tend\n\t\tend\n\tend\n\treturn [$N,$N]\nend",
"title": ""
},
{
"docid": "6727902f9da96ae5faf5370b4da9c3ea",
"score": "0.6013938",
"text": "def find_empty_cell()\n\t$value_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tif col.to_i == 0\n\t\t\t\treturn [index_r,index_c]\n\t\t\tend\n\t\tend\n\tend\n\treturn [$N,$N]\nend",
"title": ""
},
{
"docid": "7bec99f45bb2a1fb0aa95e7f89885e03",
"score": "0.5986936",
"text": "def all_cells_cleared?\n cleared_cells = true\n @minefield.each do |row|\n row.each do |column|\n if column.contains_mine?\n cleared_cells = false\n end\n end\n end\n cleared_cells\n end",
"title": ""
},
{
"docid": "83f88408d6daca28169e383f45c23c48",
"score": "0.5982268",
"text": "def numbers\n Set[*@cells.map { |c| c.number }.compact]\n end",
"title": ""
},
{
"docid": "480318781a0c0fba26e94551ecb8ec59",
"score": "0.59771883",
"text": "def cell_possibilities(index, board_array)\n cell_location_index_array= cell_location(index, board_array)\n solved_cell_index_array = cell_location_index_array.keep_if {|i| board_array[i] != \"-\"}\n\n solved_cell_values_array = []\n solved_cell_index_array.each do |i|\n solved_cell_values_array.push(board_array[i])\n end\n\n options = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n solved_cell_values_array.each do |value|\n options.delete_if{|number| number==value}\n end\n options\n end",
"title": ""
},
{
"docid": "354209ae0d562cf0cfe8aa7451f35d21",
"score": "0.59728074",
"text": "def all_cells_cleared?\n x_cordinates = (0...row_count)\n y_cordinates = (0...column_count)\n success = row_count * column_count - mine_count\n counter = 0\n x_cordinates.each do |x|\n y_cordinates.each do |y|\n if game_board[x][y] == 'x' && visible_board[x][y] == 'S'\n counter += 1\n if counter == success\n return true\n end\n end\n end\n end\n false\n end",
"title": ""
},
{
"docid": "9f3ef11a644751c45569fd32a7e03f42",
"score": "0.5969178",
"text": "def adjacent_mines(row, col)\n cell_check = [[row+1, col],\n [row-1, col],\n [row, col+1],\n [row, col-1],\n [row+1, col+1],\n [row-1, col-1],\n [row-1, col+1],\n [row+1, col-1]]\n\n count = 0\n cell_check.each do |cell|\n if contains_mine?(cell[0],cell[1])\n count +=1\n end\n end\n # clear_these.each do |clear_cell|\n # cleared_cells << [clear_cell]\n count\n\n end",
"title": ""
},
{
"docid": "25c95d6e39679438bbc4689938c8a9b8",
"score": "0.59682846",
"text": "def set_all_neighbor_cells_visible(row,col)\r\n #dont want to check cells that dont exist\r\n if (row<0) || (row>=@board_size)\r\n return\r\n end\r\n if (col<0) || (col>=@board_size)\r\n return\r\n end\r\n\r\n #if the cell is already visible, don't do anything to it\r\n if @board[row][col].visible == true\r\n return\r\n end\r\n\r\n @board[row][col].visible = true\r\n if @board[row][col].nbr_mines == 0\r\n set_all_neighbor_cells_visible((row-1), col) #check above\r\n set_all_neighbor_cells_visible(row, (col+1)) #check right\r\n set_all_neighbor_cells_visible(row, (col-1)) #check left\r\n set_all_neighbor_cells_visible((row+1), col) #check below\r\n end\r\n\r\n end",
"title": ""
},
{
"docid": "1b028d41ead1a6eb4fd75c06acc66fb7",
"score": "0.59643596",
"text": "def find_solved_cells(board, row, index)\n solved = []\n current_box = find_box(row, index)\n solved << get_row(board, row).select { |cell| cell.length == 1 }\n solved << get_column(board, index).select { |cell| cell.length == 1 }\n solved << get_box(board, current_box).select { |cell| cell.length == 1 }\n solved.flatten.uniq\nend",
"title": ""
},
{
"docid": "224a278657221f600c60c347fa4e509c",
"score": "0.59399176",
"text": "def generate_unmarked_neighbors\n [left, right, up, down].select do |pos|\n board.in_range?(pos) && moves_used.keys.none? { |used| used == pos } \n end\n end",
"title": ""
},
{
"docid": "816057cddd7aa89689656c57141e4eb4",
"score": "0.59348905",
"text": "def all_cells_cleared?\n cell_count = 0\n (0..@row_count).each do |row|\n (0..@col_count).each do |column|\n if cell_cleared?(row, column) || contains_bomb?(row, column)\n cell_count += 1\n end\n end\n end \n (row_count * col_count) == cell_count\n end",
"title": ""
},
{
"docid": "7d9f2ef9585f1d4ea819903ca0f88428",
"score": "0.5919219",
"text": "def pieces\n rows.flatten.reject { |piece| piece == sentinel}\n end",
"title": ""
},
{
"docid": "b4164e4fff1d5a01a47428948bae9120",
"score": "0.59155077",
"text": "def clear(row, col)\n @cleared << { row: row, column: col }\n return @cleared unless adjacent_mines(row, col) == 0\n adjacent_cells(row, col).each do |cell|\n next if cell[:row] > row_count || cell[:row] < 0\n next if cell[:column] > column_count || cell[:column] < 0\n next if @cleared.include?(cell)\n clear(cell[:row], cell[:column])\n end\n end",
"title": ""
},
{
"docid": "78f19f8796f3c0a6b86681c7cc6ee97c",
"score": "0.5911213",
"text": "def free_cells\r\n result = []\r\n @m.each_with_index do |c,row,col|\r\n next if c != :empty\r\n next if ship_around? row,col\r\n result << [row, col]\r\n end\r\n result\r\n end",
"title": ""
},
{
"docid": "2bb4076b2311819d11485708e8f5bb49",
"score": "0.59010524",
"text": "def potential_values(index)\n ## Check the cell's houses for values we can't be\n ## and eliminate them from the values that we can be.\n ## We are left with only a list of potential values.\n ##\n row_of_index = @puzzle.row(index_to_row(index))\n row_vals = non_blank_house_values_as_integers(row_of_index)\n\n col_of_index = @puzzle.column(index_to_col(index))\n col_vals = non_blank_house_values_as_integers(col_of_index)\n\n nonet_of_index = @puzzle.nonet(index_to_nonet(index))\n nonet_vals = non_blank_house_values_as_integers(nonet_of_index)\n\n # Merge the row, column and nonet values into a unique list.\n house_vals = (row_vals | col_vals | nonet_vals).uniq\n\n # Potential values for this cell are all the values that don't conflict\n # with the actual values of other cells in this cell's house.\n potential_vals = Puzzle::DECIMAL_VALUES - house_vals\n\n potential_vals.sort!\n end",
"title": ""
},
{
"docid": "c10b48a6f4439e15b2b68334a1272fae",
"score": "0.58937544",
"text": "def getRemainingValues\n return POSSIBLE_VALUES - @cells.map { |s| s.value }\n end",
"title": ""
},
{
"docid": "2dcf7299e3e27ae9e044fae1679ec4fa",
"score": "0.5882063",
"text": "def scan\n\n # scan scopes for numbers that appear as a possibility just once\n for num in 1..Board::MAX_VAL\n @board.scopes.each do |scope|\n cells = scope.select { |cell| cell.possible?(num) }\n if cells.size == 1\n cells.first.possibles = [num]\n end\n end\n end\n \n # scan scopes for pairs or triples\n @board.scopes.each do |scope|\n counts = {} # hash of [array of possible values] => [count]\n scope.each do |cell|\n p = cell.possibles\n next if p.size < 2\n counts[p] ||= 0\n counts[p] += 1\n end\n # only keep [1,2]x2, [4,6,8]x3, [1,2,6,9]x4, etc\n counts = counts.delete_if { |p, count| (p.size != count) }\n sets = counts.keys\n \n # eliminate the numbers if they appear outside the set\n sets.each do |set|\n scope.each do |cell|\n next if set == cell.possibles\n cell.possibles -= set\n end\n end\n end\n \n for num in (1..Board::MAX_VAL) do\n # scan rows for number appearing as a possibility in only one region\n @board.rows.each do |row|\n possible_cells = row.select { |cell| cell.possible?(num) }\n next if possible_cells.size < 2\n regions = possible_cells.map { |cell| cell.region }.uniq\n if (regions.size == 1)\n # remove num from all other cells in the region\n @board.cells_in_region(regions.first).each do |cell|\n cell.eliminate(num) unless row.include?(cell)\n end\n end\n end\n\n # scan columns for number appearing as a possibility in only one region\n @board.cols.each do |col|\n possible_cells = col.select { |cell| cell.possible?(num) }\n next if possible_cells.size < 2\n regions = possible_cells.map { |cell| cell.region }.uniq\n if (regions.size == 1)\n # remove num from all other cells in the region\n @board.cells_in_region(regions.first).each do |cell|\n cell.eliminate(num) unless col.include?(cell)\n end\n end\n end\n end\n\n # solve cells which have only one remaining possibility\n @board.cells.each do |cell|\n if cell.possibles.size == 1\n @board[cell.row,cell.col] = cell.possibles.first\n return cell\n end\n end\n\n # stuck!\n return nil\n end",
"title": ""
},
{
"docid": "6c840f0ad9aadc0764206696b585810b",
"score": "0.5877846",
"text": "def next_cell_set(value, row, column)\n new_row = (row*@amount_column + column + 1) / @amount_column\n new_column = (row*@amount_column + column + 1) % @amount_column\n\n @logic.matrix.set(new_row, new_column, value)\n run_recursion(new_row, new_column)\n @logic.matrix.set(new_row, new_column, 0)\n end",
"title": ""
},
{
"docid": "6455cf389d3d7ed87b250c8bbe6e4ed7",
"score": "0.5874932",
"text": "def free_positions\n\t\t\t(1..9).select {|position| @board[position].is_a? Integer}\n\t\tend",
"title": ""
},
{
"docid": "fd6401712f5a95415aab354c0a605c26",
"score": "0.5869825",
"text": "def removeAll(game)\n board = game[0]\n selected = game[2]\n coords = selected[0]\n y = coords[0]\n x = coords[1]\n val = board[y][x]\n count = 500\n (0..9).each do |i|\n (0..9).each do |j|\n if board[i][j] == val\n board[i][j] = 0\n count = count + 100\n end\n end\n end\n return [board,game[1],[],0,game[4],game[5]+count]\nend",
"title": ""
},
{
"docid": "5bb057016a2216076f5f8d440b6dcce4",
"score": "0.5868243",
"text": "def all_cells_cleared?\n if @mine_count == @uncleared_count\n return true\n end\n false\n end",
"title": ""
},
{
"docid": "df4d556fe3eabdd2aa26740de0ffc28a",
"score": "0.58607906",
"text": "def all_cells_cleared?\n @cleared.each do |array|\n if array.include?(false)\n return false\n end\n end\n true\n end",
"title": ""
},
{
"docid": "baf578ac54b7709d4014ad1901deaf49",
"score": "0.58593106",
"text": "def checkrow(i)\n\t\tchanged = false\n\t\tset = Hash.new\n\t\t9.times do |j|\n\t\t\tif (@board[i][j].kind_of? Array) then\n\t\t\t\t@board[i][j].each do |e|\n\t\t\t\t\tif(set[e]) then\n\t\t\t\t\t\tset[e] << j\n\t\t\t\t\telse\n\t\t\t\t\t\tset[e] = [j]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tset.each do |k,v|\n\t\t\tif(v.length == 1) then\n\t\t\t\tfoundsolution(i,v[0],k)\n\t\t\t\tchanged = true\n\t\t\tend\n\t\tend\n\t\treturn changed\n\tend",
"title": ""
},
{
"docid": "2144fd7e79d6906223a7aac173fb0c28",
"score": "0.58568305",
"text": "def get_cells(set, set_num)\n if set == :row\n ids_in_set = ((set_num-1)*9..set_num*9-1).to_a\n elsif set == :column\n ids_in_set = (set_num-1..80).step(9).to_a\n elsif set == :square\n square_row = (set_num + 2) / 3\n square_column = (set_num + 2) % 3\n # x is the top leftmost cell in the square\n x = (square_row - 1) * 27 + (square_column * 3)\n ids_in_set = (x..x+2).to_a + (x+9..x+11).to_a + (x+18..x+20).to_a\n else\n raise \"invalid :set\"\n end\n ids_in_set.map {|i| @cells[i]}\n end",
"title": ""
},
{
"docid": "10c2ac09d09b28d9bd0a3b0bc7783084",
"score": "0.5855715",
"text": "def digits_not_in_column(puzzle, column)\n complete_row - puzzle.map{ |row| row[column] }\nend",
"title": ""
},
{
"docid": "a1ea37d0c8be54fc3d4773d1763b4748",
"score": "0.58514136",
"text": "def set_all_cell_adjacent_mines\n @board.each_with_index do |row, row_index|\n @board[row_index].each_with_index do |column, column_index|\n set_cell_adjacent_mines(row_index,column_index)\n end\n end\n end",
"title": ""
},
{
"docid": "9e2c52317ad0b61646754ec3f16d4444",
"score": "0.58506006",
"text": "def possibleVals(row_index, column_index, used = [])\n # podívám se co může být v řádku, co může být ve spouci a co může být ve čtverci a udělám průsečík\n # row\n rowAry = rowVals(row_index, column_index)\n colAry = colVals(row_index, column_index)\n sqrAry = squareVals(row_index, column_index)\n\n # udělám průnik polí\n vals = (rowAry & colAry & sqrAry)\n vals -= used\n vals\n end",
"title": ""
},
{
"docid": "09ca7347afff489169c3d5a47c8c59c6",
"score": "0.58486503",
"text": "def uniqueLocalCells(board, x, y, xblks, yblks)\n\t\tcells=Array.new();\n\n\n\t\t#collumn cells\n\t\tfor posY in 0...board[0].length()\n\t\t\tcellUniqueness=true;\n\t\t\tif cells.length()>0\n\t\t\t\tcells.each do |currentCell|\n\t\t\t\t\tif currentCell[:x]==x and currentCell[:y]==posY\n\t\t\t\t\t\tcellUniqueness=false;\n\t\t\t\t\t\t#break;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif cellUniqueness#add it if it is unique\n\t\t\t\tnewCellEntry=Array.new(1);\n\t\t\t\tif board[x][posY].is_a?(Array)\n\t\t\t\t\tnewCellEntry[0]={:x=>x, :y=>posY, :values=>board[x][posY].dup()};\n\t\t\t\telse\n\t\t\t\t\tnewCellEntry[0]={:x=>x, :y=>posY, :values=>board[x][posY]};\n\t\t\t\tend\n\t\t\t\tcells.concat(newCellEntry);\n\t\t\tend\n\t\tend\n\n\t\t#row cells\n\t\tfor posX in 0...board.length()\n\t\t\tcellUniqueness=true;\n\t\t\tif cells.length()>0\n\t\t\t\tcells.each do |currentCell|\n\t\t\t\t\tif currentCell[:x]==posX and currentCell[:y]==y\n\t\t\t\t\t\tcellUniqueness=false;\n\t\t\t\t\t\t#break;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif cellUniqueness#add it if it is unique\n\t\t\t\tnewCellEntry=Array.new(1);\n\t\t\t\tif board[posX][y].is_a?(Array)\n\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>y, :values=>board[posX][y].dup()};\n\t\t\t\telse\n\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>y, :values=>board[posX][y]};\n\t\t\t\tend\n\t\t\t\tcells.concat(newCellEntry);\n\t\t\tend\n\t\tend\n\n\n\n\n\n\t\t#block group cells\n\n\t\t#TODO: figure out size of block groups in general (square root of width and height?) and finish this section\n\t\tblockXsize=Math.sqrt(board.length());\n\t\tblockYsize=Math.sqrt(board[0].length()); # x = 3 y = 2 6\n\t\tblockXsize=(board.length()/xblks).floor(); #Xsize = 6/3 = 2\n\t\tblockYsize=(board[0].length()/yblks).floor();\t# 6/2 = 3\n\t\t#blockXsize = xblks\n\t\t#blockYsize = yblks\n\t\tblockXnumber=(x/blockXsize).floor();\n\t\tblockYnumber=(y/blockYsize).floor();\n\t\txStartingPos=(blockXnumber*blockXsize).floor();#index starts at 0\n\t\tyStartingPos=(blockYnumber*blockYsize).floor();\n\n\t\tfor posX in xStartingPos...(xStartingPos+blockXsize)\n\t\t\tfor posY in yStartingPos...(yStartingPos+blockYsize)\n\t\t\tcellUniqueness=true;\n\t\t\t\tif cells.length()>0\n\t\t\t\t\tcells.each do |currentCell|\n\t\t\t\t\t\tif currentCell[:x]==posX and currentCell[:y]==posY\n\t\t\t\t\t\t\tcellUniqueness=false;\n\t\t\t\t\t\t\t#break;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif cellUniqueness#add it if it is unique\n\t\t\t\t\tnewCellEntry=Array.new();\n\t\t\t\t\tif board[posX][posY].is_a?(Array)\n\t\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>posY, :values=>board[posX][posY].dup()};\n\t\t\t\t\telse\n\t\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>posY, :values=>board[posX][posY]};\n\t\t\t\t\tend\n\t\t\t\t\tcells.concat(newCellEntry);\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn cells;\n\tend",
"title": ""
},
{
"docid": "739ef3c84dc07da78e056153b07909b3",
"score": "0.5837718",
"text": "def possible_positions(width)\n arr = prevent_overlap\n sets = collect_sets(arr, width)\n sets.reject!{|set| set.include?(nil)}\n return sets\n end",
"title": ""
},
{
"docid": "832794244fc5d765bcd79f439dfba94b",
"score": "0.5835922",
"text": "def related_cells\n @related_cells ||= begin\n cells = @board.cells_in_row(row)\n cells += @board.cells_in_col(col)\n cells += @board.cells_in_region(region)\n cells.delete(self)\n cells.uniq\n end\n end",
"title": ""
},
{
"docid": "1bd1a796e5749fbc5a74c4af77e1b519",
"score": "0.5826954",
"text": "def scan_board\n find_empty_cells.each { |coord| return true if calculate_cell([coord.first, coord.last]) }\n false\n end",
"title": ""
},
{
"docid": "81e387eca771d0b63d656d74498ccdf0",
"score": "0.5822551",
"text": "def all_cells_cleared?\n total_cells = row_count * column_count\n cells_cleared = 0\n field.each_with_index do |row,r_i|\n row.each_with_index do |col,c_i|\n if field[r_i][c_i] != MINE\n if (field[r_i][c_i] < 0)\n cells_cleared += 1\n end\n end\n end\n end\n cells_cleared + 38 == total_cells ? (return true) : (return false)\n end",
"title": ""
},
{
"docid": "1d9e8f86af040fde4451f1c4225af1eb",
"score": "0.5819395",
"text": "def all_cells_cleared?\n all_cleared = true\n @minefield.each do |row|\n if row.include?(1)\n all_cleared = false\n end\n end\n all_cleared\n end",
"title": ""
},
{
"docid": "94d1fb9db07149561afabb453d8b21dc",
"score": "0.5813528",
"text": "def remove_illogical_values(board, row, index)\n solved = find_solved_cells(board, row, index)\n board[row][index].delete_if do |num|\n solved.include?(num)\n end\nend",
"title": ""
},
{
"docid": "0323d4cb6655edbfe79a47be9cc77580",
"score": "0.57931924",
"text": "def candidates grid\n\t\t# grid = get_grid_from grid_object\n\t\tneighbours_values = get_values_of_neighbours_from grid\n\t\t(1..9).to_a - neighbours_values\n\tend",
"title": ""
},
{
"docid": "50dd1ae2405c706a7c77ecba7eb8de0a",
"score": "0.5792005",
"text": "def adjust_possibles(cell) \n\t\trow(cell.x).cells.each { |c|\n\t\t\tc.remove_possible(cell.value)\n\t\t}\n\t\tcolumn(cell.y).cells.each { |c|\n\t\t\tc.remove_possible(cell.value)\n\t\t}\n\t\tbox_for(cell.x, cell.y).cells.each { |c|\n\t\t\tc.remove_possible(cell.value)\n\t\t}\n\tend",
"title": ""
},
{
"docid": "e527edb44e1f65faf02b8537feff2a8c",
"score": "0.57870305",
"text": "def candidate_cells\n # Create a new Set of keys that will be returned\n cell_keys = Set.new\n\n # Iterate over all cell keys known to the current board\n @board.keys.each do |cell_key|\n # Ask if this cell is alive\n if alive?(cell_key)\n # Include this cell because it's currently alive\n cell_keys << cell_key\n\n # And also any neighbor cells (alive or dead)\n # which might either stay alive or come alive\n cell_keys += neighbor_cells(cell_key)\n end\n end\n\n # Return the set of keys\n cell_keys\n end",
"title": ""
},
{
"docid": "8e369ba8923c47e4aea4184b7ca82ce6",
"score": "0.5782514",
"text": "def revise_cell_neighbours\n\t\t#Go through each cell and make its index available\n\t\tcells.each_with_index do |cell, index|\n\t\t\t# Return an array, by using slice to find the range between the start and end of the row.\n\t\t\tcell.neighbours += cells.slice(index - index % 9, 9)\n\t\t\t# cell.neighbours += cells.drop(index % 9).each_slice(9).map(&:first)\n\t\t\t# cell.neighbours += neighbours_in_box_at(index)\n\t\t\tremove_self_and_duplicate_neighbours_for(cell)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c3aafa84dc11bea2e06e87e35ba46e85",
"score": "0.5781156",
"text": "def valid_sudoku(table)\n set = Set.new()\n \n x = 0\n y = 0\n \n while x < 9\n while y < 9\n if table[x][y] != \".\"\n char = (table[x][y]).to_s\n \n if !set.add?(char + \" in row \" + x.to_s) || \n !set.add?(char + \" in column \" + y.to_s) || \n !set.add?(char + \" in square \" + (x/3).to_s + \",\" + (y/3).to_s)\n return false\n end\n \n end\n \n y+=1\n end\n y = 0\n x+=1\n end\n return true\n \nend",
"title": ""
},
{
"docid": "992f0228644fa06ba60f93be11496216",
"score": "0.5780717",
"text": "def possible_values\n Set['1','2','3','4','5','6','7','8','9'] - values\n end",
"title": ""
},
{
"docid": "7910ae911a62bd15708914bb35a361e8",
"score": "0.57800215",
"text": "def mine_locations\n mine_array = []\n until mine_array.length == 9\n row = (1..9).to_a.sample\n column = (1..9).to_a.sample\n unless mine_array.include?([row,column])\n mine_array << [row, column]\n end\n end\n mine_array\n end",
"title": ""
},
{
"docid": "55bd89f4a4c471c5cf2f8d625f2b5ba5",
"score": "0.57777137",
"text": "def check_for_matches\n values = @grid.flatten\n values.each_with_index do |value, i|\n ((i+1)...values.length).each do |j|\n return value if values[j] == value && !@matches.include?(value)\n end\n end\n\n nil\n end",
"title": ""
},
{
"docid": "3ce765ad78c757f881ffc97b7125e03d",
"score": "0.5772569",
"text": "def remove_not_fillable\n each { |cell| cell.neighbors.empty.each(&:cannot_be_filled) if cell == cell.neighbors.filled }\n end",
"title": ""
},
{
"docid": "66c32cecc72af14c53c8ff330b4bcb7b",
"score": "0.5766646",
"text": "def locked_candidates_1\n\n\t\t# Look for locked candidates\n\t\t# these rely on values in other box's only appearing in\n\t\t# 1 column or row in a box\n\t\teach_box_range { |i_range, j_range|\n\t\t\t(1..9).each { |val|\n\t\t\t\t# the columns and rows these values appear in\n\t\t\t\t# if these == 1 then we have to investigate further\n\t\t\t\trows = []\n\t\t\t\tcolumns = []\n\t\t\t\ti_range.each{ |i|\n\t\t\t\t\tj_range.each {|j|\n\t\t\t\t\t\tif @grid[i][j].possibles.include?(val)\n\t\t\t\t\t\t\trows << i if !rows.include?(i)\n\t\t\t\t\t\t\tcolumns << j if !columns.include?(i)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif rows.length == 1\n\t\t\t\t\t# with the exception of cells in\n\t\t\t\t\t# this j_range, remove all val's\n\t\t\t\t\t# from the possibles of anything else\n\t\t\t\t\t# in this row\n\t\t\t\t\ti = rows[0]\n\t\t\t\t\t@grid[i].each_index { |j|\n\t\t\t\t\t\tif !(j_range === j)\n\t\t\t\t\t\t\tp \"removed locked candidate 1 (\"+i.to_s+\", \"+j.to_s+\" = \"+val.to_s+\")\"\n\t\t\t\t\t\t\t@grid[i][j].remove_possible(val)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t\tif columns.length == 1\n\t\t\t\t\t# same as before but for cols\n\t\t\t\t\tj = columns[0]\n\t\t\t\t\t9.times { |i|\n\t\t\t\t\t\tif !(i_range === i)\n\t\t\t\t\t\t\tp \"removed locked candidate 1 (\"+i.to_s+\", \"+j.to_s+\" = \"+val.to_s+\")\"\n\t\t\t\t\t\t\t@grid[i][j].remove_possible(val)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\tend",
"title": ""
},
{
"docid": "a97db3d48f71f7a6c229184eef70ece1",
"score": "0.57596624",
"text": "def possible_numbers_for_cell(i,j)\n return [] if @board[j][i] != '-'\n possible_numbers = []\n (1..9).each do |x|\n num = x.to_s\n subsquare = is_possible_in_subsquare(i,j,num)\n row = is_possible_in_row(i,j,num)\n column = is_possible_in_column(i,j,num)\n possible_numbers << x if subsquare && row && column\n end\n possible_numbers\n end",
"title": ""
},
{
"docid": "ec4cb28b64ce0b2d578dd478956411f0",
"score": "0.5751632",
"text": "def eight_queens(row=0, columns=(0..7).to_a, valid_pos = {},queens = [])\n return [queens] if queens.length == 8\n result = []\n columns.each do |col|\n pos = [row, col]\n temp_valid_pos = valid_pos.clone\n temp_queens = queens.clone\n temp_columns = columns.clone\n if temp_queens.all? {|queen_pos|(queen_pos[0].abs - pos[0].abs).abs != (queen_pos[1] - pos[1].abs).abs}\n temp_queens.push(pos)\n temp_columns.delete(col)\n new_queens = eight_queens(row+1, temp_columns, temp_valid_pos, temp_queens)\n result += new_queens unless new_queens.empty?\n end\n end\n result.uniq\nend",
"title": ""
},
{
"docid": "4f2a7521edb8f784d7a38ea5746d2f61",
"score": "0.5741409",
"text": "def find_box_numbers(row, col, sodoku)\n used_nums = []\n\n row_box = (row / 3) * 3\n col_box = (col / 3) * 3\n\n (row_box..row_box + 2).each do |row|\n (col_box..col_box + 2).each do |col|\n cell = sodoku[row][col]\n if cell != 0 && cell.class == Fixnum\n used_nums << cell\n end\n end\n end\n return used_nums\nend",
"title": ""
},
{
"docid": "b5f64bfee3d4a8739249167a8c5b232d",
"score": "0.57412875",
"text": "def candidates_for(i, j)\n n = box_for_cell(i, j)\n (1..9).to_a - (row(i) + column(j) + box(n))\n end",
"title": ""
},
{
"docid": "cf57011d086f337e5616880534b4b19d",
"score": "0.57393605",
"text": "def victory_entry(marker)\n x_cells = cells.each_index.select { |i| cells[i] == marker }\n x_cells_set = x_cells.to_set\n get_victory_entries.each do |entry|\n entry_set = entry.to_set\n if (entry_set.subset? x_cells_set)\n return x_cells\n end\n end\n\n false\n end",
"title": ""
},
{
"docid": "231299932d00a3c87fff527dcce25365",
"score": "0.5736378",
"text": "def all_cells_cleared?\n clear = true\n while clear == true\n @gameboard.grid.each do |row|\n row.spaces_array.each do |space|\n if space.mine == false && space.state == :clicked\n clear = true\n else\n clear = false\n end\n end\n end\n end\n clear\n end",
"title": ""
},
{
"docid": "19990bf6afd478f870dedb5a050cdf80",
"score": "0.5735805",
"text": "def row_check(puzzle)\n puzzle.map { |row|\n find_missing(row)\n }\nend",
"title": ""
},
{
"docid": "da41fbe00c1757c628d1c0186de94908",
"score": "0.5733108",
"text": "def fill_exact_neighbors\n each { |cell| cell.neighbors.each(&:fill) if cell == cell.neighbors.fillable }\n end",
"title": ""
},
{
"docid": "8f2f1958ab7e4d3c410ccd220d63b6df",
"score": "0.5732358",
"text": "def find_pair(unit)\n # Build a hash with a key that is the candidate set for a cell and a value that is an\n # array of cells with the equal sets.\n h = {}\n unit.foreach_cell do |cell|\n key = cell.candidates\n if h.include? key\n h[key] << cell\n else\n h[key] = [ cell ]\n end\n end\n\n # Next, scan the hash looking first for candidate sets containing only 2 candidates\n # and then check the array associated with the set to see if it contains exactly 2\n # cells. If so, for each candidate in the set, mark all cells in the unit except those\n # in the array.\n h.each_pair do | candidate_set, cell_ary |\n if candidate_set.size == 2 && cell_ary.size == 2 \n candidate_set.each { |value| unit.mark_except(value, cell_ary) }\n end\n end\n\n # Follow this with a scan of the unit for cells with one candidate and add those to\n # the queue.\n unit.scan_for_cells_to_fix()\n end",
"title": ""
},
{
"docid": "25c856ef4711c48be7d2bf09710bcb35",
"score": "0.5726264",
"text": "def all_cells_cleared?\n @minefield.each_with_index do |row,ri|\n row.each_with_index do |col,ci|\n if cell_cleared?(ri,ci) == false && @minefield[ri][ci].value == 0\n return false\n end\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "77a30f5622e15c5f60133ae261ae82a1",
"score": "0.5713782",
"text": "def uniq_sq()\n uniq_ints = (1..9).to_a \n (0..8).each do |i|\n x = (i / 3) * 3\n y = (i % 3) * 3\n sq = []\n (x...x + 3).each do |row|\n (y...y + 3).each do |col|\n sq << @grid[row][col].value\n end\n end\n return false if sq.sum != 45\n return false if (sq.sort == uniq_ints) == false\n end\n\n return true \n end",
"title": ""
},
{
"docid": "20c9b8325399cbaacafaa230816c4fdd",
"score": "0.57040274",
"text": "def win_values\n new_grid = grid.each { |e| e.map { |cell| cell = cell.value } }\n return new_grid\n end",
"title": ""
},
{
"docid": "689f2f9183ed5ebdc0d5bbef33daa402",
"score": "0.5699246",
"text": "def remove_identical_array_numbers(row, col, sodoku)\n cell = sodoku[row][col]\n compare_row_arrays(row, col, cell, sodoku)\n compare_col_arrays(col, cell, sodoku)\n compare_box_arrays(row, col, cell, sodoku)\nend",
"title": ""
},
{
"docid": "ba8d38408a5550cee11f4e0c2f8ed0a5",
"score": "0.56867015",
"text": "def all_cells_cleared?\n total_open_cells = @column_count * @row_count - @mine_count\n @clear_locations.length == total_open_cells\n end",
"title": ""
},
{
"docid": "a5b70617b25915b726775174121fc7a3",
"score": "0.56843436",
"text": "def resolve_cell(cell) \n return if cell.value\n box_cells = boxes[cell.box]\n row_cells = rows[cell.y]\n col_cells = columns[cell.x]\n other_cell_values = Set.new(box_cells.map(&:value) + row_cells.map(&:value) + col_cells.map(&:value)).delete nil\n cell.possible_values -= other_cell_values\n cell.value = cell.possible_values.first if cell.possible_values.size == 1\n cell\n end",
"title": ""
},
{
"docid": "af4a0b315e96fad343b3d13855c6d213",
"score": "0.56830156",
"text": "def each_box\n @sudoku.frequencies.each do |frequent|\n most_frequent = frequent[0]\n locations = @sudoku.value_boxes(most_frequent)\n [0, 3, 6].each do |row|\n [0, 3, 6].each do |column|\n next if locations.include?([row, column])\n box = @sudoku.box(row, column)\n unknowns = Array.new\n box.each do |box_item|\n if box_item.unknown?\n if box_item.value.include?(most_frequent)\n unknowns << box_item\n end\n end\n end\n if unknowns.length == 1\n unknowns.first.value = most_frequent\n unknowns.first.possible = [most_frequent]\n @sudoku.update_frequency(most_frequent)\n puts \"Conclusive at [#{unknowns.first.location/9}, #{unknowns.first.location%9}] using #{most_frequent} EB\" unless @quiet\n unless remove_solved(unknowns.first, most_frequent)\n return\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "09e57043c33c0b8300e9a93248b1b120",
"score": "0.5681774",
"text": "def clear_nonambiguous()\n\t\t$LOG.debug(\"clearing some cells...\") if $LOG\n\n\t\ttimes_solved = nil\n\t\tgood_number = nil\n\t\tcell = nil\n\t\tavailable_cells = @cells.dup\n\t\tbegin\n\t\t\tsrand\n\t\t\tbegin\n\t\t\t\tcell = available_cells[rand(available_cells.size)]\n\t\t\tend until cell.number\n\t\t\tavailable_cells.delete(cell)\n\t\t\t$LOG.debug(\"\\tchose cell #{cell.name}, number #{cell.number}\") if $LOG\n\n\t\t\tgood_number = cell.number\n\t\t\tcell.number = 0\n\t\t\tan = cell.available_numbers\n\t\t\t$LOG.debug(\"\\tCell #{cell.name}, available numbers now: #{an.to_a.join(', ')}\") if $LOG\n\n\t\t\ttimes_solved = 0\n\t\t\tan.each do |test_n|\n\t\t\t\tcell.number = test_n \n\t\t\t\tif(!stuck?)\n\t\t\t\t\ttimes_solved += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif(times_solved > 1)\n\t\t\t\tcell.number = good_number\n\t\t\telse\n\t\t\t\tcell.number = 0\n\t\t\tend\n\t\tend until available_cells.empty?\n\t\treturn @cells.count {|c| c.number}\n\tend",
"title": ""
},
{
"docid": "2599b645b9ee66b0cc00498a45c082f9",
"score": "0.5672545",
"text": "def all_cells_cleared?\n row_count.times do |row|\n column_count.times do |col|\n return false if !cell_cleared?(row, col) && !contains_mine?(row, col)\n end\n end\n true\n end",
"title": ""
},
{
"docid": "8ea7fbb81274c2fde95ae998bce0e715",
"score": "0.56720936",
"text": "def find_empty\n empty = []\n @grid.each_with_index do |cell, n|\n \t\tif cell == \"white\" then\n \t\t\tempty << n\n end\n end\n \tempty\n end",
"title": ""
},
{
"docid": "d7c55707a1ac71a8d2b9dfd062688cfa",
"score": "0.56699073",
"text": "def remaining_uncleared_squares\n coords = []\n @game_board.flat_map.with_index do |row, row_index|\n row.each_index.select {|i| row[i] == \"-\" || row[i] == @flag }.map do |col_index|\n coords << [row_index, col_index]\n end\n end\n coords\n end",
"title": ""
},
{
"docid": "09a39503ff42595e03646c0dea071976",
"score": "0.5666409",
"text": "def remove_rows_with_1_item!\n # select cells that have row neighbours\n old_length = length\n select! { |cell| has_row_neighbours?(cell) }\n old_length != length\n end",
"title": ""
},
{
"docid": "f3fddb660fa9f747477b1b978f01bd19",
"score": "0.5661381",
"text": "def all_cells_cleared?\n if @cleared_cells.length == (@row_count * @column_count) - @mine_count\n true\n else\n false\n end\n end",
"title": ""
}
] |
7abffa4e3264e2eabffbb6e1d03ec45b
|
DELETE /tipos_examenes/1 DELETE /tipos_examenes/1.xml
|
[
{
"docid": "e5a9028186170b45d3ab08bb12ffea26",
"score": "0.69900274",
"text": "def destroy\n @tipo_examen = TipoExamen.find(params[:id])\n @tipo_examen.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_examenes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
}
] |
[
{
"docid": "3812fc48120dcd3d5ab0f4830e033c81",
"score": "0.6807479",
"text": "def destroy\n @tipos = Tipo.find(params[:id])\n @tipos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b55fdd903e99c35327c5940cfa183c10",
"score": "0.6771522",
"text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c0c756bd72f14c8dcdf109bd420628ae",
"score": "0.6771155",
"text": "def destroy\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "417708a1aead0a7dc5f8bc0d3f0efb84",
"score": "0.6714848",
"text": "def destroy\n @tipos_subsidio = TiposSubsidio.find(params[:id])\n @tipos_subsidio.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_subsidios_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c97affe11824c34c5c4f42c8519bfa3d",
"score": "0.67035866",
"text": "def destroy\n @tipo_de_expediente = TipoDeExpediente.find(params[:id])\n @tipo_de_expediente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_expedientes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1ebeafaeaa1ba097b9243a10d762c996",
"score": "0.6683497",
"text": "def destroy\n @examquestion = Examquestion.find(params[:id])\n @examquestion.destroy\n\n respond_to do |format|\n format.html { redirect_to(examquestions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8263296fa6fb0fd857c13676378c9fed",
"score": "0.6654456",
"text": "def destroy\n @tipo_osexterna = TipoOsexterna.find(params[:id])\n @tipo_osexterna.destroy\n\n respond_to do |format|\n format.html { redirect_to(new_tipo_osexterna_path) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "67d7b793ac10999889b873c2b7e5f21b",
"score": "0.66459477",
"text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy rescue flash[:notice] = 'No se puede borrar el examen'\n\n respond_to do |format|\n format.html { redirect_to(signature_part_exams_url(@signature, @part)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e3905b9576b1ecc28336a4d1567da52d",
"score": "0.6644707",
"text": "def destroy\n @tipoespacio = Tipoespacio.find(params[:id])\n @tipoespacio.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipoespacios_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f841090dfce543f5a4d35b788015512f",
"score": "0.6641881",
"text": "def destroy\n @examtemplate = Examtemplate.find(params[:id])\n @examtemplate.destroy\n\n respond_to do |format|\n format.html { redirect_to(examtemplates_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e20dd753200c0e73177b3e7683283704",
"score": "0.6614494",
"text": "def destroy\n @exam_question = ExamQuestion.find(params[:id])\n @exam_question.destroy\n\n respond_to do |format|\n format.html { redirect_to(exam_questions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "dcddaf314d728bdf631c8e5e74ffb3a7",
"score": "0.66045076",
"text": "def destroy\n @exemplo = Exemplo.find(params[:id])\n @exemplo.destroy\n\n respond_to do |format|\n format.html { redirect_to(exemplos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e5399a2cb826177e41dc3b9d16f562e1",
"score": "0.6602916",
"text": "def destroy\n @xpath = Xpath.find(params[:id])\n @xpath.destroy\n set_site\n respond_to do |format|\n flash[:notice]=\"Field has been removed.\"\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bdc8b783c50ff576981f4c70ca6e0430",
"score": "0.65907353",
"text": "def destroy\n @episodio = get_by_numero(params[:id])\n @episodio.destroy\n\n respond_to do |format|\n format.html { redirect_to(episodios_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "630ec871b800c96835931a72c28edd60",
"score": "0.6590714",
"text": "def destroy\n @examanalysis = Examanalysis.find(params[:id])\n @examanalysis.destroy\n\n respond_to do |format|\n format.html { redirect_to(examanalyses_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7c6e23b5257c55e3104ad8eaf40c9ca1",
"score": "0.6590234",
"text": "def destroy\n @tiposactosdocumento = Tiposactosdocumento.find(params[:id])\n @tiposactosdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposactosdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "212a49d65bd3b52f248773843a9f4884",
"score": "0.6581756",
"text": "def destroy\n @tiposcaracteristica = Tiposcaracteristica.find(params[:id])\n @tiposcaracteristica.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposcaracteristicas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "524c40cc3a29f86726000d44b7d6f829",
"score": "0.6574082",
"text": "def destroy\n @etiqueta = Etiqueta.find(params[:id])\n @etiqueta.destroy\n\n respond_to do |format|\n format.html { redirect_to(etiquetas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "df26116eb86dbadafed7137f9e3c2f9e",
"score": "0.6574017",
"text": "def delete!\r\n return nil unless exists? \r\n xml = xml_at_top\r\n par = xml.instance_variable_get(:@parent) \r\n par['delete'] = 'delete'\r\n xml_on_delete( xml )\r\n rsp = write_xml_config!( xml.doc.root )\r\n @has[:_exist] = false\r\n true # rsp ... don't return XML, but let's hear from the community...\r\n end",
"title": ""
},
{
"docid": "9db77723091cc68ce4fc63e75986714c",
"score": "0.6567281",
"text": "def destroy\n @tconexion = Tconexion.find(params[:id])\n @tconexion.destroy\n\n respond_to do |format|\n format.html { redirect_to(tconexions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e400d7718513cc041c930f36ae9597ad",
"score": "0.65665644",
"text": "def destroy\n @tipocuenta = Tipocuenta.find(params[:id])\n @tipocuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipocuentas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b965aa2e76649b84623ed925811f4794",
"score": "0.65589386",
"text": "def delete(_path)\n end",
"title": ""
},
{
"docid": "4100b1ba27a9a751bb11d54b45e1aeb1",
"score": "0.6546796",
"text": "def delete(path);end",
"title": ""
},
{
"docid": "4100b1ba27a9a751bb11d54b45e1aeb1",
"score": "0.6546796",
"text": "def delete(path);end",
"title": ""
},
{
"docid": "5ccc2947f5ee20031807fa3c14702c72",
"score": "0.652738",
"text": "def destroy\n @etiquetum = Etiquetum.find(params[:id])\n @etiquetum.destroy\n\n respond_to do |format|\n format.html { redirect_to(etiqueta_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ca7ab708202f5436fabee495e00268ed",
"score": "0.6521276",
"text": "def destroy\n @tipo_consulta = TipoConsulta.find(params[:id])\n @tipo_consulta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_consultas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "716140e77187b6811beb68015073780e",
"score": "0.6514798",
"text": "def destroy\n @estagiario = Estagiario.find(params[:id])\n @estagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(estagiarios_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "452aaaf51b5dee74298f223a8d3756fa",
"score": "0.65146446",
"text": "def destroy\n @tipo_contenido = TipoContenido.find(params[:id])\n @tipo_contenido.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contenidos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2fa56996c5341a966606e4988b55e0c2",
"score": "0.65145856",
"text": "def destroy\n @tipostramite = Tipostramite.find(params[:id])\n @tipostramite.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipostramites_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8f8bbb7e1845500ea7dd2f8874a6a7de",
"score": "0.65137815",
"text": "def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to(testes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "075d3ab9110068ff2eafed8ab0b8a2b1",
"score": "0.65089756",
"text": "def destroy\n @tipo_suelo = TipoSuelo.find(params[:id])\n @tipo_suelo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_suelos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3369bcd289df04abd637e7b798703940",
"score": "0.6506276",
"text": "def destroy\n @referencia = Referencia.find(params[:id])\n @referencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(referencias_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6590f617b71e84f910190401ab0eb319",
"score": "0.65016",
"text": "def test_delete\n\n put_toto_doc\n\n doc = @s.get('errors', 'toto')\n\n r = @s.delete(doc)\n\n assert_equal nil, r\n\n doc = @s.get('errors', 'toto')\n\n assert_equal nil, doc\n end",
"title": ""
},
{
"docid": "6052abc0e9611c9960ecc15d6250209d",
"score": "0.6496349",
"text": "def destroy\n @estagiarios = Estagiario.find(params[:id])\n @estagiarios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6638cd9f2ca6224feb4bd23b975c843a",
"score": "0.6485434",
"text": "def destroy\n @tipo_elemento = TipoElemento.find(params[:id])\n @tipo_elemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_elementos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "864af646e38d331c9ac565eeb8a6fc6f",
"score": "0.64819497",
"text": "def destroy\n @examanswer = Examanswer.find(params[:id])\n @examanswer.destroy\n\n respond_to do |format|\n format.html { redirect_to(examanswers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b9d1a5dc5c944dfdef016c342183e812",
"score": "0.6473871",
"text": "def destroy\n @scrap_xml = ScrapXml.find(params[:id])\n @scrap_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(scrap_xmls_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4c8ba3339523269b9ccefa45f64b3a69",
"score": "0.64724237",
"text": "def destroy\n @child_dupa = ChildDupa.find(params[:id])\n @child_dupa.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "81ffd4c076cac3f8f3439bc34c4cf220",
"score": "0.6466214",
"text": "def destroy\n @exercicio = Exercicio.find(params[:id])\n @exercicio.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercicios_url, :flash => { :notice => 'Exercicio apagado.' }) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "67559ee500324b5d5fcd73442653cce1",
"score": "0.6464657",
"text": "def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_documentos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6eb907605515b8737ccbbdeb4b93b82e",
"score": "0.6461469",
"text": "def destroy\n @fichaselemento = Fichaselemento.find(params[:id])\n @fichaselemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(fichaselementos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "15b93eb5126f837e980812cc26be970b",
"score": "0.64551854",
"text": "def destroy\n @tiporesolucion = Tiporesolucion.find(params[:id])\n @tiporesolucion.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposresoluciones_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e4f16bf3c5d34df9cad72c96fbee3a99",
"score": "0.6452755",
"text": "def destroy\n @questionaire = Questionaire.find(params[:id])\n @questionaire.destroy\n\n respond_to do |format|\n format.html { redirect_to(questionaires_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2455503504603c8a93c1946d5d0093e8",
"score": "0.6450902",
"text": "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(exam_questions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "32432c8603163b5f195fc3da7a827611",
"score": "0.644857",
"text": "def destroy\n @tipo_contato = TipoContato.find(params[:id])\n @tipo_contato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contatos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "25b5402e76e1c2b743a95c4d20ec0f5f",
"score": "0.6444288",
"text": "def destroy\n @anexo = Anexo.find(params[:id])\n @anexo.destroy\n\n respond_to do |format|\n format.html { redirect_to(anexos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4120c4dd4e90fb2ee5e3ab4a4d3e5c54",
"score": "0.64387536",
"text": "def destroy\n @tipos_de_restaurante = TiposDeRestaurante.find(params[:id])\n @tipos_de_restaurante.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_restaurantes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "82b83610a4428e376f25649ecad78340",
"score": "0.64264405",
"text": "def destroy\n @proyectosficha = Proyectosficha.find(params[:id])\n @proyectosficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(proyectosfichas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "acdad7ff18c0837d48333bb64c414bbd",
"score": "0.6419161",
"text": "def destroy\n @idioma = Idioma.find(params[:id])\n @idioma.destroy\n\n respond_to do |format|\n format.html { redirect_to(idiomas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7ac9aee9040d83e69c6ad23151589ae3",
"score": "0.64175236",
"text": "def destroy\n @referencia_nivei = ReferenciaNivel.find(params[:id])\n @referencia_nivei.destroy\n\n respond_to do |format|\n format.html { redirect_to(referencia_niveis_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3feaeabdf61312a33502b61af2c19927",
"score": "0.64157945",
"text": "def destroy\n @assertion = Assertion.find(params[:id])\n @assertion.destroy\n\n respond_to do |format|\n format.html { redirect_to(assertions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a55ed8af98f03b2db3f52ec89ad8382c",
"score": "0.6415167",
"text": "def destroy\n @exam = Exam.find(params[:id])\n AdminLog.create(:admin_id=>session[:admin_id], :log=>\"Removed a exam -> \"+@exam.id.to_s)\n @exam.destroy\n \n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d5d934d23f998c6240f4d1b3cbdf140d",
"score": "0.6393766",
"text": "def destroy\n @track.xml_attachements.each do |xml|\n xml.uploaded_file.file.delete\n end\n @track.destroy\n respond_to do |format|\n format.html { redirect_to tracks_url, notice: 'Le tracé à été supprimé avec succès.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d9b15757e6343d53471f0d2d495a0a7c",
"score": "0.6393461",
"text": "def destroy\n @examen = Examen.find(params[:id])\n @examen.destroy\n\n respond_to do |format|\n format.html { redirect_to(examens_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6fae22bbf0138c8a9631406cacb724f8",
"score": "0.63921314",
"text": "def destroy\n @etapasproceso = Etapasproceso.find(params[:id])\n @etapasproceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(etapasprocesos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ebf30e2e4a92ef219bf6a6e335c18262",
"score": "0.638927",
"text": "def destroy\n @tiposacto = Tiposacto.find(params[:id])\n @tiposacto.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposactos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9af17857296d90b6da8e77d42c79f71d",
"score": "0.63888013",
"text": "def test_delete\n questionnaire6 = questionnaires(:questionnaire6)\n assert_not_nil(Questionnaire.find(@Questionnaire))\n assert_difference ('Questionnaire.count', difference = -1) do\n post :delete, :id => questionnaire6.id\n\n assert_nil flash[:error]\n assert_equal \"Questionnaire <B>questionnaire6</B> was deleted.\", flash[:note]\n assert_redirected_to :controller => 'tree_display', :action => :list\n end\n end",
"title": ""
},
{
"docid": "f67e1d438c545b51262360ac44a71fe7",
"score": "0.6379943",
"text": "def destroy\n @examresult = Examresult.find(params[:id])\n @examresult.destroy\n\n respond_to do |format|\n format.html { redirect_to(examresults_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6e118a52a44c697e7fc22c8c08fa262b",
"score": "0.63787174",
"text": "def destroy\n @testcase = Testcase.find(params[:id])\n TestcaseXref.delete_all(\"from_testcase_id=\"+params[:id]+\" || to_testcase_id=\"+params[:id])\n UserTestcaseXref.delete_all(\"testcase_id=\"+params[:id])\n TestcaseBugXref.delete_all(\"testcase_id=\"+params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4c49d6eb83f3c2758233599efca6c9b0",
"score": "0.63782114",
"text": "def destroy\n @tst1 = Tst1.find(params[:id])\n @tst1.destroy\n\n respond_to do |format|\n format.html { redirect_to(tst1s_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6b32e661ee4df662d0d753eeedcd953a",
"score": "0.6377929",
"text": "def destroy\r\n @asignacionexa = Asignacionlabexa.find(params[:id])\r\n @asignacionexa.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacionlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"title": ""
},
{
"docid": "faa9e5141e69d3a2d5a9188024e7b46f",
"score": "0.6375843",
"text": "def destroy\n @dependencia = Dependencia.find(params[:id])\n @dependencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(dependencias_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "50b015c6285763c3a4973f5501dd1473",
"score": "0.63740045",
"text": "def destroy\n @tipo_mant = TipoMant.find(params[:id])\n @tipo_mant.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_mants_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6414cf4ed396746de0af2ba6b2723604",
"score": "0.63709253",
"text": "def destroy\n @aetapa = Aetapa.find(params[:id])\n @aetapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(aetapas_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c01cf4cfb990d82ffe9fe7718cede2c7",
"score": "0.63707256",
"text": "def destroy\n @tipo_reconocimiento = TipoReconocimiento.find(params[:id])\n @tipo_reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_reconocimientos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bf5837b1899d603b35d6ef8f88afe23b",
"score": "0.6369011",
"text": "def destroy\n @econtrato = Econtrato.find(params[:id])\n @econtrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(econtratos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1c161b7b7afd8f1102e03b0014609a46",
"score": "0.6366529",
"text": "def destroy\n\n if (File.exist?(Rails.root.join('public', 'uploads/examinees/', @exam.persona_url.to_s)) && !@exam.persona_url.blank?)\n FileUtils.rm(Rails.root.join('public', 'uploads/examinees/', @exam.persona_url.to_s))\n end\n\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c4a5973881d5573fd3522c8dcdf37ad4",
"score": "0.6360596",
"text": "def destroy\n @equivalencia = Equivalencia.find(params[:id])\n @equivalencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(equivalencias_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "48079a2a0e81f5b230cbcab10eeec67e",
"score": "0.6358406",
"text": "def del\n @status1 = Status1.find(params[:id])\n @status1.destroy\n\n respond_to do |format|\n format.html { redirect_to(status1s_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4882c28002d871e29b1297626df2e39e",
"score": "0.6355515",
"text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to(questaos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "534e60873ce240167db69ffe68ab139b",
"score": "0.6352948",
"text": "def destroy\n @adjunto = Adjunto.find(params[:id])\n archivo = \"#{Rails.root}/app/assets/images/examenes/#{@adjunto.archivo}\"\n begin\n File.delete(archivo)\n flash[:mensaje] = \"Archivo Eliminado del sistema.\"\n @adjunto.destroy\n rescue Exception => e\n flash[:mensaje] = \"Error al intentar eliminar. #{e.message}\"\n end\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8c1cb0569792579c380f84354c35b26f",
"score": "0.6352347",
"text": "def destroy\n @excursion = Excursion.find(params[:id])\n @excursion.destroy\n\n respond_to do |format|\n format.html { redirect_to(excursions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "771827e302cbd3586e5c09a7fe4c83dd",
"score": "0.6346175",
"text": "def destroy\n @lexique = Lexique.find(params[:id])\n @lexique.destroy\n\n respond_to do |format|\n format.html { redirect_to(lexiques_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2a95905ae2e0a5439f31d55044fc61f5",
"score": "0.63461",
"text": "def destroy\n @exammark = Exammark.find(params[:id])\n @exammark.destroy\n\n respond_to do |format|\n format.html { redirect_to(exammarks_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2a95905ae2e0a5439f31d55044fc61f5",
"score": "0.63461",
"text": "def destroy\n @exammark = Exammark.find(params[:id])\n @exammark.destroy\n\n respond_to do |format|\n format.html { redirect_to(exammarks_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4ac0592812da86863b4954941a073482",
"score": "0.6345561",
"text": "def destroy\n @action = \"delete\"\n puts \"pase por aca destroy !\"\n @proyecto = Proyecto.find(params[:id])\n @proyecto.destroy\n\n respond_to do |format|\n format.html { redirect_to(proyectos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "22b4c24965b9b6b9b962155dcd68ccab",
"score": "0.634539",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n File.unlink(@exercise.path)\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ceabb5ef1ecc0edbe0acd9628fe6685",
"score": "0.632977",
"text": "def destroy\n @exam = current_user.organization.exams.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c68e5cdc9105fcefa909015a055ad7e7",
"score": "0.6327869",
"text": "def destroy\n @tconsumo = Tconsumo.find(params[:id])\n @tconsumo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tconsumos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8cf5eb7bc296bd5f7b1f7fa8851484ed",
"score": "0.63267905",
"text": "def destroy\n @tip = Tip.find(params[:id])\n @tip.destroy\n\n respond_to do |format|\n format.html { redirect_to(tips_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "822ddea2e45bf78350003645efcbdb54",
"score": "0.6325628",
"text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end",
"title": ""
},
{
"docid": "27602a53dfa7f31c7fcdc743b164b1ce",
"score": "0.63254803",
"text": "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d3352b389528ac994811152f9da4c786",
"score": "0.63251764",
"text": "def destroy\n @logotipo = Logotipo.find(params[:id])\n @logotipo.destroy\n\n respond_to do |format|\n format.html { redirect_to(logotipos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d1b9ad8050601355a8da90ade38a5846",
"score": "0.63206387",
"text": "def destroy\n @question = @test.questions.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b68f32584b8c74775ce424187b816d12",
"score": "0.63201225",
"text": "def destroy\n @correctivo = Correctivo.find(params[:id])\n @correctivo.destroy\n\n respond_to do |format|\n format.html { redirect_to(correctivos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5a27d07a1e62cf565fd001eb481cc207",
"score": "0.63160473",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercises_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5a27d07a1e62cf565fd001eb481cc207",
"score": "0.63160473",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercises_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5a27d07a1e62cf565fd001eb481cc207",
"score": "0.63160473",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercises_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5a27d07a1e62cf565fd001eb481cc207",
"score": "0.63160473",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercises_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "af353f1235b19efad06e38970d6cb856",
"score": "0.6313887",
"text": "def destroy\n @visitante = Visitante.find(params[:id])\n @visitante.destroy\n\n respond_to do |format|\n format.html { redirect_to(visitantes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8dd9e96ee2f53de4851bc13df74c86e5",
"score": "0.6313623",
"text": "def destroy\n @testimony = Testimony.find(params[:id])\n @testimony.destroy\n\n respond_to do |format|\n format.html { redirect_to(testimonies_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d2a9784c2007bed6c20af0af684e45b7",
"score": "0.6312951",
"text": "def destroy\n @efectivo = Efectivo.find(params[:id])\n @efectivo.destroy\n\n respond_to do |format|\n format.html { redirect_to(efectivos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ad86927f1fcde37e80086f508ce163d0",
"score": "0.63065064",
"text": "def destroy\n @exam = Exam.find(params[:id])\n @exam.delete\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "83ea55194c7607e8122afdf487d76601",
"score": "0.63006693",
"text": "def destroy\n @questao = Questao.find(params[:id])\n @questao.destroy\n\n respond_to do |format|\n format.html { redirect_to(questoes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8e36417662c96c13a32fe55b3cd5c5f3",
"score": "0.6298182",
"text": "def del\n @office1 = Office1.find(params[:id])\n @office1.destroy\n\n respond_to do |format|\n format.html { redirect_to(office1s_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3a268a41e0b6773d6632fc0c2fe55963",
"score": "0.62974745",
"text": "def destroy\n @roteiro = Roteiro.find(params[:id])\n @roteiro.destroy\n\n respond_to do |format|\n format.html { redirect_to(roteiros_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cef857471089b938c912e72f49ec42fc",
"score": "0.62850153",
"text": "def destroy\n @obrasproyecto = Obrasproyecto.find(params[:id])\n @obrasproyecto.destroy\n\n respond_to do |format|\n format.html { redirect_to(obrasproyectos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c1afbcea6ff7e0f401faecd9fbf637a6",
"score": "0.6284885",
"text": "def destroy\n @repuesto = Repuesto.find(params[:id])\n @repuesto.destroy\n\n respond_to do |format|\n format.html { redirect_to(repuestos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "731c5bd004359911ffb8162d5ccc124e",
"score": "0.62842435",
"text": "def destroy\n @solicitud_documento = SolicitudDocumento.find(params[:id])\n @solicitud_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitudes_documento_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "088a77089d2bcbcaa6402841ad591680",
"score": "0.62840986",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_exercises_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
}
] |
ed0f1f0d52b8bd01d7a225cb796dcd18
|
Creates a new view table from the given query.
|
[
{
"docid": "b404d473638c2d373f97fda7e555cf38",
"score": "0.82443726",
"text": "def create_view table_id, query, name: nil, description: nil\n options = { query: query, name: name, description: description }\n insert_table table_id, options\n end",
"title": ""
}
] |
[
{
"docid": "e0005a9dd43940720a5b3153a27fecff",
"score": "0.67507875",
"text": "def view(name)\n new_view = view_old(name)\n new_view.table_name = name\n new_view\n end",
"title": ""
},
{
"docid": "6285a0102bf56678f015ac4ab662a512",
"score": "0.65332705",
"text": "def create_view(name, source)\n source = source.sql if source.is_a?(Dataset)\n execute(\"CREATE VIEW #{name} AS #{source}\")\n end",
"title": ""
},
{
"docid": "3d2406d0bcc0a66495df221445b56a2b",
"score": "0.61092484",
"text": "def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"title": ""
},
{
"docid": "1f700cc48192b124c37f9a2a08f48b8f",
"score": "0.6089911",
"text": "def create_view_prefix_sql(name, options)\n create_view_sql_append_columns(\"CREATE #{'OR REPLACE 'if options[:replace]}VIEW #{quote_schema_table(name)}\", options[:columns])\n end",
"title": ""
},
{
"docid": "147e872f0faaa0696c9303e0d10e64f0",
"score": "0.6087505",
"text": "def do_query_view(view_name, view_options)\n database.view \"#{self.name.underscore}/#{view_name}\", view_options\n end",
"title": ""
},
{
"docid": "5d7b2ff2325117abd5611aa0cd946a14",
"score": "0.6074382",
"text": "def add_select_into_table(new_table_name, sql_query)\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\n end",
"title": ""
},
{
"docid": "57f5b0f068ca1e5f06ca338dcc1c07fd",
"score": "0.6033567",
"text": "def add_select_into_table(new_table_name, sql_query)\r\n sql_query.sub(/FROM/i, \"INTO #{new_table_name} FROM\")\r\n end",
"title": ""
},
{
"docid": "92fab898bf43e81cf509327dc28fb8fe",
"score": "0.6011032",
"text": "def create_view_prefix_sql(name, options)\n sql = create_view_sql_append_columns(\"CREATE #{'OR REPLACE 'if options[:replace]}#{'TEMPORARY 'if options[:temp]}#{'RECURSIVE ' if options[:recursive]}#{'MATERIALIZED ' if options[:materialized]}VIEW #{quote_schema_table(name)}\", options[:columns] || options[:recursive])\n\n if options[:security_invoker]\n sql += \" WITH (security_invoker)\"\n end\n\n if tablespace = options[:tablespace]\n sql += \" TABLESPACE #{quote_identifier(tablespace)}\"\n end\n\n sql\n end",
"title": ""
},
{
"docid": "0cbeaa73e2dc8537ed905cf3e3a83496",
"score": "0.598345",
"text": "def add_select_into_table(new_table_name, sql_query)\n \"CREATE TABLE #{new_table_name} \" + sql_query\n end",
"title": ""
},
{
"docid": "613a9ce3943e9ae320df8f3eccc1e964",
"score": "0.59688187",
"text": "def create_view(view_name, definition, options={})\n SchemaMonkey::Middleware::Migration::CreateView.start(connection: self, view_name: view_name, definition: definition, options: options) do |env|\n definition = env.definition\n view_name = env.view_name\n options = env.options\n definition = definition.to_sql if definition.respond_to? :to_sql\n\n if options[:materialized] && options[:allow_replace]\n raise ArgumentError, 'allow_replace is not supported for materialized views'\n end\n\n if options[:force]\n drop_view(view_name, {if_exists: true}.merge(options.slice(:materialized)))\n end\n\n command = if options[:materialized]\n \"CREATE MATERIALIZED\"\n elsif options[:allow_replace]\n \"CREATE OR REPLACE\"\n else\n \"CREATE\"\n end\n\n execute \"#{command} VIEW #{quote_table_name(view_name)} AS #{definition}\"\n end\n end",
"title": ""
},
{
"docid": "753fc8d1bc2e3f6539110b1432ac519e",
"score": "0.58643985",
"text": "def create_view(name, body = nil, force: false, **kwargs, &block)\n kwargs[:sqlite3] = !!(adapter_name =~ /sqlite/i)\n\n drop_view(name) if force && table_exists?(name)\n\n execute build_create_view_query(name, body, **kwargs, &block)\n end",
"title": ""
},
{
"docid": "a75224138d116e3b15555eb1c3f5d3a8",
"score": "0.5826751",
"text": "def write_view_definition(stream, table_schema, table_name, view_definition)\n stream << \" create_view \\\"#{table_schema}.#{table_name}\\\", <<-SQL\\n\" \\\n \" #{view_definition}\\n\" \\\n \" SQL\\n\"\n end",
"title": ""
},
{
"docid": "b0d27437a323c2e42e5410ab54627d13",
"score": "0.5802622",
"text": "def initialize(parent, new_query = {}, name = nil)\n if parent.is_a? Base\n raise \"Name must be provided for view to be initialized\" if name.nil?\n @name = name\n @database = parent.database\n @query = { :reduce => false }\n elsif parent.is_a? View\n @database = parent.database\n @query = parent.query.dup\n else\n raise \"View cannot be initialized without a parent Model or View\"\n end\n @query.update(new_query)\n super\n end",
"title": ""
},
{
"docid": "1b45d4f596086ef809cd727d8fc507a7",
"score": "0.57744235",
"text": "def new\n @query = Query.new\n new_edit\n end",
"title": ""
},
{
"docid": "e3df228fd33ee9fe51a8bae7dec1458e",
"score": "0.5748142",
"text": "def cd_id_table\n view_name = cd_id_table_tn\n if @cd_id_table_tn_exists.nil?\n @cd_id_table_tn_exists=true\n if !$db.table_exists?(view_name)\n $db.run(\"CREATE VIEW #{view_name} AS SELECT DISTINCT(r.canonical_document_id) FROM records r INNER JOIN records_searches br ON r.id=br.record_id INNER JOIN searches b ON br.search_id=b.id WHERE b.systematic_review_id=#{self[:id]} AND b.valid=1\n\n UNION\n\n SELECT DISTINCT r.canonical_document_id FROM searches b INNER JOIN records_searches br ON b.id=br.search_id INNER JOIN records_references rr ON br.record_id=rr.record_id INNER JOIN bib_references r ON rr.reference_id=r.id WHERE b.systematic_review_id=#{self[:id]} and r.canonical_document_id IS NOT NULL and b.valid=1 GROUP BY r.canonical_document_id\")\n end\n end\n $db[view_name.to_sym]\n end",
"title": ""
},
{
"docid": "c873602b219e40ec598bdb648c3e2f02",
"score": "0.57215697",
"text": "def tnTableCreation(tableName)\n pk_list = @pkList.join(',')\n pk_list = \"#{pk_list},branch_name,node_name\"\n q = QueryBuilder.create_tbl(tableName, pk_list, \"select #{@pkSelect}, 0 as test_id,''::varchar(30) as node_name, ''::varchar(30) as branch_name, ''::varchar(5) as type from #{@fTable} f where 1 = 0\")\n # pp q\n DBConn.exec(q)\n\n # q=\"ALTER TABLE #{tableName} add column test_id int, add column node_name varchar(30), add column branch_name varchar(30), add column type varchar(5);\"\n # DBConn.exec(q)\n # pk=@pkList.join(',')\n # # add index\n # q=\"create index ix_#{tableName}t on #{tableName} (#{pk},branch_name);\"\n # pp q\n # DBConn.exec(q)\n end",
"title": ""
},
{
"docid": "82672b2e123971a194518959145fe7fc",
"score": "0.5682369",
"text": "def create_materialized_view(name, body = nil, force: false, **kwargs, &block)\n supports_materialized_view!\n\n drop_materialized_view(name) if force && table_exists?(name)\n\n execute build_create_materialized_view_query(name, body, **kwargs, &block)\n end",
"title": ""
},
{
"docid": "4a7c82853f8f771799bbca594b777db0",
"score": "0.56496674",
"text": "def from_sql(db, query)\n require 'daru/io/sql_data_source'\n SqlDataSource.make_dataframe(db, query)\n end",
"title": ""
},
{
"docid": "4a7c82853f8f771799bbca594b777db0",
"score": "0.56496674",
"text": "def from_sql(db, query)\n require 'daru/io/sql_data_source'\n SqlDataSource.make_dataframe(db, query)\n end",
"title": ""
},
{
"docid": "d13cf7bb5c1083c97030fed08156c7b3",
"score": "0.5617474",
"text": "def create_view(name, source, options = OPTS)\n execute_ddl(create_view_sql(name, source, options))\n remove_cached_schema(name)\n nil\n end",
"title": ""
},
{
"docid": "9d6eb54ac566713c9412a95bf9e361b0",
"score": "0.56016123",
"text": "def create_or_replace_view(name, source)\n source = source.sql if source.is_a?(Dataset)\n execute(\"CREATE OR REPLACE VIEW #{name} AS #{source}\")\n end",
"title": ""
},
{
"docid": "522d54321354abb6076c2eba0d02e81a",
"score": "0.55729353",
"text": "def show_create_table(db, table)\n end",
"title": ""
},
{
"docid": "ab5e4e38eca36b5726f8b696a449c451",
"score": "0.5550609",
"text": "def recreate_view name\n view_structure = ActiveRecord::Base.connection.select_value(\"select definition from pg_views where viewname='#{name}'\")\n if view_structure\n execute \"DROP VIEW IF EXISTS #{name}\"\n execute \"CREATE VIEW #{name} AS #{view_structure};\"\n end\n end",
"title": ""
},
{
"docid": "7b50a8c37ec96ac721eef156bb9cf45c",
"score": "0.55243707",
"text": "def initialize(design_doc, parent, new_query = {}, name = nil)\n self.design_doc = design_doc\n\n # Extrace important non-regular query values\n proxy = new_query.delete(:proxy)\n delete = new_query.delete(:delete)\n\n if parent.is_a?(Class) && parent < CouchRest::Model::Base\n raise \"Name must be provided for view to be initialized\" if name.nil?\n self.model = (proxy || parent)\n self.owner = parent\n self.name = name.to_s\n # Default options:\n self.query = { }\n elsif parent.is_a?(self.class)\n self.model = (proxy || parent.model)\n self.owner = parent.owner\n self.name = parent.name\n self.query = parent.query.dup\n else\n raise \"View cannot be initialized without a parent Model or View\"\n end\n\n # Update the local query hash\n query.update(new_query)\n delete.each{|k| query.delete(k)} if delete\n\n super()\n end",
"title": ""
},
{
"docid": "605e00b23a4dd82dbb235474718418de",
"score": "0.5500927",
"text": "def initialize(query:, model: )\n @query = query\n @root = model.table_name\n end",
"title": ""
},
{
"docid": "62180caebc76f05b7acbdcae1da50fca",
"score": "0.544381",
"text": "def set_up_table_view\n self.table_view\n _table_view = self.create_table_view_from_data(self.table_data)\n adjusted_frame = self.view.bounds\n adjusted_frame.size.width = app_delegate.panels.leftVisibleWidth\n _table_view.frame = adjusted_frame\n self.view = UIView.new\n self.view.addSubview(_table_view)\n end",
"title": ""
},
{
"docid": "01fca760b934b7475a32c9adcbe38462",
"score": "0.544142",
"text": "def create(data_={})\n Table.new(self, data_)\n end",
"title": ""
},
{
"docid": "364ecc9a618e838a3980216b6962f546",
"score": "0.5421305",
"text": "def add_query_to_table\n @query = Search.create(:search => \"#{@search}\", :count => @count.to_i)\n end",
"title": ""
},
{
"docid": "95e090ee59aef675fb12aaa29e5098e1",
"score": "0.53766096",
"text": "def create_view_sql(name, source, options)\n source = source.sql if source.is_a?(Dataset)\n sql = String.new\n sql << \"#{create_view_prefix_sql(name, options)} AS #{source}\"\n if check = options[:check]\n sql << \" WITH#{' LOCAL' if check == :local} CHECK OPTION\"\n end\n sql\n end",
"title": ""
},
{
"docid": "77fe8ec8c9e6b0e64114cc22d5a0f595",
"score": "0.5352486",
"text": "def get_table(table_name)\n table = Table.new\n table.name = table_name\n table.reload\n table\n end",
"title": ""
},
{
"docid": "9acfefcbc129adffcb69f86403f10ee0",
"score": "0.5335455",
"text": "def create(structure_, data_={})\n Table.new(structure_, data_)\n end",
"title": ""
},
{
"docid": "7f1883dd9dbd57f1a3c854f9c537422e",
"score": "0.5314257",
"text": "def view name, query={}, &block\n unless design_doc_fresh\n refresh_design_doc\n end\n query[:raw] = true if query[:reduce] \n raw = query.delete(:raw)\n view_name = \"#{design_doc_slug}/#{name}\"\n fetch_view_with_docs(view_name, query, raw, &block)\n end",
"title": ""
},
{
"docid": "acdefc619775e54646b30227bb1544cf",
"score": "0.5293578",
"text": "def materialize_view(name, sql)\n unless @enduser\n raise Empire::MissingEnduserError.new\n end\n path = \"view/#{name}\"\n data = {'query' => sql}\n request path, :put, {}, data\n end",
"title": ""
},
{
"docid": "5d2a0220c42d9c258cea3c46d1e2d0b2",
"score": "0.5289498",
"text": "def view_table(db, table)\n db.execute(\"SELECT * FROM #{table}\")\nend",
"title": ""
},
{
"docid": "59e364477e8e5245d727b7faf67b1faf",
"score": "0.5261673",
"text": "def copy_vassal_view(view)\n # Copy this view to a new one. Both views needs to point to the same\n # buffer.\n new_view = CSTE::View.new(\n view.buffer, view.init_col, view.init_line, view.cols, view.lines)\n\n # This container is the lord of those views.\n view.lord = self\n new_view.lord = self\n\n return new_view\n end",
"title": ""
},
{
"docid": "437d1d3c21bf055223140a1d4179d4b3",
"score": "0.52470124",
"text": "def create_tbilisi_districts(month)\n vl_name = \"#{@year} #{month} voters list\"\n view_name = \"#{vl_name} - #{@shapes[:tbilisi_district]}\"\n @client.query(\"drop view if exists `#{view_name}`\")\n sql = \"create view `#{view_name}` as\n select `region` AS `region`,\n `district_id` AS `district_id`,\n `district_name` AS `district_name`,\n avg(`avg_age`) AS `avg_age`,\n sum(`greater_99`) AS `greater_99`,\n sum(`85_99`) AS `85_99`,\n sum(`less_than_85`) AS `less_than_85`,\n sum(`no_birthdate`) AS `no_birthdate`,\n sum(`total_voters`) AS `total_voters`,\n sum(`duplicates`) AS `duplicates`\n from `#{vl_name} - raw`\n where (`district_id` between 1 and 22)\n group by `region`, `district_id`, `district_name`\n order by `district_id`\"\n\n results = @client.query(sql)\nend",
"title": ""
},
{
"docid": "ffcdc6b28523298cb95a2ce017ea68e5",
"score": "0.52346706",
"text": "def make_table(options={})\n get_table(options).rows\n end",
"title": ""
},
{
"docid": "1f9f770752dc736b5205b0746543418f",
"score": "0.52161443",
"text": "def new\n find_database\n @query = @database.queries.new\n @resultset = nil\n @results_count = 0\n @table_row_counted_at = nil\n end",
"title": ""
},
{
"docid": "fde8ca7c40f6330dfcf06bb0ed19abcc",
"score": "0.5214648",
"text": "def create_display_table(title, headings, rows)\n Terminal::Table.new :title=> title, :headings => headings, :rows => rows\n end",
"title": ""
},
{
"docid": "4e804086adaca43c3b76122cae971ab2",
"score": "0.52097076",
"text": "def call(query)\n @query = query\n @conn, @adapter = choose_adapter(@dbh, @query)\n df_hash = result_hash\n Daru::DataFrame.new(df_hash).tap(&:update)\n end",
"title": ""
},
{
"docid": "b4a03f08518f6caf34da0bbc50b4f39a",
"score": "0.51800984",
"text": "def initialize(database, design_doc, view_name, view_options = {}, container_class = nil, query_type = :view)\n raise ArgumentError, \"database is a required parameter\" if database.nil?\n\n @database = database\n @container_class = container_class\n @query_type = query_type\n\n strip_pagination_options(view_options)\n @view_options = view_options\n\n if design_doc.class == Design\n @view_name = \"#{design_doc.name}/#{view_name}\"\n else\n @view_name = \"#{design_doc}/#{view_name}\"\n end\n end",
"title": ""
},
{
"docid": "a623c55e0f6ae9da48d72970bbe33f1b",
"score": "0.51658916",
"text": "def view_query(design_document_name, view_name, options = Options::View::DEFAULT)\n resp = @backend.document_view(@name, design_document_name, view_name, options.namespace, options.to_backend)\n ViewResult.new do |res|\n res.meta_data = ViewMetaData.new do |meta|\n meta.total_rows = resp[:meta][:total_rows]\n meta.debug_info = resp[:meta][:debug_info]\n end\n res.rows = resp[:rows].map do |entry|\n ViewRow.new do |row|\n row.id = entry[:id] if entry.key?(:id)\n row.key = JSON.parse(entry[:key])\n row.value = JSON.parse(entry[:value])\n end\n end\n end\n end",
"title": ""
},
{
"docid": "283e5b5d2cbe59ee1dc1e837e5fcf0f2",
"score": "0.51650894",
"text": "def initialize(view)\n @view = view\n @dt_params = DtParams.new view.params\n @column_key_options = ColumnKeyOptions.new columns, global_search_columns, predefined_ranges\n @preferences = Preferences.new preferences_holder, preferences_field, self.class.name\n\n # if @dt_params.dt_columns.size != @column_key_options.size\n # raise Error, \"dt_columns size of columns is #{@dt_params.dt_columns.size} \\\n # but column_key_options size is #{@column_key_options.size}\"\n # end\n end",
"title": ""
},
{
"docid": "f5c15f3e13fb2cd75758556c765ed1e0",
"score": "0.51584035",
"text": "def write_foods_view()\n puts <<SQL\nDROP VIEW IF EXISTS foods;\n\nCREATE VIEW foods AS\nSELECT food_description.id, food_description.description,\n nutrient_data.nutrient_value AS kcal,\n food_group.description AS food_group,\n food_description.refuse_percentage, food_description.refuse_description\n FROM food_description, nutrient_definition, nutrient_data, food_group\n WHERE food_description.id = nutrient_data.food_id\n AND food_group.id = food_description.food_group_id\n AND nutrient_definition.id = nutrient_data.nutrient_id\n AND nutrient_definition.id = '208'\n AND food_group.id NOT IN ('0300', '2100', '2200', '3600');\nSQL\nend",
"title": ""
},
{
"docid": "f6b3ca2f79a9b3803c8cd93c9dd66a20",
"score": "0.51429397",
"text": "def get_table instance_id, table_id, view: nil\n tables.get_table name: table_path(instance_id, table_id), view: view\n end",
"title": ""
},
{
"docid": "252f0b5338d08cf3a98884e2c068237a",
"score": "0.514184",
"text": "def create_table(table)\n db_client.query(\"SHOW CREATE TABLE #{table['name']}\").first['Create Table'] + ';'\n end",
"title": ""
},
{
"docid": "6bfaa485e1482db75397dfea6ed16ad7",
"score": "0.51337886",
"text": "def create_view(name, opts = {})\n Designs::View.define_and_create(self, name, opts)\n end",
"title": ""
},
{
"docid": "f4c750c26258ab15f6fdedfaf6dce3ab",
"score": "0.5111351",
"text": "def initialize(view)\n @view = view\n end",
"title": ""
},
{
"docid": "3827345557e669b4ce901f4d54cb7ee0",
"score": "0.51099646",
"text": "def initialize(view)\n @view = view\n end",
"title": ""
},
{
"docid": "3f8bdf8ade1fc463d71ee2f9de9b3bdd",
"score": "0.51064587",
"text": "def views(stream)\n # Don't create \"system\" views.\n view_names = PgSaurus::Tools.views\n view_names.each do |options|\n write_view_definition(stream,\n options[\"table_schema\"],\n options[\"table_name\"],\n options[\"view_definition\"])\n end\n stream << \"\\n\"\n end",
"title": ""
},
{
"docid": "16a676f86bbde7f0c6b5e34d4fe2c777",
"score": "0.5103104",
"text": "def initialize(view)\n @view = view\n end",
"title": ""
},
{
"docid": "90f50e099d99a8f036ff92c04f903519",
"score": "0.5092861",
"text": "def create_view(db)\n begin\n db.get('_design/todos')\n rescue RestClient::ResourceNotFound => nfe\n db.save_doc({\n \"_id\" => \"_design/todos\",\n :views => {\n :allTodos => {\n :reduce => \"_count\",\n :map => \"function(doc){if(doc.name != null){emit(doc.order,{name: doc.name})}}\"\n }\n }\n })\n end\n end",
"title": ""
},
{
"docid": "0f75cbe9cda472e4075becc85cbe6253",
"score": "0.50834095",
"text": "def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f75cbe9cda472e4075becc85cbe6253",
"score": "0.50834095",
"text": "def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f75cbe9cda472e4075becc85cbe6253",
"score": "0.5082669",
"text": "def create\n @query = Query.new(query_params)\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render :show, status: :created, location: @query }\n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02820cecf73c9098a88bc3091e9a4f64",
"score": "0.507309",
"text": "def create_view(view_name, map_function, reduce_function = nil)\n design_doc = database.get \"_design/#{self.name.underscore}\" rescue nil\n if design_doc\n design_doc[\"views\"][view_name] = {:map => map_function, :reduce => reduce_function}\n else\n design_doc = {\n \"_id\" => \"_design/#{self.name.underscore}\",\n :views => {\n view_name => {\n :map => map_function,\n :reduce => reduce_function\n }\n }\n }\n end\n database.save(design_doc)\n end",
"title": ""
},
{
"docid": "5f3b1c6c5a9f4b40569d208d91610e06",
"score": "0.50718236",
"text": "def initialize(query)\n @query = query\n end",
"title": ""
},
{
"docid": "7954eae216504e80ffdcae6d620d61da",
"score": "0.5061293",
"text": "def reload! view: nil\n view ||= :SCHEMA_VIEW\n @grpc = service.get_table instance_id, name, view: view\n @loaded_views = Set[view]\n self\n end",
"title": ""
},
{
"docid": "4fa24d2d5faf1a5dd318affca18c891b",
"score": "0.5059725",
"text": "def createProjectTable\n @Handle.execute( @ProjectSchema ) \n end",
"title": ""
},
{
"docid": "c1f55c61184808912b5fa9860a3ebdee",
"score": "0.50589913",
"text": "def make_query(query)\n puppetdb_client = Puppet.lookup(:bolt_pdb_client)\n # Bolt executor not expected when invoked from apply block\n executor = Puppet.lookup(:bolt_executor) { nil }\n executor&.report_function_call(self.class.name)\n\n puppetdb_client.make_query(query)\n end",
"title": ""
},
{
"docid": "db5c3843e8e51710b11ce01be6844be7",
"score": "0.50446373",
"text": "def get_table instance_id, table_id, view: nil\n execute do\n tables.get_table(\n table_path(instance_id, table_id),\n view: view\n )\n end\n end",
"title": ""
},
{
"docid": "64dbc749c9426bbebf2844dc21726397",
"score": "0.5034224",
"text": "def table(table)\n self.query.table = table\n self\n end",
"title": ""
},
{
"docid": "6f3235a545384985948d08bb49526208",
"score": "0.5030489",
"text": "def create\n @table = Table.new\n @table.user_id = current_user.id\n @table.name = params[:name] if params[:name]\n @table.description = params[:description] if params[:description]\n @table.the_geom_type = params[:the_geom_type] if params[:the_geom_type]\n @table.force_schema = params[:schema] if params[:schema]\n @table.tags = params[:tags] if params[:tags]\n @table.import_from_query = params[:from_query] if params[:from_query]\n\n if @table.valid? && @table.save\n @table = Table.fetch(\"select *, array_to_string(array(select tags.name from tags where tags.table_id = user_tables.id),',') as tags_names\n from user_tables\n where id=?\",@table.id).first\n render_jsonp(@table.public_values, 200, { :location => table_path(@table) })\n else\n CartoDB::Logger.info \"Error on tables#create\", @table.errors.full_messages\n render_jsonp( { :description => @table.errors.full_messages,\n :stack => @table.errors.full_messages\n }, 400)\n end\n end",
"title": ""
},
{
"docid": "ad5ddc8e7ca6a2f743398fa8822873e3",
"score": "0.5029671",
"text": "def create\n @query = Query.new(params[:query])\n\n respond_to do |format|\n if @query.save\n run_query\n @results = @query.results\n \n flash[:notice] = 'Query was successfully created.'\n format.html { redirect_to(@query) }\n format.xml { render :xml => @query, :status => :created, :location => @query }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e44bc366f6733afb2d37fb40bd800f50",
"score": "0.5027352",
"text": "def create_table(create_table_options = {})\n self.connection.create_table(table_name, create_table_options) do |t|\n t.column :undone, :boolean, :default => false, :null => false\n t.column :description, :string\n t.column :updated_at, :timestamp\n end\n end",
"title": ""
},
{
"docid": "e98e99fc1ed17e9c29e5f1a6cd95a83c",
"score": "0.49907804",
"text": "def create_table!(*args, &block)\n drop_table(model.table_name)\n create_table(*args, &block)\n end",
"title": ""
},
{
"docid": "d7c216cfbac43c39c7b22210a79cc0c1",
"score": "0.4987449",
"text": "def create_tbilisi_precincts(month)\n vl_name = \"#{@year} #{month} voters list\"\n view_name = \"#{vl_name} - #{@shapes[:tbilisi_precinct]}\"\n @client.query(\"drop view if exists `#{view_name}`\")\n sql = \"create view `#{view_name}` as\n select `region` AS `region`,\n `district_id` AS `district_id`,\n `district_name` AS `district_name`,\n `precinct_id` AS `precinct_id`,\n concat(cast(`district_id` as char charset utf8),\n '.',\n cast(`precinct_id` as char charset utf8)) AS `precinct_name`,\n `prec_id_from_data` AS `prec_id_from_data`,\n `avg_age` AS `avg_age`,\n `greater_99` AS `greater_99`,\n `85_99` AS `85_99`,\n `less_than_85` AS `less_than_85`,\n `no_birthdate` AS `no_birthdate`,\n `total_voters` AS `total_voters`,\n `duplicates` AS `duplicates`\n from `#{vl_name} - raw`\n where (`district_id` between 1 and 22)\n order by `district_id`\"\n\n results = @client.query(sql)\nend",
"title": ""
},
{
"docid": "4311a90debd0054aecf999039bfc4f5b",
"score": "0.49859875",
"text": "def create_schema\n schema = @index.schema\n unless schema.tables['search']\n @index.execute_batch <<-SQL\n CREATE VIRTUAL TABLE search USING fts5(\n sequence_number,\n kanji,\n kana,\n senses\n );\n SQL\n @index.reload_schema!\n end\n end",
"title": ""
},
{
"docid": "58a0d6accc87866db0980b16cd162ec1",
"score": "0.4980511",
"text": "def view(name, opts = {})\n View.create(model, name, opts)\n create_view_method(name)\n end",
"title": ""
},
{
"docid": "d2f5a8f1eb552b54d8eb129a69119012",
"score": "0.49755844",
"text": "def view_select_statement(view, name=nil)\n q =<<-ENDSQL\n SELECT\n SM.definition\n FROM\n sys.objects O\n JOIN\n sys.sql_modules SM ON o.object_id = SM.object_id\n WHERE\n o.type = 'V' AND o.name = '#{view}'\n ENDSQL\n \n view_def = select_value(q, name)\n \n if view_def\n return convert_statement(view_def)\n else\n raise \"No view called #{view} found\"\n end\n end",
"title": ""
},
{
"docid": "6eedbc39fdb0d712d1fcf8c9c3003188",
"score": "0.4975525",
"text": "def create_table_statement(table_name, table)\n normalize_primary_key(table)\n add_line \"create_table #{table_name.inspect}#{pretty_hash(table[:table_options])} do\"\n indent do\n output_columns(table[:columns], table[:primary_key])\n output_indexes(table[:indexes])\n output_primary_key(table)\n end\n add_line \"end\"\n end",
"title": ""
},
{
"docid": "aa56ef59b57cfb9650b4469576e4711e",
"score": "0.49640173",
"text": "def view(name, opts = {})\n design_doc.create_view(name, opts)\n end",
"title": ""
},
{
"docid": "ddcc2d1636229780b632c096753e3fd9",
"score": "0.49610662",
"text": "def create_text_search_documents_table(table_name)\n text_search_adapter.create_text_search_documents_table table_name\n end",
"title": ""
},
{
"docid": "15e7b57456b48d5c8084979fcb1d0d9e",
"score": "0.49586162",
"text": "def create_view(id,doc)\n resp = get_design_doc(id)\n ddoc = set_views(resp,doc)\n\n create_design_doc(id,ddoc)\n end",
"title": ""
},
{
"docid": "bd71518795d313bf9ed73e54013b4e44",
"score": "0.49539176",
"text": "def begin_view_new(object_locale_key)\n begin_view(t(:Create),\" \",t(object_locale_key))\n end",
"title": ""
},
{
"docid": "73541bb0b7b3f49cf37c08bba35a5201",
"score": "0.49525833",
"text": "def initialize(query={})\n @query = query\n end",
"title": ""
},
{
"docid": "bdaae491664e99eb394a7d59369bd05e",
"score": "0.49496102",
"text": "def create_table(table_name)\n # translate into pinyin, then to symbol\n table = trans_pinyin(table_name).to_sym\n DB.create_table table do\n primary_key :id\n String :mid, :unique=>true\n DateTime :created_timestamp\n String :content, :text => true\n String :source\n String :user_id\n String :user_name\n String :user_gender\n Integer :user_status_count\n Integer :user_fansNum\n end\n return table\nend",
"title": ""
},
{
"docid": "f6e555f1ad178c63b1e0bb832d304443",
"score": "0.4946937",
"text": "def create_table\n ActiveRecord::Migration.create_table(table_name) do |t|;end;\n end",
"title": ""
},
{
"docid": "ae2b210bf9c123590ffa2e4b562889b6",
"score": "0.49464238",
"text": "def create\n\t\tsql = \"CREATE TABLE `#{@table}` (\"\n\t\t@columns.each do |column|\n\t\t\tsql += \"`#{column[:name]}` #{column[:type]}\"\n\t\t\tif(column[:not_null])\n\t\t\t\tsql += ' NOT NULL'\n\t\t\tend\n\n\t\t\tif(column[:primary_key])\n\t\t\t\tsql += ' PRIMARY KEY'\n\t\t\tend\n\n\t\t\tif(column[:auto_increment])\n\t\t\t\tsql += ' AUTOINCREMENT'\n\t\t\tend\n\n\t\t\tif(column[:unique])\n\t\t\t\tsql += ' UNIQUE'\n\t\t\tend\n\t\t\tsql += ','\n\t\tend\n\t\tsql.chop! # Remove trailing ','\n\t\tsql += ');'\n\t\tp sql\n\t\t@db.execute(sql)\n\tend",
"title": ""
},
{
"docid": "4e33f1d705427e0212f53c5af3c142bb",
"score": "0.4943316",
"text": "def table(table_id); Table.new(@opts, get(\"tables/#{table_id}\")); end",
"title": ""
},
{
"docid": "d057912b435faba82d32d1fca11efb4a",
"score": "0.4937059",
"text": "def create_table_as(name, sql, options)\n sql = sql.sql if sql.is_a?(Sequel::Dataset)\n run(create_table_as_sql(name, sql, options))\n end",
"title": ""
},
{
"docid": "3ec0800c73f12b9890299c8a733db541",
"score": "0.49142084",
"text": "def table(name, args = {}, &block)\n args[:base_columns] ||= columns\n table = Table.new(args, &block)\n tables << table\n singleton_class.send(:define_method, name) { return table }\n end",
"title": ""
},
{
"docid": "2931da819fd3b1c71ca584933bb84a82",
"score": "0.4913692",
"text": "def create\n @query = current_user.queries.new(params[:query])\n\n respond_to do |format|\n if @query.save\n format.html { redirect_to @query, notice: 'Query was successfully created.' }\n format.json { render json: @query, status: :created, location: @query }\n else\n format.html { render action: \"new\" }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b92c848797c67a14fae080413f4c0bca",
"score": "0.49046525",
"text": "def create_query( relation )\n Query.new(relation)\n end",
"title": ""
},
{
"docid": "fe9a31eff7d0a247937daac631fa72b8",
"score": "0.48987874",
"text": "def on_table(params = {})\n table = Yummi::Table::new params\n table.data = self\n return table\n end",
"title": ""
},
{
"docid": "56b90dcdd3fec8bde164d251c1356245",
"score": "0.48781344",
"text": "def create_table(klass)\n fields = fields_for_class(klass)\n\n sql = \"CREATE TABLE #{klass.table} (#{fields.join(', ')}\"\n\n # Create table constraints.\n\n if constraints = klass.ann(:self, :sql_constraint)\n sql << \", #{constraints.join(', ')}\"\n end\n\n # Set the table type (Mysql default, InnoDB, Hash, etc)\n\n if table_type = @options[:table_type]\n sql << \") TYPE = #{table_type};\"\n else\n sql << \")\"\n end\n\n begin\n exec(sql, false)\n info \"Created table #{klass.table}.\"\n rescue Object => ex\n if table_already_exists_exception? ex\n # Don't return yet. Fall trough to also check for the\n # join table.\n else\n handle_sql_exception(ex, sql)\n end\n end\n end",
"title": ""
},
{
"docid": "84a6f74273d6583123c1edc4e2e9d22a",
"score": "0.486983",
"text": "def tableView(tableView, rowViewForRow:row)\n FBSidePanelTableRowView.new\n end",
"title": ""
},
{
"docid": "40993d7e2a6db525966a88a123df0fd6",
"score": "0.48569596",
"text": "def create_or_replace_view(name, source, options = OPTS)\n if supports_create_or_replace_view?\n options = options.merge(:replace=>true)\n else\n swallow_database_error{drop_view(name)}\n end\n\n create_view(name, source, options)\n nil\n end",
"title": ""
},
{
"docid": "6bfc4929a1a34216c89bcda3ef2a0664",
"score": "0.4856155",
"text": "def new\n @query = CannedQuery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end",
"title": ""
},
{
"docid": "c0801de37d724979bb9e165e42583e87",
"score": "0.4856123",
"text": "def create_table(table)\n raise IMDB::DatabaseExceptions::TableExists.new(table.name) if @tables.has_key? table.name\n @tables[table.name] = table\n end",
"title": ""
},
{
"docid": "5c16e7a19e443aa446ce3db2c0ea588a",
"score": "0.48435903",
"text": "def create_extension_view_and_class\n self.const_get(\"Extended#{to_s}\")\n rescue\n clause = view_builder\n #this needs to be moved into the specific db adapter files\n connection.execute %{\n create or replace algorithm = merge SQL SECURITY DEFINER view #{extended_table_name} as select #{clause[:view_select]} from #{table_name} #{clause[:view_joins]}#{clause[:view_conditions]}\n }\n class_eval %{\n class Extended#{to_s} < #{to_s}\n set_table_name \"#{extended_table_name}\"\n def self.descends_from_active_record?\n true\n end\n end\n }\n true\n end",
"title": ""
},
{
"docid": "87aaa83724b1c4f036df690bdbacc79d",
"score": "0.48400778",
"text": "def create_table(table, **kwargs, &block)\n current_instructions << Instructions::CreateTable.new(\n **kwargs,\n table: table,\n columns_block: block,\n )\n end",
"title": ""
},
{
"docid": "a3d74d059a4c62af9ec2a45f7f6fd0a8",
"score": "0.48368913",
"text": "def generate_query\n unless databases.nil?\n databases.each do |db|\n create_query[db] = [\"create table #{tablename} (\"]\n end\n csv_column_datatypes.each do |header, datatype|\n append_to_query = build_query_for_datatype(header, datatype)\n append_to_query.each do |key, value|\n create_query[key].push(value)\n end\n end\n prepare_sql_statements\n prepare_import_csv\n # Pass the prepared statements to options varaible.\n # Which gets passed on to print_metadata_analysis\n options[:create_query] = create_query\n options[:import_query] = import_query\n end\n print_metadata_analysis\n end",
"title": ""
},
{
"docid": "d04d762d8b9ae113581cec3e0e429852",
"score": "0.4826831",
"text": "def tables view: nil\n client.list_tables(\n instance_path,\n view: view\n )\n end",
"title": ""
},
{
"docid": "d433e46f015758ed401c412dfd2b2e11",
"score": "0.48195395",
"text": "def new\n @query = params[:query]\n end",
"title": ""
},
{
"docid": "076eebc8ae751b467e4f04a9b13ba5b8",
"score": "0.48171198",
"text": "def view_select_statement(view, name=nil)\n row = execute(\"SELECT VIEW_DEFINITION FROM SYSIBM.VIEWS WHERE TABLE_NAME = '#{view}'\", name).each do |row|\n return row[0]\n end\n raise \"No view called #{view} found\"\n end",
"title": ""
},
{
"docid": "7f71432ae4036145084f497a96d6a76c",
"score": "0.48159584",
"text": "def create_table!\n raise InvalidTableDefinition.new \"#{ self.name } has invalid table configuration\" unless model_table_config_is_valid?\n TinyDyno::Adapter.create_table(create_table_request)\n end",
"title": ""
},
{
"docid": "285218c90df9d7b4ec27a146e0d4c45d",
"score": "0.4813407",
"text": "def create_table( table_name, options = {}, &block )\n super( table_name, options, &block )\n @connection.schema.load_table( table_name.to_s )\n end",
"title": ""
},
{
"docid": "bfd1e0ab4a2534dffa787f78b111794c",
"score": "0.4811893",
"text": "def new_table(name, field_defs, encrypt, record_class)\r\n # Header rec consists of last record no. used, delete count, and\r\n # all field names/types. Here, I am inserting the 'recno' field\r\n # at the beginning of the fields.\r\n header_rec = ['000000', '000000', record_class, 'recno:Integer',\r\n field_defs].join('|')\r\n\r\n header_rec = 'Z' + encrypt_str(header_rec) if encrypt\r\n\r\n begin\r\n fptr = open(File.join(@db.path, name.to_s + @db.ext), 'w')\r\n fptr.write(header_rec + \"\\n\")\r\n ensure\r\n fptr.close\r\n end\r\n end",
"title": ""
},
{
"docid": "9d8187a727706e300cc410c63a317143",
"score": "0.47916797",
"text": "def view(ddoc,view,*opts)\n q = \"#{database}/_design/#{ddoc}/_view/#{view}\"\n q << build_query_string(opts.first,\"view\") if opts && opts.any? && opts.first.is_a?(Hash)\n\n @conn.query({url_path: q, method: :get})\n end",
"title": ""
}
] |
3341a75228724c47fd6b03561c9ba70d
|
Public: Instantiate new validator. ldap: GitHub::Ldap object groups: Array of Net::LDAP::Entry group objects options: Hash of options
|
[
{
"docid": "3a97e5d84a8321ac5c4e730568b765c6",
"score": "0.7811679",
"text": "def initialize(ldap, groups, options = {})\n @ldap = ldap\n @groups = groups\n @options = options\n end",
"title": ""
}
] |
[
{
"docid": "311cf9f1dd279e48cadb493517f7de31",
"score": "0.65478474",
"text": "def initialize(ldap, options = {})\n @ldap = ldap\n @options = options\n end",
"title": ""
},
{
"docid": "c69c5026b61ca28ecf517f736360f65b",
"score": "0.6146484",
"text": "def initialize(options ={})\n\n\t\t\tif @@users.find {|user| user.dn == options[:dn] } #We dont want duplicated in our array so lets see if the group cn already exists\n\t\t\t\treturn #Have a think about this, we dont want to ignore new data if there is more than the existing object\n\t\t\tend\n\n\t\t\t@name = options[:name] || options[:samaccountname]\n\t\t\t@samaccountname = options[:samaccountname] #Name will be set on users but not service accounts\n\t\t\t@dn = options[:dn]\n\t\t\t@memberof = LDAPData.dn_to_human(options[:memberof])\n\t\t\t@whencreated = LDAPData.windows_time_two(options[:whencreated])\n\t\t\t@badpasswordtime = LDAPData.windows_time(options[:badpasswordtime])\n\t\t\t@accountexpires = LDAPData.windows_time(options[:accountexpires])\n\t\t\t@badpwdcount = options[:badpwdcount]\n\t\t\t@admincount = options[:admincount]\n\t\t\t@description = options[:description]\n\t\t\t@enabled = self.user_account_enabled(options[:useraccountcontrol])\n\t\t\t@hash = nil\n\t\t\t@hash_type = nil\n\t\t\t@cracked = nil #if the john / hashcat output contained the hash\n\t\t\t@external = nil \n\t\t\t@password = nil\n\t\t\t@@users << self\n\t\t\t\n\t\tend",
"title": ""
},
{
"docid": "bd66c9a11e051f69f45cbfe4b90a1f08",
"score": "0.6015433",
"text": "def initialize(options)\n options.symbolize_keys!\n\n if options.has_key?(:ldap_uid)\n @ldap_uid = options.fetch(:ldap_uid)\n elsif options.has_key?(:ldap_person)\n @ldap_person = options.fetch(:ldap_person)\n else\n raise InvalidOption, \"Expects :ldap_uid or :ldap_person as options\"\n end\n end",
"title": ""
},
{
"docid": "fe6a11a1ffd43c338d36ddac39d46bca",
"score": "0.578501",
"text": "def initialize(options = {})\n @uid = options[:uid] || \"sAMAccountName\"\n\n # Keep a reference to these as default auth for a Global Catalog if needed\n @admin_user = options[:admin_user]\n @admin_password = options[:admin_password]\n @port = options[:port]\n\n @connection = Net::LDAP.new({\n host: options[:host],\n port: options[:port],\n hosts: options[:hosts],\n instrumentation_service: options[:instrumentation_service]\n })\n\n if options[:admin_user] && options[:admin_password]\n @connection.authenticate(options[:admin_user], options[:admin_password])\n end\n\n if encryption = check_encryption(options[:encryption], options[:tls_options])\n @connection.encryption(encryption)\n end\n\n configure_virtual_attributes(options[:virtual_attributes])\n\n # enable fallback recursive group search unless option is false\n @recursive_group_search_fallback = (options[:recursive_group_search_fallback] != false)\n\n # enable posixGroup support unless option is false\n @posix_support = (options[:posix_support] != false)\n\n # search_domains is a connection of bases to perform searches\n # when a base is not explicitly provided.\n @search_domains = Array(options[:search_domains])\n\n # configure both the membership validator and the member search strategies\n configure_search_strategy(options[:search_strategy])\n\n # configure the strategy used by Domain#user? to look up a user entry for login\n configure_user_search_strategy(options[:user_search_strategy])\n\n # enables instrumenting queries\n @instrumentation_service = options[:instrumentation_service]\n end",
"title": ""
},
{
"docid": "fce4018d894d278dc30ff2d6a612b313",
"score": "0.54253036",
"text": "def validators(attr, options, *blacklist)\n options.map.with_object({}) do |(key, opts), obj|\n name = key.to_s\n\n next if blacklist.map(&:to_s).include? name\n next if %w(allow_nil if unless on message).include? name\n\n opts = {} unless opts.is_a? Hash\n obj[key] = find_validator_by_name(name).new(attributes: attr, **opts)\n end\n end",
"title": ""
},
{
"docid": "f3d5d8bcdce7f506963e0d51fb61ff0b",
"score": "0.53735954",
"text": "def init_validation\n @group = Valid.get_association(self, :group_id, MailingListGroup)\n @mailing_list_address = Valid.get_association self, :id\n end",
"title": ""
},
{
"docid": "9af4220ea84b331b27cdabab4459f756",
"score": "0.53672916",
"text": "def initialize(host, port, base, username, password, use_ssl)\n @people_base = \"ou=people,#{base}\"\n @group_base = \"ou=groups,#{base}\"\n @ldap_conf = {\n :host => host,\n :port => port,\n :base => @people_base,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n }\n\n # enable SSL if n\n if use_ssl.is_a? String then use_ssl = use_ssl.downcase == 'true' ? true : false end\n if use_ssl\n @ldap_conf[:encryption] = { :method => :simple_tls }\n end\n\n # test whether it can bind\n #test_ldap = Net::LDAP.new @ldap_conf\n #raise ldap_ex(test_ldap, \"Could not bind to ldap server.\") if !test_ldap.bind\n end",
"title": ""
},
{
"docid": "da2f76184c66fd99538b5ed229bb40f3",
"score": "0.53383934",
"text": "def ldap_mapping(options={})\n validate_ldap_mapping_options(options)\n dn_attribute = options[:dn_attribute] || default_dn_attribute\n prefix = options[:prefix] || default_prefix\n classes = options[:classes]\n recommended_classes = options[:recommended_classes]\n scope = options[:scope]\n\n self.dn_attribute = dn_attribute\n self.prefix = prefix\n self.scope = scope\n self.required_classes = classes\n self.recommended_classes = recommended_classes\n\n public_class_method :new\n end",
"title": ""
},
{
"docid": "0b3dbfc8bc74dd07287c259285a8571f",
"score": "0.5251778",
"text": "def initialize(options)\n @hash = options\n validate\n end",
"title": ""
},
{
"docid": "27da1264517da9d5bc0a96b95fdf63f7",
"score": "0.5208341",
"text": "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",
"title": ""
},
{
"docid": "ad248c38b8a83ab5a2b7fc3ddfe59db2",
"score": "0.5143915",
"text": "def init_validation\n @user = Valid.get_association(self, :user_id)\n @mailing_list_group = Valid.get_association self, :id\n end",
"title": ""
},
{
"docid": "8e82a2c7afbe093429ca1ca3649c8e16",
"score": "0.5135047",
"text": "def new_net_ldap\n params = {\n :host => host,\n :auth => authentication_information,\n :port => 636,\n :encryption => { :method => :simple_tls }\n }\n @net_ldap = Net::LDAP.new(params)\n @net_ldap.bind || raise(BindFailedException)\n @net_ldap\n rescue Net::LDAP::Error => e\n raise(BindFailedException)\n end",
"title": ""
},
{
"docid": "bf8f9c0a018e1bcadc47042da4eba1b8",
"score": "0.51321775",
"text": "def initialize(dn = nil, attrs = {})\n #\n @ldap_entry = Net::LDAP::Entry.new(dn)\n attrs.each { |name, value| @ldap_entry[name] = value }\n @new_entry = true\n @persisted_attrs = {}\n self\n end",
"title": ""
},
{
"docid": "e547b6c966288933027be9cf74cc2395",
"score": "0.5077246",
"text": "def initialize(options = {})\n raise ArgumentError, \"You must specify a year for date time grouping\" unless options[:year]\n raise ArgumentError, \"You must specify a date_time_grouping when creating a DateGroupItem for auto filter\" unless options[:date_time_grouping]\n\n parse_options options\n end",
"title": ""
},
{
"docid": "00340ec3fb69eb727ad9937764f1a85d",
"score": "0.50710386",
"text": "def validate(options); end",
"title": ""
},
{
"docid": "b78f0a3f8f312f5aa427ecd15251308b",
"score": "0.50683707",
"text": "def initialize(conf:)\n @ldap = Net::LDAP.new host: LDAP_SERVER, # your LDAP host name or IP goes here,\n # port: '389', # unencrypted LDAP host port,\n port: '636', # TLS port\n encryption: :simple_tls,\n base: 'DC=UoA,DC=auckland,DC=ac,DC=nz', # the base of your AD tree goes here,\n auth: {\n method: :simple,\n username: conf.ldap_user, # a user w/sufficient privileges to read from AD goes here,\n password: conf.ldap_auth_token # the user's password goes here\n }\n end",
"title": ""
},
{
"docid": "26ac8c2720078df310a5431c405622e3",
"score": "0.50511223",
"text": "def validator(name, **options, &code)\n validators[name] = Validator.new(options, code)\n end",
"title": ""
},
{
"docid": "45732ece76faaba2de58e5203e50649a",
"score": "0.50211394",
"text": "def load_group(group_entry)\n if @virtual_attributes.enabled?\n VirtualGroup.new(self, group_entry)\n elsif posix_support_enabled? && PosixGroup.valid?(group_entry)\n PosixGroup.new(self, group_entry)\n else\n Group.new(self, group_entry)\n end\n end",
"title": ""
},
{
"docid": "1748def583d70d6c083935a53e3bb6dd",
"score": "0.4979283",
"text": "def initialize(criteria, options={})\n @criteria = parse(criteria).freeze\n @options = options.freeze\n end",
"title": ""
},
{
"docid": "3403ee7fca83a3022f0c563f1c720af1",
"score": "0.49726018",
"text": "def initialize(schema, group, key = nil)\n if group && key.nil?\n raise Error, \"Cannot create a new non-root permission group without a key\"\n elsif group.nil? && key\n raise Error, \"Cannot create a new root permission group with a key\"\n end\n\n @schema = schema\n @group = group\n @key = key.to_sym if key\n @groups = {}\n @permissions = {}\n @defined_rules = {}\n end",
"title": ""
},
{
"docid": "39ee94de2db179e347815e6299423612",
"score": "0.49467674",
"text": "def initialize(groups_hosts)\n @groups_hosts = groups_hosts\n end",
"title": ""
},
{
"docid": "bbb162734a359961822fb7097c0452bc",
"score": "0.49414858",
"text": "def initialize(group, key)\n if group.nil?\n raise Error, \"Group must be provided when creating a permission\"\n end\n\n @group = group\n @key = key\n @required_object_types = []\n @dependencies = []\n @contexts = []\n end",
"title": ""
},
{
"docid": "fa96644b36841d05e13c67f07a833db2",
"score": "0.49318945",
"text": "def initialize(owner, group, dacl, protect = false)\n @owner = owner\n @group = group\n @dacl = dacl\n @protect = protect\n end",
"title": ""
},
{
"docid": "2cdd0534df9f64859592cada6f73ff60",
"score": "0.49174526",
"text": "def initialize(options = {})\n self.class.validate_options(options)\n end",
"title": ""
},
{
"docid": "b7ef278a05c9e26d0c50605b1b785088",
"score": "0.4916698",
"text": "def initializeApprovalAndLDAP(emailConf, prod)\n @ldap = ldap_storage\n ApprovalEngine.init(@ldap, nil, !prod)\nend",
"title": ""
},
{
"docid": "ecbca8f644d0acb359b6d72c5628ec03",
"score": "0.4907934",
"text": "def initialize(api, email_selector: nil, ldap_lookup: nil, users: nil)\n self.api = api\n self.email_selector = email_selector\n self.ldap_lookup = ldap_lookup\n self.users = users || {}\n end",
"title": ""
},
{
"docid": "0c6c0cbbadcaa643553adf14733a3a0e",
"score": "0.48951998",
"text": "def initialize(options = {})\n @rules = options.fetch(:rules, {})\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "db8c0ee4e76bc081d83315628acb53d8",
"score": "0.48692632",
"text": "def initialize(options = {})\n @options = options\n @group = options.delete(:group)\n @watchers = options.delete(:watchers) { [] }\n @callbacks = options.delete(:callbacks) { [] }\n _register_callbacks\n end",
"title": ""
},
{
"docid": "4da28803e2f0be0534cbc0804a49de86",
"score": "0.48685947",
"text": "def initialize(attributes={})\n set_attributes(attributes)\n @errors = {}\n end",
"title": ""
},
{
"docid": "f2fe80fdce5f0c5bcd66826111ad991e",
"score": "0.48585165",
"text": "def validations\n CompiledValidations.new(@validations, @allow_keys)\n end",
"title": ""
},
{
"docid": "ff4ef52711bdbbe222e36069f1962702",
"score": "0.48369753",
"text": "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end",
"title": ""
},
{
"docid": "13582aa102eeddadf750b870e718da99",
"score": "0.48343307",
"text": "def initialize(options)\n @options = options || {}\n self.class.verify_options(@options)\n end",
"title": ""
},
{
"docid": "525c635290efbf8e84080046622f48ad",
"score": "0.48315674",
"text": "def validate_associations\n errors.add(:group_id, :doesnt_exist) if @group.nil?\n end",
"title": ""
},
{
"docid": "bdb95b664ad9e26738a4fe2249e14a4b",
"score": "0.48164442",
"text": "def initialize(options = {})\n @options = options\n merge_configs\n merge_message\n validate_options\n end",
"title": ""
},
{
"docid": "314485d1a1977e1ce540ffddb1a8979a",
"score": "0.4816209",
"text": "def initialize(attributes=nil)\n init_base\n @new_entry = true\n initial_classes = required_classes | recommended_classes\n if attributes.nil?\n apply_object_class(initial_classes)\n elsif attributes.is_a?(String) or attributes.is_a?(Array)\n apply_object_class(initial_classes)\n self.dn = attributes\n elsif attributes.is_a?(Hash)\n classes, attributes = extract_object_class(attributes)\n apply_object_class(classes | initial_classes)\n normalized_attributes = {}\n attributes.each do |key, value|\n real_key = to_real_attribute_name(key) || key\n normalized_attributes[real_key] = value\n end\n self.dn = normalized_attributes[dn_attribute]\n self.attributes = normalized_attributes\n else\n message = _(\"'%s' must be either nil, DN value as String or Array \" \\\n \"or attributes as Hash\") % attributes.inspect\n raise ArgumentError, message\n end\n yield self if block_given?\n end",
"title": ""
},
{
"docid": "80a75e6a05d83e3f32dcb69d0b628408",
"score": "0.48147064",
"text": "def initialize( options )\n\t\tTreequel.logger.formatter = Treequel::ColorLogFormatter.new( Treequel.logger )\n\n\t\tif options.debug\n\t\t\t$DEBUG = true\n\t\t\t$VERBOSE = true\n\t\t\tTreequel.logger.level = Logger::DEBUG\n\t\telsif options.loglevel\n\t\t\tTreequel.logger.level = Treequel::LOG_LEVELS[ options.loglevel ]\n\t\tend\n\n\t\t@options = options\n\t\tif @options.all?\n\t\t\t@options[:attrtypes] =\n\t\t\t\t@options[:objectclasses] =\n\t\t\t\t@options[:syntaxes] =\n\t\t\t\t@options[:matching_rules] =\n\t\t\t\t@options[:matching_rule_uses] =\n\t\t\t\ttrue\n\t\tend\n\n\t\t@directory = Treequel.directory( options.ldapurl )\n\t\t@prompt = HighLine.new\n\n\t\t@prompt.wrap_at = @prompt.output_cols - 10\n\n\t\tself.log.debug \"Created new treewhat command object for %s\" % [ @directory ]\n\tend",
"title": ""
},
{
"docid": "7572308fb7728a58e3bdb2b61e761c4e",
"score": "0.48145974",
"text": "def parser(security_groups)\n @security_groups = security_groups\n @sec_grp_objs = objectize_security_groups(security_groups)\n # @list = retrieve_remote_group # Fixme list and the method\n retrieve_remote_group # Fixme list and the method\n @list = @sec_grp_objs # Fixme list and the method\n self\n end",
"title": ""
},
{
"docid": "19bf32ab4588729b33bc7deeb0ec740d",
"score": "0.48067856",
"text": "def validator_instances\n @validator_instances ||= validators.map { |klass| klass.new(context, options.merge(parent_validator: self)) }\n .select(&:valid_in_context?)\n end",
"title": ""
},
{
"docid": "2da0d2c71887c67d52bc6f3beb1021a8",
"score": "0.4805044",
"text": "def initialize(rules)\n @rules = rules\n end",
"title": ""
},
{
"docid": "f8f72c60820ee055c181febc4f485445",
"score": "0.47982925",
"text": "def validates(attribute, options)\n unless attribute.is_a? Symbol\n raise ArgumentError.new(\"Invalid :attribute argument. Expected #{attribute.class} to be a Symbol\")\n end\n\n unless options.is_a? Hash\n raise ArgumentError.new(\"Invalid :options argument. Expected #{options.class} to be a Hash\")\n end\n\n if options.keys.empty?\n raise ArgumentError.new(\"Invalid :options argument. Options can not be empty\")\n end\n\n options = options.reduce({}) do |memo, (k, v)|\n memo.merge({ k.to_sym => v})\n end\n\n @validators[attribute] = []\n options.each_pair do |key, value|\n key = key.to_s.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').tr(\"-\", \"_\").downcase.to_sym\n\n unless [:ref].include?(key)\n if key == :type && value == \"Enumerated\"\n @validators[attribute] << Bodhi::Validator.constantize(key).new(value, options[:ref])\n else\n @validators[attribute] << Bodhi::Validator.constantize(key).new(value)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "0a8e81559b371aa3fb7b05bc1369e059",
"score": "0.47969568",
"text": "def build_matcher(options, whitelist_option, blacklist_option); end",
"title": ""
},
{
"docid": "3aad20d0e192a69e4f01844f2639e620",
"score": "0.4781012",
"text": "def initialize(options = {})\n if options[:validator_uri]\n @validator_uri = URI.parse(options[:validator_uri])\n options.delete(options[:validator_uri])\n else\n @validator_uri = URI.parse(FEED_VALIDATOR_URI)\n end\n super(options)\n end",
"title": ""
},
{
"docid": "4a4cdfc2bc39379adc22d0df2e2d6e25",
"score": "0.4776787",
"text": "def initialize(data=nil)\n json_obj = Validator::validate_argument(data,'Groups')\n @alive = json_obj['alive']\n @id = json_obj['id']\n @name = json_obj['name']\n end",
"title": ""
},
{
"docid": "af8700e6470756986c1c2f3f60f62d65",
"score": "0.47522965",
"text": "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",
"title": ""
},
{
"docid": "00c982aaff57b531feb2d3d1f1e95cbc",
"score": "0.47347993",
"text": "def search_constrains\n {group: @group}\n end",
"title": ""
},
{
"docid": "110604d762c482a7f51cbccf0a6c5124",
"score": "0.47219893",
"text": "def validate( options={} )\n\t\toptions = DEFAULT_VALIDATION_OPTIONS.merge( options )\n\n\t\tself.before_validation or\n\t\t\traise Treequel::BeforeHookFailed, :validation\n\t\tself.errors.add( :objectClass, 'must have at least one' ) if self.object_classes.empty?\n\n\t\tsuper( options )\n\t\tself.log.debug \"Validations failed:\\s %s\" % [ self.errors.full_messages.join(\"\\n \") ] if\n\t\t\tself.errors.count.nonzero?\n\n\t\tself.after_validation\n\tend",
"title": ""
},
{
"docid": "402e71c159f7615bbed95bf2be8c8e66",
"score": "0.46938127",
"text": "def initialize(attributes={})\n @args = Array(attributes[:args])\n @valid_options = attributes[:valid_options] || {}\n end",
"title": ""
},
{
"docid": "43aa44d86bf381ccda001eb5040ca7b6",
"score": "0.4688248",
"text": "def initialize(schemas = {}, options = {})\n schemas = {} unless schemas\n\n # not needed\n # if (!(this instanceof LinkifyIt)) {\n # return new LinkifyIt(schemas, options);\n # }\n\n # not needed, if you want to pass options, then must also pass schemas\n # if options.empty?\n # if (isOptionsObj(schemas)) {\n # options = schemas;\n # schemas = {};\n # }\n # }\n\n @__opts__ = DEFAULT_OPTIONS.merge(options)\n\n # Cache last tested result. Used to skip repeating steps on next `match` call.\n @__index__ = -1\n @__last_index__ = -1 # Next scan position\n @__schema__ = ''\n @__text_cache__ = ''\n\n @__schemas__ = {}.merge!(DEFAULT_SCHEMAS).merge!(schemas)\n @__compiled__ = {}\n\n @__tlds__ = TLDS_DEFAULT\n @__tlds_replaced__ = false\n\n @re = {}\n\n @bypass_normalizer = false # only used in testing scenarios\n\n compile\n end",
"title": ""
},
{
"docid": "b640966042094a7f5eda5a46ea72a899",
"score": "0.46866682",
"text": "def initialize(rules)\n @rules = rules\n end",
"title": ""
},
{
"docid": "a62be9b240072404072a657ae48a6a8e",
"score": "0.4677333",
"text": "def search_options_for(filter:, attributes:)\n {}.tap do |opts|\n group_base = APP_CONFIG[\"ldap\"][\"group_base\"]\n opts[:base] = group_base if group_base.present?\n opts[:filter] = Net::LDAP::Filter.construct(filter)\n opts[:attributes] = attributes\n end\n end",
"title": ""
},
{
"docid": "040b0ffe52fe0df5545914495690b7f7",
"score": "0.46772197",
"text": "def initialize(domain, options = {})\n @domain, @options = domain, RailsERD.options.merge(options)\n end",
"title": ""
},
{
"docid": "3e76ff8f5a8b9f6360ba3f95b03cfcd5",
"score": "0.46756327",
"text": "def initialize(options)\n options.symbolize_keys.each do |key, value|\n raise ArgumentError, \"Invalid key '#{key}'\" unless VALID_KEYS.include?(key)\n instance_variable_set(\"@#{key}\", value)\n end\n\n %i[name active_directory_authority resource_manager_url].each do |key|\n unless instance_variable_get(\"@#{key}\")\n raise ArgumentError, \"Mandatory argument '#{key}' not set\"\n end\n end\n end",
"title": ""
},
{
"docid": "2a4c290c3c9baa91d2f9e176937bff1b",
"score": "0.46742177",
"text": "def initialize(options=nil, &block)\n options ||= {}\n\n @checks = {}\n\n yield(self) if block_given?\n end",
"title": ""
},
{
"docid": "82b85e01515c323e4a48ab528c26291c",
"score": "0.46380362",
"text": "def initialize options: nil, tasks: nil, validators: nil\n @options = options.nil? ? {} : options.clone\n @tasks = tasks.nil? ? {} : tasks.clone\n @validators = validators.nil? ? {} : validators.clone\n\n @options.each do |key,val|\n define_option_accessor key.to_sym\n end\n\n @validators.each do |key,val|\n define_validator key.to_sym\n end\n end",
"title": ""
},
{
"docid": "2511c46b529b0e2e290d8d5c4b63662b",
"score": "0.46352786",
"text": "def initialize_test_validation(validation_class_name, file_specs, options)\n options = { :logger => 'LoggerTest' }.merge(options)\n Object.const_get(\"Repositext::Validation::#{ validation_class_name }\").new(file_specs, options)\nend",
"title": ""
},
{
"docid": "0eaab1eabf8af23ef59f466f583d943f",
"score": "0.46351457",
"text": "def initialize(rules = [])\n @rules = rules\n end",
"title": ""
},
{
"docid": "8931bb39edc71cb5b383a1888b883b66",
"score": "0.4622907",
"text": "def initialize(jd = false, ed = false, file = false, tc = false)\n self.uids = Hash.new { |h,k| h[k] = [] }\n self.counts_contests = Hash.new { |h,k| h[k] = {} }\n self.counts_questions = Hash.new { |h,k| h[k] = {} }\n self.counts_accumulated = []\n self.counts_expected = []\n self.errors = []\n self.warnings = []\n if (tc == false)\n val_fatal(\"Unexpected JD/ED args to Validator initialize\") unless\n (jd.is_a?(Hash) && jd.keys.include?(\"jurisdiction_definition\") &&\n ed.is_a?(Hash) && ed.keys.include?(\"election_definition\"))\n validate_jurisdiction_definition(jd[\"jurisdiction_definition\"])\n validate_election_definition(ed[\"election_definition\"])\n new_tabulator_count(jd, ed, file)\n elsif (tc.is_a?(Hash) && tc.keys.include?(\"tabulator_count\"))\n validate_tabulator_count(tc)\n else\n val_fatal(\"Unexpected TC args to Validator initialize\")\n end\n end",
"title": ""
},
{
"docid": "024957faadc96e76d1c4a15af13a8b68",
"score": "0.46198565",
"text": "def initialize(name:, addresses: [], address_groups: [], rulebases: [])\n self.name = name\n self.addresses = addresses\n self.address_groups = address_groups\n self.rulebases = rulebases\n\n self\n end",
"title": ""
},
{
"docid": "001d7f84e64cf21442057e8cdf2a5885",
"score": "0.46166408",
"text": "def initialize(options)\n @email = options[:email]\n @remove = options[:remove]\n @domain = options[:domain]\n @username = options[:username]\n end",
"title": ""
},
{
"docid": "f7db8643c83af692a619ea9c4d13b8f3",
"score": "0.46163327",
"text": "def initialize(options = {})\n set_layout_variables(options)\n validate! options\n end",
"title": ""
},
{
"docid": "76e8f7bda736b5d8bcfe5acf126235be",
"score": "0.46160924",
"text": "def options_to_validations(options)\n validations = {}\n validations[:presence] = true if options[:required]\n validations\n end",
"title": ""
},
{
"docid": "2e8169bb744e550561549e5406e3f3f5",
"score": "0.4604088",
"text": "def create\n @group = Group.new(params[:group])\n\n @group.group_locales = []\n\n params[:group_locales].each do |locale, values|\n @group.group_locales << GroupLocale.new(:locale => Locale.new(values), :group => @group)\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n format.xml { render xml: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n format.xml { render xml: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b2ab95c0bd48030a1a80a2b5354214d4",
"score": "0.46023953",
"text": "def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end",
"title": ""
},
{
"docid": "c8c90144dc2504cd0c284e3547b96ef1",
"score": "0.45986184",
"text": "def validations\n options_to_validations(@options)\n end",
"title": ""
},
{
"docid": "39a756356db54abc73839da348b2bea5",
"score": "0.45868045",
"text": "def initialize(options = {})\n @show_warnings = options.delete(:show_warnings)\n @validator = W3CValidators::MarkupValidator.new(options)\n end",
"title": ""
},
{
"docid": "691c6ce1c1cd1729cac4ace85bc6d6b1",
"score": "0.45853516",
"text": "def new_group(group_data)\n [:id, :name].each { |attr| raise(ArgumentError, \"Missing or Invalid Parameter(s)\") unless group_data.key?(attr) }\n set_values group_data\n end",
"title": ""
},
{
"docid": "633b567c84f328ee731f8d22a96df7b1",
"score": "0.4574805",
"text": "def initialize(options)\n @options = options\n @pattern = DMAMP.pattern(options[:pattern])\n @modname = @options[:modulename]\n self.build\n end",
"title": ""
},
{
"docid": "c343d11d3f46744e1cb3232e08250b58",
"score": "0.45632234",
"text": "def create\n group = params[:group] || {}\n group.delete(:locales)\n group.delete(:domains)\n @group = GROUP.new(group)\n @group.current_user = current_user\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group, :status => :created, :location => group_url(@group.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46dbcb318843ae2fc348aff2848f17fa",
"score": "0.4559375",
"text": "def create_default_authentication_ldap_configuration(opts)\n opts = check_params(opts,[:search_base_dn,:servers])\n super(opts)\n end",
"title": ""
},
{
"docid": "2ea54efd0f7c40587e63fe68284a7be7",
"score": "0.45507517",
"text": "def initialize(*arg)\n super(*arg)\n\n if @fragment\n raise InvalidURIError, 'bad LDAP URL'\n end\n\n parse_dn\n parse_query\n end",
"title": ""
},
{
"docid": "f1ee0662e20db0b28ce5ea2976232d9c",
"score": "0.45357448",
"text": "def initialize_mailing_list_group\n @mailing_list_group_id = correct_integer?(params[:group_id]) ? params[:group_id].to_i : 0\n @mailing_list_group = MailingListGroup.find_by_id @mailing_list_group_id\n update_ok(!@mailing_list_group.nil?)\n end",
"title": ""
},
{
"docid": "48a06ac25bf9ae33ea7c1a9a66faa00d",
"score": "0.45097333",
"text": "def create_external_feed_groups(group_id,url,verbosity,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :url,\n :header_match,\n :verbosity,\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"url is required\" if url.nil?\n raise \"verbosity is required\" if verbosity.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :url => url,\n :verbosity => verbosity\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/external_feeds\",\n :group_id => group_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n ExternalFeed.new(response)\n end",
"title": ""
},
{
"docid": "f29c7b2f3d5e5fc883279882cfa319ea",
"score": "0.45008647",
"text": "def initialize(options = {})\n options[:parser] = 'html'\n if options[:validator_uri]\n @validator_uri = URI.parse(options[:validator_uri])\n options.delete(options[:validator_uri])\n else\n @validator_uri = URI.parse(MARKUP_VALIDATOR_URI)\n end\n super(options)\n end",
"title": ""
},
{
"docid": "fe55cc80068c5cbbc1924bec5eebc913",
"score": "0.4477459",
"text": "def initialize(options)\n raise \"Invalid options\" unless (options.has_key?(:links_file) and options.has_key?(:dept_abbrevs) and options.has_key?(:verbose))\n @evals = []\n @failed_count = 0\n options[:links_file].readlines.each do |link|\n doc = Hpricot(open(link.chomp))\n eval = Eval.new(doc, options[:dept_abbrevs])\n if eval.valid?\n @evals << eval\n puts eval if options[:verbose]\n else\n @failed_count += 1\n end\n end\n self\n end",
"title": ""
},
{
"docid": "0188e0e8bb11e7426ed4c5547caf46f1",
"score": "0.44700208",
"text": "def initialize(user, group)\n if user.admin_in_group?(group) \n can [:read, :update], Group, :id => group.id\n can :invite_to, Group, :id => group.id\n can :accept_member, GameUserGroup, :group_id => group.id\n can :create_collection, Group, :id => group.id\n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n elsif user.owner_in_group?(group)\n can :manage, Group\n can :invite_to, Group, :id => group.id\n can :accept_member, GameUserGroup, :group_id => group.id\n can :create_collection, Group, :id => group.id\n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n else\n can :read, Group do |group|\n gug_state = user.game_user_groups.where(:group_id => group.id).first.state\n if gug_state == 'accepted'\n true\n else\n false\n end\n end\n \n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n end\n end",
"title": ""
},
{
"docid": "4be806169111bc47af906fecc1cafb6a",
"score": "0.44682297",
"text": "def initialize\n @options = Options.new({})\n @rules = {}\n @dicts = {}\n @transforms = {}\n @modifiers = Modifiers.new\n end",
"title": ""
},
{
"docid": "bf6a4d0c8cbe7c246bea9aac827d93bc",
"score": "0.44644943",
"text": "def new\n @group = Group.new\n end",
"title": ""
},
{
"docid": "89e587c3a4c6e48f0d7bc4b4d919c3a4",
"score": "0.44641045",
"text": "def initialize(options)\n options = {\n reader: nil\n }.merge(options)\n # @auth_rules = AuthorizationRuleSet.new reader.auth_rules_reader.auth_rules\n @reader = ::Authoreyes::Parser::DSLParser.factory(options[:reader] || AUTH_DSL_FILES)\n end",
"title": ""
},
{
"docid": "035cd88616d6fb417bef124680837667",
"score": "0.44633934",
"text": "def initialize(*args, email_selector: nil, filename: nil, ldap_lookup: nil, **kwargs, &block)\n super(*args, **kwargs, &block)\n self.email_selector = email_selector\n self.ldap_lookup = ldap_lookup\n self.load(filename) if filename\n end",
"title": ""
},
{
"docid": "7c5e4da6772e47a707d0ad23746cc348",
"score": "0.44612178",
"text": "def ldap_crea_grupo(grupo, prob)\n if !ENV['JN316_CLAVE']\n prob << 'Falta clave LDAP para agregar grupo'\n return nil\n end\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n ldap_conadmin = Net::LDAP.new( opcon )\n cn = limpia_cn(grupo.cn)\n dn = \"cn=#{cn},#{Rails.application.config.x.jn316_basegrupos}\"\n if grupo.gidNumber.nil?\n grupo.gidNumber = Msip::Grupo.maximum('gidNumber')\n if grupo.gidNumber.nil?\n prob << \"No pudo obtenerse gidNumber máximo. Parece que no ha sincronizado (cree algún usuario en LDAP antes)\"\n return false\n end\n grupo.gidNumber += 1\n end\n attr = {\n cn: cn,\n gidNumber: grupo.gidNumber.to_s,\n description: grupo.nombre,\n objectclass: [\"top\", \"posixGroup\"]\n }\n gusuarios = grupo.usuario.map(&:nusuario).sort.uniq\n ldap_conadmin.open do |ldap|\n if !ldap.add(:dn => dn, :attributes => attr)\n prob << ldap.get_operation_result.code.to_s +\n ' - ' + ldap.get_operation_result.message \n return false\n end\n gusuarios.each do |nusuario|\n unless ldap.add_attribute(dn, 'memberUid', nusuario)\n prob << ldap.get_operation_result.code.to_s +\n ' - ' + ldap.get_operation_result.message \n return nil\n end\n end\n end\n return true\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP (ldap_crea_grupo). ' +\n ' Excepción: ' + exception.to_s\n puts prob\n return false\n end",
"title": ""
},
{
"docid": "154d8964644d14849b290a63a707f5ea",
"score": "0.44579467",
"text": "def domain_validation_option(&block)\n option = ResourceProperty::CertificateManagerCertificateDomainValidationOption.new(self)\n option.instance_exec(&block) if block\n domain_validation_options << option\n end",
"title": ""
},
{
"docid": "c4e7000d968b6b489367c408e3ecc2aa",
"score": "0.44469187",
"text": "def new\n @user_group = UserGroup.new\n @permissions = {}\n @group_permissions = Permission.get_group_permissions\n @group_permissions.each do |g|\n @permissions[g.group_permission_name] = Permission.get_permission_in_group_permission(g.group_permission_name)\n end\n end",
"title": ""
},
{
"docid": "6d728d4a9259eb908d7c1996657b55e8",
"score": "0.4442497",
"text": "def create_validators(fields)\n validators = []\n\n fields.each do |attribute, validations|\n next unless validations.is_a? Hash\n\n validations.each do |key, options|\n key = \"#{key.to_s.camelize}Validator\"\n\n begin\n validator = key.include?('::') ? key.constantize : ActiveModel::Validations.const_get(key)\n rescue NameError\n raise ArgumentError, \"Unknown validator: '#{key}'\"\n end\n\n validators << validator.new(_parse_validates_options(options).merge(:attributes => [ attribute ]))\n end\n end\n\n validators\n end",
"title": ""
},
{
"docid": "0b35d397729059370d46f3881933aa78",
"score": "0.44393528",
"text": "def initialize( options={} )\n\t\toptions = DEFAULT_OPTIONS.merge( options )\n\n\t\t@host = options[:host]\n\t\t@port = options[:port]\n\t\t@connect_type = options[:connect_type]\n\t\t@results_class = options[:results_class]\n\n\t\t@conn = nil\n\t\t@bound_user = nil\n\n\n\t\t@object_conversions = DEFAULT_OBJECT_CONVERSIONS.dup\n\t\t@attribute_conversions = DEFAULT_ATTRIBUTE_CONVERSIONS.dup\n\t\t@registered_controls = []\n\n\t\t@base_dn = options[:base_dn] || self.get_default_base_dn\n\t\t@base = nil\n\n\t\t# Immediately bind if credentials are passed to the initializer.\n\t\tif ( options[:bind_dn] && options[:pass] )\n\t\t\tself.bind( options[:bind_dn], options[:pass] )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "be21cbb421a6f9c22fb95dbc8ea0b468",
"score": "0.44376734",
"text": "def initialize(args)\n @label = LABEL\n @hash = validate(args)\n end",
"title": ""
},
{
"docid": "033c5637f2bec19051a8f1e856d7e9c7",
"score": "0.44333145",
"text": "def validate(dn, errs = [])\r\n errs.clear # Make sure the array starts out empty\r\n if dn.nil?\r\n errs << ERRS[:zero_size]\r\n else\r\n dn = dn.strip\r\n errs << ERRS[:zero_size] if dn.size == 0\r\n end\r\n\r\n if errs.size == 0\r\n errs << ERRS[:max_domain_size] if dn.size > MAX_DOMAIN_LENGTH\r\n parts = dn.downcase.split('.')\r\n errs << ERRS[:max_level_size] if parts.size > MAX_LEVELS\r\n errs << ERRS[:min_level_size] if parts.size < MIN_LEVELS\r\n parts.each do |p|\r\n errs << ERRS[:max_label_size] if p.size > MAX_LABEL_LENGTH\r\n errs << ERRS[:label_dash_begin] if p[0] == '-'\r\n errs << ERRS[:label_dash_end] if p[-1] == '-'\r\n errs << ERRS[:illegal_chars] unless p.match(/^[a-z0-9\\-\\_]+$/)\r\n end\r\n errs << ERRS[:top_numerical] if parts.last.match(/^[0-9]+$/)\r\n if parts.last.size < MIN_TLD_LENGTH || parts.last.size > MAX_TLD_LENGTH\r\n unless parts.last == 'arpa' ||\r\n parts.last == 'aero' ||\r\n parts.last == 'asia' ||\r\n parts.last == 'coop' ||\r\n parts.last == 'info' ||\r\n parts.last == 'jobs' ||\r\n parts.last == 'mobi' ||\r\n parts.last == 'museum' ||\r\n parts.last == 'name' ||\r\n parts.last == 'post' ||\r\n parts.last == 'travel' ||\r\n parts.last.match(/^xn--/)\r\n errs << ERRS[:bogus_tld] \r\n end\r\n end\r\n errs << ERRS[:illegal_start] if parts.first[0] == '.'\r\n end\r\n\r\n errs.size == 0 # TRUE if valid, FALSE otherwise\r\n end",
"title": ""
},
{
"docid": "8db80d6ade12fd27f8e8501fe42cfd52",
"score": "0.44292867",
"text": "def new\n \t@group = Group.new\n end",
"title": ""
},
{
"docid": "2dbfa7b4c85ebc5ce9c781f3f6875b5e",
"score": "0.4425979",
"text": "def validate(validator, *args); validation_chain.validate(validator, *args); end",
"title": ""
},
{
"docid": "9319d17fd53795f034c5f473fc9eba2e",
"score": "0.44217858",
"text": "def initialize(rules = Rules.new, commands = Commands.new, &block)\n @rules = rules\n @commands = commands\n configure(&block)\n end",
"title": ""
},
{
"docid": "1abcd9c01e5212994e5496e9e79c8392",
"score": "0.4411726",
"text": "def initialize(folder1, folder2, options)\n \t @folder1 = folder1\n \t @folder2 = folder2\n \t @format = options['output']\n \t @filehash = Hash.new\n\t\t\t validate\n\t\tend",
"title": ""
},
{
"docid": "d6ef71cdf08c7dc0bfc725fd6db25978",
"score": "0.44065675",
"text": "def initialize(options = {})\n @dicts = {}\n @google, @strict = [ false, true ]\n @data = {}\n\n reset_options_with options\n end",
"title": ""
},
{
"docid": "9bf2e36afc911d18afdcdb84e6622770",
"score": "0.44030404",
"text": "def test_constructor\n\n endpoint = SmsCountryApi::Endpoint.new(\"abcdefghijkl\", \"xyzzy\")\n refute_nil endpoint, \"Endpoint was not successfully created.\"\n obj = SmsCountryApi::Group.new(endpoint)\n refute_nil obj, \"Group object was not successfully created.\"\n assert_kind_of SmsCountryApi::Group, obj, \"Group object isn't the right type.\"\n\n assert_raises ArgumentError do\n obj = SmsCountryApi::Group.new(nil)\n end\n\n assert_raises ArgumentError do\n obj = SmsCountryApi::Group.new(\"Non-endpoint\")\n end\n\n end",
"title": ""
},
{
"docid": "7f69dc69532a0af7336a225a896aa5fd",
"score": "0.44027555",
"text": "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",
"title": ""
},
{
"docid": "c36c493edc256f5e11573160d292821b",
"score": "0.44009447",
"text": "def initialize(opts = {})\n validate_basic_constraints opts[:basic_constraints]\n validate_key_usage opts[:key_usage]\n validate_extended_key_usage opts[:extended_key_usage]\n validate_certificate_policies opts[:certificate_policies]\n validate_inhibit_any_policy opts[:inhibit_any_policy]\n validate_policy_constraints opts[:policy_constraints]\n validate_name_constraints opts[:name_constraints]\n @ocsp_no_check = (opts[:ocsp_no_check] == true or opts[:ocsp_no_check] == \"true\")?true:false\n validate_subject_item_policy opts[:subject_item_policy]\n end",
"title": ""
},
{
"docid": "e1b28c6bb6e583e6ff7b84d133b823c7",
"score": "0.43912634",
"text": "def build_option_validator(option)\n option_validator = OptionValidator.new\n option_validator.add(ArgumentTypeValidator.new) if option.type?\n option_validator\n end",
"title": ""
},
{
"docid": "044e31ee7072a82a830c1d4f3e655f14",
"score": "0.43810526",
"text": "def initialize(name, parent_options, parent_report_group = nil)\n raise \"Configuration Error: #{parent_report_group.path.join('>')} lists the group '#{name}' that has not been defined\" unless AppConfig[\"report_groups\"][name] || parent_report_group.nil?\n @name = name\n @attributes = AppConfig[\"report_groups\"][name] || {}\n @parent_report_group = parent_report_group\n @options = parent_options.merge(@attributes[\"options\"]) rescue parent_options\n @groups = []\n begin\n @groups = @attributes[\"groups\"].collect do |group_name|\n if path.include?(group_name)\n raise \"Configuration Error: report_groups path #{path.join('>')} attempts to loop back on itself by adding #{group_name} again\"\n end\n ReportGroup.new(group_name, @options, self)\n end\n rescue NoMethodError\n end\n end",
"title": ""
},
{
"docid": "428c1a9250d889fc7147c5a28b7135a7",
"score": "0.43788835",
"text": "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",
"title": ""
},
{
"docid": "7427f2bbae0d1453b5ab6e3484399399",
"score": "0.43771082",
"text": "def new\n @group = Group.new \n end",
"title": ""
},
{
"docid": "8969aace976c3c3f5204ad8384e58449",
"score": "0.43721732",
"text": "def add_validation(args, validator, onfailure)\n args = [args] if Symbol===args\n @rules << ValidationRule.new(args, validator, onfailure)\n end",
"title": ""
},
{
"docid": "4ae5e75324b57db8b983a7c4402e7f40",
"score": "0.43713945",
"text": "def new\n @student_group = StudentGroup.find(params[:student_group])\n @student_group_rules = Array.new(Rule.all.count) { StudentGroupRule.new }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_group_rule }\n end\n end",
"title": ""
}
] |
e0f7251197cf54f5640250cb796708ee
|
Tests to see if a template file exists for the specified format. If one doesn't exist then the style would fall back to an 'anonymous' template.
|
[
{
"docid": "447163a3bbbf3c2d8a6f76d0226844fe",
"score": "0.69802785",
"text": "def template?(format = :html, renderer = default_renderer)\n !(inline_template(format) || file_template(format, renderer)).nil?\n end",
"title": ""
}
] |
[
{
"docid": "a1538bd16533603e3af89dba4930903c",
"score": "0.7739857",
"text": "def template?(name, format)\n glob = dir.join(\"#{name}.#{format}.*\")\n Dir[glob].first\n end",
"title": ""
},
{
"docid": "2d97c4d8d266e7ee44d5b542397be1c8",
"score": "0.73571116",
"text": "def check_template_exists(template_path)\n unless File.exist?(template_path)\n puts \"The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.\".color(:red)\n exit 1\n end\n end",
"title": ""
},
{
"docid": "557a6086d5fa8e8a16ffa6c006a3fe11",
"score": "0.7335502",
"text": "def check_template_exists(template_path)\n unless File.exist?(template_path)\n puts \"The template #{template_path} does not exist. Are you sure you use the right template name? The template name does not require the extension.\".color(:red)\n exit 1\n end\n end",
"title": ""
},
{
"docid": "3fdba028013f2cdb9849ee4db68d0c0b",
"score": "0.707142",
"text": "def specific_template_exists?(template)\n template, extension = template.split('.')\n path = File.join(RAILS_ROOT, \"app/views\", template)\n if extension.blank?\n File.exist?(\"#{path}.rhtml\") || File.exist?(\"#{path}.html.haml\")\n else\n File.exist?(\"#{path}.#{extension}\")\n end\n end",
"title": ""
},
{
"docid": "c37900fcb7829dc05d9f41ec92c6d3ee",
"score": "0.7019946",
"text": "def template_exists?(template)\n File.exists?(File.join(self.class.template_root(true), \"_#{template}.html.erb\"))\n end",
"title": ""
},
{
"docid": "68ade76dc38f60a5683774d7bfa898aa",
"score": "0.68115044",
"text": "def specific_template_exists?(template)\n template, extension = template.split('.')\n path = File.join(RAILS_ROOT, \"app/views\", template)\n File.exist?(\"#{path}.#{extension || 'rhtml'}\")\n end",
"title": ""
},
{
"docid": "bc04a222c41dc602e2a93332d5f482d4",
"score": "0.67116207",
"text": "def find_template(template_path, format = nil, html_fallback = true)\n super\n rescue ::ActionView::MissingTemplate\n find_parent_template(template_path, format)\n end",
"title": ""
},
{
"docid": "f99e234cc5364060f0b6da64ad7407c3",
"score": "0.66367704",
"text": "def template\n possible_templates.find {|t| File.exists? \"#{t}.html\"}\n end",
"title": ""
},
{
"docid": "e6b9c7a29e2a036d0568fafbcd9f080d",
"score": "0.6495792",
"text": "def template_path_for(format)\n raise TemplateUndefined, \"Template for #{ format } is missing!\" if @renderers[format].nil?\n\n File.join( @template_path, @renderers[format] )\n end",
"title": ""
},
{
"docid": "7003e6f7f5a376a3d8fbe642d7911169",
"score": "0.64334947",
"text": "def check_for_file(format)\n File.exists?(\"#{@work.download_basename}.#{format}\")\n end",
"title": ""
},
{
"docid": "d03bde3c6ce956a9ee3d0c2a091f0b73",
"score": "0.6424691",
"text": "def detect_format\n # @templates contains Array of Hashes. Example:\n # [{name: \"\"blog-web-prod.json\", block: ...},\n # {name: \"\"api-web-prod.json\", block: ...}]\n formats = @templates.map{ |t| File.extname(t[:name]) }.uniq\n if formats.size > 1\n puts \"ERROR: Detected multiple formats: #{formats.join(\", \")}\".colorize(:red)\n puts \"All the source values in the template blocks in the config folder must have the same format extension.\"\n exit 1\n else\n found_format = formats.first\n if found_format\n detected_format = found_format.sub(/^\\./,'')\n detected_format = \"yaml\" if detected_format == \"yml\"\n else # empty templates, no templates defined yet\n detected_format = \"yaml\" # defaults to yaml\n end\n end\n detected_format\n end",
"title": ""
},
{
"docid": "24b9db6f6af4915361720b5378e76220",
"score": "0.6409929",
"text": "def exists?(style_name = default_style)\n if original_filename\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "3a4e9d78adc9a66b0f9aef77736ef667",
"score": "0.6380071",
"text": "def mktg_template_exists?( options )\n File.exists?( Rails.root.join('app','views',mktg_template_filename( options ) ))\n end",
"title": ""
},
{
"docid": "cbd7589b34c7e4e5b8a66755b3d40baa",
"score": "0.6373839",
"text": "def exists?(name)\r\n \t!template_paths(name).empty?\r\n end",
"title": ""
},
{
"docid": "07854a04f12ecf801a4aae455fc670d5",
"score": "0.63635147",
"text": "def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end",
"title": ""
},
{
"docid": "07854a04f12ecf801a4aae455fc670d5",
"score": "0.63635147",
"text": "def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end",
"title": ""
},
{
"docid": "e6604239d8bf02053bf23fe77a49811e",
"score": "0.6316039",
"text": "def exists?(style_name = default_style)\n filesystem.exists?\n end",
"title": ""
},
{
"docid": "2783315561dbca696d9088f70f768654",
"score": "0.6310654",
"text": "def has_template?(tmpl, cookbook=nil)\n has_source?(tmpl, :templates, cookbook)\n end",
"title": ""
},
{
"docid": "6e7ca966a9893e93b4a2cf3037d51b6b",
"score": "0.6274341",
"text": "def exists?(style_name = default_style)\n filesystem.exists?(style_name)\n end",
"title": ""
},
{
"docid": "1a7cc9685b46542a2efe026016d664d0",
"score": "0.6235031",
"text": "def template?\n return false if source_file.nil?\n !::Tilt[source_file].nil?\n end",
"title": ""
},
{
"docid": "785ee06f909c98b95033fa9b1ae0de2c",
"score": "0.6178662",
"text": "def template(name, opts={})\n format = opts.fetch(:format, default_format)\n template_name = template_name_and_format_glob(name,format, opts)\n\n return _template_cache[template_name] if _template_cache[template_name]\n\n file = nil\n layout_dirs.detect do |dir|\n file = Dir[File.join(dir, template_name)].first\n end\n\n if file.nil?\n nil\n else\n _template_cache[template_name] = Tilt.new(file)\n end\n end",
"title": ""
},
{
"docid": "6dbb036996227ad156e2e58c4fcbb86d",
"score": "0.617044",
"text": "def config_template_exist?\n Chef::Log.debug(\"config_template_exist?: Checking for config file template #{new_resource.config_file}\")\n config_resource = !find_resource!(:template, ::File.join(new_resource.config_file)).nil?\n\n Chef::Log.debug(\"config_template_exist?: #{config_resource}\")\n config_resource\n rescue Chef::Exceptions::ResourceNotFound\n Chef::Log.debug(\"config_template_exist?: Config file template #{new_resource.config_file} ResourceNotFound\")\n false\n end",
"title": ""
},
{
"docid": "ef9ecc98549b41b20b10e907724e9922",
"score": "0.6152741",
"text": "def check_type_template(type)\n assit_kind_of(String, type)\n file_name = File.join(self.class.path_to_self, @template_dir, \"_#{type}.rhtml\")\n if(FileTest.exists?(file_name))\n File.join(@template_dir, type)\n else\n File.join(@template_dir, \"default\")\n end\n end",
"title": ""
},
{
"docid": "7480d94afe0c8ddabef4a9c8138f95c3",
"score": "0.60430425",
"text": "def user_template_exists?\n !options['puppet_config_template'].nil? &&\n File.exist?(options['puppet_config_template'])\nend",
"title": ""
},
{
"docid": "47569c36c2f08c85852c53a5c56d2b7c",
"score": "0.60173005",
"text": "def validate_template_name\n GlobalConstant::PepoCampaigns.supported_templates.include?(@template_name) ? success : error_with_data(\n 'e_hc_stm_1',\n 'something_went_wrong',\n GlobalConstant::ErrorAction.default,\n {template_name: @template_name}\n )\n end",
"title": ""
},
{
"docid": "5f7861517786c2ad4cdb6506efba9386",
"score": "0.59840727",
"text": "def find_template(template, environment = nil)\n if template == File.expand_path(template)\n return template\n end\n\n if template_paths = templatepath(environment)\n # If we can find the template in :templatedir, we return that.\n template_paths.collect { |path|\n File::join(path, template)\n }.each do |f|\n return f if FileTest.exist?(f)\n end\n end\n\n # check in the default template dir, if there is one\n if td_file = find_template_in_module(template, environment)\n return td_file\n end\n\n nil\n end",
"title": ""
},
{
"docid": "7c73bc0ae6dff58f3374f5b6e07bc137",
"score": "0.59611243",
"text": "def raise_template_error_with message\n raise MissingTemplateError.new \"No template #{message} found.\"\n end",
"title": ""
},
{
"docid": "a11bfca2aa7ddc74394526176d588f85",
"score": "0.59213066",
"text": "def glob_template(path, opts = {})\n the_template = \"#{path}.#{opts[:format] || @_template_format}\"\n Merb::AbstractController._template_path_cache[the_template] || (@_merb_unmatched = (the_template + \".*\"); nil)\n end",
"title": ""
},
{
"docid": "27670d07355510beb950c23bd252ce23",
"score": "0.59212977",
"text": "def effective_template(file, env)\n template_file = Puppet::Parser::Files.find_template(file, env)\n if !template_file.nil?\n template_file\n elsif Puppet::FileSystem.exist?(file)\n file\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "0b2ccec1f024bca51a5ccd67747084fc",
"score": "0.5886533",
"text": "def find_template_sub(t)\n for path in [File.join(juli_repo, Juli::REPO), Juli::TEMPLATE_PATH] do\n template = File.join(path, t)\n return template if File.exist?(template)\n end\n raise Errno::ENOENT, \"no #{t} found\"\n end",
"title": ""
},
{
"docid": "9f3856f85d58d48f200efa8b5e3b1806",
"score": "0.5864679",
"text": "def pdf_template\n valid_templates = %w(standard f90)\n params[:template] && valid_templates.include?(params[:template]) ? params[:template] : valid_templates.first\n end",
"title": ""
},
{
"docid": "ae28e157869751b54b8acab54d2730ca",
"score": "0.5830696",
"text": "def load_template(template_path)\n if ! File.exist?(template_path)\n return nil\n end\n\n return File.read(template_path)\nend",
"title": ""
},
{
"docid": "8ed9c65300a357de87d9402aad41b44f",
"score": "0.5816",
"text": "def _pick_template(template_path)\n return template_path if template_path.respond_to?(:render)\n\n path = template_path.sub(/^\\//, '')\n if m = path.match(/(.*)\\.(\\w+)$/)\n template_file_name, template_file_extension = m[1], m[2]\n else\n template_file_name = path\n end\n\n # OPTIMIZE: Checks to lookup template in view path\n if template = self.view_paths[\"#{template_file_name}.#{template_format}\"]\n template\n elsif template = self.view_paths[template_file_name]\n template\n elsif (first_render = @_render_stack.first) && first_render.respond_to?(:format_and_extension) &&\n (template = self.view_paths[\"#{template_file_name}.#{first_render.format_and_extension}\"])\n template\n elsif template_format == :js && template = self.view_paths[\"#{template_file_name}.html\"]\n @template_format = :html\n template\n else\n template = ActionView::Template.new(template_path, view_paths)\n template.registerView(self)\n\n if self.class.warn_cache_misses && logger\n logger.debug \"[PERFORMANCE] Rendering a template that was \" +\n \"not found in view path. Templates outside the view path are \" +\n \"not cached and result in expensive disk operations. Move this \" +\n \"file into #{view_paths.join(':')} or add the folder to your \" +\n \"view path list\"\n end\n\n template\n end\n end",
"title": ""
},
{
"docid": "74f3fee54bf7aeaa2bf13b6cfb4f77cc",
"score": "0.5802299",
"text": "def template_path\n File.join(File.dirname(__FILE__), 'templates', 'type', \"#{@format}.erb\")\n end",
"title": ""
},
{
"docid": "6c4f6f149d8124f1bf57213721f12628",
"score": "0.57889307",
"text": "def thumb_exists_for?(format)\n File.exists?(self.thumb_path_for(format))\n end",
"title": ""
},
{
"docid": "2ba69d1324c87faa2dcc730f3a5e3331",
"score": "0.5750952",
"text": "def template_named template_name\n\ttemplate_path = \"templates/#{template_name}.erb\"\n\tif File.exists? template_path\n\t\tERB.new(File.open(template_path).read)\n\telse\n\t\traise \"Template named '#{template_name}' not found at location #{template_path}!\"\n\tend\nend",
"title": ""
},
{
"docid": "5d0be954aa8c6fdfc93b330a96c8418e",
"score": "0.5750812",
"text": "def templated?\n !template.nil?\n end",
"title": ""
},
{
"docid": "c29e5042fcf20b0136493f9bdd6136cc",
"score": "0.5730768",
"text": "def find_parent_template(template_path, format = nil, html_fallback = true)\n # first, we grab the inherit view paths that are 'above' the given template_path\n if inherit_view_paths.present? && (starting_path = inherit_view_paths.detect {|path| template_path.starts_with?(\"#{path}/\")})\n parent_paths = inherit_view_paths.slice(inherit_view_paths.index(starting_path)+1..-1)\n # then, search through each path, substituting the inherit view path, returning the first found\n parent_paths.each do |path|\n begin\n return orig_find_template(template_path.sub(/^#{starting_path}/, path), format, html_fallback)\n rescue ::ActionView::MissingTemplate\n next\n end\n end\n end\n raise ::ActionView::MissingTemplate.new(self, template_path, format)\n end",
"title": ""
},
{
"docid": "8ed917350c6aa247cedf46d4d1716558",
"score": "0.5701033",
"text": "def template_for(path)\n path = File.expand_path(path) \n METHOD_LIST[path] ||= begin\n unless File.exists?(path) \n raise ArgumentError, \"Could not find a template at #{path}.*\"\n end\n inline_template(path)\n end\n end",
"title": ""
},
{
"docid": "3eabd0abc6a444818a75358f3c6def63",
"score": "0.5696795",
"text": "def find_template(name)\n \n # Search in theme path\n template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{name}.erb\",'template','ui') \n \n # Search in the project\n if not template_path\n path = app.get_path(name) #File.expand_path(File.join(File.dirname(__FILE__), '..', 'views', \"#{name}-fieldset-render.erb\")) \n template_path = path if File.exist?(path)\n end\n \n template_path\n \n end",
"title": ""
},
{
"docid": "e5caefc84c3995cd65fafb57771d52e9",
"score": "0.5696749",
"text": "def use_template_filename\n return nil unless @args[:___use_template___]\n ConfigData.real_type_filename 'templates', @args[:___use_template___]\n end",
"title": ""
},
{
"docid": "94d7bcbe16f002a904373fe8d0b78121",
"score": "0.56792796",
"text": "def find_templates(name, prefix, partial, details)\n # checks if the format has a fallback chain\n if @fallback_formats.has_key?(details[:formats].first)\n details = details.dup\n details[:formats] = Array.wrap(@fallback_formats[details[:formats].first]) \n end\n super(name, prefix, partial, details)\n end",
"title": ""
},
{
"docid": "20cd87d8be6115ff85ea645c22df04c7",
"score": "0.56669277",
"text": "def get_template(name)\n if File.exists?(\"#{repository.path}/#{name}.mustache\")\n IO.read(\"#{repository.path}/#{name}.mustache\")\n else\n IO.read(File.join(File.dirname(__FILE__), \"templates/#{name}.mustache\"))\n end\n end",
"title": ""
},
{
"docid": "587f3f8d4b0843acc25d5e891f689c74",
"score": "0.56657356",
"text": "def font_exists?\n ::File.exist?(@current_resource.file)\nend",
"title": ""
},
{
"docid": "df6d009aa13f11b5c208d02ceb569f50",
"score": "0.5663362",
"text": "def find_template(opts={})\n if template = opts[:template]\n path = _template_root / template\n elsif action = opts[:action]\n segment = self.class.name.snake_case.split('::').join('/')\n path = _template_root / segment / action\n elsif _layout = opts[:layout]\n path = _template_root / 'layout' / _layout\n else\n raise \"called find_template without an :action or :layout\" \n end \n glob_template(path, opts)\n end",
"title": ""
},
{
"docid": "ee3ddae840ecc7f9df586f88d1e6392c",
"score": "0.5656067",
"text": "def content_template_specified?\n return if content_template_text || content_template_name\n\n errors.add :content_template_name, 'or content template text must be set'\n end",
"title": ""
},
{
"docid": "0f0e9ffd2f3e2765cedc89dafc3e0b61",
"score": "0.5648895",
"text": "def has_file_format?\n @file_format\n end",
"title": ""
},
{
"docid": "9f833e0a322f93b5fd39fa1985a3bf70",
"score": "0.5640183",
"text": "def template_file\n @template_file || \"#{path}/#{template_name}.#{template_extension}\"\n end",
"title": ""
},
{
"docid": "9c51cfa1482b3753a0d4cfb0bcde43b7",
"score": "0.56315076",
"text": "def static_template_file?\n # this const was defined in StaticFileCommand originally\n default_mime_types = StaticFileCommand::DefaultMimeTypes\n\n file = find_file(adapter, path)\n\n if file\n ext = \".\" + (path[/\\.(\\w+)$/, 1] || \"html\")\n headers['Content-Type'] = mime_type(ext, default_mime_types)\n self.body = File.read(file)\n raise FinishRequest\n end\n end",
"title": ""
},
{
"docid": "ea51764207c7f803125ccafa631764f1",
"score": "0.5631138",
"text": "def template_for(filename, opts = {})\n # A bunch of potential matches in order of preference.\n candidates = if Gluttonberg.localized?\n # Locale and dialect\n # Locale only\n # Default\n [\n \"#{filename}.#{opts[:locale].slug}.#{opts[:dialect].code}\",\n \"#{filename}.#{opts[:locale].slug}\",\n \"#{filename}\"\n ]\n elsif Gluttonberg.translated?\n # Dialect\n # Default\n [\n \"#{filename}.#{opts[:dialect].code}\",\n \"#{filename}\"\n ]\n else\n [\"#{filename}.*\"]\n end\n # Loop through them and return the first match\n for candidate in candidates \n path = template_dir / candidate + \".*\"\n matches = Dir.glob(path)\n return candidate unless matches.empty?\n end\n # This nil has to be here, otherwise the last evaluated object is \n # returned, in this case the candidates hash.\n nil\n end",
"title": ""
},
{
"docid": "841d0b941b1a50894f64d86db7a9ad7e",
"score": "0.5583904",
"text": "def sample_template?\n return false if external_asset.is_a? OpenbisExternalAsset\n possible_sample_types.any?\n rescue SysMODB::SpreadsheetExtractionException\n false\n end",
"title": ""
},
{
"docid": "954cefd9c2f66fc428ff269e3f4d61ad",
"score": "0.55821556",
"text": "def resolve_standard_template(name)\n @template_lookup.lookup(name)\n end",
"title": ""
},
{
"docid": "5e0d2eb482c511c635c0a75c81593ffc",
"score": "0.5527935",
"text": "def find_tpl_file(fname)\n # add default search directory\n ipath = File.expand_path(File.dirname(__FILE__) + '/../templates')\n opts.tpl_directories << ipath unless opts.tpl_directories.include?(ipath)\n rpath = File.expand_path('./templates')\n opts.tpl_directories << rpath unless opts.tpl_directories.include?(rpath)\n\n fname = 'default.' + fname unless fname =~ /\\./\n cand, buf = [], nil\n fname.split('.').reverse.each do |b|\n buf = buf ? b + '.' + buf : b\n cand.unshift buf\n end\n\n cand.each do |pt|\n opts.tpl_directories.each do |d|\n tpl = d + '/' + pt + '.erb'\n return tpl if File.exists?(tpl)\n end\n end\n\n # raise 'no template file found for ' + opts.template\n nil\n end",
"title": ""
},
{
"docid": "6835aad523c17f29f8864858fa7971e0",
"score": "0.5527935",
"text": "def get_template(path)\n parts = [\n device_name(screen_size(path)),\n orientation_name(path),\n @color\n ]\n\n templates_path = [ENV['HOME'], FrameConverter::FRAME_PATH].join('/')\n templates = Dir[\"#{templates_path}/**/#{parts.join('_')}*.png\"]\n\n if templates.count == 0\n if screen_size(path) == Deliver::AppScreenshot::ScreenSize::IOS_35\n Helper.log.warn \"Unfortunately 3.5\\\" device frames were discontinued. Skipping screen '#{path}'\".yellow\n else\n Helper.log.error \"Could not find a valid template for screenshot '#{path}'\".red\n Helper.log.error \"You can download new templates from '#{FrameConverter::DOWNLOAD_URL}'\"\n Helper.log.error \"and store them in '#{templates_path}'\"\n Helper.log.error \"Missing file: '#{parts.join('_')}.psd'\".red\n end\n return nil\n else\n # Helper.log.debug \"Found template '#{templates.first}' for screenshot '#{path}'\"\n return templates.first.gsub(\" \", \"\\ \")\n end\n end",
"title": ""
},
{
"docid": "0189c30f6c6cc9b9cafae6ad8bfb8c7a",
"score": "0.5518503",
"text": "def template\n @template ||= File.read(template_full_path)\n end",
"title": ""
},
{
"docid": "92bf255583fdacfdee54fdf85765c1a4",
"score": "0.5504566",
"text": "def get_template(params)\n if params[:file_path]\n return get_template_from_file(params[:file_path])\n elsif params[:template]\n return params[:template]\n else\n raise 'A valid template file path or template text is required.'\n end\n end",
"title": ""
},
{
"docid": "8a50b39e72f8c91f47299bc3c1ede196",
"score": "0.54953027",
"text": "def exists?(group, id, format = DEFAULT_FORMAT)\n File.exists?( file_name(group, id, format) )\n end",
"title": ""
},
{
"docid": "4ab24231a69b9211e4649ea2803d8bde",
"score": "0.54889494",
"text": "def find_template\n \n template_name = \"render-activity\"\n template_name << \"-#{display}\" unless display.nil?\n\n # Search in theme path\n activity_template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{template_name}.erb\",'template','activity') \n \n # Search in the project\n if not activity_template_path\n path = context.get_path(template_name) \n activity_template_path = path if not path.nil? and File.exist?(path)\n end\n \n return activity_template_path\n \n end",
"title": ""
},
{
"docid": "15cc209b5a4961eea63b4e4d94780960",
"score": "0.54777837",
"text": "def find_template(name)\n TEMPLATES.find do |fn, _|\n fn == name || fn.split('.').first == name\n end\n end",
"title": ""
},
{
"docid": "b9a9e0e860743433bb6f1c1aed819795",
"score": "0.54567957",
"text": "def exists?\n File.exists?(\"#{rdoc_dir('default')}/index.html\") && File.exists?(\"#{rdoc_dir(RdocInfo.config[:template])}/index.html\")\n end",
"title": ""
},
{
"docid": "dfd19f6c692427c32a9e2f822b1512e6",
"score": "0.54383767",
"text": "def render_document_export_format format_name\n render\n rescue ActionView::MissingTemplate\n render plain: @response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join(\"\\n\"), layout: false\n end",
"title": ""
},
{
"docid": "76f8c98d0be5ce048a9fd0c0324bf1f3",
"score": "0.5437703",
"text": "def file_exists?(file)\n false\n end",
"title": ""
},
{
"docid": "ca994ecb998460bc7c496e62af5a875b",
"score": "0.5425752",
"text": "def header_template?\n result = File.exists?(@@header_template)\n if result\n @@log.info \"#{__method__}: The header template was found at #{@@header_template}\"\n else\n @@log.error \"#{__method__}: Cannot find the header template file. Check the value of @@header_template in this script.\"\n return false\n end\n\n digest = Digest::SHA256.file(@@header_template.to_s)\n result = digest == @@header_digest\n unless result\n @@log.error \"#{__method__}: Did someone tamper with the header template? If you\"\n @@log.error \"#{__method__}: meant to change the template and know what you're doing,\"\n @@log.error \"#{__method__}: then the new digest is:\"\n @@log.error \"#{__method__}: #{digest}\"\n end\n result\n end",
"title": ""
},
{
"docid": "31496ccb43fbbbb9bc8aac69cc5099bf",
"score": "0.541183",
"text": "def render_for_file_with_dryml(template_path, status = nil, layout = nil, locals = {})\n render_for_file_without_dryml(template_path, status, layout, locals)\n rescue ActionView::MissingTemplate => ex\n # Try to use a DRYML <page> tag instead\n tag_name = @dryml_fallback_tag || \"#{File.basename(template_path).dasherize}-page\"\n\n text = call_dryml_tag(tag_name)\n if text\n render_for_text text, status \n else\n raise ex\n end\n end",
"title": ""
},
{
"docid": "db126167b28709bf9f1988816cab79c5",
"score": "0.5390463",
"text": "def locate_template(document)\n view_prefix = 'cms'\n\n return File.join(view_prefix, document.template) unless document.template.blank?\n return File.join(view_prefix, document.node.get(:template)) unless document.node.get(:template).blank?\n\n paths = [document.title.parameterize('_'), \n document.permalink.gsub('/', '.')[1..-1], \n document.permalink, \n document.node.ancestry.gsub('/root', ''),\n document.node.ancestry.gsub('/root', '').gsub('/', '.')[1..-1], \n 'default', \n 'show']\n paths.uniq.each do | path |\n view_paths.each do | view_path |\n rel_path = File.join(view_prefix, path) + '.html.erb'\n full_path = File.join(view_path.to_s, rel_path)\n if File.exists? full_path\n logger.debug \"Found: #{full_path}\"\n return rel_path\n else\n logger.debug \"Not Found: #{full_path}\"\n end\n end\n logger.debug ''\n end\n raise NoTemplateFound\n end",
"title": ""
},
{
"docid": "48d08ddc74771d67569097f4f3bffb82",
"score": "0.53878367",
"text": "def cfn_template_guess\n cfn_template_cfer || cfn_template_yaml || cfn_template_json\n end",
"title": ""
},
{
"docid": "272fe68cdb3c81d71e4e8e3150df95fe",
"score": "0.53849834",
"text": "def use_template_by_default\n @use_template_by_default || false\n end",
"title": ""
},
{
"docid": "1879123b9f28b526c9e2b9b8e77df020",
"score": "0.5383874",
"text": "def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end",
"title": ""
},
{
"docid": "a0b3fb9bdee804b13316ee0798635ec9",
"score": "0.5368107",
"text": "def active_template?\n stored_files.template.count > 0\n end",
"title": ""
},
{
"docid": "510346443d56caad3706a127a89949ae",
"score": "0.536497",
"text": "def template_for(file); end",
"title": ""
},
{
"docid": "1206dda50c57667712bcd38f161e7541",
"score": "0.5363162",
"text": "def fetch_template(template_name = nil)\n # Due to security reason, it cannot use templates outside until it will be fixed\n # if GitlabHook::Project::config['template']\n # return GitlabHook::Project::config['template']\n # end\n\n if template_name.nil?\n template_name = @default_template_name\n else\n validate_template_name template_name\n end\n\n File.read(\n File.expand_path(\n configatron.app.path.templates + '/slack/message/' +\n template_name + '.erb')\n )\n end",
"title": ""
},
{
"docid": "3cf2aede444672eb7ff1eab0ac2ba1ad",
"score": "0.53562313",
"text": "def invalid_format?(format)\n return true unless FORMATS.include?(format)\n end",
"title": ""
},
{
"docid": "1d41ef3494a47e68c5123b64fca65c28",
"score": "0.5350851",
"text": "def exists?\n File.exists?(@resource[:name])\n end",
"title": ""
},
{
"docid": "1cc380347b812bf845e48173819894da",
"score": "0.5347974",
"text": "def pagina_valida?\n requested_file = ActionController::Base.helpers.sanitize(params[:pagina])\n if File.exist?(Pathname.new(Rails.root + \"app/views/paginas/#{requested_file}.html.erb\"))\n true\n else\n raise \"Unknown file format requested\"\n end\n end",
"title": ""
},
{
"docid": "dcb29ccacc95261dc3bd8cd62b905ea3",
"score": "0.53281265",
"text": "def find_template(views, name, engine)\n filename = ::File.join(views, \"#{name}.#{engine}\")\n File.exist?(filename) ? filename : nil\n end",
"title": ""
},
{
"docid": "3b170ad3bbb826bccfd69c2de8e322cd",
"score": "0.5327952",
"text": "def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"title": ""
},
{
"docid": "1452e4f4107abdfac17dcdcbe8e8c73f",
"score": "0.5324552",
"text": "def resolve_ext(file_name)\n SUPPORTED_TEMPLATE_FORMATS.find { |ext| File.exists?(\"#{file_name}.#{ext}\") }\n end",
"title": ""
},
{
"docid": "c65f6c7969e8e3acb148e2f9bf129001",
"score": "0.5322674",
"text": "def load_file(file_name)\n @loadOK = false \n begin\n @template = File.read(file_name)\n @loadOK = true \n rescue => ex\n @template = ex.to_s \n @loadOK = false \n end\n return @loadOK\n end",
"title": ""
},
{
"docid": "8620d0b1c30a670bff28ea38a3d2e15b",
"score": "0.5317809",
"text": "def get_template_file(filename)\n if File.exists?(filename)\n templateFile = filename\n else\n templateFile = File.expand_path(\"../../#{filename}\", __FILE__)\n end\n\n File.read(templateFile)\nend",
"title": ""
},
{
"docid": "6542fed21a0b38682438dcad4dd0597e",
"score": "0.53176504",
"text": "def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n @template\n end",
"title": ""
},
{
"docid": "6895f536b7b3dc46c8cf5d71bc7e130a",
"score": "0.5317255",
"text": "def theme_exists?(theme_name)\n File.exist?(\"#{themes_path}/#{theme_name}\")\n end",
"title": ""
},
{
"docid": "d5ceeb42ce13b3f8ff0c0ba52bb6d914",
"score": "0.5308153",
"text": "def load_format(format)\n case format.to_s\n when /(md|mkdn?|mdown|markdown)$/i\n :markdown\n when /(textile)$/i\n :textile\n when /(rdoc)$/i\n :rdoc\n when /(org)$/i\n :org\n when /(creole)$/i\n :creole\n when /(re?st(\\.txt)?)$/i\n :rest\n when /(asciidoc)$/i\n :asciidoc\n when /(pod)$/i\n :pod\n when /(\\d)$/i\n :roff\n when /(media)?wiki$/i\n :mediawiki\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "d1fb33f58a45813ec94240ef6136d9ca",
"score": "0.530781",
"text": "def document_export_formats(format)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n if @response.export_formats.include? format_name\n render_document_export_format format_name\n else\n raise ActionController::UnknownFormat\n end\n end\n end",
"title": ""
},
{
"docid": "a0b1e1e1f596ca717c6fb027277f034c",
"score": "0.53015584",
"text": "def base_file_exists\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n uri = \"/notebooks/#{course}_#{file}\"\n if File.exist?(uri)\n render json: { result: true }\n else\n render json: { result: false }\n end\n end",
"title": ""
},
{
"docid": "499841f26814523e5b774a502cdb03c1",
"score": "0.529774",
"text": "def template_path(template)\n modulepath.each do | path|\n return path if File.exists?(\"#{path}/easy_type/templates/#{template}\")\n end\n fail \"Template #{template} not found in modulepath #{modulepath}\"\n end",
"title": ""
},
{
"docid": "fef1d0e492e5f515675de15909fdf504",
"score": "0.5295354",
"text": "def template(template)\n @template = \"#{Aina::TEMPLATES_DIR}/#{template}\" if template\n end",
"title": ""
},
{
"docid": "bb77507e20451f146e2b4e4ba679a4e6",
"score": "0.52928036",
"text": "def get_template(template); end",
"title": ""
},
{
"docid": "54baf477688d6fda2c974dccea52a8f7",
"score": "0.52903557",
"text": "def template( name )\n\t\ttemplate_name = \"#{name}.erb\"\n\t\ttemplate = self.template_search_path.\n\t\t\tmap {|dir| dir + template_name }.\n\t\t\tfind {|tmpl| tmpl.exist? }\n\n\t\ttemplate or raise Foreman::Export::Exception,\n\t\t\t\"Can't find the %p template in any of: %p\" %\n\t\t\t[ name, self.template_search_path.map(&:to_s) ]\n\n\t\terbtmpl = ERB.new( template.read, nil, '<%>' )\n\tend",
"title": ""
},
{
"docid": "63a180eaf4b17ccdd214ff532527c2ff",
"score": "0.52899146",
"text": "def find_template(template)\n template = locate_config_value(:template_regex) if template.nil?\n # if we got a string then try to find that template exact\n # if no exact template matches, search\n if template.is_a?(String)\n found = get_template(template)\n return found if found\n end\n\n # make sure our nil template gets set to default\n if template.nil?\n template = locate_config_value(:template_regex)\n end\n\n Chef::Log.debug \"Name: #{template.class}\"\n # quick and dirty string to regex\n unless template.is_a?(Regexp)\n template = /#{template}/\n end\n\n # loop over all vm's and find the template\n # Wish there was a better API method for this, and there might be\n # but i couldn't find it\n Chef::Log.debug \"Using regex: #{template}\"\n xapi.VM.get_all_records.each_value do |vm|\n if vm['is_a_template'] && vm['name_label'] =~ template\n Chef::Log.debug \"Matched: #{h.color(vm['name_label'], :yellow)}\"\n found = vm # we're gonna go with the last found\n end\n end\n\n # ensure return values\n if found\n ui.msg \"Using Template: #{h.color(found['name_label'], :cyan)}\"\n return get_template(found['name_label']) # get the ref to this one\n end\n nil\n end",
"title": ""
},
{
"docid": "a743698abfb795a070db9de6ff6aac1f",
"score": "0.5281354",
"text": "def find_template(views, name, engine)\n filename = ::File.join(views, \"#{name}.#{engine}\")\n File.exists?(filename) ? filename : nil\n end",
"title": ""
},
{
"docid": "00ef2a95b2c90f41eb6c9a578eece5b7",
"score": "0.5270289",
"text": "def load_template(name)\r\n f = lam_path(name)\r\n if File.exist?(f)\r\n File.open(f).read\r\n else\r\n raise \"Missing template file #{f}\"\r\n end\r\n end",
"title": ""
},
{
"docid": "c3c3e78756c503e56b86a7141f4068fc",
"score": "0.5269218",
"text": "def template(template_name = 'template.txt')\n File.read([File.dirname(__FILE__), template_name].join('/'))\n end",
"title": ""
},
{
"docid": "9e4f61a61edcb0abd05920ab7ad05e46",
"score": "0.52583927",
"text": "def get_type_template(types)\n default_template = File.join(@template_dir, \"default\")\n template = default_template\n \n # For each of the types, check if the type template exists\n for type in types\n assit_kind_of(N::URI, type)\n type_uri = type.to_name_s('_')\n template = if(Dependencies.mechanism == :require)\n @@type_templates[type_uri] ||= check_type_template(type_uri)\n else\n check_type_template(type_uri)\n end\n \n # When a template is found, break out\n return template unless(template == default_template)\n end\n \n template # Otherwise this will return \"default\"\n end",
"title": ""
},
{
"docid": "e32d90c93c041879f337f57a30e05c61",
"score": "0.52581435",
"text": "def get_template(filename)\n File.read(filename)\nend",
"title": ""
},
{
"docid": "810b1bd80c70ed1ff192fe6cff53874b",
"score": "0.52553016",
"text": "def locate_template(name)\n results = Dir.glob(@directory + \"/#{name}.{erb.sql,sql.erb}\")\n if results.length > 1\n raise Exception.new(\"Too many templates have the name '#{name}'. \")\n elsif results.length == 0\n raise Exception.new(\"Cannot find template '#{name}.erb.sql' in the directory '#{@directory}'.\")\n else\n # Check if they are using old file extensions. Only do it once though.\n if @@did_send_deprecation_notice != true && results.first.match(/\\.sql\\.erb$/)\n @@did_send_deprecation_notice = true\n puts \"Deprecation Notice: .sql.erb extensions for ERB SQL templates has been deprecated in favor of .erb.sql extensions.\"\n end\n \n return results.first\n end\n end",
"title": ""
},
{
"docid": "f9723911cdf4d82efc0e829440b38ea7",
"score": "0.5248778",
"text": "def exists?(style=default_style)\n client.object_exists?(path(style))\n end",
"title": ""
},
{
"docid": "6eb29fa8f47bd5b8e4de1e46fb9c8c0e",
"score": "0.5241986",
"text": "def find_template_extension_from_handler_with_generic_paths(template_path, template_format = @template.template_format)\r\n extension = find_template_extension_from_handler_without_generic_paths(template_path, template_format)\r\n if extension.blank? and search_generic_view_paths?\r\n self.class.template_handler_extensions.each do |handler_extension|\r\n return handler_extension if controller.find_generic_base_path_for(template_path, handler_extension)\r\n end\r\n end\r\n extension\r\n end",
"title": ""
},
{
"docid": "ddd215aa5f9b914abd3fa10e910f4fb7",
"score": "0.5229457",
"text": "def create_or_find_format_by name, variant = :default\n fs = @formats[name]\n fs = @formats[name] = {} if fs.nil?\n f = fs[variant]\n if f.nil?\n f = Workbook::Format.new\n if (variant != :default) && fs[:default]\n f = fs[:default].clone\n end\n @formats[name][variant] = f\n end\n @formats[name][variant]\n end",
"title": ""
},
{
"docid": "5a66235763a8e8e5bb695448e097b1b2",
"score": "0.5229355",
"text": "def set_template(file = \"human.erb\")\n @template = [\n ChefSpec.root.join(\"templates\", \"coverage\", file),\n File.expand_path(file, Dir.pwd),\n ].find { |f| File.exist?(f) }\n raise Error::TemplateNotFound.new(path: file) unless @template\n end",
"title": ""
},
{
"docid": "7fd2e8790ef8259d9c50fe4ef84abbf5",
"score": "0.52172446",
"text": "def check_acceptable_format\n if [\"txt\", \"png\"].include?(params[:format])\n params[:format] = nil\n raise ActiveRecord::RecordNotFound.new\n end\n end",
"title": ""
}
] |
29307493d8b5d3748f0c80a3c6ed8de5
|
Asserts attributes passed in for chaos mode are valid
|
[
{
"docid": "98ccbbdfe9a8749b320c7daa67bed88c",
"score": "0.70680845",
"text": "def assert_chaos_options( chaos )\n eval = -> { [Array, String, TrueClass, FalseClass, Symbol].include? chaos.class }\n msg = \"chaos: arg does not support object of type: '#{chaos.class}'\"\n raise NoSuchAttributeError, msg unless eval.call\n\n case chaos\n when Array\n assert_only_known_and_optional_attributes_for_chaos(chaos)\n when String, Symbol\n assert_only_known_and_optional_attributes_for_chaos([chaos])\n end\n end",
"title": ""
}
] |
[
{
"docid": "70614cca49616d8819f4001d4d9f468f",
"score": "0.7085583",
"text": "def test_attribute_detection\n verify_method :is_attribute?, with: [\n {param: ' attr_reader :a', expect: true},\n {param: ' attr_accessor :a1', expect: true},\n {param: ' attr_writer :a_a', expect: true},\n {param: ' attr_reader :a?', expect: true},\n {param: ' attr_accessor :a-', expect: true},\n {param: ' def attr_accessor :a', expect: false},\n {param: ' attr_accessor = :a', expect: false}\n ]\n end",
"title": ""
},
{
"docid": "20502272837979836e88c2338e79eb7e",
"score": "0.69529027",
"text": "def test_valid_attr_type_should_be_valid\n assert @valid_attr_type.valid?\n end",
"title": ""
},
{
"docid": "683ec70587d245407e64741331824f6c",
"score": "0.69359434",
"text": "def have_attributes(expected); end",
"title": ""
},
{
"docid": "3853b8420daa417f019c29d84483fb43",
"score": "0.67829293",
"text": "def test_valid_spec_attribute_should_be_valid\n assert @valid_spec_attribute.valid?\n end",
"title": ""
},
{
"docid": "ec23e2378b4a93a6eb17349957610f43",
"score": "0.67065185",
"text": "def test_raw_validation\n address = Address.new\n if REQ_ATTR_NAMES.blank?\n assert address.valid?, \"Address should be valid without initialisation parameters\"\n else\n # If Address has validation, then use the following:\n assert !address.valid?, \"Address should not be valid without initialisation parameters\"\n REQ_ATTR_NAMES.each {|attr_name| assert address.errors.invalid?(attr_name.gsub(/_id$/,'').to_sym), \"Should be an error message for :#{attr_name}\"}\n end\n end",
"title": ""
},
{
"docid": "ec23e2378b4a93a6eb17349957610f43",
"score": "0.67065185",
"text": "def test_raw_validation\n address = Address.new\n if REQ_ATTR_NAMES.blank?\n assert address.valid?, \"Address should be valid without initialisation parameters\"\n else\n # If Address has validation, then use the following:\n assert !address.valid?, \"Address should not be valid without initialisation parameters\"\n REQ_ATTR_NAMES.each {|attr_name| assert address.errors.invalid?(attr_name.gsub(/_id$/,'').to_sym), \"Should be an error message for :#{attr_name}\"}\n end\n end",
"title": ""
},
{
"docid": "c3ee427828f061e568b0a4123f436fe4",
"score": "0.6674742",
"text": "def assert_contained_attribute(**args)\n Bucky::Utils::BuckyLogger.write('assert_contained_attribute', args)\n part = @pages.get_part(args)\n verify_rescue { assert(part[args[:attribute]].include?(args[:expect]&.to_s), \"Not Contain Expected Attribute.\\nexpect: #{args[:expect].to_s.bg_green.black}\\nactual: #{part[args[:attribute]].to_s.bg_red.black}\") }\n end",
"title": ""
},
{
"docid": "af1f814cca95370c72b4208c16cd7404",
"score": "0.65533763",
"text": "def assert_valid_args\n # nop\n end",
"title": ""
},
{
"docid": "6d4f49075d6cdda51339999aba1ab3eb",
"score": "0.65399575",
"text": "def test_apptype_invalidity\n assert !@invalid_apptype.valid?\n attributes = [:abbrev, :fullname, :translation, :country_id]\n attributes.each do |attribute|\n assert @invalid_apptype.errors.invalid?(attribute)\n end\n end",
"title": ""
},
{
"docid": "2647a88f2755a29d57494ba5446651cc",
"score": "0.6533769",
"text": "def assert_attributes(anEngine, attributes)\n attributes.each_pair do |attr_name, expected_val|\n msg = attr_name.to_sym()\n actual = anEngine.send(msg)\n error_msg = \"Expected #{expected_val} for #{attr_name}, actual was: #{actual}\"\n assert(actual == expected_val)\n end\n end",
"title": ""
},
{
"docid": "069c59926a5ed7b1da56e7998a8683db",
"score": "0.6528443",
"text": "def assert_validates_presence_of(*params)\n object = params.shift\n attributes = params\n\n attributes.each do |attr|\n object.send(\"#{attr}=\", nil)\n end\n\n assert_invalid object, attributes\n end",
"title": ""
},
{
"docid": "8179eff557358b89076e40fe48d76845",
"score": "0.64936733",
"text": "def test_valid\n pasta = Food.new\n\n assert_equal(false, pasta.valid?)\n\n pasta.name = \"pasta\"\n assert_equal(false, pasta.valid?)\n\n pasta.category_id = 4\n assert_equal(true, pasta.valid?)\n\n pasta.name = \"\"\n assert_equal(false, pasta.valid?)\n\n pasta.name = \"pasta\"\n pasta.category_id = \"\"\n assert_equal(false, pasta.valid?)\n end",
"title": ""
},
{
"docid": "03d8abc5e7029207d7d009fc6be80a1e",
"score": "0.6463762",
"text": "def it_should_require_acceptance_of(*attributes)\n message = get_options!(attributes, :message)\n message ||= default_error_message(:accepted)\n klass = self.described_type\n\n attributes.each do |attribute|\n describe \"requires #{attribute} to be accepted\" do\n assert_bad_value(klass, attribute, false, message)\n end\n end\n end",
"title": ""
},
{
"docid": "d3d1f4d773b203d7284431d20116d04a",
"score": "0.6457116",
"text": "def assert_valid options, error_message = \"\"\n error_message << \"Must specify a :method_name. \" unless method_name\n error_message << \"Must specify either a :type or :object. \" unless (target_type or target_object)\n error_message << \"Can't specify both a :type or :object. \" if (target_type and target_object)\n bad_attributes(error_message, options) if error_message.length > 0\n end",
"title": ""
},
{
"docid": "d3d1f4d773b203d7284431d20116d04a",
"score": "0.6457116",
"text": "def assert_valid options, error_message = \"\"\n error_message << \"Must specify a :method_name. \" unless method_name\n error_message << \"Must specify either a :type or :object. \" unless (target_type or target_object)\n error_message << \"Can't specify both a :type or :object. \" if (target_type and target_object)\n bad_attributes(error_message, options) if error_message.length > 0\n end",
"title": ""
},
{
"docid": "265cf75bcfe83772dc6f9897bd2128a8",
"score": "0.6434139",
"text": "def assert_ar_attr_valid(ar, attr, msg=nil)\r\n assert_respond_to ar, 'errors'\r\n msg ||= \"#{attr} should be valid\"\r\n assert !ar.errors.invalid?(attr), msg\r\n end",
"title": ""
},
{
"docid": "8682ae387f0332d30f258b035e31f7d2",
"score": "0.64330983",
"text": "def test_wine_invalidity\n assert !@invalid_wine.valid?\n attributes = [:name, :appellation_id, :winecolor_id, :winetype_id]\n attributes.each do |attribute|\n assert @invalid_wine.errors.invalid?(attribute)\n end\n end",
"title": ""
},
{
"docid": "afe193d7811eb757604804effa20206f",
"score": "0.63971645",
"text": "def test_valid_with_attributes\r\n policy = Policy.new\r\n policy.group_number = @policy.group_number\r\n policy.group_name = @policy.group_name\r\n policy.relationship_id = @policy.relationship_id\r\n policy.subscriber_DOB = @policy.subscriber_DOB\r\n policy.subscriber_sex = @policy.subscriber_sex\r\n policy.carrier_type = @policy.carrier_type\r\n policy.subscriber_number = @policy.subscriber_number\r\n policy.subscriber_first_name = @policy.subscriber_first_name\r\n policy.subscriber_last_name = @policy.subscriber_last_name\r\n policy.subscriber_address = @policy.subscriber_address\r\n policy.subscriber_city = @policy.subscriber_city\r\n policy.subscriber_state = @policy.subscriber_state\r\n policy.subscriber_zipcode= @policy.subscriber_zipcode\r\n assert !policy.valid?, policy.errors.full_messages \r\n end",
"title": ""
},
{
"docid": "71fe8dbc662fffc770036b0fdca7704e",
"score": "0.6377466",
"text": "def test_ship_has_attributes\n assert_equal \"Cruiser\", @cruiser.name\n assert_equal 3, @cruiser.length\n assert_equal 3, @cruiser.health\n end",
"title": ""
},
{
"docid": "8c544d06b49d7181c5e67306dfbb02e5",
"score": "0.6352321",
"text": "def test_user_invalidity\n assert !@invalid_user.valid?\n attributes = [:handle, :fullname, :email, :password]\n attributes.each do |attribute|\n assert @invalid_user.errors.invalid?(attribute)\n end\n end",
"title": ""
},
{
"docid": "379fbd0b8433278d89e89d654519faaa",
"score": "0.63353",
"text": "def assert_produces_object_with_attributes\n attrs = generate_attr_hash\n obj = yield attrs\n check_attrs(attrs, obj)\n end",
"title": ""
},
{
"docid": "10e8d7a80b822eff4721d6a2390f6da1",
"score": "0.63210243",
"text": "def it_should_validate_presence_of(*attributes)\n message = get_options!(attributes, :message)\n message ||= default_error_message(:blank)\n klass = self.described_type\n\n attributes.each do |attribute|\n describe \"requires #{attribute} to be set\" do\n assert_bad_value(klass, attribute, nil, message)\n end\n end\n end",
"title": ""
},
{
"docid": "fb5da8234a3305f6c1b252a181df723b",
"score": "0.631856",
"text": "def should_validate_acceptance_of(*attributes)\n message = get_options!(attributes, :message)\n klass = model_class\n\n attributes.each do |attribute|\n matcher = validate_acceptance_of(attribute).with_message(message)\n should matcher.description do\n assert_accepts matcher, get_instance_of(klass)\n end\n end\n end",
"title": ""
},
{
"docid": "53c733b0ee13fea6ae8f7c6345fb7780",
"score": "0.62964666",
"text": "def check_attributes\n attributes_keys = Pod::Specification::DSL.attributes.keys.map(&:to_s)\n platform_keys = Specification::DSL::PLATFORMS.map(&:to_s)\n valid_keys = attributes_keys + platform_keys\n attributes_hash = consumer.spec.attributes_hash\n keys = attributes_hash.keys\n Specification::DSL::PLATFORMS.each do |platform|\n if attributes_hash[platform.to_s]\n keys += attributes_hash[platform.to_s].keys\n end\n end\n unknown_keys = keys - valid_keys\n\n unknown_keys.each do |key|\n results.add_warning('attributes', \"Unrecognized `#{key}` key.\")\n end\n\n Pod::Specification::DSL.attributes.each do |_key, attribute|\n declared_value = consumer.spec.attributes_hash[attribute.name.to_s]\n validate_attribute_occurrence(attribute, declared_value)\n validate_attribute_type(attribute, declared_value)\n if attribute.name != :platforms\n value = value_for_attribute(attribute)\n validate_attribute_value(attribute, value) if value\n end\n end\n end",
"title": ""
},
{
"docid": "85242eae0b75e467d48081d9e3cda77c",
"score": "0.6277537",
"text": "def test_should_be_valid_with_no_attribute_and_no_unit\n \t@valid_specification.spec_attribute_id = nil\n \t@valid_specification.unit_id = nil\n \tassert @valid_specification.valid?\n\tend",
"title": ""
},
{
"docid": "28fba1bfa7f997e3d3688299aa6dc172",
"score": "0.62737364",
"text": "def assert_valid_attribute(instance, attribute)\n instance.valid?\n assert_equal 0, instance.errors[attribute.to_sym].size\n end",
"title": ""
},
{
"docid": "77df0bd8bc8cb0da6b58de92ada4c6b2",
"score": "0.6271155",
"text": "def test_valid_with_attributes\r\n referal_provider = ReferalProvider.new\r\n referal_provider.first_name = @referal_provider.first_name\r\n referal_provider.last_name = @referal_provider.last_name\r\n referal_provider.npi = @referal_provider.npi\r\n referal_provider.taxonomy = @referal_provider.taxonomy\r\n assert referal_provider.valid?, referal_provider.errors.full_messages\r\n end",
"title": ""
},
{
"docid": "a0727d2fe289cb7e12175e31e482b29b",
"score": "0.62654054",
"text": "def assert_valid_model_attributes(attributes)\n model = self.class.to_s.gsub(\"Controller\", \"\").gsub(\"Test\", \"\").constantize\n instance = model.new\n\n attributes.each do |attribute_name, attribute_value|\n instance.send(\"#{attribute_name}=\", attribute_value)\n end\n\n assert_valid instance, instance.inspect\n end",
"title": ""
},
{
"docid": "1ef58fd8e5f1da5ba59ad840495895fa",
"score": "0.6259132",
"text": "def test_ace\n assert(@cardA.ace?, \"Ace validation\")\n assert(!@card.ace?, \"Ace invalidation\")\n end",
"title": ""
},
{
"docid": "572e35599ad8b87df4f8ff2fd647cbb4",
"score": "0.6254365",
"text": "def valid_attributes\n {:name => \"Test Lifecycle Phase\",\n :sequence_number => 1,\n :lifecycle_id => @lifecycle.id}\n end",
"title": ""
},
{
"docid": "3d32a8f90e36033a0d797ac3d6e81299",
"score": "0.62095374",
"text": "def test_roles_have_attributes\n attributes = [:TEAM, :VISIBLE_TEAM, :WEIGHT, :ALLIES, :POWERS, :DESCRIPTION]\n Werewolf::Roles::all.each do |role|\n attributes.each do |attribute|\n assert defined? \"role::#{attribute}\", \"#{role.name} is missing the #{attribute} attribute\"\n end\n assert !role::TEAM.nil?\n assert !role::DESCRIPTION.nil?\n end\n end",
"title": ""
},
{
"docid": "ba256bcaf9380bcf7dcea373ae58452d",
"score": "0.62070256",
"text": "def validate_attribute_occurrence(attribute, value)\n if attribute.root_only? && !value.nil? && !consumer.spec.root?\n results.add_error('attributes', \"Can't set `#{attribute.name}` attribute for \" \\\n \"subspecs (in `#{consumer.spec.name}`).\")\n end\n if attribute.test_only? && !value.nil? && !consumer.spec.test_specification?\n results.add_error('attributes', \"Attribute `#{attribute.name}` can only be set \" \\\n \"within test specs (in `#{consumer.spec.name}`).\")\n end\n end",
"title": ""
},
{
"docid": "e15d0adf1505afdf7827114bba8b8ef2",
"score": "0.62022483",
"text": "def test_it_has_readable_attributes\n # create the queen of diamonds\n card = Card.new(:diamond, 'Queen', 12)\n # Check that the card's attributes are readable and correct\n assert_equal :diamond, card.suit\n assert_equal 'Queen', card.value\n assert_equal 12, card.rank\n end",
"title": ""
},
{
"docid": "1a6b9660b6c0439113223ece64c8a9cb",
"score": "0.62007415",
"text": "def test_valid_with_attributes\r\n doctor = Doctor.new\r\n doctor.npi = @mydoctor_tst.npi\r\n doctor.ssn = @mydoctor_tst.ssn\r\n assert doctor.valid?, doctor.errors.full_messages \r\n end",
"title": ""
},
{
"docid": "310ea1458f75700aee58a00282bec680",
"score": "0.6196649",
"text": "def validate\n assert_present :status\n assert_present :user_id\n end",
"title": ""
},
{
"docid": "ad774d9e7b48fa71f9a464d97979e10f",
"score": "0.6195739",
"text": "def test_attributes\n assert_equal \"Untitled\", @print.title\n assert_equal \"12345678-abcd-abcd-abcd-12345678abcd\", @print.guid\n assert_equal Time.utc(2015, 9, 13, 21, 0, 5), @print.date_added\n assert_equal 50.0, @print.sale_price\n assert_equal \"\", @print.card_stock_name\n end",
"title": ""
},
{
"docid": "bb6125a4cb4c4b2354525a8232a9d7c6",
"score": "0.61944014",
"text": "def valid_attributes\n { body: \"blah\",\n title: 'Something' }\n end",
"title": ""
},
{
"docid": "3afecf688badd6b9e95986a0f3942902",
"score": "0.61925066",
"text": "def test_valid_with_attributes\n carrier = Carrier.new\n carrier.name = @carrier.name\n carrier.address = @carrier.address\n carrier.city = @carrier.city\n carrier.state = @carrier.state\n carrier.zipcode = @carrier.zipcode\n carrier.payer_identification = @carrier.payer_identification\n carrier.edi_type = @carrier.edi_type\n assert carrier.valid?, carrier.errors.full_messages \n end",
"title": ""
},
{
"docid": "cdbcf67d8d2a6714bdd1d2fe17173cbb",
"score": "0.61906135",
"text": "def validate_feature_class_attributes( id, access_level,\n control_level = ApplicationController::FEATURE_CONTROL_NONE, no_workflows = 0 )\n assert @controller.feature_identifier, 'feature_identifier not assigned'\n assert_equal id, @controller.feature_identifier, 'feature_identifier to not match'\n assert @controller.feature_access_level, 'feature_access_level not assigned'\n assert_equal access_level, @controller.feature_access_level, 'feature_access_level do not match'\n assert @controller.feature_control_level, 'feature_control_level not assigned' \n assert_equal control_level, @controller.feature_control_level, 'feature_control_level do not match'\n assert @controller.no_workflows, 'no_workflows not assigned'\n assert_equal no_workflows, @controller.no_workflows, 'no_workflows do not match'\n end",
"title": ""
},
{
"docid": "467fe2e833fe36a7e092d7ebe95a7dc5",
"score": "0.61313415",
"text": "def _test_attr # test_attr object attribute ?(label)\r\n obj_id, attribute = @operands\r\n\r\n branch (zobj obj_id).has_attribute? attribute\r\n end",
"title": ""
},
{
"docid": "ffddef1f1e8396b4b5585b4a012694ed",
"score": "0.61294466",
"text": "def test_should_know_which_spec_attributes_belong_to_it\n assert_equal([@valid_attr_type.id]*2, @valid_attr_type.spec_attributes.collect {|s| s.attr_type_id})\n end",
"title": ""
},
{
"docid": "dab1835cab11879f4568621b568e25d8",
"score": "0.61207354",
"text": "def validates_acceptance_of(*attr_names); end",
"title": ""
},
{
"docid": "dab1835cab11879f4568621b568e25d8",
"score": "0.61207354",
"text": "def validates_acceptance_of(*attr_names); end",
"title": ""
},
{
"docid": "774a366b9f69fd65cf48be53dd57842f",
"score": "0.6119452",
"text": "def valid_attribute?(attr_name)\n attribute_names.include?(attr_name)\n end",
"title": ""
},
{
"docid": "416ea18aaad585815a87a22d36cc71f2",
"score": "0.61187077",
"text": "def validate\n required_attributes = [\n :name,\n :md5,\n :description,\n :type\n ]\n\n required_attributes.map do |ra|\n self.send(ra)\n end.include? nil\n\n end",
"title": ""
},
{
"docid": "642edac774337cea62648841ed888e1c",
"score": "0.61158264",
"text": "def test_check_args_valid\n\t\targs = Prospect.new(0)\n\t\tassert_silent {args.check_args [1, 2]}\n\tend",
"title": ""
},
{
"docid": "33cc05dc7d2e4bd44018ea59210f4939",
"score": "0.6111322",
"text": "def valid_attributes\n # check basic correctnes of input hash\n ATTRIBUTES.each { |attr| return false unless @post_data.keys.include? attr }\n # check \"data\" attribute to contain 2 elements, as stated in task description\n data = @post_data[\"data\"]\n return false unless data.is_a?(Array) && data.size == INPUT_OBJECTS_COUNT\n # check \"data\" array to contain valid data\n data.each do |h|\n next if valid_data_hash? h\n return false\n end\n # input data is valid enough to process it\n true\n end",
"title": ""
},
{
"docid": "c884f0af997014ddaaf56fb7bd4470ef",
"score": "0.61069596",
"text": "def test_card_exists_and_has_attributes\n assert_instance_of Card, card\n assert_equal \"Juneau\", card.answer\n assert_equal :Geography, card.category\n assert_equal \"What is the capital of Alaska?\", card.question\n end",
"title": ""
},
{
"docid": "fbf4a75a69bf565bf35381f2507034a2",
"score": "0.610224",
"text": "def test_user_invalidity\n assert !@invalid_user.valid?\n attributes = [:screen_name, :email, :password]\n attributes.each do |attr|\n assert @invalid_user.errors.invalid?(attr)\n end\n end",
"title": ""
},
{
"docid": "de31096445e744c9c1a42dc2273f7fba",
"score": "0.609953",
"text": "def test_invalid_with_empty_attributes\r\n doctor = Doctor.new\r\n assert !doctor.valid?, doctor.errors.full_messages\r\n assert doctor.errors.invalid?(:npi)\r\n assert doctor.errors.invalid?(:ssn)\r\n end",
"title": ""
},
{
"docid": "e3ecea19c10bd74b848b2268e6638090",
"score": "0.60882056",
"text": "def assert_invalid_attribute(object, attribute, message = \"\")\n object.valid?\n errors_on_attribute = object.errors[attribute].length\n error_messages = object.errors[attribute].join(',')\n message << \"\\nExpected at least one error on #{attribute} but got #{errors_on_attribute} :\\n#{error_messages}\"\n assert errors_on_attribute > 0, message\n end",
"title": ""
},
{
"docid": "937baab4e5baa354e757df8844d3eefd",
"score": "0.60853827",
"text": "def test_should_not_be_valid_without_a_name\n @valid_attr_type.name = nil\n assert !@valid_attr_type.valid?\n end",
"title": ""
},
{
"docid": "56b1eb46f52c1540992fa1b4548fd329",
"score": "0.6064449",
"text": "def assert_has_test_execution_attributes(hash)\n assert_has_attributes(hash, accepted_execution_show_attributes)\n end",
"title": ""
},
{
"docid": "56b1eb46f52c1540992fa1b4548fd329",
"score": "0.6064449",
"text": "def assert_has_test_execution_attributes(hash)\n assert_has_attributes(hash, accepted_execution_show_attributes)\n end",
"title": ""
},
{
"docid": "705d23ff13117edf766d3e4bb0b31359",
"score": "0.6053986",
"text": "def test_invalid_with_empty_attributes\r\n policy = Policy.new\r\n assert !policy.valid?\r\n assert policy.errors.invalid?(:group_number)\r\n assert policy.errors.invalid?(:group_name)\r\n assert policy.errors.invalid?(:relationship_id)\r\n assert policy.errors.invalid?(:subscriber_DOB)\r\n assert policy.errors.invalid?(:subscriber_sex)\r\n assert policy.errors.invalid?(:carrier_type)\r\n assert policy.errors.invalid?(:subscriber_number)\r\n assert policy.errors.invalid?(:subscriber_first_name)\r\n assert policy.errors.invalid?(:subscriber_last_name)\r\n assert policy.errors.invalid?(:subscriber_address)\r\n assert policy.errors.invalid?(:subscriber_city)\r\n assert policy.errors.invalid?(:subscriber_state)\r\n assert policy.errors.invalid?(:subscriber_zipcode)\r\n end",
"title": ""
},
{
"docid": "d879bb2aa94b3ae55909e1b5db56cb94",
"score": "0.60513103",
"text": "def assert_ar_attr_invalid(ar, attrib, msg=nil)\r\n assert_ar_invalid ar\r\n assert_respond_to ar, 'errors'\r\n msg ||= \"#{attrib} has no error associated with it\"\r\n assert ar.errors.invalid?(attrib), msg\r\n end",
"title": ""
},
{
"docid": "d04fd9387d2c470a43cd4a09e3b65f36",
"score": "0.6050463",
"text": "def test_all_attributes\n assert_equal(\n { :name => \"Name\", \n :age => \"Age\", \n :calorie_intake => \"% Daily value USDA recommended intake\", \n :auspicious_fortune => \"Auspicious fortune\", \n :zodiac_sign => \"Zodiac sign\"\n },\n @field_defs.all_attributes\n )\n end",
"title": ""
},
{
"docid": "6122650e27ab62610a0464ce2050c17a",
"score": "0.60412335",
"text": "def valid?\n begin\n valid!\n rescue Occi::Core::Errors::AttributeValidationError, Occi::Core::Errors::AttributeDefinitionError => ex\n logger.warn \"Attribute invalid: #{ex.message}\"\n return false\n end\n\n true\n end",
"title": ""
},
{
"docid": "bc381d220261d0c14294b0afffdd2a1a",
"score": "0.60379297",
"text": "def attrib_bits_valid; end",
"title": ""
},
{
"docid": "e524c271207f600924a1de32e0123264",
"score": "0.6037874",
"text": "def test_valid_with_attributes\n document = Document.new\n document.patient_id ='1'\n document.name = 'SSS'\n assert !document.valid?, document.errors.full_messages \n end",
"title": ""
},
{
"docid": "477daded5fe1fcf4833feef5d28df0b8",
"score": "0.60377574",
"text": "def valid_attribute?(attr_name)\n attribute_names.include?(attr_name)\n end",
"title": ""
},
{
"docid": "123d0591937c3c1f95ada79b5d45962e",
"score": "0.6033034",
"text": "def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"title": ""
},
{
"docid": "123d0591937c3c1f95ada79b5d45962e",
"score": "0.6033034",
"text": "def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"title": ""
},
{
"docid": "68ddbf9d07783ca4a4eb769d6be98918",
"score": "0.6019672",
"text": "def check_attrs(attr_hash, obj)\n not_equal = []\n attr_hash.each do |attr_name, value|\n actual = obj.send(attr_name)\n next if value == actual\n\n not_equal << <<~MSG\n Attribute #{attr_name}\n Expected: \"#{value}\"\n Actual: \"#{actual}\"\n MSG\n end\n assert not_equal.empty?,\n <<~MSG\n The following attributtes are not equal:\n #{not_equal.join \"\\n\"}\n MSG\n end",
"title": ""
},
{
"docid": "bd69176b971e923f7cf61b38db34ad6a",
"score": "0.6013179",
"text": "def test_new_specification_should_not_be_valid_if_attribute_and_unit_are_different_attr_types\n\t\t@new_specification = Specification.new(\n :spec_value => @valid_specification.spec_value,\n :spec_attribute_id => spec_attributes(:height).id,\n :unit_id => units(:pound).id )\n assert !@new_specification.valid?\n\tend",
"title": ""
},
{
"docid": "873f18a48582ccf05c8541a4cdecedee",
"score": "0.60112864",
"text": "def have_attributes(*names)\n Matchers::Attributes.new(*names)\n end",
"title": ""
},
{
"docid": "93bdc1ad34e60363f445b1ec5a1c7a1d",
"score": "0.6009769",
"text": "def valid_attributes\n {\n name: \"something\"\n }\n end",
"title": ""
},
{
"docid": "93bdc1ad34e60363f445b1ec5a1c7a1d",
"score": "0.6009769",
"text": "def valid_attributes\n {\n name: \"something\"\n }\n end",
"title": ""
},
{
"docid": "93bdc1ad34e60363f445b1ec5a1c7a1d",
"score": "0.6009769",
"text": "def valid_attributes\n {\n name: \"something\"\n }\n end",
"title": ""
},
{
"docid": "93bdc1ad34e60363f445b1ec5a1c7a1d",
"score": "0.6009769",
"text": "def valid_attributes\n {\n name: \"something\"\n }\n end",
"title": ""
},
{
"docid": "93bdc1ad34e60363f445b1ec5a1c7a1d",
"score": "0.6009769",
"text": "def valid_attributes\n {\n name: \"something\"\n }\n end",
"title": ""
},
{
"docid": "9b17d4716d024b7ff8e4e8248846a7b2",
"score": "0.6009634",
"text": "def test_user_invalidity\n #assert !users(:invalid_user).valid?\n assert !@invalid_user.valid?\n attributes = [ :screen_name, :email, :password ]\n attributes.each do |attribute|\n assert @invalid_user.errors.invalid?(attribute)\n end\n end",
"title": ""
},
{
"docid": "ec3bc31d93f8d4e3376bf03ca481b61a",
"score": "0.60000056",
"text": "def validates!(*attributes); end",
"title": ""
},
{
"docid": "ec3bc31d93f8d4e3376bf03ca481b61a",
"score": "0.60000056",
"text": "def validates!(*attributes); end",
"title": ""
},
{
"docid": "31ba5f210cf758c6cdd98c0d5a768662",
"score": "0.59994644",
"text": "def valid_attributes\n { \"hostname\" => \"MyString\" }\n end",
"title": ""
},
{
"docid": "ebc86afb7ec3d7e7672cd6de2ac3cf7e",
"score": "0.5990667",
"text": "def validate\n assert_present(:uid)\n assert_present(:token)\n assert_unique(:uid)\n end",
"title": ""
},
{
"docid": "7e0c67bd9ce99a855868fc55714c1f74",
"score": "0.59890664",
"text": "def valid_attributes_compare_up\n valid_attributes = Hash.new\n valid_attributes = {\n 'population' => true,\n 'area' => true,\n 'idh' => true,\n 'health' => true\n }\n end",
"title": ""
},
{
"docid": "d91cd69f1648a74325368a9a053facdb",
"score": "0.59866047",
"text": "def validate(attributes)\n attributes\n end",
"title": ""
},
{
"docid": "93e4b59bcee86332a31210f317808511",
"score": "0.59794176",
"text": "def valid_attributes\n {:name => \"Tryal name\",\n :content => \"stupid content\"}\n end",
"title": ""
},
{
"docid": "228ddb3a6c650861d3b7b0ec0a5caf83",
"score": "0.59735334",
"text": "def valid_attributes\n { name: \"MyString\" }\n end",
"title": ""
},
{
"docid": "fb23bc968e2f91100fc9d68e6294fe3b",
"score": "0.59709495",
"text": "def should_validate_presence_of(*attributes)\n message = get_options!(attributes, :message)\n klass = model_class\n\n attributes.each do |attribute|\n matcher = validate_presence_of(attribute).with_message(message)\n should matcher.description do\n assert_accepts(matcher, get_instance_of(klass))\n end\n end\n end",
"title": ""
},
{
"docid": "7fbd82108c195577f81ce7793ff6fb57",
"score": "0.59686005",
"text": "def should_accept(attr, value)\n k=attr.to_sym\n with(valid_params_with({k => value}))[k].should == value\n end",
"title": ""
},
{
"docid": "fdbac4655ab1bb02a95dc065e18f2e7f",
"score": "0.59672713",
"text": "def test_valid\n new_recipe = Recipe.new\n\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.name = \"tacos\"\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.recipe_type_id = 1\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.time_to_make = 20\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.information = \"Step 1\"\n assert_equal(true, new_recipe.valid?)\n\n new_recipe.name = \"\"\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.name = \"tacos\"\n new_recipe.recipe_type_id = \"\"\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.recipe_type_id = 2\n new_recipe.time_to_make = \"\"\n assert_equal(false, new_recipe.valid?)\n\n new_recipe.time_to_make = 45\n new_recipe.information = \"\"\n assert_equal(false, new_recipe.valid?)\n end",
"title": ""
},
{
"docid": "513af9e331346360cb329113405cf9e8",
"score": "0.5963324",
"text": "def valid_attributes\n {\"title\" => \"test title\",\n \"context_id\" => 1,\n \"user_id\" => 1\n }\n end",
"title": ""
},
{
"docid": "7dcc52adfd073b08d9a8796cbebe3bc0",
"score": "0.5962066",
"text": "def valid_attributes\n { \n :title => \"aaa\",\n :content => \"123456\"\n }\n end",
"title": ""
},
{
"docid": "7be0eb9bf0bc17879d6d845c82979453",
"score": "0.59567726",
"text": "def test_country_invalidity\n assert !@invalid_grape.valid?\n attributes = [:name]\n attributes.each do |attribute|\n assert @invalid_grape.errors.invalid?(attribute)\n end\n end",
"title": ""
},
{
"docid": "eeca87baa0fff0c51a4d20277c99c6ce",
"score": "0.59525096",
"text": "def valid_attributes\n { name: \"MyName\",\n preliminary: false}\n end",
"title": ""
},
{
"docid": "de4d44c66acb7cfa296f33307d92ac5b",
"score": "0.5948071",
"text": "def assert(attr)\n @conditions << Conditions::Assert.new(attr)\n end",
"title": ""
},
{
"docid": "2c512f1af45d460bce4089e53969e67d",
"score": "0.59449226",
"text": "def valid_attributes\n {name: \"MyRule\"}\n end",
"title": ""
},
{
"docid": "7e48ff21ea2a2e07f7b3c95e0e3a6f4e",
"score": "0.59445935",
"text": "def test_valid_with_valid_attributes\n task = Task.new(:title => 'Title', :order => 999)\n assert task.valid?\n end",
"title": ""
},
{
"docid": "35039cb1591a693d9c70a5e659e12b1c",
"score": "0.59427965",
"text": "def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"title": ""
},
{
"docid": "56b357be57a66969646833e222385bc0",
"score": "0.59377766",
"text": "def check_attributes\n self.attributes.each do |attr_name , attr_value|\n if (attr_value.blank? || attr_value.nil?) && (attr_name != \"further_info\") && !(attr_name.include? \"toefl\")\n return false\n end\n end\n end",
"title": ""
},
{
"docid": "58272dd725358ef851e0b5bca0092e0f",
"score": "0.5931366",
"text": "def parse_args\n @node_name = @name_args[0]\n @attr_path = @name_args[1]\n option_assert(@node_name, 'You must specify a node name')\n option_assert(\n @attr_path, 'You must specify an encrypted attribute name'\n )\n @attr_ary = attribute_path_to_ary(@attr_path)\n\n assert_valid_args\n end",
"title": ""
},
{
"docid": "599a3f4669567e3ab7150809e801dcdf",
"score": "0.59213275",
"text": "def test_invalid_with_empty_attributes\n user = User.new\n assert !user.valid?\n assert user.errors[:email].any?\n assert user.errors[:password].any?\n assert user.errors[:name].any?\n end",
"title": ""
},
{
"docid": "5b5c1fca227ea7d84b1129a81ba9a053",
"score": "0.5920521",
"text": "def it_should_accept_as_valid(attribute, *values)\n values.each do |value|\n value_inspect = case value\n when String : \"'#{value}'\"\n when NilClass : \"nil\"\n else value\n end\n it \"should accept #{value_inspect} as a valid #{attribute}\" do\n instance.send \"#{attribute}=\", value\n instance.errors_on(attribute).should == []\n end\n end\n end",
"title": ""
},
{
"docid": "9f71a66000c11a6d5f116fa9095577fa",
"score": "0.59199524",
"text": "def validate!\n validations.each do |v|\n value = send v[:attr_name]\n unless validate_value(value, v[:condition])\n raise ArgumentError, \"#{v[:attr_name]} validation failed, #{v[:condition]} missmatch\"\n end\n end\n end",
"title": ""
},
{
"docid": "c3f033e70cf322538c1ff887788a59f0",
"score": "0.59187067",
"text": "def valid_attributes\n { state: 'ok', hostname: 'foo.lvh.me'}\n end",
"title": ""
},
{
"docid": "1ea0145f1766317f8875773e74bd2a56",
"score": "0.59063673",
"text": "def assertions; end",
"title": ""
},
{
"docid": "1ea0145f1766317f8875773e74bd2a56",
"score": "0.59063673",
"text": "def assertions; end",
"title": ""
},
{
"docid": "8011fc75c86ef3fddd26acf1e113b67b",
"score": "0.5905849",
"text": "def valid_attributes\n {\"title\" => \"test chore\",\n \"user_id\" => 1,\n \"email_id\" => 1,\n \"choretype_id\" => 1,\n \"context_id\" => 1,\n \"project_id\" => 1\n }\n end",
"title": ""
}
] |
6843f9aa515b68718036234e1b6b09bd
|
return a list of tags
|
[
{
"docid": "14af7cea5532682cf53c5a7e34326c9e",
"score": "0.7703888",
"text": "def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"title": ""
}
] |
[
{
"docid": "ab239355c19730b1272435965e9fb6a4",
"score": "0.8610595",
"text": "def list_of_tags\n tag_list\n end",
"title": ""
},
{
"docid": "03aed83d9d03ecbeb45773b9ee5962cf",
"score": "0.8404396",
"text": "def taglist\n\tself.tags.map {|t| t.name}\n end",
"title": ""
},
{
"docid": "213e1f083c9dd0f950de3f3e7bcf99e1",
"score": "0.8179431",
"text": "def tag_list\n tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "aa1a3c317604cd6ec0cb189d075a8e9e",
"score": "0.8154919",
"text": "def tag_list\n #tags sie bierze z asocjacji\n tags.map { |t| t.name }.join(\",\")\n end",
"title": ""
},
{
"docid": "56163d23bc897cc748b09c7a13ef9671",
"score": "0.8142713",
"text": "def tags\n self.lib.tags.map { |r| tag(r) }\n end",
"title": ""
},
{
"docid": "eedb98f0f40cfd482924adff9cac5682",
"score": "0.8125621",
"text": "def tag_list\n tags.collect(&:name).join(', ')\n end",
"title": ""
},
{
"docid": "eedb98f0f40cfd482924adff9cac5682",
"score": "0.8125621",
"text": "def tag_list\n tags.collect(&:name).join(', ')\n end",
"title": ""
},
{
"docid": "a884c49b76badeb8db3e2a64574815b3",
"score": "0.81156605",
"text": "def tag_list\n tags.join(\", \")\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.81131595",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.81131595",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.81131595",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "a08897c0f5f4e78ec05dc7d9283ab647",
"score": "0.8106228",
"text": "def tag_list\n tags.collect do |tag|\n tag.name\n end.join(', ')\n end",
"title": ""
},
{
"docid": "c4798c04d5fe0577541dcd4d8bb42644",
"score": "0.80980635",
"text": "def list_tags\n\n r = []\n n = @node\n\n while n\n ts = n['tags']\n r.concat(ts) if ts\n n = @execution['nodes'][n['parent']]\n end\n\n r\n end",
"title": ""
},
{
"docid": "aeab23a3be4afa84926a7149dec76c47",
"score": "0.806627",
"text": "def tag_list\n tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "aeab23a3be4afa84926a7149dec76c47",
"score": "0.806627",
"text": "def tag_list\n tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "aeab23a3be4afa84926a7149dec76c47",
"score": "0.806627",
"text": "def tag_list\n tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "7f5e5c29dc66c9bb22465ff50d4b22fc",
"score": "0.805755",
"text": "def tag_list\n tags.map(&:name).join(', ')\n end",
"title": ""
},
{
"docid": "5a7c972760f0b6057f1f8e5fb08bb28f",
"score": "0.80481213",
"text": "def my_tag_list\n self.taggings.order('id ASC').map(&:tag).map(&:name)\n end",
"title": ""
},
{
"docid": "f834d6a564c4cfd2905d340d6ca1adb9",
"score": "0.8025975",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"title": ""
},
{
"docid": "ea0bd0924eeadf4a14f3d0e306728915",
"score": "0.8011107",
"text": "def getTags\r\n\t\t\t\t\treturn @tags\r\n\t\t\t\tend",
"title": ""
},
{
"docid": "e2cdfc98d0961262586858f25e43d2ab",
"score": "0.7987739",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"title": ""
},
{
"docid": "7046feef1e8ca8e81864513effcb8697",
"score": "0.7939371",
"text": "def tags\n @tags ||= []\n end",
"title": ""
},
{
"docid": "e36ae42b67ce1c130936c5fc1f0c0338",
"score": "0.7864472",
"text": "def tag_list\n tag_list_array = self.tags.to_a\n tag_list_array.delete_if { |tag| Tag.main_tags.include?(tag.name) }\n tag_list_array.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "118540c2eaab1a1475b83fcdb3d30f44",
"score": "0.78602934",
"text": "def tags\n get.tagGuids\n end",
"title": ""
},
{
"docid": "feadf8032901c3eaa3e349de793a8677",
"score": "0.7859941",
"text": "def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend",
"title": ""
},
{
"docid": "0772d462e602b98fbfacca884410eb64",
"score": "0.78586036",
"text": "def tag_list\n\t\t@tag_list ||= self.tags.map { |tag| tag.name }.join(', ')\n\tend",
"title": ""
},
{
"docid": "5b1098644d0de8c3ab1f7b920cd442dc",
"score": "0.7856971",
"text": "def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end",
"title": ""
},
{
"docid": "d2d4ab0f956594ffc7279d5b49a5381c",
"score": "0.7823925",
"text": "def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"title": ""
},
{
"docid": "27a9e748e12ae40d9280bf00c215fb6a",
"score": "0.77979285",
"text": "def tags\n attributes[:tags] || []\n end",
"title": ""
},
{
"docid": "884217149ed2726eb1ccc9790ea8e475",
"score": "0.7772667",
"text": "def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend",
"title": ""
},
{
"docid": "36add17b4e0cb4b2b68f7af75dc798dc",
"score": "0.7759112",
"text": "def get_tags\n\t\t\ttaglist = read_command_output( 'hg', 'tags' )\n\t\t\treturn taglist.split( /\\n/ ).collect {|tag| tag[/^\\S+/] }\n\t\tend",
"title": ""
},
{
"docid": "560e8ff80389dbc54e4ca7e62104ea4b",
"score": "0.77539897",
"text": "def tag_list\n #converting all tag objects to an array of tag names\n self.tags.collect do |tag|\n tag.name\n end.join(\", \") #join the array of tag names with a comma\n end",
"title": ""
},
{
"docid": "01efaa25fdb6a27bdf28ec6d99983b47",
"score": "0.7751794",
"text": "def tags\n entries = Entry.all\n # Create a list of all the tags, as a String\n tags_list = String.new\n entries.each do |entry|\n tags_list << entry.tags + \" \"\n end\n # Convert the String to a global array, removing the duplicate elements\n $tags_array = tags_list.split.uniq\n end",
"title": ""
},
{
"docid": "1f64e8c4629982c7e7011d31e2b837cc",
"score": "0.77468807",
"text": "def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/.match(@node.inner_text)\n (match ? match[:tags] : '').split(' ')\n end",
"title": ""
},
{
"docid": "01dbb9b2b6c71c5f3b05f0b4bf4af39b",
"score": "0.7741199",
"text": "def tag_list\n tags.map{ |tag| tag.name }.reject(&:empty?).join(\" \")\n end",
"title": ""
},
{
"docid": "5c224ba25e0790ebd983cd2b72afdbde",
"score": "0.77392215",
"text": "def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend",
"title": ""
},
{
"docid": "31c8fa008a8b914ad2ddc3154e8e62c7",
"score": "0.7730624",
"text": "def tags\n @tags ||= []\n end",
"title": ""
},
{
"docid": "8071e9e4a37c8472c5e59ec04c4f4d65",
"score": "0.7730144",
"text": "def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"title": ""
},
{
"docid": "4faef966fee9223bc0cc35cc5eee6c87",
"score": "0.7725114",
"text": "def aws_tags_list\n @aws.tags\n end",
"title": ""
},
{
"docid": "c744c91ed84292cd680c9718608c0b7e",
"score": "0.7718992",
"text": "def get_tags\n [['pxb', 'PXB'], ['ind', 'Individuals'], ['bus', 'Businesses'], ['grp', 'Peer Groups']]\n end",
"title": ""
},
{
"docid": "30d06673100ce8a29edc49e6bd5d763a",
"score": "0.77064514",
"text": "def tag_list\n data[:tag_list]\n end",
"title": ""
},
{
"docid": "30d06673100ce8a29edc49e6bd5d763a",
"score": "0.77064514",
"text": "def tag_list\n data[:tag_list]\n end",
"title": ""
},
{
"docid": "bb2680d4cffefb72db00af09bbe3ddd7",
"score": "0.76803654",
"text": "def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend",
"title": ""
},
{
"docid": "69e7f14840b939dff96b19bc8ad6848f",
"score": "0.76745427",
"text": "def all_tags\n\t\ttags.map(&:name).join(\", \")\n\tend",
"title": ""
},
{
"docid": "bdd7d25fd592f7d3f8c842a3860a3c34",
"score": "0.76544833",
"text": "def tags\n response[\"tags\"]\n end",
"title": ""
},
{
"docid": "d84cb1aee38b0869a77237329bbb688a",
"score": "0.7652627",
"text": "def tags\n @obj['tags']\n end",
"title": ""
},
{
"docid": "c6ba77c4e36910408038f3862128e6f4",
"score": "0.7641743",
"text": "def tags() []; end",
"title": ""
},
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.7627665",
"text": "def tags; end",
"title": ""
},
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.7627665",
"text": "def tags; end",
"title": ""
},
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.7627665",
"text": "def tags; end",
"title": ""
},
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.7627665",
"text": "def tags; end",
"title": ""
},
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.7627665",
"text": "def tags; end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.76199865",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.76199865",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.76199865",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.76199865",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.76199865",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "28dcf67fabe5b4761e6db77a01f84c77",
"score": "0.7604994",
"text": "def tag_names\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "97ce96c11c14af47f2b572dd3ce12d6c",
"score": "0.7600258",
"text": "def return_all_tags\n @tags.uniq.each { |tag| puts tag }\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.7597159",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.7597159",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.7597159",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "0ed334b49d0f5020a58c9b221bd9deae",
"score": "0.75787115",
"text": "def tag_list(list = [])\n taggings = ActsAsTaggableOn::Tagging.find_all_by_taggable_id(id)\n if taggings\n taggings.each do |tagging|\n next unless tagging.context == 'interest'\n list << ActsAsTaggableOn::Tag.find(tagging.tag_id).name\n end\n end\n # return empty default or tags retrieved via ActsAsTaggableOn\n list\n end",
"title": ""
},
{
"docid": "1e0beabe439a84c3abbaaa2c64641dad",
"score": "0.7573596",
"text": "def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end",
"title": ""
},
{
"docid": "543b00c92b20a340c801232cd0641425",
"score": "0.75729597",
"text": "def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end",
"title": ""
},
{
"docid": "43dd22fcde67fb67bd03a12e5b2d7732",
"score": "0.75588757",
"text": "def tags\n @fields.tag_list\n end",
"title": ""
},
{
"docid": "52a26998e2f35009006e2615d89b69f8",
"score": "0.7552929",
"text": "def _tags\n tags = []\n categories.find_each do |category|\n tags << category.self_and_ancestors.pluck(:name)\n end\n tags.flatten.uniq\n end",
"title": ""
},
{
"docid": "a7aeb76e6ebaae71a098c581d2ea37d0",
"score": "0.7548193",
"text": "def tags\n object.tags.map {|tag| tag.id}\n end",
"title": ""
},
{
"docid": "dcfd9c374f44227cf1ea6d59ee3fd495",
"score": "0.75453633",
"text": "def list\n ::MachineTag::Set.new(read_tag_file(@tag_file))\n end",
"title": ""
},
{
"docid": "8ba8f4451dd84ff0cc3c6937baec3840",
"score": "0.7523578",
"text": "def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/\n .match(@type_node.inner_text)\n return [] unless match\n match[:tags].split(' ')\n end",
"title": ""
},
{
"docid": "0b48b2ec2662f153eab034434de6c556",
"score": "0.75231737",
"text": "def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend",
"title": ""
},
{
"docid": "660ecbb46172bdfe4e0e716d2c5fb5cb",
"score": "0.7504182",
"text": "def get_tags()\n db = connect_to_database()\n return db.execute(\"SELECT * FROM tags\")\n end",
"title": ""
},
{
"docid": "5766e7d195a671c5f85190f40403efa5",
"score": "0.75013256",
"text": "def tags\n @data['tags']\n end",
"title": ""
},
{
"docid": "6cc652b5800d13978227d9c561aa7fcc",
"score": "0.7497798",
"text": "def tag_names\n if tags_string\n tags_string.split(',').map(&:strip)\n else\n []\n end\n end",
"title": ""
},
{
"docid": "c29f6d25f2815c2ccadbd4b894585113",
"score": "0.74961406",
"text": "def all_tags\n each_with_object([]) do |entry, tags|\n tags.concat(entry.tags).sort!.uniq!\n end\n end",
"title": ""
},
{
"docid": "505cb7e2784a73be3400081dfed4aed7",
"score": "0.7490064",
"text": "def available_tags\n available_tags = []\n Tag.all.each do |t|\n available_tags << t.name\n end\n\n tags = []\n self.tags.each do |t|\n tags << t.name\n end\n\n available_tags - tags\n end",
"title": ""
},
{
"docid": "efa6317b80ccbba40ef7c2f0ddd55d83",
"score": "0.7467402",
"text": "def allTags\n tags = []\n MU::MommaCat.listStandardTags.each_pair { |name, value|\n tags << {key: name, value: value}\n }\n\n if @config['optional_tags']\n MU::MommaCat.listOptionalTags.each_pair { |name, value|\n tags << {key: name, value: value}\n }\n end\n\n if @config['tags']\n @config['tags'].each { |tag|\n tags << {key: tag['key'], value: tag['value']}\n }\n end\n\n return tags\n end",
"title": ""
},
{
"docid": "ff7a9db2437cd744ef5660427d15e5eb",
"score": "0.7462661",
"text": "def all_tags\n tags.map(&:title).join(\", \")\n end",
"title": ""
},
{
"docid": "20f9a4ebc6bb37882419c3a36f228dfa",
"score": "0.7453135",
"text": "def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"title": ""
},
{
"docid": "674fb5634f64f44bed73210043c0a502",
"score": "0.74528354",
"text": "def tags\n css_selectors = [\n '.watch-info-tag-list a', # YouTube\n '.entry .tags a', # Livejournal\n 'a[rel~=tag]', # Wordpress and many others\n 'a.tag', # Tumblr\n '.tags a',\n '.labels a',\n '.categories a',\n '.topics a'\n ]\n\n tags = []\n\n # grab the first one we get results from\n css_selectors.each do |css_selector|\n tags += @doc.css(css_selector)\n break if tags.any?\n end\n\n # convert from Nokogiri Element objects to strings\n tags.map!(&:inner_text)\n\n # remove \"#\" from hashtag-like tags\n tags.map! { |t| t.gsub(/^#/, '') }\n\n tags\n end",
"title": ""
},
{
"docid": "8782f2c12138491ceca27fa94d2e41bf",
"score": "0.7424022",
"text": "def tag_list; []; end",
"title": ""
},
{
"docid": "9d177f96bf2a2dd934c13b30278ded70",
"score": "0.7420519",
"text": "def tags\n get('tags')\n end",
"title": ""
},
{
"docid": "81ba68e9af5f3c9c1114d9b334d53b53",
"score": "0.74195343",
"text": "def tags\n @result.keys\n end",
"title": ""
},
{
"docid": "0e64180c963cedd77ef159315ee71cc7",
"score": "0.7418548",
"text": "def tags\n @values.keys.map { |key| @tag_names[key] }\n end",
"title": ""
},
{
"docid": "b06517dcbb2a0bcc5dff5d1b80f2fe3e",
"score": "0.7411628",
"text": "def tags() ; info[:tags] ; end",
"title": ""
},
{
"docid": "b06517dcbb2a0bcc5dff5d1b80f2fe3e",
"score": "0.7411628",
"text": "def tags() ; info[:tags] ; end",
"title": ""
},
{
"docid": "12fb8e0c5129c14a13dc7dc0fe132273",
"score": "0.74040973",
"text": "def tags\n @note.tagNames\n end",
"title": ""
},
{
"docid": "71d2ba48b5e6fd34e2406b6249898fef",
"score": "0.738776",
"text": "def all\n Tag.all.map{|t| \"#{t.tag} \"}\n end",
"title": ""
},
{
"docid": "02bdec5f93db1eba51f453693a032b34",
"score": "0.7386429",
"text": "def tags(name = nil)\n list = @tags + convert_ref_tags\n return list unless name\n list.select {|tag| tag.tag_name.to_s == name.to_s }\n end",
"title": ""
},
{
"docid": "16b6786633f204619f6f26daa6a9c2ae",
"score": "0.73615485",
"text": "def tags\n Tags.new(@tags)\n end",
"title": ""
},
{
"docid": "5800679b09a221e47c53bc057260d29e",
"score": "0.73585147",
"text": "def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end",
"title": ""
},
{
"docid": "30cc7ae0cbd4ae0c9b4e670867f382d3",
"score": "0.7351716",
"text": "def tags\n @tags ||= tag_class.in_challenge(collection).group(:id)\n end",
"title": ""
},
{
"docid": "862d4b79d8425a8eb857fdcbbb9a7aed",
"score": "0.73341733",
"text": "def get_all_tags()\n tag_hashes = USER_TAGS.order(:tag_name).all\n\n tags = []\n tag_hashes.each do |tag|\n tags.push(UserTag.new(tag))\n end\n\n return tags\n end",
"title": ""
},
{
"docid": "4468077fd57c37cd5e5f3f6db959c6a1",
"score": "0.7326876",
"text": "def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end",
"title": ""
},
{
"docid": "a3c00bdc16308f66afc7a3605ec0fe08",
"score": "0.7319058",
"text": "def tag_names\n @tag_names ||= tags.map(&:name).join(' ')\n end",
"title": ""
},
{
"docid": "0852aaf81f4c448c5f9ad82aa3b3cee1",
"score": "0.7314793",
"text": "def linked_tags\n taggings.map {|tagging| tagging.tag.value}\n end",
"title": ""
},
{
"docid": "35657ff65abacb91653a30c23a885ac3",
"score": "0.7304503",
"text": "def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end",
"title": ""
},
{
"docid": "5b131464eca1414f8d12e02e3d0b013d",
"score": "0.7295467",
"text": "def tags(*list)\n @tags.concat(makelist(list)) unless list.empty?\n @tags\n end",
"title": ""
},
{
"docid": "38e7e436ba7da93b90a8fa261799e9ae",
"score": "0.7272991",
"text": "def tags\n @map.tags\n end",
"title": ""
},
{
"docid": "c1dcedb372b3d59e36f8f81116611967",
"score": "0.7264371",
"text": "def tag_list\n\t\t# for an instance of Article, do this\n\t\t# invoke the given block once for each element of `self`\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \")\n\n\t\t# tags.join(\", \")\n\t\t# the `join` method converts each element in the array to a string, \n\t\t# separated by the given `separator`. But it calls the `to_s` method on our object `tags`\n\tend",
"title": ""
}
] |
de68a811753527833b44756f66f8dfe3
|
path to the site
|
[
{
"docid": "0b2d76cae5e9140cfd338d3101979a4a",
"score": "0.0",
"text": "def create_page\n segments = self.slug.split('/').find_all { |segment| segment != '' }\n max_segments = segments.size\n\n while segment = segments.pop do\n _options = self.page_options(slug: segment, translated: false)\n file_path = File.join(pages_path, segments, segment)\n\n # the content type option is never deleted for the first segment (the requested template)\n _options.delete(:content_type) unless segments.size == (max_segments - 1)\n\n template 'template.liquid.tt', \"#{file_path}.liquid\", _options\n\n self.other_locales.each do |locale|\n _options[:translated] = true\n template 'template.liquid.tt', \"#{file_path}.#{locale}.liquid\", _options\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "4fe91caa98259fae08eb84e6b888fa85",
"score": "0.8112752",
"text": "def pathWebSite\n \"./website/\"\nend",
"title": ""
},
{
"docid": "baed70316f622a449a3cd0199fbf4484",
"score": "0.8052568",
"text": "def site_path\n settings.site_path\n end",
"title": ""
},
{
"docid": "d984c302cd32017557c2cec169ba8453",
"score": "0.78559875",
"text": "def site_url(path)\n\t\tbase_url = \"http://fullridecentral.com\"\n\t\t\"#{base_url}#{path}\"\n\tend",
"title": ""
},
{
"docid": "947499bac63ca85b41fc208a692bbccd",
"score": "0.76878643",
"text": "def url\n Config.site.url.chomp('/') + self.path\n end",
"title": ""
},
{
"docid": "ded4c716f9d289e1c8b8eb9ed3b18b25",
"score": "0.74685574",
"text": "def site_url\n get_url(:site)\n end",
"title": ""
},
{
"docid": "59a40ffa9321b9802005810d56c75e0b",
"score": "0.73113364",
"text": "def local_site_path\n SiteProcessor.new(self).local_site_path\n end",
"title": ""
},
{
"docid": "c2ad5b58a1bb56236dba04b5df1347bc",
"score": "0.7304178",
"text": "def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end",
"title": ""
},
{
"docid": "410471ae6b392566f24fb08700b45b1c",
"score": "0.7176068",
"text": "def pathWebSitePages\n pathWebSite + \"pages/\"\nend",
"title": ""
},
{
"docid": "f75a1cf95680b098377eaf7f660d4c71",
"score": "0.7131744",
"text": "def site_url\n SITE_URL\n end",
"title": ""
},
{
"docid": "fde0fd42a1e65e1d1098ac94cdf8abca",
"score": "0.71310663",
"text": "def basepath; end",
"title": ""
},
{
"docid": "c1a5bc4366b6ad4477abe1d8012bdb9b",
"score": "0.7105632",
"text": "def _site_path(config, filename)\n \"#{config['baseurl']}/#{asset_path(config)}#{filename}\"\n end",
"title": ""
},
{
"docid": "de729e9fb7864b98b16e56190569c3e2",
"score": "0.7087007",
"text": "def path\n if @website_file.in_blog?\n blog_folder.path + @name\n else\n siteroot.path + @name\n end\n end",
"title": ""
},
{
"docid": "03811c839c000e585c658c9c5de3c7e1",
"score": "0.69383603",
"text": "def url\n ::File.join \"/\", path.to_s\n end",
"title": ""
},
{
"docid": "34e7057704e633e76bb1ca9d66c012e6",
"score": "0.689672",
"text": "def url\n [ Configuration.url, @path ].join\n end",
"title": ""
},
{
"docid": "32406c8215995b19cb956f07c8d935d8",
"score": "0.68811816",
"text": "def set_paths(site)\n @public_path = site.public_path\n @view_path = site.view_path\n end",
"title": ""
},
{
"docid": "c38f12c621dc3d738690692dc62a5a5f",
"score": "0.6874282",
"text": "def path_in_public\n (sitemaps_path + filename).to_s\n end",
"title": ""
},
{
"docid": "d246593d4c2010094bf584ad98102494",
"score": "0.68590456",
"text": "def page_dir\n if root?\n site.public_dir\n else\n pieces = path.sub(/^\\//, '').split('/')\n File.join(site.site_files_dir, *pieces[0..-2])\n end\n end",
"title": ""
},
{
"docid": "188aff9902f909c95536ab799465f810",
"score": "0.685685",
"text": "def site_url\n raise StandardError.new \"define method site_url\"\n end",
"title": ""
},
{
"docid": "4b6182aa1340dabe1baa1c0921b69eba",
"score": "0.68227243",
"text": "def base_url_path; end",
"title": ""
},
{
"docid": "2f2b437d2f885e7111006f83b04b785e",
"score": "0.6815827",
"text": "def url\n URL(@site.url).join(attributes[\"RootFolder\"]).to_s\n # # Dirty. Used to use RootFolder, but if you get the data from the bulk calls, RootFolder is the empty\n # # string rather than what it should be. That's what you get with web services as an afterthought I guess.\n # view_url = ::File.dirname(attributes[\"DefaultViewUrl\"])\n # result = URL(@site.url).join(view_url).to_s\n # if ::File.basename(result) == \"Forms\" and dir = ::File.dirname(result) and dir.length > @site.url.length\n # result = dir\n # end\n # result\n end",
"title": ""
},
{
"docid": "9484811d332ee86098f3bbd7ba4a89e9",
"score": "0.6789378",
"text": "def site_url(href)\n path_resolver = (@path_resolver ||= PathResolver.new)\n base_dir = path_resolver.posixify(@document.base_dir)\n site_root = path_resolver.posixify(@document.attr('site-root', base_dir))\n unless path_resolver.is_root? site_root\n raise ::ArgumentError, %(site-root must be an absolute path: #{site_root})\n end\n base_dir_to_root = nil\n if (base_dir != site_root) && (base_dir.start_with? site_root)\n comp, root = path_resolver.partition_path(base_dir.slice(site_root.length + 1, base_dir.length))\n base_dir_to_root = '../' * comp.length\n end\n path_resolver.web_path(href, base_dir_to_root)\n end",
"title": ""
},
{
"docid": "1d150b9493e86e41a408160de1162e87",
"score": "0.6783798",
"text": "def public_path_for(sling)\n return home_path_for(sling) + \"/public\"\n end",
"title": ""
},
{
"docid": "0b7002e2e0d3335a621a0e39335d18b0",
"score": "0.67820394",
"text": "def path\n @global_page.path\n end",
"title": ""
},
{
"docid": "38f3b2168a0dd184709d5ec5d630ca71",
"score": "0.67777425",
"text": "def url\n File.join(server.url, path)\n end",
"title": ""
},
{
"docid": "43b996b3b248c32cac2e305ea015d8f9",
"score": "0.67654425",
"text": "def get_web_sample_path()\n\t\treturn backslashify(File.join(Dir.pwd, WEB_SAMPLE_DIR))\n\tend",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "b0f5e152764f751c7a6a6ed5c331b99a",
"score": "0.6746316",
"text": "def site; end",
"title": ""
},
{
"docid": "4d71201d380e4212472fe11a2366c6b2",
"score": "0.6746097",
"text": "def old_url\n \"http://#{site.default_host.hostname}#{path}\"\n end",
"title": ""
},
{
"docid": "8ebba9e72ca1c9431c8635bbb3128c4b",
"score": "0.67421156",
"text": "def website_url; website end",
"title": ""
},
{
"docid": "33d32ec7db9449eb5ae192f8e78876a0",
"score": "0.67283815",
"text": "def to_www\n @path \n end",
"title": ""
},
{
"docid": "89f4438f66117bb1bc2763e4242b8803",
"score": "0.6721576",
"text": "def public_path; end",
"title": ""
},
{
"docid": "89f4438f66117bb1bc2763e4242b8803",
"score": "0.6721576",
"text": "def public_path; end",
"title": ""
},
{
"docid": "89f4438f66117bb1bc2763e4242b8803",
"score": "0.6721576",
"text": "def public_path; end",
"title": ""
},
{
"docid": "c6af88d000c408ae4756b3beb8f9ecf7",
"score": "0.6702744",
"text": "def base_path\n Dir.pwd + \"/\"\n end",
"title": ""
},
{
"docid": "9278ae1758a73a3d65b686a5e943ecbb",
"score": "0.6694681",
"text": "def relative_url_root; end",
"title": ""
},
{
"docid": "9278ae1758a73a3d65b686a5e943ecbb",
"score": "0.6694681",
"text": "def relative_url_root; end",
"title": ""
},
{
"docid": "9278ae1758a73a3d65b686a5e943ecbb",
"score": "0.6694681",
"text": "def relative_url_root; end",
"title": ""
},
{
"docid": "fee916cb101fbc92890f27da240bf9c9",
"score": "0.66887873",
"text": "def contact_site\n\t\troot_path\n\tend",
"title": ""
},
{
"docid": "3fab1756230b0ca9f5449b9840267a67",
"score": "0.66504717",
"text": "def siteroot\n \"/var/www/gforge-projects\"\n end",
"title": ""
},
{
"docid": "0cfbb70433897db4823f9d99bbd9e52b",
"score": "0.66478956",
"text": "def public_path(target) \n page_generator.theme.file_path(target) \n end",
"title": ""
},
{
"docid": "21a656a22ebfd9129ca43147c15307eb",
"score": "0.6642587",
"text": "def file_path( target )\n # theme.site do not work.\n File.join(page_layout.site.path, self.path, file_name(target)) \n end",
"title": ""
},
{
"docid": "eba98f17f909824afe95ee7f55b1ec16",
"score": "0.6639142",
"text": "def url\n \"http://#{self.cms_site.hostname}#{self.full_path}\"\n end",
"title": ""
},
{
"docid": "d9304a8a3512e82d936d54799b32fb30",
"score": "0.6631557",
"text": "def sourcehome\n site ? site.home : '#'\n end",
"title": ""
},
{
"docid": "e7f589f2ba830c7693900226b974c176",
"score": "0.6622863",
"text": "def path\n File.join Dubya.root_path, 'vendor/wiki'\n end",
"title": ""
},
{
"docid": "b75239839408194931a4557ca966f359",
"score": "0.66214997",
"text": "def get_base_path()\n return TembooSession.get_base_path + \"/choreos\"\n end",
"title": ""
},
{
"docid": "2e4893b91e2feda0ff431586dc7b38be",
"score": "0.66141754",
"text": "def root\n @site.root\n end",
"title": ""
},
{
"docid": "e2a949e6ccd0d0111b64b8d85eed9a5f",
"score": "0.65964913",
"text": "def render_path\n @render_path ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"])\n end",
"title": ""
},
{
"docid": "788c58dda61888530f15c2c534763878",
"score": "0.6596011",
"text": "def public_path\n # TODO: this might present an attack vector if the file is outside the web_root\n options[:web_root].to_s + '/' + self.relative_path.gsub(\"\\\\\", \"/\")\n end",
"title": ""
},
{
"docid": "1dee7e6709050ab0bfb00352d556e551",
"score": "0.6591186",
"text": "def path\n http_url RDoc::RDoc.current.generator.file_dir\n end",
"title": ""
},
{
"docid": "0fc90bd25ab68894a6b538a466ab1956",
"score": "0.6574543",
"text": "def home_path\n @heroku_home\n end",
"title": ""
},
{
"docid": "7a187100a0d3a7b31bb14d0bbe4ea1c7",
"score": "0.6545384",
"text": "def site_asset_path(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets}/\"))\n end",
"title": ""
},
{
"docid": "ea54b428ddc1e728dd94b3efd1314302",
"score": "0.6544317",
"text": "def path\n `window.location.pathname`\n end",
"title": ""
},
{
"docid": "d8eae22102fbc28735a1718422781c10",
"score": "0.65347993",
"text": "def base_path\n wiki.base_path\n end",
"title": ""
},
{
"docid": "d707bb8f649f9ceefa73b8185b624067",
"score": "0.65306044",
"text": "def path\n if @site.config[\"feed\"] && @site.config[\"feed\"][\"path\"]\n @site.config[\"feed\"][\"path\"]\n else\n \"feed.xml\"\n end\n end",
"title": ""
},
{
"docid": "004a9504f0bd4c7baf916d9b9dd5df4e",
"score": "0.65291095",
"text": "def url\n File.join(environment.config.url, @logical_path).sub /(index)?\\.html?$/, ''\n end",
"title": ""
},
{
"docid": "058009afc56abc9b64b9d5bb4c295330",
"score": "0.65250355",
"text": "def root_path; end",
"title": ""
},
{
"docid": "058009afc56abc9b64b9d5bb4c295330",
"score": "0.65250355",
"text": "def root_path; end",
"title": ""
},
{
"docid": "058009afc56abc9b64b9d5bb4c295330",
"score": "0.65250355",
"text": "def root_path; end",
"title": ""
},
{
"docid": "bc698cc627e0f87baa25eb2df6e58b81",
"score": "0.6523269",
"text": "def website_path(website)\n url_for([website.websiteable, website])\n end",
"title": ""
},
{
"docid": "585db5d945e9faf7b657e859b7834a65",
"score": "0.6522459",
"text": "def relative_path(options = {})\n File.join(self.site.content_dir(options), sanitize_filename(self.name))\n end",
"title": ""
},
{
"docid": "3d0f47b76e19ac07d1fe18545366ce60",
"score": "0.6521357",
"text": "def document_root\n end",
"title": ""
},
{
"docid": "04925655fe6aac5d8d6d4d7af102bcb4",
"score": "0.651899",
"text": "def path\n @base\n end",
"title": ""
},
{
"docid": "940478ec061bf26fd950cb7fa1ae548a",
"score": "0.6498117",
"text": "def path\n http_url @store.rdoc.generator.file_dir\n end",
"title": ""
},
{
"docid": "9473b308c48d4140cb725cc0a0aeb917",
"score": "0.6489518",
"text": "def virtual_path; end",
"title": ""
},
{
"docid": "9473b308c48d4140cb725cc0a0aeb917",
"score": "0.6489518",
"text": "def virtual_path; end",
"title": ""
},
{
"docid": "9473b308c48d4140cb725cc0a0aeb917",
"score": "0.6489518",
"text": "def virtual_path; end",
"title": ""
},
{
"docid": "70a1c22e6b7feb38bcaf656ff636da07",
"score": "0.64811057",
"text": "def site_url(path = '', scheme = nil )\n get_site_url(nil, path, scheme )\n end",
"title": ""
},
{
"docid": "22af74b97b89780e0095ba57be77c5e1",
"score": "0.6477566",
"text": "def web_path\n # 47 char is \"/\"\n return path[0] == 47 ? path : \"/\" + path\n end",
"title": ""
},
{
"docid": "e1c2fb4d72af6f6be4bf64a178ba9987",
"score": "0.646684",
"text": "def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end",
"title": ""
},
{
"docid": "2334ea4e97dc436a8f540f356893e7b6",
"score": "0.6466557",
"text": "def rails_root\n @path\n end",
"title": ""
},
{
"docid": "deeab3c89d10f60b34d18fe6017b7024",
"score": "0.6461225",
"text": "def _uri_path\n \"#{@dir}.#{CGI.escape @reg}/#{CGI.escape @dss}\"\n end",
"title": ""
},
{
"docid": "e37b07817b62064fea13d5e751091874",
"score": "0.6459755",
"text": "def path\n URI.parse(@url).path\n end",
"title": ""
},
{
"docid": "f488217a5ee5583ce31f7c01c33e7c66",
"score": "0.6455119",
"text": "def account_site_assets_url\n Account.current.url_base + account_site_assets(true)\n end",
"title": ""
},
{
"docid": "5503020ab085c75381a5fb954a0e7d6b",
"score": "0.6452206",
"text": "def source_path\n if @site.respond_to?(:in_source_dir)\n @site.in_source_dir(\"_app.yaml\")\n else\n Jekyll.sanitized_path(@site.source, \"_app.yaml\")\n end\n end",
"title": ""
},
{
"docid": "c316d664c44cc6fb9ae3598793b99cd2",
"score": "0.6451197",
"text": "def path\n host.path\n end",
"title": ""
},
{
"docid": "64589fc463943777a6c0d0e301ce3267",
"score": "0.6449775",
"text": "def base_path\n @base_path ||= server_path(File.expand_path(Dir.pwd))\n end",
"title": ""
}
] |
7577b2e51a4db3aa9d85448be5c5b766
|
Invoke the given command if the given args. source://thor//lib/thor/invocation.rb122
|
[
{
"docid": "88abbe24c823730f7785af58f4ad1208",
"score": "0.8435125",
"text": "def invoke_command(command, *args); end",
"title": ""
}
] |
[
{
"docid": "85559646bf3e9645f9538d980587d5af",
"score": "0.74566203",
"text": "def thor(command, *args); end",
"title": ""
},
{
"docid": "c455192366f05c7d28205802ab26b867",
"score": "0.7383362",
"text": "def invoke(*args)\n handle_options(args)\n if options[:help]\n show_help\n elsif @when_invoked\n @when_invoked.call(options)\n else\n execute\n end\n end",
"title": ""
},
{
"docid": "eea0b8007dd4792b981c5ce3e21d499b",
"score": "0.72977906",
"text": "def invoke_command(command, *args) #:nodoc:\n command.run(self, *args)\n end",
"title": ""
},
{
"docid": "eea0b8007dd4792b981c5ce3e21d499b",
"score": "0.72977906",
"text": "def invoke_command(command, *args) #:nodoc:\n command.run(self, *args)\n end",
"title": ""
},
{
"docid": "1831e6f3e87d36bb63353b18aa3148c3",
"score": "0.72891563",
"text": "def execute( args )\n command = args.shift or fail \"Missing command, use -h to see usage.\"\n method = \"execute_#{command}\"\n fail \"Invalid command, use -h to see usage.\" unless respond_to?( method, true )\n check_args( args, method( method ).arity )\n send( method, *args )\n end",
"title": ""
},
{
"docid": "a71012e052ac544468ff4bb5eba6d039",
"score": "0.7213445",
"text": "def run(command_string, *args); end",
"title": ""
},
{
"docid": "a71012e052ac544468ff4bb5eba6d039",
"score": "0.7213445",
"text": "def run(command_string, *args); end",
"title": ""
},
{
"docid": "34580942ae67add42543bd4ce4e32155",
"score": "0.7158783",
"text": "def invoke_task(command, *args); end",
"title": ""
},
{
"docid": "6a7b47ae0ea2969ffe799a64da7b0fae",
"score": "0.71350527",
"text": "def full_invoke(cmd, args)\n main_object.send(cmd, *args)\n end",
"title": ""
},
{
"docid": "08f38dee44f8b0521ef5505d9333d4c6",
"score": "0.7053847",
"text": "def invoke(args); end",
"title": ""
},
{
"docid": "fae31ce21f30d0c82fe393564526c47a",
"score": "0.70294845",
"text": "def exec(cmd, args)\n\t\treturn if cmd.empty?\n\t\treturn RacketLib::Print.error(\"Command '#{cmd}' does not exist. Enter 'help' for usage help.\") unless @@commands.include?(cmd.to_sym) # Spacing issue. :(\n\n\t\tparams = [cmd.to_sym]\n\t\tparams << args unless args.empty?\n\n\t\tsend(*params)\n\tend",
"title": ""
},
{
"docid": "058b491fc97dbaf55bd254fe8e3ef159",
"score": "0.702433",
"text": "def invoke_command(text)\n # Mithril.logger.debug \"#{class_name}.invoke_command(), text =\" +\n # \" #{text.inspect}\"\n \n command, args = self.parse_command text\n \n if self.has_action? command\n self.invoke_action command, args\n elsif allow_empty_action?\n self.invoke_action :\"\", args\n else\n command_missing(text)\n end # unless-elsif\n end",
"title": ""
},
{
"docid": "058b491fc97dbaf55bd254fe8e3ef159",
"score": "0.702433",
"text": "def invoke_command(text)\n # Mithril.logger.debug \"#{class_name}.invoke_command(), text =\" +\n # \" #{text.inspect}\"\n \n command, args = self.parse_command text\n \n if self.has_action? command\n self.invoke_action command, args\n elsif allow_empty_action?\n self.invoke_action :\"\", args\n else\n command_missing(text)\n end # unless-elsif\n end",
"title": ""
},
{
"docid": "74854fab3fca229681794496b04fec25",
"score": "0.70181954",
"text": "def call(command, *args)\n self.send(command, *args)\n end",
"title": ""
},
{
"docid": "1a39878ea9cafdc148e8eed75c7d2e2c",
"score": "0.6908516",
"text": "def call cmd, *args\n call_execute cmd, \"run\", *args\n end",
"title": ""
},
{
"docid": "f47dd20614b1854dce3fa60a5033647a",
"score": "0.6883738",
"text": "def call(*command); end",
"title": ""
},
{
"docid": "ddec2670365616b980b12ff718299d06",
"score": "0.68829376",
"text": "def invoke(*args); end",
"title": ""
},
{
"docid": "ddec2670365616b980b12ff718299d06",
"score": "0.68829376",
"text": "def invoke(*args); end",
"title": ""
},
{
"docid": "1fdd1c11e5488fc753c8723c4f609193",
"score": "0.68555343",
"text": "def run(*argv)\n return invoke(default) if argv.empty?\n\n @command = argv.shift\n invoke(@command, *argv) or invoke(invalid, *argv)\n end",
"title": ""
},
{
"docid": "aa9b9fee604a369d30c719bc99c78dda",
"score": "0.6833452",
"text": "def exec(command_name, args)\n puts \"You called \" + command_name + \" with args: \" + args.inspect\n end",
"title": ""
},
{
"docid": "79f2c31936261ddde50f1c1624a15f96",
"score": "0.6821157",
"text": "def invoke_command(cmd, options={}, &block)\n options = options.dup\n via = options.delete(:via) || :run\n send(via, cmd, options, &block)\n end",
"title": ""
},
{
"docid": "ed214324a31adf44c8b3e63f153c7176",
"score": "0.6814159",
"text": "def full_invoke(cmd, args) #:nodoc:\n command, subcommand = cmd.include?('.') ? cmd.split('.', 2) : [cmd, nil]\n dispatcher = subcommand ? Boson.invoke(command) : Boson.main_object\n dispatcher.send(subcommand || command, *args)\n end",
"title": ""
},
{
"docid": "eb76eabca677540471bdc763ff8e4b8d",
"score": "0.67747796",
"text": "def run(args)\n opts.parse!(args)\n\n command = args.shift\n if command.nil?\n puts opts\n else\n meth = command.gsub('-', '_').to_sym\n if respond_to?(meth)\n send(meth)\n else\n puts %(`#{command}` is not a #{opts.program_name} command. See `#{opts.program_name} --help` for a list of available commands.)\n end\n end\n end",
"title": ""
},
{
"docid": "1955279e0f11714d3ca8ae21cdfe8940",
"score": "0.67243725",
"text": "def execute(*args)\n check_args(args)\n println('Command', @name, 'not yet implemented.')\n end",
"title": ""
},
{
"docid": "09aa7d2bf7f6236180368a58cb159390",
"score": "0.6700064",
"text": "def execute_command(cmd, args)\n Boson.full_invoke(cmd, args)\n rescue ArgumentError\n raise if !allowed_argument_error?($!, cmd, args)\n abort_with \"'#{cmd}' was called incorrectly.\\nUsage: \" + Command.usage(cmd)\n rescue NoMethodError => err\n index = RUBY_ENGINE == 'rbx' ? 1 : 0\n raise if !err.backtrace[index].include?('`full_invoke')\n no_command_error cmd\n end",
"title": ""
},
{
"docid": "7f3a686c0d678676c05a81addc1969a3",
"score": "0.66600174",
"text": "def invoke_command(servers, cmd, options={}, &block)\n options = options.dup\n via = options.delete(:via) || :run\n send(via, servers, cmd, options, &block)\n end",
"title": ""
},
{
"docid": "dd9396b988831d029189b9e785326388",
"score": "0.6651993",
"text": "def run cmd, *args\n execute cmd, \"run\", *args\n end",
"title": ""
},
{
"docid": "797f3a0a39eb7e91260c3e8a3fac7510",
"score": "0.6609716",
"text": "def call(argv = ARGV, env = ENV)\n context, prefix, any_match = *_parser.parse(argv, env)\n\n if context\n if context.runnable?\n invoke_command(context)\n else\n @output.puts usage(context, prefix: prefix)\n end\n elsif !any_match\n @output.puts(\"Command '#{_parser.unknown_command}' not found\")\n end\n end",
"title": ""
},
{
"docid": "0f1555d4fb790807ba85437e5ced698c",
"score": "0.65967184",
"text": "def run_command(command, args)\n @command = command.to_s\n if %w{-h --help}.include?(args[0])\n print_command_help\n else\n send(command, args)\n end\n rescue StandardError\n $stderr.puts \"Error: \"+ $!.message\n end",
"title": ""
},
{
"docid": "b0844eb752741cced6c610cb5e4af2f1",
"score": "0.6543545",
"text": "def execute(*args); end",
"title": ""
},
{
"docid": "a4260255cc518ae447f3dc7da36e0ad1",
"score": "0.6540972",
"text": "def command(*args)\n opts.command(*args)\n end",
"title": ""
},
{
"docid": "dd293972bd1e2b1e6250663f2d3e7bb4",
"score": "0.6539821",
"text": "def run *args\n\t\t\tcommand(*args).flatten\n\t\tend",
"title": ""
},
{
"docid": "d09e4ec957d097e10a3223343311fb48",
"score": "0.6521576",
"text": "def execute(command, args)\n if (valid? command)\n self.send(command,args)\n else\n error_message(args)\n end\n end",
"title": ""
},
{
"docid": "a2017b71aa4cf1ca90757723da1c7fe5",
"score": "0.65203315",
"text": "def method_missing(name, *args)\n cmd.run2(@command, name, *args)\n end",
"title": ""
},
{
"docid": "ed5d71f49d58cccd4c4e56093e907d9e",
"score": "0.65053046",
"text": "def command!(*args)\n return if @stop\n args = @args if args.empty?\n return help if args.empty?\n return send(args.shift, *args) if @commands.include?(args.first)\n err.puts \"Unknown command: #{args.first}\"\n end",
"title": ""
},
{
"docid": "bc7e6de6c8310b5c4a776b1ba9f4358c",
"score": "0.6505117",
"text": "def exec(command, arguments, interops = {}, options = {})\n line(command, arguments, options).pass(interops)\n end",
"title": ""
},
{
"docid": "bc7e6de6c8310b5c4a776b1ba9f4358c",
"score": "0.6505117",
"text": "def exec(command, arguments, interops = {}, options = {})\n line(command, arguments, options).pass(interops)\n end",
"title": ""
},
{
"docid": "7fe5ccb6852e16d9cd55f0ea64729e94",
"score": "0.65039724",
"text": "def run_command(command, args=[])\n method = \"redisk_command_#{command}\"\n if self.respond_to?(method)\n puts \"Received command #{command} #{args.inspect}\"\n self.send method, args\n else\n response_ok\n end\n end",
"title": ""
},
{
"docid": "90db8716b6fb3ee32b6a06b329b6d0cf",
"score": "0.64908487",
"text": "def exec!\n thor_config[:shell] ||= Thor::Base.shell.new\n \n thor_class.send(\n :dispatch,\n nil,\n given_args,\n nil,\n thor_config\n ) { |thor_instance|\n @thor_instance = thor_instance\n \n logger.debug \"Got Thor instance\",\n options: thor_instance.options\n }\n rescue SystemExit\n # `exit` was called; we want to just let this keep going\n raise\n rescue Errno::EPIPE\n # This happens if a thor command is piped to something like `head`,\n # which closes the pipe when it's done reading. This will also\n # mean that if the pipe is closed, further unnecessary\n # computation will not occur.\n exit true\n rescue Exception => error\n raise if raise_errors?\n \n if backtrace?\n logger.error error\n else\n logger.error error.message\n end\n \n exit false\n end",
"title": ""
},
{
"docid": "69fc2b6abc84e8abb9c9eb48e3384fc0",
"score": "0.6489454",
"text": "def call(args, command_name)\n cmd = new(@ctx)\n cmd.call(args, command_name)\n end",
"title": ""
},
{
"docid": "0ae6ece1e8b99245c5613c318a1edaf9",
"score": "0.6479408",
"text": "def exec(command_name, args)\n exec_command(command_name, args)\n end",
"title": ""
},
{
"docid": "60c7ecbcccb9ee1fdda60a38118b7461",
"score": "0.64534324",
"text": "def invoke(argv)\n options = map_options_with_values(argv)\n command = new_command_instance(command_key(argv), options)\n return command.run if has_no_arguments?(options) || has_valid_arguments?(command.class, options)\n command.class.help\n end",
"title": ""
},
{
"docid": "e165db3c08a32c4cfc027dc5b7f9b0e2",
"score": "0.64504725",
"text": "def execute\n if @cmd.nil?\n log.warn(\"No command given, nothing to do\") and exit\n end\n\n @cmd.execute(@args)\n end",
"title": ""
},
{
"docid": "ee52a1c70b3a920f58e06946279e08bd",
"score": "0.64384687",
"text": "def call(*args, &block)\n @executable.invoke(@name, @defined_in, @receiver, args, block)\n end",
"title": ""
},
{
"docid": "a6aff380e8fdb0d2fee2f28abf364df7",
"score": "0.64323634",
"text": "def command(*args)\n @log.info(\"method command was called on MockResult\")\n \"echo foo\"\n end",
"title": ""
},
{
"docid": "345df061933f381b907dcbc491800e10",
"score": "0.6428317",
"text": "def run(args)\n # Ensure Omnibus related binaries are in the PATH\n ENV[\"PATH\"] = [File.join(base_path, \"bin\"),\n File.join(base_path, \"embedded\", \"bin\"),\n ENV[\"PATH\"]].join(\":\")\n\n command_to_run = args[0]\n\n ## when --help is run as the command itself, we need to strip off the\n ## `--` to ensure the command maps correctly.\n if command_to_run == \"--help\"\n command_to_run = \"help\"\n end\n\n # This piece of code checks if the argument is an option. If it is,\n # then it sets service to nil and adds the argument into the options\n # argument. This is ugly. A better solution is having a proper parser.\n # But if we are going to implement a proper parser, we might as well\n # port this to Thor rather than reinventing Thor. For now, this preserves\n # the behavior to complain and exit with an error if one attempts to invoke\n # a pcc command that does not accept an argument. Like \"help\".\n options = args[2..-1] || []\n if is_option?(args[1])\n options.unshift(args[1])\n service = nil\n else\n service = args[1]\n end\n\n # returns either hash content of command or nil\n command = retrieve_command(command_to_run)\n if command.nil?\n log \"I don't know that command.\"\n if args.length == 2\n log \"Did you mean: #{exe_name} #{service} #{command_to_run}?\"\n end\n help\n Kernel.exit 1\n end\n\n if args.length > 1 && command[:arity] != 2\n log \"The command #{command_to_run} does not accept any arguments\"\n Kernel.exit 2\n end\n\n parse_options options\n @force_exit = false\n exit_code = 0\n\n run_global_pre_hooks\n\n # Filter args to just command and service. If you are loading\n # custom commands and need access to the command line argument,\n # use ARGV directly.\n actual_args = [command_to_run, service].reject(&:nil?)\n if command_pre_hook(*actual_args)\n method_to_call = to_method_name(command_to_run)\n begin\n ret = send(method_to_call, *actual_args)\n rescue SystemExit => e\n @force_exit = true\n ret = e.status\n end\n command_post_hook(*actual_args)\n exit_code = ret unless ret.nil?\n else\n exit_code = 8\n @force_exit = true\n end\n\n if @force_exit\n Kernel.exit exit_code\n else\n exit_code\n end\n end",
"title": ""
},
{
"docid": "221e055fabc7737f29e8dde8b2569b03",
"score": "0.64087623",
"text": "def command\n [*executable, *args]\n end",
"title": ""
},
{
"docid": "6b9f6e022f8f71b063cc300e6ed27a03",
"score": "0.6396043",
"text": "def run(args)\n global_opts = parse_args(args)\n name = args.shift\n Trollop.educate if name.nil?\n command = Subcommand.commands.select { |cmd| cmd.name == name }.first\n begin\n raise \"unknown command '#{name}'\" unless command\n command.run global_opts.merge command.parse args\n rescue StandardError => e\n puts \"Error: #{e}\"\n end\n end",
"title": ""
},
{
"docid": "c282461c41376ace05a9e315851d8813",
"score": "0.6389552",
"text": "def vrun(*args, &block)\n options = Hash===args.last ? args.pop.dup : {}\n options[:via] ||= fetch(:run_method, :run)\n invoke_command *args.push(options), &block\n end",
"title": ""
},
{
"docid": "e48feb45afe022c49bb0a67cfbeec5f2",
"score": "0.6387147",
"text": "def run_command(args)\n Debox::Command.load\n given_command = args.shift.strip rescue \"help\"\n if given_command == 'help' || options[:show_help]\n help_and_exit\n end\n command = Debox::Command.get_command given_command\n unless command\n puts \"Invalid command #{given_command}\"\n help_and_error\n end\n\n Debox::Config.merge_command_line_options! options\n Debox::Command.run(command, options, args)\n end",
"title": ""
},
{
"docid": "67a6f45f2e81065120b45709283a68ab",
"score": "0.6383315",
"text": "def call_command\n verb = match.captures[match.names.index('command')]\n verb = verb.downcase if verb\n public_send(verb)\n end",
"title": ""
},
{
"docid": "adc61a0ed9a54bc73f3ae40128b1b56c",
"score": "0.63730115",
"text": "def call\n if requested_command && commands.has_key?(requested_command)\n self.command_method = commands[requested_command].method(:call)\n end\n\n command_method.call(_args.drop(1))\n\n self\n end",
"title": ""
},
{
"docid": "394c0f6ee33b1990d297a66eca52c3e9",
"score": "0.63492835",
"text": "def perform_command(arguments)\n command, args = parse(kommand, arguments, [])\n command.call(**args)\n end",
"title": ""
},
{
"docid": "f6f7e4ae0e95a12cdd0c2af37493eaa1",
"score": "0.6346557",
"text": "def command(command, *args)\n internal_command(command, :command, *args)\n end",
"title": ""
},
{
"docid": "2875a89df55f989254867037276b49bd",
"score": "0.63300246",
"text": "def run()\n option = @args[0]\n\n if @args.length > 0\n cmd = find_command(option)\n if not cmd.nil?\n cmd.execute(@args)\n else\n invalid_command(option)\n end\n else\n show_help(@args)\n end\n end",
"title": ""
},
{
"docid": "3669f4a56dba23b4fd1305cc23b68f5b",
"score": "0.63271165",
"text": "def run( command, *args )\n\t\tcommand ||= 'help'\n\t\tcmd_method = nil\n\n\t\t# Set the datadir override if it's given\n\t\tif self.options.datadir\n\t\t\tself.log.debug \"Using data dir option: %s\" % [ self.options.datadir ]\n\t\t\tStrelka::App.local_data_dirs = Pathname( self.options.datadir )\n\t\tend\n\n\t\t# Include a 'lib' directory if there is one\n\t\t$LOAD_PATH.unshift( 'lib' ) if File.directory?( 'lib' )\n\n\t\t# Run the command\n\t\tbegin\n\t\t\tcmd_method = self.method( \"#{command}_command\" )\n\t\trescue NameError => err\n\t\t\terror \"No such command %p\" % [ command ]\n\t\t\texit :usage\n\t\tend\n\n\t\tcmd_method.call( *args )\n\tend",
"title": ""
},
{
"docid": "9fdea11fdfea2426d06d2be49849463a",
"score": "0.6323053",
"text": "def invoke(full_namespace, args = [], **config)\n load_commands!\n\n namespace = full_namespace = full_namespace.to_s\n\n if char = namespace =~ /:(\\w+)$/\n command_name, namespace = $1, namespace.slice(0, char)\n else\n command_name = namespace\n end\n\n command_name, namespace = \"help\", \"help\" if command_name.blank? || HELP_MAPPINGS.include?(command_name)\n command_name, namespace = \"version\", \"version\" if %w( -v --version ).include?(command_name)\n\n command = find_by_namespace(namespace, command_name)\n\n # if command && command.all_commands[command_name]\n if command\n command.perform(command_name, args, config)\n else\n $stderr.puts \"Unknown command #{full_namespace}\\n\\n\"\n command_name, namespace = \"help\", \"help\"\n command = find_by_namespace(namespace, command_name)\n command.perform(command_name, args, config)\n end\n\n # else\n # find_by_namespace(\"rake\").perform(full_namespace, args, config)\n # end\n end",
"title": ""
},
{
"docid": "849af959dbaa8ee6947898faa6a0f5d4",
"score": "0.63225085",
"text": "def dispatch(command, given_args, given_opts, config); end",
"title": ""
},
{
"docid": "a838b28f9c67784a8d71c92780f95131",
"score": "0.63209814",
"text": "def execute(*args)\n args.flatten!\n parse_params args\n run\n end",
"title": ""
},
{
"docid": "9e723ef7334122dbe98f9dc90b2a2888",
"score": "0.6308122",
"text": "def execute(args = [])\n raise '404: command not found'\n end",
"title": ""
},
{
"docid": "bd877f99c9959d12f51a59f967ac7c45",
"score": "0.63015646",
"text": "def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"title": ""
},
{
"docid": "bd877f99c9959d12f51a59f967ac7c45",
"score": "0.63015646",
"text": "def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"title": ""
},
{
"docid": "e920dfe4143b75df7db0a757a4bd74f3",
"score": "0.62920135",
"text": "def run\n preflight_checks\n\n PriorityOrder.each do |command|\n if self.class.method_defined?(command) && ! Launchr.config[:args][command].nil?\n self.send command, Launchr.config[:args][command]\n end\n end\n\n left_to_execute = Launchr.config[:args].keys - PriorityOrder\n Launchr.config[:args].each do |command, value|\n if left_to_execute.include?(command) && self.class.method_defined?(command) && ! value.nil?\n self.send command, Launchr.config[:args][command]\n end\n end\n end",
"title": ""
},
{
"docid": "e51dcef0e70c0e4894cc631f9240e0d3",
"score": "0.6284127",
"text": "def execute(command_namespace, args=[])\n commands[command_namespace][:command].call(args)\n end",
"title": ""
},
{
"docid": "57207860318ea78459301d5022b5ed4b",
"score": "0.6278003",
"text": "def exec( *args )\n # remove project from arguments\n @args = args\n # first argument is the action's keyword\n # print help message if no keywords given\n parse_args\n \n run\n end",
"title": ""
},
{
"docid": "da16ccfbf35a572c63af61d681c51094",
"score": "0.6269559",
"text": "def execute!\n # Ensure our rootness if needed, will restart script if needed\n sudo_root! if @run_as_root\n \n # Find the action to run\n @action = find_action_for(CommandLine.instance.args, CommandLine.instance.options)\n \n # Invoke the action!\n @action.invoke\n end",
"title": ""
},
{
"docid": "4c65ee28d3b8fda24b60526cb1513af0",
"score": "0.6255979",
"text": "def run(command, *params)\n \n Rails.logger.info \"Shell command #{cmd}\"\n \n \n end",
"title": ""
},
{
"docid": "6c6c972664a0ced21d46c72594491150",
"score": "0.62500423",
"text": "def invoke!\n @target.send(@method, *@args)\n end",
"title": ""
},
{
"docid": "a32f5fab3a750f40c5e53c52390f07fe",
"score": "0.624708",
"text": "def thor(command, *args)\n config = args.last.is_a?(Hash) ? args.pop : {}\n verbose = config.key?(:verbose) ? config.delete(:verbose) : true\n pretend = config.key?(:pretend) ? config.delete(:pretend) : false\n capture = config.key?(:capture) ? config.delete(:capture) : false\n\n args.unshift(command)\n args.push Foreman::Thor::Options.to_switches(config)\n command = args.join(\" \").strip\n\n run command, :with => :thor, :verbose => verbose, :pretend => pretend, :capture => capture\n end",
"title": ""
},
{
"docid": "f1b861c23f46da0285d043d1950fc0e5",
"score": "0.6245162",
"text": "def invoke(full_namespace, args = [], **config)\n args = [\"--help\"] if rails_new_with_no_path?(args)\n\n full_namespace = full_namespace.to_s\n namespace, command_name = split_namespace(full_namespace)\n command = find_by_namespace(namespace, command_name)\n\n with_argv(args) do\n if command && command.all_commands[command_name]\n command.perform(command_name, args, config)\n else\n invoke_rake(full_namespace, args, config)\n end\n end\n rescue UnrecognizedCommandError => error\n if error.name == full_namespace && command && command_name == full_namespace\n command.perform(\"help\", [], config)\n else\n puts error.detailed_message\n end\n exit(1)\n end",
"title": ""
},
{
"docid": "ebe6f817acea5713f6572070b0663efa",
"score": "0.6235973",
"text": "def run(executable, *args)\n executable_full = executable_path(executable)\n self.command = args | default_args\n self.command = command.sort.unshift(executable_full)\n\n system(self.command.join(' '), system_options)\n end",
"title": ""
},
{
"docid": "982d05f16fe398c86c5886335e3b2458",
"score": "0.6234277",
"text": "def send_command\n return BistroView.error if ARGV[0].nil?\n ARGV[1].nil? ? (send ARGV[0]) : (send ARGV[0], ARGV[1])\n end",
"title": ""
},
{
"docid": "a644a79711825ada434798147a10f06c",
"score": "0.62294656",
"text": "def execute\n if args.noop?\n puts commands\n elsif not args.skip?\n if args.chained?\n execute_command_chain\n else\n exec(*args.to_exec)\n end\n end\n end",
"title": ""
},
{
"docid": "090097e55e5b2144f0cebad6f9cc9df1",
"score": "0.6218305",
"text": "def invoke(params={})\n process_result(Xbmc.invoke_and_process(command, params))\n end",
"title": ""
},
{
"docid": "4250af05af0201d3322933988814b615",
"score": "0.6216691",
"text": "def method_missing(*args, &block)\n command(*args, &block)\n end",
"title": ""
},
{
"docid": "ee7c7072079e4dcc6ad057f6ccb3c176",
"score": "0.62103045",
"text": "def execute(args=nil)\n args ||= EMPTY_TASK_ARGS\n if application.options.dryrun\n application.trace \"** Execute (dry run) #{name}\"\n return\n end\n application.trace \"** Execute #{name}\" if application.options.trace\n application.enhance_with_matching_rule(name) if @actions.empty?\n if opts = Hash.try_convert(args) and !opts.empty?\n @actions.each { |act| act.call(self, args, **opts) }\n else\n @actions.each { |act| act.call(self, args) }\n end\n end",
"title": ""
},
{
"docid": "8d9b320540daefe710939cddda439958",
"score": "0.62067395",
"text": "def run(args={})\n @on_success = args[:on_success] if args.has_key?(:on_success)\n @on_failure = args[:on_failure] if args.has_key?(:on_failure)\n @verb, @entity, @route, @params = self.command\n dispatch(@verb, @entity, @route, @params)\n end",
"title": ""
},
{
"docid": "ab1036945e98b259ad84074a264c4d59",
"score": "0.6206271",
"text": "def execute(args)\n if args.empty?\n KaijuShellHelp.new.execute([])\n else\n my_args = args.dup\n KaijuShellCommand.new_cmd(my_args.delete_at(0)).execute(my_args)\n end\n end",
"title": ""
},
{
"docid": "c49f55e17f2b90fb69778b5ee9c1f3c8",
"score": "0.6195452",
"text": "def call(*args, &block)\n command = new(*args)\n command.evaluate(&block) if block_given?\n command.call\n end",
"title": ""
},
{
"docid": "c4b5dab949c347ca23e6fda277608f49",
"score": "0.61928076",
"text": "def invoke_command(context)\n @lock.synchronize do\n command, action = *split_runnable(context)\n runnable = load_command_class(context, command)\n\n if runnable.is_a?(Module)\n Interceptor.intercept(runnable, action: action)\n runnable = runnable.new\n end\n\n if runnable.respond_to?(action)\n runnable.__send__(action, *runnable_args(runnable, action))\n else\n raise Error, \"missing command action: #{action.to_s.inspect}\"\n end\n end\n end",
"title": ""
},
{
"docid": "3a71641c0909e111d45a22d543974d90",
"score": "0.61880493",
"text": "def exec_cmd(command, arguments = nil, opts = nil)\n\tend",
"title": ""
},
{
"docid": "822639a40232c894b93cdc4d74ed387c",
"score": "0.61851794",
"text": "def perform(options, arguments)\n command_info, command_options = @command_line.triggered_command\n\n if command_info\n client_filter = Pantry::Communication::ClientFilter.new(\n application: options['application'],\n environment: options['environment'],\n roles: options['roles']\n )\n\n command = command_info[:class].new(*arguments)\n command_options = command_options.merge(options)\n\n request(client_filter, command, command_options)\n else\n $stderr.puts \"I don't know the #{arguments.first} command\"\n end\n end",
"title": ""
},
{
"docid": "193f2b4e106af22d692f8a7cbc12317c",
"score": "0.6183618",
"text": "def call(*command)\n send_command(command)\n end",
"title": ""
},
{
"docid": "544f79338b571c8895c0d6af62f21682",
"score": "0.61833626",
"text": "def exec(*args)\n args.flatten!\n Cany.logger.info args.join(' ')\n unless system(*args)\n raise CommandExecutionFailed.new args\n end\n end",
"title": ""
},
{
"docid": "77fc96c732f36d8b4732fe4a63a85962",
"score": "0.6179437",
"text": "def execute(*args)\n spawn(*args).join\n end",
"title": ""
},
{
"docid": "809ecd554e2057886ab23f745b02d4f1",
"score": "0.61781764",
"text": "def invoke_command(input)\n # Mithril.logger.debug \"#{class_name}.invoke_command(), text =\" +\n # \" #{text.inspect}, session = #{request.session.inspect}, proxy =\" +\n # \" #{proxy}\"\n \n if self.proxy.nil?\n super\n elsif self.allow_own_actions_while_proxied? && self.can_invoke_on_self?(input)\n super\n elsif proxy.can_invoke? input\n proxy.invoke_command input\n else\n command_missing(input)\n end # if-elsif-else\n end",
"title": ""
},
{
"docid": "cfe41c8894dacb2feca2a778a8995ce5",
"score": "0.61708605",
"text": "def run(*args)\n args = ARGV if args.nil?\n args.flatten!\n\n name = args.delete_at(0)\n load_commands\n\n if (name.nil? && args.size == 0) || display_help?(name)\n display_help\n return\n end\n\n command = find_command name\n command.execute *args\n end",
"title": ""
},
{
"docid": "1dc614ae9eb7205966818c244db20d25",
"score": "0.6170145",
"text": "def perform_command(_command, *_args)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "1e8aee81cbc9d7d06b9be57555f8e275",
"score": "0.6161678",
"text": "def exec(cmd)\n\t\tsplitted = cmd.split(\" \")\n\n\t\tif splitted.length > 1\n\t\t\tself.send(splitted[0], splitted[1..(splitted.length - 1)])\n\t\telse\n\t\t\tself.send(cmd)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "67385525eff6f51181892d9c21ea93f1",
"score": "0.6152913",
"text": "def execute(*args)\n command = args.shift\n major = args.shift\n minor = args.empty? ? nil : args.join(' ')\n\n return overview unless command\n delegate(command, major, minor)\n end",
"title": ""
},
{
"docid": "67385525eff6f51181892d9c21ea93f1",
"score": "0.6152913",
"text": "def execute(*args)\n command = args.shift\n major = args.shift\n minor = args.empty? ? nil : args.join(' ')\n\n return overview unless command\n delegate(command, major, minor)\n end",
"title": ""
},
{
"docid": "07d189750f4de077ec6d9ca7ff1f80c1",
"score": "0.61490643",
"text": "def invoke_with_call_chain (*args)\n\t\t\tself.args\n\t\t\toriginal_invoke_with_call_chain *args\n\t\tend",
"title": ""
},
{
"docid": "05594c8c8de808a6fd34609555e9592b",
"score": "0.61482304",
"text": "def run(*args)\n args, opts = preparse(args)\n name = args.shift unless args.empty?\n\n command = command(name).new(opts)\n\n command.parse(args)\n command.execute\n end",
"title": ""
},
{
"docid": "44cbdb9823534f85b75339f6ccf5be5b",
"score": "0.61411065",
"text": "def run!\n @command.invoke(engine, options)\n end",
"title": ""
},
{
"docid": "9e3d7caf2f5f5c4ff54a908f4e62bfa2",
"score": "0.613121",
"text": "def run(argv)\n begin\n # Parse global arguments\n global_opts.parse argv\n\n # Specific command (must exists)\n cmd_name = argv.shift\n raise Trollop::HelpNeeded, \"\" unless cmd_name\n\n # Given command that is current executed\n @cmd = COMMANDS[cmd_name].new\n\n # Finish parsing arguments\n @cmd.global_args = @global_opts\n @cmd.args = @cmd.opts.parse(argv)\n @cmd.files = argv\n\n # And finally run the command\n @cmd.process\n\n rescue Trollop::CommandlineError => e\n $stderr.puts \"Error: #{e.message}.\"\n $stderr.puts \"Try --help for help.\"\n exit(-1)\n rescue Trollop::HelpNeeded\n # Global arguments\n global_opts.educate\n\n # Help for each command\n COMMANDS.each do |name, cmd|\n puts \"\\nCommand :#{name}\\n\"\n cmd.new.opts.educate\n end\n rescue Trollop::VersionNeeded\n puts global_opts.version\n rescue Exception::RepositoryExists\n puts \"Repository has been already initialized.\"\n exit(-1)\n end\n end",
"title": ""
},
{
"docid": "b9d87557c566667e05f13306e471c52c",
"score": "0.6123739",
"text": "def execute_command(command_class, method, args = [])\n command_class.new.send(method, *args)\n end",
"title": ""
},
{
"docid": "2780bf065b12e956aeec58bb003b6430",
"score": "0.6123323",
"text": "def pass *args\n halt invoke(*args)\n end",
"title": ""
},
{
"docid": "1aa0feb54df4da4e3cf7070dc6ed4432",
"score": "0.6120502",
"text": "def invoke(job, environment, name, *args)\n self.command(name).invoke(job, environment, args)\n end",
"title": ""
},
{
"docid": "2be9ce5a8d8355f146251a4869e363c2",
"score": "0.6106392",
"text": "def method_missing(cmd, options = {}, *args)\n run(cmd, options, *args)\n end",
"title": ""
},
{
"docid": "6aa0a7163b78b1ea86f5eeeaddba7ce0",
"score": "0.610581",
"text": "def run(command)\n # ...\n end",
"title": ""
}
] |
2f767b2b12b774f3209cb2c321844eb9
|
GET /campaigns/1 GET /campaigns/1.json
|
[
{
"docid": "6865e582b12ed0b04a885f6b6dfcd82b",
"score": "0.0",
"text": "def show\n # solicitations where campaign_id == @campaign.id.include donations include donation.users return s.amount raised and user email\n @top_amount = @campaign.fundraisers_by_amount_raised.select { |f| f[0] > 0 }\n # solicitations where campaign_id == @campaign.id.include donations and users, return user.email and d.size\n @top_number = @campaign.fundraisers_by_number_of_donations.select { |f| f[0] > 0 }\n end",
"title": ""
}
] |
[
{
"docid": "72b190ff4ca249af6f70a1203c574d9f",
"score": "0.8128707",
"text": "def get_campaigns\n get('/fcb30500-7b98-476f-810d-463a0b8fc3df')\n end",
"title": ""
},
{
"docid": "5799619765be2031d6b4a1e3ca6883fb",
"score": "0.8022026",
"text": "def get_campaigns()\n exec_get(\"#{@base_path}/api/v2/customers/campaigns.json?api_key=#{@api_key}\")\n end",
"title": ""
},
{
"docid": "3c96f4d848e73f2dce807480708974dd",
"score": "0.7963378",
"text": "def campaign(id)\n make_json_api_request :get, \"v2/#{account_id}/campaigns/#{id}\"\n end",
"title": ""
},
{
"docid": "9837fadf09b44ae04ec9a35d9720724b",
"score": "0.7647663",
"text": "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "9837fadf09b44ae04ec9a35d9720724b",
"score": "0.7647663",
"text": "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "9837fadf09b44ae04ec9a35d9720724b",
"score": "0.7647663",
"text": "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "9837fadf09b44ae04ec9a35d9720724b",
"score": "0.7647663",
"text": "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "bf403b041a7497fe76c3fcf17da05b18",
"score": "0.764473",
"text": "def index\n @campaigns = Campaign.all\n render json: @campaigns, status: :ok\n end",
"title": ""
},
{
"docid": "9f8808bd942c7b7add7019f8482658d5",
"score": "0.7634553",
"text": "def find(id)\n get(\"#{domain}/campaigns/#{id}\")\n end",
"title": ""
},
{
"docid": "71a66c1a088226a712eac84172f006a6",
"score": "0.75940853",
"text": "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @campaign }\n end\n end",
"title": ""
},
{
"docid": "ff10f27d9efdbda2d0a502044672daac",
"score": "0.7501439",
"text": "def get_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"title": ""
},
{
"docid": "2298b9d22072717bfa8e6bed716943c9",
"score": "0.7499233",
"text": "def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"title": ""
},
{
"docid": "0eeb27eca5770a792f620000aed14459",
"score": "0.7486522",
"text": "def all\n get(\"#{domain}/campaigns\")\n end",
"title": ""
},
{
"docid": "3a0cc7ac2811623b896afb67e874cea0",
"score": "0.7462857",
"text": "def get_campaign(campaign_id)\n full_path = full_resource_path(\"/#{campaign_id}\")\n query_params = MaropostApi.set_query_params()\n\n MaropostApi.get_result(full_path, query_params)\n end",
"title": ""
},
{
"docid": "ae085d2d4f0257709db5d3e656583590",
"score": "0.7373646",
"text": "def campaign\n Campaign.find campaign_id\n end",
"title": ""
},
{
"docid": "279cf72b0d68bd999a2187ec33646d07",
"score": "0.73642004",
"text": "def campaigns(user_id)\n self.class.get(\"/users/\"+user_id+\"/campaigns\", @options)\n end",
"title": ""
},
{
"docid": "5fc0b8bb8fa9de919f452e3b5ee992f4",
"score": "0.73591053",
"text": "def show\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "4bb477021d5aa074c5475cb9419433be",
"score": "0.7279169",
"text": "def index\n @campaigns = Campaign.all\n render json: @campaigns.to_json(include_hash)\n end",
"title": ""
},
{
"docid": "97d89c814ae451ff5af4bd831f68d7d7",
"score": "0.72681665",
"text": "def index\n @campaigns = Campaign.where(user_id: params[:user_id])\n # @new_campaign = Campaign.new\n render json: @campaigns\n end",
"title": ""
},
{
"docid": "f746a473531b83976b3c21f02c5c5da9",
"score": "0.72482085",
"text": "def campaigners\n return get(\"/campaigners/list\")\n end",
"title": ""
},
{
"docid": "74abed4adae414c6563049e9cf28984b",
"score": "0.72419846",
"text": "def index\n @campaigns = @org.campaigns\n end",
"title": ""
},
{
"docid": "aaec4092a91002280acda10412da269c",
"score": "0.7240425",
"text": "def campaigns(advertizer_id, params = {})\n get_collection('campaign/get/', params.merge(advertiser_id: advertizer_id))\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "d80d4202b2229d8bd23fa0a0e87d6783",
"score": "0.72266304",
"text": "def index\n @campaigns = Campaign.all\n end",
"title": ""
},
{
"docid": "c716c9e56ca36083f947fcbec61c1608",
"score": "0.7216143",
"text": "def show\n render json: @campaign, status: :ok\n end",
"title": ""
},
{
"docid": "be2c7df1fffeb6ff9bc103b5d07fc885",
"score": "0.7208069",
"text": "def index\n #get all the campaigns\n @campaigns = Campaign.first(200)\n if(@campaigns!= nil)\n #loop through each campaign in the @campaigns object and store the campaign id, name and goal. The goal is originally in cents so we are displaying it in dollars\n campaigns_hash_array = @campaigns.collect{|campaign| {\"campaign_id\"=> campaign.id, \"campaign_name\" => campaign.name, \"campaign_goal\" => campaign.goal_cents/100}}\n render json: campaigns_hash_array, status: :ok\n else\n render json: no_campaigns_error, :status => 404\n end\n end",
"title": ""
},
{
"docid": "bef9a312d040da875f1d2274df7ea605",
"score": "0.71738154",
"text": "def show\n campaign_id = params[:id]\n campaign = Campaign.find(campaign_id)\n if (campaign!=nil)\n retDetails = {\"campaign_id\"=> campaign.id, \"campaign_name\"=> campaign.name, \"campaign_description\"=> campaign.description, \"campaign_goal\"=> campaign.goal_cents/100, \"campaign_progress\"=> campaign.amount_donated_cents/100, \"campaign_image_url\" => campaign.getimageurl(campaign.image)}\n render json: retDetails\n else\n render json: campaign_does_not_exist_error, :status => 404\n end\n end",
"title": ""
},
{
"docid": "3cd2e8d899b388fef22adcf34cfe0dcb",
"score": "0.71620077",
"text": "def get_campaign_by_id(id)\n if id.nil?\n raise LinkemperorCustomerException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}\")\n end",
"title": ""
},
{
"docid": "307e10c1bd8a29ed20b5b4a3a70d9a6d",
"score": "0.7157228",
"text": "def test_get_campaign\n test_add_campaign() unless @campaign\n selector = @campaign_srv.module::CampaignSelector.new\n selector.ids = [@campaign.id]\n response = @campaign_srv.get(selector)\n assert_not_nil(response.rval.entries, 'Empty result set returned')\n assert_equal(1, response.rval.entries.size,\n 'Unexpected number of entries returned')\n assert_equal(@campaign.id, response.rval.entries.first.id)\n end",
"title": ""
},
{
"docid": "b9672284333a26e60240bee94bd6b494",
"score": "0.71544397",
"text": "def show\n @affiliate_campaign = Affiliate::Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affiliate_campaign }\n end\n end",
"title": ""
},
{
"docid": "003be24d4215e1a86b4da436b0cc2635",
"score": "0.714864",
"text": "def show\n @campaign = @user.campaigns.find(params[:id])\n end",
"title": ""
},
{
"docid": "480c0e1c92e97dd5a59f9c6da9bfec07",
"score": "0.7081039",
"text": "def get_campaign_info(id)\n return handle_error('Empty campaign id') unless id.to_i > 0\n send_request(\"campaigns/#{id}\")\n end",
"title": ""
},
{
"docid": "3d258883bed08c657f7885a8f3534c5b",
"score": "0.70544845",
"text": "def get\n return nil unless created?\n request :get_campaign_on_bidstalk do\n client = Bidstalk::Campaign::Client.new\n client.get_by_id platform_id!\n end\n end",
"title": ""
},
{
"docid": "11d092f26292fd262c1bcbc5a50288c5",
"score": "0.70316094",
"text": "def show\n @campaign = Campaign.find(params[:id])\n respond_to do |format|\n if @campaign.try(:active?) || current_admin?\n format.json { render json: @campaign }\n format.html\n else\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n format.html do\n flash[:notice] = Stripstarter::Response::CAMPAIGN_NOT_FOUND\n redirect_to campaigns_path\n end\n end\n end\n end",
"title": ""
},
{
"docid": "981e539fa7114cc657705346c271a515",
"score": "0.7028501",
"text": "def show\n @campaign_category = CampaignCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign_category }\n end\n end",
"title": ""
},
{
"docid": "e2fdb2402742e613ebddcbe256c001a6",
"score": "0.69471115",
"text": "def index\n @campaigns = Campaign.all\n \n render json: @campaigns.as_json(methods: [:goal_reached, :campaign_started])\n end",
"title": ""
},
{
"docid": "0199549018a875b30ae335f0bf0c67ff",
"score": "0.6942093",
"text": "def show\n @campaign_type = CampaignType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign_type }\n end\n end",
"title": ""
},
{
"docid": "9734827a32a982ebcdf018c67d296c16",
"score": "0.68892205",
"text": "def find_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"title": ""
},
{
"docid": "9734827a32a982ebcdf018c67d296c16",
"score": "0.68892205",
"text": "def find_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"title": ""
},
{
"docid": "bf19c641238a1e885e8620bb476923e3",
"score": "0.6884472",
"text": "def create\n campaign = Campaign.create(campaign_params)\n render json: campaign\n end",
"title": ""
},
{
"docid": "fb90afd0f0c9cc5fe5702e915997cd77",
"score": "0.6868889",
"text": "def show\n @campaign = Campaign.cached_find(params[:campaign_id])\n end",
"title": ""
},
{
"docid": "31b43c1d6472ae726411f83f6f5f80bc",
"score": "0.68627274",
"text": "def index\n @campaigns = current_user.campaigns\n end",
"title": ""
},
{
"docid": "fda35742b871546f5da9964a307216a1",
"score": "0.68589395",
"text": "def campaigns(client_id)\n handle_response(Client_GetCampaigns(\"ClientID\" => client_id)) do |response|\n response[\"Campaign\"].collect{|c| Campaign.new(c) }\n end\n end",
"title": ""
},
{
"docid": "552cca91343ed986afb0bbdd3bd9ceab",
"score": "0.68517196",
"text": "def get_campaigns(status = nil)\n url = @base_url + '/campaigns'\n url = status.present? ? url + \"?status=#{status}\" : url\n campaigns = Campaign.get_campaigns(url, self)\n return campaigns\n end",
"title": ""
},
{
"docid": "3edb7d6674330433838850b91669ca2c",
"score": "0.6816176",
"text": "def index\n @campaigns = Campaign.active\n end",
"title": ""
},
{
"docid": "c7e7850979f921c65242c3db3de78147",
"score": "0.68160313",
"text": "def campaigns\n @campaigns\n end",
"title": ""
},
{
"docid": "5f61c6cfe9d1addeb519f871f27b6d6c",
"score": "0.68113476",
"text": "def list_campaigns(options = {})\n response = connection.get do |req|\n req.url \"campaigns/list\", options\n end\n return_error_or_body(response, response.body.response.campaigns.items)\n end",
"title": ""
},
{
"docid": "e5d1acb08cc8bda6a4719341f99beb9b",
"score": "0.681078",
"text": "def new\n @campaign = current_user.campaigns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "b6ea429e8fe87adf3dc607400b214446",
"score": "0.6794764",
"text": "def new\n @campaign = Campaign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "b6ea429e8fe87adf3dc607400b214446",
"score": "0.6794764",
"text": "def new\n @campaign = Campaign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "b6ea429e8fe87adf3dc607400b214446",
"score": "0.6794764",
"text": "def new\n @campaign = Campaign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "b6ea429e8fe87adf3dc607400b214446",
"score": "0.6794764",
"text": "def new\n @campaign = Campaign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campaign }\n end\n end",
"title": ""
},
{
"docid": "51bc856673541b93c0966491eded1373",
"score": "0.6764124",
"text": "def GetCampaigns\n cm_client.campaigns(self.id)\n end",
"title": ""
},
{
"docid": "47a6b145cc3b4fa96e5f02170f07b44e",
"score": "0.6762451",
"text": "def find(campaign)\n Mailgun.submit :get, campaign_url(campaign)\n end",
"title": ""
},
{
"docid": "75c3d412f45ed640eb2b82250535a08a",
"score": "0.67618316",
"text": "def show\n @campaign_management = CampaignManagement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign_management }\n end\n end",
"title": ""
},
{
"docid": "aef31ac52f9cf522665bfee49fcc4c2f",
"score": "0.6759042",
"text": "def get_campaigns(journey_id, page)\n full_path = full_resource_path(\"/#{journey_id}/journey_campaigns\")\n query_params = MaropostApi.set_query_params({:pae => page})\n \n MaropostApi.get_result(full_path, query_params)\n end",
"title": ""
},
{
"docid": "1de8bc3e844f776e24d0ddfa9e330a98",
"score": "0.67581666",
"text": "def campaigns\n if request.xhr? && Page.find_by(page_id: params[:page_id])\n page = Page.find_by(page_id: params[:page_id])\n data = page.campaigns\n\n send_response(data)\n end\n end",
"title": ""
},
{
"docid": "8a0dc1f4cfb2c0b49a78bd4ec8d28782",
"score": "0.67571974",
"text": "def find_campaign_by_id(campaign_id)\n call(\"campaigns\", {:campaign_id => campaign_id}).first\n end",
"title": ""
},
{
"docid": "28701033b2d32f6720992035a6c51a6b",
"score": "0.6756934",
"text": "def get_user_campaigns(options={})\n response = get(\"get_user_campaigns/\", options)\n end",
"title": ""
},
{
"docid": "c7fc259135d38318742d09d2cbcdf62a",
"score": "0.6752874",
"text": "def show\n @campaign_person = CampaignPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign_person }\n end\n end",
"title": ""
},
{
"docid": "0908c0340e9e00fa595a807b4d3dcdd2",
"score": "0.6731169",
"text": "def show\n @campaign_member = CampaignMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @campaign_member }\n end\n end",
"title": ""
},
{
"docid": "e675962ad765a7e77f538a1462d4dfcb",
"score": "0.6721765",
"text": "def show\n @campaign_person = CampaignPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @campaign_person }\n end\n end",
"title": ""
},
{
"docid": "9906c18b97f5aaf5e2da4c17bebeeba6",
"score": "0.67195106",
"text": "def index\n @campaigns = Campaign.where(:advertiser_id => @advertiser.id)\n end",
"title": ""
},
{
"docid": "025c351c854b9b4916bc009063148306",
"score": "0.6709565",
"text": "def index\n @campaigns = current_user.campaigns.where(\"is_deleted is false\").order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaigns }\n end\n end",
"title": ""
},
{
"docid": "9bc58cd7f7105a7d80fd33a7e0d07b0f",
"score": "0.67087317",
"text": "def show\n @campaign = Campaign.where(id: params[:id]).as_json(\n :include => {\n :saved_jobs => {\n :include => {\n :job => {\n :include => {\n :writer => {\n only: [:id, :f_name, :l_name]\n },\n :outlet => {\n only: :name\n }\n }\n }\n }\n }\n }\n )\n render json: @campaign\n end",
"title": ""
},
{
"docid": "5001e8c1e9af7e427547b6a3ffcaba44",
"score": "0.66924965",
"text": "def set_campaign\n @campaign = @org.campaigns.find(params[:id])\n end",
"title": ""
},
{
"docid": "eebe402d38e5dd67e3c38abed2626f0f",
"score": "0.66879225",
"text": "def show\n @ad_campaign = AdCampaign.find(params[:id])\n #render json: @ad_campaign\n #format.html { redirect_to @ad_campaign }\n #format.json { render :show, status: :created, location: @ad_campaign }\n end",
"title": ""
},
{
"docid": "394b1c9882c0d120d2175237e1056d96",
"score": "0.6679725",
"text": "def campaigns\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/post/direct-mail/campaigns'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"title": ""
},
{
"docid": "85e1b190d0c44e0bd858e56b7dd48afd",
"score": "0.66756946",
"text": "def find(domain = Mailgun.domain, campaign_id)\n Mailgun.submit :get, campaign_url(domain, campaign_id)\n end",
"title": ""
},
{
"docid": "3604a674c7030419694204d0b8d784d2",
"score": "0.66751295",
"text": "def index\n @campaigns = Campaign.paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "3e7c7d55fba30e5a27650591d55182bd",
"score": "0.6675053",
"text": "def index\n @recipients = @campaign.recipients.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipients }\n end\n end",
"title": ""
},
{
"docid": "fc7bc6de26e667c5cbd8a133e9f6530e",
"score": "0.66483176",
"text": "def campaigns\n @_campaigns ||= UplandMobileCommonsRest::Campaigns.new(client: self)\n end",
"title": ""
},
{
"docid": "f5b5a9d934feffff55e4cee960079d87",
"score": "0.66352075",
"text": "def campaigns_list cID: nil, aID: nil \n call_adglare_api 'campaigns_list', {cID: cID, aID: aID}\n end",
"title": ""
},
{
"docid": "018075b60ddd73f447fd906a06ebccbd",
"score": "0.66268235",
"text": "def get_campaigns_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsApi.get_campaigns_0 ...\"\n end\n # resource path\n local_var_path = \"/campaigns\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\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 => 'InlineResponse2007')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsApi#get_campaigns_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "fd2041b30907e85f11e4646e9830607b",
"score": "0.66266644",
"text": "def campaign\n if (c = campaignId.to_i) > 0\n Campaign.find(c)\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "6a0202d8241b392c1e55ee9d9849025d",
"score": "0.66072637",
"text": "def index\n @campaign_members = CampaignMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaign_members }\n end\n end",
"title": ""
},
{
"docid": "e25e709323bbba5770612ec4848ca895",
"score": "0.6605216",
"text": "def get_campaigns_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsApi.get_campaigns ...\"\n end\n # resource path\n local_var_path = \"/campaigns\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\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 => 'InlineResponse2007')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsApi#get_campaigns\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "e1f9d24bf1fd15e1c0aa45605dcc97ab",
"score": "0.6602075",
"text": "def set_campaign\n @campaign = current_account.campaigns.find(params[:id])\n end",
"title": ""
},
{
"docid": "e1f9d24bf1fd15e1c0aa45605dcc97ab",
"score": "0.6602075",
"text": "def set_campaign\n @campaign = current_account.campaigns.find(params[:id])\n end",
"title": ""
},
{
"docid": "884fcddb8c3925d4816335d65159730e",
"score": "0.65953606",
"text": "def index\n @ad_campaigns = AdCampaign.all\n end",
"title": ""
},
{
"docid": "4360bd7ddffd8f63792cd53966c94891",
"score": "0.6586074",
"text": "def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "4360bd7ddffd8f63792cd53966c94891",
"score": "0.6586074",
"text": "def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "4360bd7ddffd8f63792cd53966c94891",
"score": "0.6586074",
"text": "def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "4360bd7ddffd8f63792cd53966c94891",
"score": "0.6586074",
"text": "def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "4360bd7ddffd8f63792cd53966c94891",
"score": "0.6586074",
"text": "def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "4360bd7ddffd8f63792cd53966c94891",
"score": "0.6586074",
"text": "def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"title": ""
},
{
"docid": "9706bbc55e8743261f333c4d23ccd0ec",
"score": "0.6580794",
"text": "def load_campaign\n @campaign= Campaign.find(params[:campaign_id])\n end",
"title": ""
},
{
"docid": "e9196e2c0c47c2879aa25e58ac63106b",
"score": "0.65774184",
"text": "def show\n @campaign = Campaign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @campaign }\n end\n end",
"title": ""
},
{
"docid": "187ed34624a617d5834884752f23864b",
"score": "0.65763044",
"text": "def show\n\t\t@campaign = Campaign.where(:account_id => @auth_user.account_id).find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @campaign }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "917c656efee99103c2cdac1f068dfd5f",
"score": "0.65758234",
"text": "def index\n @campaign_items = CampaignItem.all\n end",
"title": ""
},
{
"docid": "26671fbe587dc35830694df4e392fa1f",
"score": "0.6564052",
"text": "def create\n campaign_id = params[:campaign_id]\n campaign = Campaign.find_by_id(campaign_id)\n if (campaign!=nil)\n retDetails = {\"campaign_id\"=> campaign.id, \"campaign_name\"=> campaign.name, \"campaign_description\"=> campaign.description, \"campaign_goal\"=> campaign.goal_cents/100, \"campaign_progress\"=> campaign.amount_donated_cents/100}\n render json: retDetails\n else\n render json: campaign_does_not_exist_error, :status => 404\n end\n end",
"title": ""
}
] |
57eefd057e365a938c35730459540804
|
read user data from file
|
[
{
"docid": "f8dcfad2733728d554b8d2e30f98de57",
"score": "0.0",
"text": "def get_all_data\n Hash[*File.read(\"#{@path}scripts/data\").split(/[, \\n]+/)]\n end",
"title": ""
}
] |
[
{
"docid": "61c82d0e4b80e6ba3f0acb43795278d7",
"score": "0.76339334",
"text": "def fetch_data(user)\n array = read_from_file(\"userdata/#{user}.txt\")\n array[0]\nend",
"title": ""
},
{
"docid": "ef9803394501351d95b8d0e11d1d9d72",
"score": "0.6893017",
"text": "def read_data_file(path); end",
"title": ""
},
{
"docid": "0de149b7f1db406f46ff7971615fcceb",
"score": "0.6855768",
"text": "def readFile()\n\t#This is assuming the file name will be used\n\tfilename = 'names-data.txt'\n\topen(filename, 'r') {|f| f.read}\nend",
"title": ""
},
{
"docid": "f9b86eb9057708ac25f0a3973e1dfee6",
"score": "0.6746558",
"text": "def read\n\t\t@file_content = File.open(\"/home/calin/football/football.dat\",\"r\")\n\tend",
"title": ""
},
{
"docid": "db45147c81bc1a67470790a211499bdf",
"score": "0.6615601",
"text": "def load_users \n\tFile.readlines(file_input).each do |line|\n\t\tusernames = line.split(\",\")\n\t\t# the return value of this method needs to be an array, not the file\n\t\t# so there's an explicit return\n\t\treturn usernames\n\tend\nend",
"title": ""
},
{
"docid": "7adc8c47a62501f3cd9c20ddcb778282",
"score": "0.6592241",
"text": "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend",
"title": ""
},
{
"docid": "9a9e4d9f6fef6caacaa7cb9c95d6cfcc",
"score": "0.65611917",
"text": "def read_save_data(file)\r\n read_characters(file)\r\n read_frame(file)\r\n read_data(file)\r\n read_edit\r\n read_refresh\r\n end",
"title": ""
},
{
"docid": "149d0fedd07a38c8ece5577548d787c5",
"score": "0.6512803",
"text": "def user_data(filename)\n user_data = CSV.read Dir.pwd + filename\n descriptor = user_data.shift\n descriptor = descriptor.map { |key| key.to_sym }\n user_data.map { |user| Hash[ descriptor.zip(user) ] }\n end",
"title": ""
},
{
"docid": "e71fd1184c9dd2c50388769813cb9dac",
"score": "0.6499873",
"text": "def read file\n File.open file\n end",
"title": ""
},
{
"docid": "4a810510c7d65c3015688c5a248b4ac9",
"score": "0.6472102",
"text": "def read_credentials\n File.readlines(USERPASS_FILE).each do |line|\n user, pass = line.split\n pass = \"\" if pass == '(none)'\n @crends << [\"#{user}\", pass]\n end\n end",
"title": ""
},
{
"docid": "5eb4cf81bfff28d79a1e71bef554afe5",
"score": "0.646274",
"text": "def parse_user_file\n @data = []\n @data = CSV.read(@configuration[:user_file])\n if @configuration[:blacklist]\n datasize = @data.count\n @blacklist = []\n @blacklist = CSV.read(@configuration[:blacklist])\n @data = @data - @blacklist\n puts \"Blacklist applied. Removed #{datasize - @data.count} out of #{@blacklist.count} entries.\"\n end\n puts \"I successfully parsed #{@data.count} lines of data. Here's the first one: \\n#{@data[0]}\\n\\n\"\n @data\n end",
"title": ""
},
{
"docid": "304bc276cc6c960a8b0a728e78b0412d",
"score": "0.6442165",
"text": "def retrieve_data\n File.file?(\"#{@username}\") ? customer = read_from_file : customer = User.new(username)\n customer\n end",
"title": ""
},
{
"docid": "304bc276cc6c960a8b0a728e78b0412d",
"score": "0.6442165",
"text": "def retrieve_data\n File.file?(\"#{@username}\") ? customer = read_from_file : customer = User.new(username)\n customer\n end",
"title": ""
},
{
"docid": "ed0ecf0e6bcb283a8bcad48548156a8d",
"score": "0.64403385",
"text": "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets)\n file.close()\n return object\nend",
"title": ""
},
{
"docid": "66d4575d423d8e8e84628261bc7b1ed7",
"score": "0.6397914",
"text": "def load_data (file, data, k=nil)\n\t\ti=0\n\t\tfile.each_line do |line|\n\t\t\tif i ==k \n\t\t\t\tbreak\n\t\t\tend\n\t\t\twords = line.split(\"\\t\")\n\t\t\tif data.has_key?(words[0].to_i)\n\t\t\t\tdata[words[0].to_i].store_data(words[1].to_i,words[2].to_i)\n\t\t\telse\n\t\t\t\tx = User_data.new\n\t\t\t\tx.store_data(words[1].to_i,words[2].to_i)\n\t\t\t\tdata.store(words[0].to_i, x)\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4b016e6c6f8376baf7f7d3ab4f497099",
"score": "0.6370218",
"text": "def data\n File.read(path)\n end",
"title": ""
},
{
"docid": "4b8d7bfb45122dd4758b1711acf6af1e",
"score": "0.635661",
"text": "def read\n file.read\n end",
"title": ""
},
{
"docid": "fb640b62a032f24c9eb2ea91d220191b",
"score": "0.6353436",
"text": "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend",
"title": ""
},
{
"docid": "2778c9d98a5d1c811649eefbecf60626",
"score": "0.62932956",
"text": "def read_login_data\n login_data_file = 'login.data'\n Hash[*File.read(login_data_file).split(/[ \\n]+/)]\n end",
"title": ""
},
{
"docid": "caf1358063c30e52f6d38362cbe46f20",
"score": "0.6211618",
"text": "def read\n file\n end",
"title": ""
},
{
"docid": "e8af13871af8cc6bc61342bcf9a86879",
"score": "0.61956835",
"text": "def read_text(filename); end",
"title": ""
},
{
"docid": "7863232e26ad3816b26bbcfd62a15538",
"score": "0.6192745",
"text": "def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend",
"title": ""
},
{
"docid": "69c0504b6e2217c521c7602d53eb26a9",
"score": "0.61890835",
"text": "def load_saved_file\n\n begin\n parse_json_file('./data/user_data.json')\n\n puts \"Great to have you back #{@parsed_data[:userdata][:username]}!\"\n attribute_data_from_parsed_file()\n\n @prompt.keypress(Rainbow('Please press space or enter to continue!').orange.to_s, keys: %i[space return])\n\n rescue\n puts \"It appears that no previous file exists. Sorry... it just doesn't....\"\n\n @prompt.keypress(Rainbow('Please press space or enter to return!').orange.to_s,keys: %i[space return])\n\n upload_data_from_file()\n\n end\n\n end",
"title": ""
},
{
"docid": "d08a60b48f4f9afb879ab63f55665a50",
"score": "0.61577773",
"text": "def read_file(filename); end",
"title": ""
},
{
"docid": "d22c39d4437c6bfcf39d76aa87185072",
"score": "0.6134144",
"text": "def read_file(file)\n\tbegin\n\t\tinput_file = File.open(file)\n\trescue\n\t\traise \"Can't find file with that name\"\n\tend\n\n\tfile_type = File.extname(input_file)\n\n\tif file_type == \".bmp\"\n\t\tdata_array\t= input_file.read.unpack(\"C*\")\n\t\ttotal_size\t= input_file.size\n\t\tdata_offset\t= get_data_offset(data_array.slice(10..13))#Not pretty, but these 4 bytes are the data offset.\n\t\tdata_size\t= input_file.size - data_offset\n\telse\n\t\traise \"Couldn't recognize file type. Must be a .bmp file.\"\n\tend\n\n\tinput_file.close#Or sherri will kill me telepathically\n\n\tworking_file = User_File.new(\ttotal_size,\n\t\t\t\t\t\t\t\t\tdata_size,\n\t\t\t\t\t\t\t\t\tfile_type,\n\t\t\t\t\t\t\t\t\tdata_offset,\n\t\t\t\t\t\t\t\t\tdata_array)\nend",
"title": ""
},
{
"docid": "6667a4f8ad49e913ba3024ffa96bbf42",
"score": "0.6130659",
"text": "def customize_file(user_id, filename)\n\t handle = File.open(filename, 'r')\n\t content = handle.read\n\t \n\tend",
"title": ""
},
{
"docid": "4ca62147ad5166e3983315945fd72b6e",
"score": "0.6129775",
"text": "def read(path); end",
"title": ""
},
{
"docid": "8581dccf55620fe885d0bf4fdafcb744",
"score": "0.61287606",
"text": "def read\n return nil if FileTest.exist?(@fname)==false\n\n open(@fname,\"rb\") do |file| #Read & Binary mode\n @data = Marshal.load(file)\n end\n @data\n end",
"title": ""
},
{
"docid": "f328b9670df4d532b1366f6aff10b925",
"score": "0.6120471",
"text": "def data name\n File.read data_path(name)\nend",
"title": ""
},
{
"docid": "d7cc54e7bd23e7780e3d5757a2e7c125",
"score": "0.6119882",
"text": "def read_user_creds\n return [] unless File.exist?(\"names.txt\")\n #clean_file = File.read(\"names.txt\").split(\"\\n\")\n clean_file.uniq\n end",
"title": ""
},
{
"docid": "c24068902174d765f7a1f155c93fee07",
"score": "0.60976833",
"text": "def read_input_file\n\t\tbegin \n\t\t\tfile = File.read('data.json')\n\t\t\tjson_info = JSON.parse(file)\n\t\t\t\n\t\t\t#getting cars and rentals information\n\t\t\t@cars = json_info[\"cars\"]\n\t\t\t@rentals = json_info[\"rentals\"]\n\t\trescue Exception => e \n\t\t\tputs \"Error trying to read the input file!\" \n\t\t\tputs e.message\n\t\tend\n\tend",
"title": ""
},
{
"docid": "996d0e30166894825628eaeabe512f64",
"score": "0.6086087",
"text": "def load_user(filepath)\n $user = load_yaml(filepath)\nend",
"title": ""
},
{
"docid": "195ebf32bb35285f18e63e4e28a588e8",
"score": "0.608553",
"text": "def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end",
"title": ""
},
{
"docid": "09dcbbbab96519d65c0ab0f77514d222",
"score": "0.6067669",
"text": "def read_from_file\n begin\n File.open(@file) do |file|\n file.each_line {|line| @data_for_output << line}\n end\n rescue Errno::ENOENT => e\n puts e\n exit\n end\n end",
"title": ""
},
{
"docid": "b8002e515f142ec667c93386dcc44907",
"score": "0.6065924",
"text": "def read_file(filename)\n file = File.open(filename, 'r')\n data = file.read\n file.close\n data\nend",
"title": ""
},
{
"docid": "44c655f0b895ab43d01ead2948f75a69",
"score": "0.6058351",
"text": "def open_data(file)\n @data = JSON.parse(IO.readlines(file).join)\n end",
"title": ""
},
{
"docid": "3e3808b5ae172d2acd5cdf9ca66a57dc",
"score": "0.60549766",
"text": "def read_file(file, context); end",
"title": ""
},
{
"docid": "d3356a1d23cbd3c7a6ba03f0c926f2d9",
"score": "0.6048337",
"text": "def my_file_reader(fname)\n fstream = File.open(fname, 'r')\n data = fstream.read\n fstream.close\n \n return data\nend",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.6048304",
"text": "def read; end",
"title": ""
},
{
"docid": "d49429398dd2d1259ef84544cd971330",
"score": "0.60439265",
"text": "def read\n $t1 = Time.now # Init procedure timestamp\n person = []\n IO.foreach(\"data_500.txt\") do |line| # Get all patients from file iterate each line\n line.chomp! # Remove trailing whitespace.\n person.push(line.split(\":\")) # Saving data split :\n end\n group(person) # Get blood type\n end",
"title": ""
},
{
"docid": "d19ca551794bdb0a7d8aac2f4be28b2d",
"score": "0.60370934",
"text": "def read_file(file_name)\n file = File.open(file_name, \"r\")\n data = file.read\n file.close\n return data\nend",
"title": ""
},
{
"docid": "eb90a550148776e55bda9bc091bc2e0c",
"score": "0.6036965",
"text": "def load_data\n\t\tFile.open(\"u.data\", \"r\").each_line do |line|\n\t\t\ta = line.split\n\t\t\t@movies[a[1].to_i] = @movies[a[1].to_i] + a[2].to_i\n\n\t\t\t@users[a[0].to_i] = @users[a[0].to_i].push(a[1].to_i)\n\t\t\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9711d6fa3ed463e4ad1dc4ee42b81cdb",
"score": "0.6020589",
"text": "def load_data(file_name)\n\t\tindata = []\n\t\t#csv reader as shown in class; typecasted because I ran into some weird bugs\n\t\tCSV.foreach(\"#{file_name}\", col_sep: \"\\t\") do |row| \n\t\t\tindata.push({\"user_id\"=>row[0].to_i, \"movie_id\"=>row[1].to_i, \"rating\" => row[2].to_i, \"timestamp\" => row[3].to_i})\n\t\tend\n\t\treturn indata\n\tend",
"title": ""
},
{
"docid": "e235fdad1ac8e0e51426b0bec0873625",
"score": "0.60189635",
"text": "def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend",
"title": ""
},
{
"docid": "6d57e99872bb74fe8805c9d51d85bb97",
"score": "0.59790367",
"text": "def read() end",
"title": ""
},
{
"docid": "a95bf379e4825539b2771dd5d68de69e",
"score": "0.59724545",
"text": "def read\n @read ||= File.read(path)\n end",
"title": ""
},
{
"docid": "7782fb6c689ae80837765bf160ad84ee",
"score": "0.59462166",
"text": "def read_data\n unpacker.read\n end",
"title": ""
},
{
"docid": "31b8947fa216f7a09b69e61b466795b8",
"score": "0.5938141",
"text": "def read\n \n end",
"title": ""
},
{
"docid": "78e1ce1c43b836045dda4aac21ccdac5",
"score": "0.5925249",
"text": "def read_user(int_index)\n ensure_open\n raise ArgumentError if !(int_index >= 0 && int_index < USER_HEADER_INTS)\n @header_data.read_int(HDR_USERSTART_ + int_index)\n end",
"title": ""
},
{
"docid": "29accd6986317b580056df319bf507ff",
"score": "0.5913151",
"text": "def load_file_data(file)\n @data = separate_into_blocks(IO.readlines(file))\n end",
"title": ""
},
{
"docid": "636d2dc24299b5ed63f9a943a3d319ee",
"score": "0.59123164",
"text": "def read_in\n File.foreach(file_name).map(&:chomp)\n end",
"title": ""
},
{
"docid": "3e8d1cbe9ccf1513d5ce37d4c74369e2",
"score": "0.5901624",
"text": "def password_from_file()\n file = File.open(\"password.txt\", \"rb\")\n contents = file.read\n contents = contents.split(\":\")\n end",
"title": ""
},
{
"docid": "1ec9becca64afcbea3a4c0efd9a80c5f",
"score": "0.58991176",
"text": "def read_kuni (file,kuni)\n if can_see_this kuni\n erubis file \n end\n end",
"title": ""
},
{
"docid": "c03e80ac20ce8f41c69913e6fd55bbc5",
"score": "0.5892979",
"text": "def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend",
"title": ""
},
{
"docid": "173ec0de90d87ab1f6253783df35f73f",
"score": "0.5880498",
"text": "def load_file(f)\n\t\tdata = []\n f.each do |line| \n user_id, movie_id, rating, timestamp = line.split(\"\\t\")\n data.push({\"user_id\"=> user_id.to_i, \"movie_id\"=>movie_id.to_i,\"rating\"=> rating.to_i,\"timestamp\"=>timestamp.to_i})\n\t\tend\n\t\treturn data\n\tend",
"title": ""
},
{
"docid": "dad0e58b11486853a350196a7c8c249a",
"score": "0.5878783",
"text": "def get_data(file)\n f = File.open(file, 'rb')\n buffer = f.read\n f.close\n\n buffer\n end",
"title": ""
},
{
"docid": "8ca06fbadfd7f16a3e528106c5f785a7",
"score": "0.5877946",
"text": "def load_user_file(file, placeholder: true)\n path = \"#{Settings.source_dir}/#{file}\"\n default_content = placeholder ? \"echo \\\"error: cannot load file\\\"\" : ''\n\n content = if File.exist? path\n File.read path\n else \n default_content\n end\n\n \"# :#{path}\\n#{content}\"\n end",
"title": ""
},
{
"docid": "eaecd1db167a4b226d93db8118d274ab",
"score": "0.5875975",
"text": "def load_users\n @users = Array.new\n str = @fh.read_obj_no_par\n if str!=nil && str.size>0 then\n u_arr = YAML::load(str)\n set_users(u_arr)\n i = @users.size\n print \"Successfully loaded #{i} \"\n if i>1 \n puts \"users!\"\n return 1\n end\n if i==1\n puts \"user!\" \n end\n return 1\n end\n puts \"No users were found!\"\n return -1\n end",
"title": ""
},
{
"docid": "58767c24aafda98296c25c0b07e8bea0",
"score": "0.58736736",
"text": "def read(_ = nil)\n as_hash(read_lines)[base_name]\n end",
"title": ""
},
{
"docid": "0d76497da67e5a2f7c791dd79fd1a736",
"score": "0.5873141",
"text": "def read filename\n # Open file, Read in and process data.\n file = File.open(filename)\n file.each do |line|\n # Comma seperated data.\n # E.g. 1,2,1 => x=1, y=2, output=1\n line = line.chomp\n if line.size > 0\n # If the line is not empty, then it has data\n line = line.split \",\"\n @x << line[0].to_i\n @y << line[1].to_i\n @output << line[2].to_i\n end\n end\n end",
"title": ""
},
{
"docid": "058036807361f8d188bbcbe701839924",
"score": "0.5869736",
"text": "def read_file(file)\n File.read(file)\n end",
"title": ""
},
{
"docid": "058036807361f8d188bbcbe701839924",
"score": "0.5869736",
"text": "def read_file(file)\n File.read(file)\n end",
"title": ""
},
{
"docid": "9845e49a0efa150e66fcdb431633ccd3",
"score": "0.58615565",
"text": "def initialize(user_or_file = nil, password = nil)\n return if user_or_file.nil?\n if password.nil?\n if !File.exists?(user_or_file)\n puts \"File #{user_or_file} does not exist. Exiting...\"\n exit 1\n end\n @data = File.read(user_or_file)\n else\n url = DATA_URL.sub('{USERNAME}', user_or_file).sub('{PASSWORD}', password)\n @data = fetch(url)\n end\n parse(@data)\n end",
"title": ""
},
{
"docid": "03c07372e1bca2b3fd2df06454571633",
"score": "0.5850416",
"text": "def read\n object = uy_connection.get(@path)\n object.data\n end",
"title": ""
},
{
"docid": "458ceea22b513a59f886eb728e4c4dc5",
"score": "0.5839968",
"text": "def load_info\n info = File.readlines @dir+\"info\"\n @last_quantity = info[0].chop\n @last_category = info[1].chop.to_i\n @exercises = info[2].chop.split(\",\")\n @last_repq = info[3].chop\n @rep_ex = info[4].chop\n end",
"title": ""
},
{
"docid": "0ed41a09844a2e1e3886e2163bcfcaba",
"score": "0.5834684",
"text": "def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end",
"title": ""
},
{
"docid": "ae1ae5856346849de314da1ad83cbbde",
"score": "0.5825415",
"text": "def readData(filename)\n\t\t@dataArray = Array.new\n\t\tfile = File.open(filename)\n\t\t\n\t\tfile.each_line do |line|\n\t\t\tarray = line.split(/,/)\n\t\t\tentry = Struct::ContactEntry.new(array[0], array[1], array[2])\n\t\t\t@dataArray.push(entry)\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend",
"title": ""
},
{
"docid": "1ca1355d50fe52d2832fd8d427d24685",
"score": "0.5820346",
"text": "def read\nend",
"title": ""
},
{
"docid": "fc23b39166f6432c488ebc25c4a9de52",
"score": "0.5804836",
"text": "def read_users_from_file(filename)\n CSV.read(filename, :headers => true, :header_converters => :symbol).map { |row| row.to_hash }\nend",
"title": ""
},
{
"docid": "0d52f50f19aac795f0ff81403086bfb5",
"score": "0.58038706",
"text": "def load_data\n @data ||= CSV.read(@file)\n end",
"title": ""
},
{
"docid": "b56b75ab895e6dee3d2b405b3e88e1c1",
"score": "0.5797383",
"text": "def readFile(filename)\n info = \"\"\n file = File.open(filename)\n file.each do |line|\n info = info + line\n end\n file.close\n $myinfo = info\n end",
"title": ""
},
{
"docid": "2ef0f6cff8122b73598c7ddfe5026d84",
"score": "0.5789863",
"text": "def read_file(uptime_file)\n raise('File doest not exist') unless File.exist? uptime_file\n\n File.read(uptime_file)\nend",
"title": ""
},
{
"docid": "5b40f79d351fd66bb3838163a809f1e4",
"score": "0.5779844",
"text": "def get_loginfo\n File.open(LOGINFO, \"r\") do |loginfo_file|\n @username = loginfo_file.gets.chomp\n @password = loginfo_file.gets.chomp\n end\n end",
"title": ""
},
{
"docid": "996d5045d2cccb4397fe54d5a392db51",
"score": "0.5779401",
"text": "def data; file_log.read(file_node); end",
"title": ""
},
{
"docid": "c70435fc213afde4641300895c20cd1c",
"score": "0.5766888",
"text": "def parseusers(f, userentryptr)\n f.seek(userentryptr + 0x14)\n dstart = makefptr(f.read(4))\n f.seek(userentryptr + 0x1C)\n numentries = makelong(f.read(4))\n f.seek(userentryptr + 0x60)\n headerlen = makeword(f.read(2))\n f.seek(userentryptr + 40) # sorry decimal\n entrylen = makeword(f.read(2)) # sorry this is decimal\n logins = Rex::Text::Table.new(\n 'Header' => \"D20 usernames, passwords, and account levels\\n(use for TELNET authentication)\",\n 'Indent' => 1,\n 'Columns' => [\"Type\", \"User Name\", \"Password\"])\n\n 0.upto(numentries -1).each do |i|\n f.seek(dstart + headerlen + i * entrylen)\n accounttype = makeword(f.read(2))\n f.seek(dstart + headerlen + i * entrylen + 2)\n accountname = makestr(f, dstart + headerlen + i * entrylen + 2)\n f.seek(dstart + headerlen + i * entrylen + 2 + 22)\n accountpass = makestr(f, dstart + headerlen + i * entrylen + 2 + 22)\n if accountname.size + accountpass.size > 44\n print_error(\"Bad account parsing at #{dstart + headerlen + i * entrylen}\")\n break\n end\n logins << [accounttype, accountname, accountpass]\n report_cred(\n ip: datastore['RHOST'],\n port: 23,\n service_name: 'telnet',\n user: accountname,\n password: accountpass,\n proof: accounttype\n )\n end\n if not logins.rows.empty?\n loot = store_loot(\n \"d20.user.creds\",\n \"text/csv\",\n datastore['RHOST'],\n logins.to_s,\n \"d20_user_creds.txt\",\n \"General Electric TELNET User Credentials\",\n datastore['RPORT']\n )\n print_line logins.to_s\n print_status(\"Loot stored in: #{loot}\")\n else\n print_error(\"No data collected\")\n end\n end",
"title": ""
},
{
"docid": "97bbe8b3ff826d846b3699f399046426",
"score": "0.5765032",
"text": "def read\n IO.read(full_path)\n end",
"title": ""
},
{
"docid": "48a580a455f1b7df9df2c32dab29d8d3",
"score": "0.5762758",
"text": "def read_file(path)\n File.read(path)\n end",
"title": ""
},
{
"docid": "24feea68ded81446e268b6cf5f598a57",
"score": "0.5747741",
"text": "def read!(file)\n File.open(file, \"r\") do |f|\n while (s = f.gets.chomp) != ''\n header, value = s.split(\": \")\n case header\n when 'Version'\n major, minor = value.split('.')\n # NOTE: This is where I'd do conversions to the latest format, I think\n major != MAJOR_VERSION and\n raise \"File #{file} uses a different format (#{value}) than this program (#{VERSION}). Please upgrade your groupdir\"\n when 'Label'\n @label = value\n when 'Host'\n @host = value\n when 'Dir'\n @dir = value\n when 'Prune'\n @prune_leading_dir = (value == 'true')\n end\n end\n super(f)\n end\n return self\n end",
"title": ""
},
{
"docid": "561f47047bd7e54618d161585ffdf5e6",
"score": "0.57456344",
"text": "def read_file\n\t\tif @filename == \"\"\n\t\t\t@text = [\"\"]\n\t\t\treturn\n\t\telse\n\t\t\tif File.exists? @filename\n\t\t\t\ttext = IO.read(@filename)\n\t\t\telse\n\t\t\t\t@text = [\"\"]\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t# get rid of crlf\n\t\ttemp = text.gsub!(/\\r\\n/,\"\\n\")\n\t\tif temp == nil\n\t\t\t@eol = \"\\n\"\n\t\telse\n\t\t\t@eol = \"\\r\\n\"\n\t\tend\n\t\ttext.gsub!(/\\r/,\"\\n\")\n\t\t@text = text.split(\"\\n\",-1)\n\tend",
"title": ""
},
{
"docid": "4888d5bbdbac049e8dc9fc8eda52a824",
"score": "0.5737799",
"text": "def read_binary(file); end",
"title": ""
},
{
"docid": "a456146e81567ef1c1b2a32a03b436d9",
"score": "0.5728722",
"text": "def fetch_conf_data()\n $file_data = {}\n File.open(\"#{$project_home}/Conf/conf_file.txt\", 'r') do |file|\n file.each_line do |line|\n line_data = line.split(',')\n $file_data[line_data[0]] = line_data[1]\n end\n end\nend",
"title": ""
},
{
"docid": "e437544c354b6b0362eb9a4755239f47",
"score": "0.572852",
"text": "def auth_info_from_file\n os = Config::CONFIG[\"host_os\"]\n if os =~ /darwin/\n info = YAML.load_file(\"/Users/#{ENV[\"USER\"]}/.dhl_info.yml\")\n else \n info = YAML.load_file(\"/home/#{ENV[\"USER\"]}/.dhl_info.yml\")\n end\n info\n end",
"title": ""
},
{
"docid": "ff04a6dcfff86b1567f9bc0311d1986b",
"score": "0.57251096",
"text": "def read(file)\n if @options[:input_file]\n file = File.join(File.dirname(@options[:input_file]), file)\n end\n File.read(file)\n end",
"title": ""
},
{
"docid": "15ac92dcb7b9bd6f9cacccbc171da80c",
"score": "0.5714553",
"text": "def load_data()\n puts \"Which file would you like to pull data from?\"\n\n IO.foreach($stdin.gets.chomp) do |l|\n ui, mi, r, ts = l.split\n user_id, movie_id, rating, timestamp = ui.to_i, mi.to_i, r.to_i, ts.to_i\n\n # mov_and_rat = movies_and_ratings\n # use_and_rat = users_and_ratings\n @data[:users].add(user_id)\n unless(@data[:user_id][user_id])\n @data[:user_id][user_id] = {\n mov_and_rat: { movie_id => rating },\n titles: [movie_id]\n }\n else\n @data[:user_id][user_id][:mov_and_rat][movie_id] = rating\n @data[:user_id][user_id][:titles].push(movie_id)\n end\n\n @data[:movies].add(movie_id)\n unless(@data[:movie_id][movie_id])\n @data[:movie_id][movie_id] = {\n use_and_rat: { user_id => rating },\n ratings: [rating]\n }\n else\n @data[:movie_id][movie_id][:use_and_rat][user_id] = rating\n @data[:movie_id][movie_id][:ratings].push(rating)\n end\n end\n end",
"title": ""
},
{
"docid": "80869888280b1467ba2460ec8916acdf",
"score": "0.57119536",
"text": "def read(*args, **kwd); end",
"title": ""
},
{
"docid": "7cb5eadab4181d3942b90bccc1f3a24a",
"score": "0.5706167",
"text": "def read_data(filename)\n count = 0\n fd = File.open(filename)\n while not fd.eof?\n line = fd.readline\n line.chomp!\n count += 1\n fields = []\n line.split('^').each do |f|\n datum = f.gsub('~~','').gsub(/^~/,'').gsub(/~$/,'')\n fields.push(datum.empty? ? nil : datum)\n end\n yield fields\n end\nrescue => e\n STDERR.puts \"error '#{e}' file '#{filename}' line #{count}\"\n exit\nensure\n fd.close\nend",
"title": ""
},
{
"docid": "fad9cc15af5afc64cc0897c94a36423a",
"score": "0.57024163",
"text": "def read(file)\n begin\n if file.class == String\n f = File::open(file)\n else\n f = file\n end\n f.each_line do |line|\n input(line.strip)\n end\n ensure\n f.close\n end\n end",
"title": ""
},
{
"docid": "6aa281f928d0f13176adcd0cf9e8b637",
"score": "0.569749",
"text": "def load_data(file)\n return [] unless File.exist?(file)\n @crypto.decrypt(File.open(file, 'rb').read, password: @passphrase).to_s.each_line.to_a\n rescue GPGME::Error::NoData\n []\n end",
"title": ""
},
{
"docid": "d5dcf89a6c53312b9c208fcc9bb45b3a",
"score": "0.5697197",
"text": "def load()\n\tFile.open(\"instructors.csv\", \"r\") { |f|\n\t\tdata = f.read()\n\t\treturn data\n\t}\nend",
"title": ""
},
{
"docid": "6c2589d3e9783c1cc122b1ed59f88143",
"score": "0.5696498",
"text": "def read_file(file_name=\"\")\n\tFile.open(file_name) do |file|\n\t\twhile line = file.gets\n\t\t\ta = %w{#{line}}\n\t\t\tputs a\n\t\t\tputs line\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "cfc5e14132f783a050d7fe1026d192c1",
"score": "0.56941456",
"text": "def read_file(path)\n struct=Struct.new(:u_id, :m_id,:rating,:time)\n puts path\n return [] if !File.exists? path\n File.open(path, \"r\") do |f|\n #splits each line by ws and convert to integer and build structures from values\n return f.each_line.map { |line| struct.new(*line.split.map {|x| x.to_i}) }\n end\n end",
"title": ""
},
{
"docid": "9da9af5d0e0904bba306ba77cfcba29d",
"score": "0.56877947",
"text": "def read(path)\n @path = path\n unless File.exist?(info_file)\n debug(\"file #{info_file} missing\")\n write(path, {})\n return\n end\n # data = @info_cacher[info_file]\n info_hash[base_name]\n end",
"title": ""
},
{
"docid": "2ad33a62f21bcebd9abdb23543803f1a",
"score": "0.5687392",
"text": "def read_file(file)\n File.read(file)\nend",
"title": ""
},
{
"docid": "cf8e85fdc34cc6bcd9b8b02dd845050c",
"score": "0.5669006",
"text": "def read\n data = File.open(@filename, mode(\"r\")) do |f|\n f.flock File::LOCK_SH\n f.read\n end\n import(data)\n end",
"title": ""
},
{
"docid": "1156c909d5cf56997fbf75fbfe9cbc7e",
"score": "0.5659452",
"text": "def read_data(file)\n if ENV['RACK_ENV'] == 'test'\n local = File.expand_path(\"../test/data/#{file}\", __FILE__)\n else\n local = File.expand_path(\"../data/#{file}\", __FILE__)\n\n if USE_GOOGLE_DRIVE\n remote = google_session.file_by_title(file.to_s)\n remote.download_to_file(local)\n end\n end\n\n YAML.load_file(local)\nend",
"title": ""
}
] |
afc1884dc2c726ef79f4e6eb2f158993
|
given a set of words, we find all documents that have all these words
|
[
{
"docid": "cc2c31e24bd3cd94aabfa474f97624b1",
"score": "0.8393497",
"text": "def find_documents_with_all_words(words)\n # Just get the names of all possible documents\n documents = @documents.keys\n # Now for each word passed in\n words.each do |word|\n # We do a repeated setwise intersection\n documents = documents & @word_list[word].keys unless @word_list[word].nil? || @word_list[word].empty?\n end\n # Now we have all the documents that all the words are in.\n # And we transform that into a Hashtable where the keys are the\n # names of those documents and the values are initialized to zero.\n documents.inject(Hash.new) { |a, b| a.merge({b, 0}) }\n end",
"title": ""
}
] |
[
{
"docid": "2f442583f4a9d305e3ef076885468f29",
"score": "0.83883786",
"text": "def find_documents_with_all_words(words)\n # Just get the names of all possible documents\n documents = @documents.keys\n # Now for each word passed in\n words.each do |word|\n # We do a repeated setwise intersection\n documents = documents & @word_list[word].keys unless @word_list[word].nil? || @word_list[word].empty?\n end\n # Now we have all the documents that all the words are in.\n # And we transform that into a Hashtable where the keys are the\n # names of those documents and the values are initialized to zero.\n documents.inject(Hash.new) {|a,b| a.merge({b,0})}\n end",
"title": ""
},
{
"docid": "451c5d33bed4a6f26fdc1ac554111bc9",
"score": "0.77361816",
"text": "def search_of_many_words(words, doc_tokens)\n words.collect { |word| grep_doc(doc_tokens, word).first }.compact\n end",
"title": ""
},
{
"docid": "2c61068f59c92d84d03ddef9bf11bd7f",
"score": "0.71207935",
"text": "def known(words)\n known_words = Set.new\n words.each do |w|\n known_words << w if @wordlist.include?(w)\n end\n known_words\n end",
"title": ""
},
{
"docid": "0424eb39359ae18ae295e0aae3ec3f00",
"score": "0.70368093",
"text": "def query_multiple_words(words)\n words.map { |word| word.stem! } # stem all the words\n words.reject! { |word| word_does_not_belong(word) } # remove the ones that don't count\n words.reject! { |word| @word_list[word].nil? } # remove search terms not in word list\n # Get all the documents that all the words are in (intersection)\n documents = find_documents_with_all_words(words) unless words.nil? || words.empty?\n unless documents.nil? || documents.empty?\n # For each word\n words.each do |word|\n # We look at each document that word appears in\n @word_list[word].each_key do |document|\n # And if its in the intersected document list\n if !documents[document].nil?\n # We add the tfidf to the current value\n documents[document] += tfidf(word, document)\n end\n end\n end\n # Now we order the documents in descending order by tf.idf score\n documents.sort {|a,b| b[1]<=>a[1]}.each do |document, tfidf|\n # and print both the document name and the tfidf score\n puts \"#{document} %.3f\" % tfidf\n end\n else\n puts \"Query returned no results.\" \n end\n end",
"title": ""
},
{
"docid": "9cb159757b7f4e35ddb7b2b694a1a955",
"score": "0.6835276",
"text": "def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"title": ""
},
{
"docid": "a691f7b657ac06fb5d6023e4d10b8288",
"score": "0.6808331",
"text": "def known(words)\n return words.find_all {true} #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"title": ""
},
{
"docid": "85b3ef940b0647e359205ca849bfda54",
"score": "0.66712475",
"text": "def known(words)\n return words.find_all {|word| @dictionary.has_key? word} #find all words for which condition is true\n end",
"title": ""
},
{
"docid": "f1a6c4014f2393c1230302f0d96583b5",
"score": "0.64916307",
"text": "def find_words(target_words, readed_words)\n # The strategy is: look for the first word, then check if the following\n # words match the list of target words.\n needle = target_words.first\n readed_words.each_with_index.map do |word, index|\n next unless equal_words?(word.word, needle)\n\n # We did find the first word, lets see if following words\n # match the target.\n word_chain(target_words, readed_words, index)\n end.compact\n end",
"title": ""
},
{
"docid": "7cfe3f1e8aaff3f081ec1a7659907977",
"score": "0.6445688",
"text": "def known(words)\n\n return words.find_all { |w| @dictionary.has_key?(w) }\n\n\n #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"title": ""
},
{
"docid": "8b4b059a47081fe10d7bb9f6153b6ced",
"score": "0.6431377",
"text": "def known(words)\n return words.find_all {|word| dictionary.key?(word) } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"title": ""
},
{
"docid": "4d3934c01378edd296d6982e5e573ea1",
"score": "0.64255977",
"text": "def known(words)\n return words.find_all {|word| @dictionary.key?(word) } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"title": ""
},
{
"docid": "d1245504f9c8abe6ea1318e64f0ef63a",
"score": "0.63604116",
"text": "def known(words)\n return words.find_all {|word| lookup(word) > 0 } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"title": ""
},
{
"docid": "d3696af072e9479949b3613dc9ecbb48",
"score": "0.63561255",
"text": "def known(words)\n result = words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n result.empty? ? nil : result\n end",
"title": ""
},
{
"docid": "0ebaccffacbf1e864268bf8bb5e3ec02",
"score": "0.6352021",
"text": "def batch_find(terms_to_lookup)\n search_query = terms_to_lookup.map { |vocab, uris|\n uri_query = uris.compact.uniq.map { |u| \"\\\"#{u}\\\"\" }.join(' OR ')\n \"(vocabulary:\\\"#{vocab}\\\" AND uri:(#{uri_query}))\"\n }.join(' OR ')\n\n start = 0\n count = 100\n docs = []\n loop do\n response = search do |params|\n params.q(search_query, false)\n params.start(start)\n params.rows(count)\n start += count\n end\n break if response['response']['docs'].empty?\n docs.concat(response['response']['docs'])\n end\n\n docs\n end",
"title": ""
},
{
"docid": "e088a873c6334461afb39c71f1aaa49d",
"score": "0.6337361",
"text": "def filter_against_dictionary(array_of_words)\n return unless array_of_words\n valid_words = []\n array_of_words.each do | word |\n if Dictionary.words.include? word\n valid_words << word\n end\n end\n valid_words\n end",
"title": ""
},
{
"docid": "392d43972f4c891f990d368a205b8715",
"score": "0.63047993",
"text": "def check_words_dict(research_strings)\n @words_dict.each do |dict_word|\n research_strings.each do |research_string|\n @found_words.push(dict_word) if research_string.include?(dict_word)\n end\n end\n @found_words.sort!.uniq!\n end",
"title": ""
},
{
"docid": "08c3284c2f7d1d72028641ab8e2ae92f",
"score": "0.6265445",
"text": "def find_embedded_words(baseforms)\n search_hits = []\n baseforms.each do |base|\n search = Word.solr_search do\n fulltext base\n end\n if search.results.any?\n search_hits << search.results\n end\n end\n return search_hits\n end",
"title": ""
},
{
"docid": "c83cd0a7d8fb772e9b6f19689c4733a9",
"score": "0.62552786",
"text": "def all_words_in_dictionary(sent, dictionary)\n words = sent.split(' ')\n words.each do |word|\n exists = false\n # if !dictionary.include?(word)\n # return false\n # end\n dictionary.each do |word_def|\n if word == word_def\n exists = true\n end\n end\n if !exists\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "9a9146858bac1f8ecb21ee3ed396c127",
"score": "0.61832416",
"text": "def include_words(*words)\n\t->(obj) { words.all? { |word| obj.split.include? word } }\nend",
"title": ""
},
{
"docid": "4dc612c575eb060811dc57d6749cca51",
"score": "0.6171164",
"text": "def search_ids phrase\n # TODO: to find with a help of profiler the quickest sequence of and-or-not queries\n # depending on word occurances number in the documents\n \n and_phrases, or_phrases, not_phrases = get_and_or_not_of phrase\n \n res = nil\n \n if not and_phrases.empty?\n res = List::chain res, @handler.search_and(and_phrases)\n end\n \n or_phrases.each do |or_p|\n res = List::chain res, @handler.search_or(or_p)\n end\n \n except = @handler.search_and not_phrases\n \n # finally filter pages not to show and return\n # real document names\n return List::NOT(res, except)\n end",
"title": ""
},
{
"docid": "81731e4c16eac9b0e494fe24b789e5a5",
"score": "0.6157539",
"text": "def valid_words(rack, words)\n # Load the words\n list_of_words = words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\n end",
"title": ""
},
{
"docid": "2a4dbf6bdcf903957ec96e28076af5a1",
"score": "0.61051184",
"text": "def known(words)\n DictionaryWord.where(word: words).map{|x| x[:word]}\n end",
"title": ""
},
{
"docid": "4297908e6249e38f8be0aba58e1f9179",
"score": "0.6081055",
"text": "def search_word_combinations(key_words)\n final_words = []\n # Loop to get all combinations of words (Minimum word length 3)\n i = 2\n while i < 7 do\n a = key_words.map{|x| x[0..i]}.uniq\n b = key_words.map{|y| y[i+1..-1]}.uniq\n\n # Find all matching words from dictionary\n lookup_one = @dictionary_words & a\n lookup_two = @dictionary_words & b\n\n # Combining the lookup result arrays\n merge_lookup = lookup_one.product(lookup_two)\n final_words << merge_lookup unless merge_lookup.empty?\n i += 1\n end\n\n # Get exact matches\n exact_matches = @dictionary_words & key_words\n final_words << exact_matches\n\n # Flatten final array by one level.\n p final_words.flatten(1)\n end",
"title": ""
},
{
"docid": "8cf7411ca2fb4f5d74c703bb8f971751",
"score": "0.6070037",
"text": "def find_word_in_sets\n prepared_data_sets[REQUIRED_WORD_LENGTH]&.each_with_object([]) do |word, array|\n total_word_length = word.length\n current_word_substring = ''\n word.each_char do |char|\n current_word_substring << char\n target_first_word = prepared_data_sets[current_word_substring.length].include?(current_word_substring)\n remain_word_length = total_word_length - current_word_substring.length\n remain_substring = word[(total_word_length - remain_word_length)..-1]\n\n break array << word if target_first_word && prepared_data_sets[remain_word_length]&.include?(remain_substring)\n end\n end\n end",
"title": ""
},
{
"docid": "8af17345aa0d3894ea92461f953e9fe0",
"score": "0.6068985",
"text": "def words_in_the_dictionary(words)\n matches = Array.new(dictionary.size) { 0 } # initialize with 0\n words.each do |word|\n matches[dictionary.index(word)] = 1 if dictionary.include?(word)\n end\n matches\n end",
"title": ""
},
{
"docid": "7fbb867aed2a865907a2d87c76d6f406",
"score": "0.6051072",
"text": "def wordset(words)\n words.map{|w| w.downcase.to_sym}.to_set - nonwords\n end",
"title": ""
},
{
"docid": "c3f633b7c640bc2a54d1dc54673f8cb3",
"score": "0.60290277",
"text": "def intersection(keywords)\n @keyword_set.intersection(set)\n end",
"title": ""
},
{
"docid": "e8d35f707528a00a415173cc0a4d9688",
"score": "0.60260063",
"text": "def known(words)\n #return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n\t#the_result = words.find_all {|ww| @dictionary.has_key?(ww)}\n\t#the_result.empty? ? nil : the_result\n\t if words.class == Array\n result = words.delete_if { |word| !@dictionary.has_key?(word) }.uniq\n result.any? ? result : nil\n else\n words if @dictionary.has_key?(words)\n end \n\n end",
"title": ""
},
{
"docid": "bdb6eebb159473fd3c5ee68654df5afa",
"score": "0.60146385",
"text": "def intersect?(set)\n return @keyword_set.intersect?(set)\n end",
"title": ""
},
{
"docid": "d9b84925373e286e1f9efea392035461",
"score": "0.60046196",
"text": "def all_words_in_dictionary(sent, dictionary)\n words = sent.split\n words.each do |word|\n if !dictionary.include?(word)\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "7ba84bc1af931c7f3e882dfb338a745c",
"score": "0.5998528",
"text": "def search_for_word(word, doc_tokens)\n s_res = grep_doc(doc_tokens, word) \n s_res_singularize = grep_doc(doc_tokens, word.singularize)\n search_res = s_res.size >= s_res_singularize.size ? s_res : s_res_singularize\n search_res\n end",
"title": ""
},
{
"docid": "08014b73f16ba990d163594806324d11",
"score": "0.5976524",
"text": "def all_words_in_dictionary(sent, dictionary)\n words = sent.split(' ')\n words.each do |word|\n if !dictionary.include?(word)\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "08014b73f16ba990d163594806324d11",
"score": "0.5976524",
"text": "def all_words_in_dictionary(sent, dictionary)\n words = sent.split(' ')\n words.each do |word|\n if !dictionary.include?(word)\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "0404f1492a5355a3bdcc9d942abb71bb",
"score": "0.5951194",
"text": "def known(words)\n result = words.find_all {|w| @dictionary.has_key?(w) }\n result.empty? ? nil : result\n end",
"title": ""
},
{
"docid": "ff8ac53ad61686aa2198d4685730143f",
"score": "0.5937327",
"text": "def filtered_set(set, search_term, search_columns)\n # split search terms separated by spaces, which may be grouped by quotes (eg. <foo \"bar baz\"> => [\"foo\", \"bar baz\"])\n tokens = search_term.strip.scan(/(\"[^\"]+\"|\\w+)\\s*/)\n tokens = tokens.flatten.map{|t| t.delete('\"') }\n\n tokens.each do |token|\n condition_strs = search_columns.map { |column| \"#{column} like :search\" }\n set = set.where(condition_strs.join(\" OR \"), search: \"%#{token}%\")\n end\n set\n end",
"title": ""
},
{
"docid": "5c1cf01ef55585c2c1a9dd9d54fa0ede",
"score": "0.59339577",
"text": "def subwords(text, words)\n s = create_big_subletter_set(text)\n words.select { |word| @subletter_hash[word] <= s }\n end",
"title": ""
},
{
"docid": "cc4bea3ff27acd2e1313a83dc044b3e2",
"score": "0.5925535",
"text": "def full_text_search(cols, terms, opts = OPTS)\n terms = \"\\\"#{terms.join('\" OR \"')}\\\"\" if terms.is_a?(Array)\n where(Sequel.lit(\"CONTAINS (?, ?)\", cols, terms))\n end",
"title": ""
},
{
"docid": "34542bc728a4871c1708e53f74194596",
"score": "0.5909344",
"text": "def filter_to_present(words)\n vectors.keys & words\n end",
"title": ""
},
{
"docid": "319aedca99f75a7a97fb11a3fb78567c",
"score": "0.5889499",
"text": "def search_word_combinations(key_words)\n final_words = []\n # Loop to get all combinations of words (Minimum word length 3)\n i = 2\n while i < 7 do\n a = key_words.map{|x| x[0..i]}.uniq\n b = key_words.map{|y| y[i+1..-1]}.uniq\n\n # Find all matching words from dictionary\n lookup_one = @dictionary_words & a\n lookup_two = @dictionary_words & b\n\n # Combining the lookup result arrays\n merge_lookup = lookup_one.product(lookup_two)\n final_words << merge_lookup unless merge_lookup.empty?\n i += 1\n end \n\n # Get exact matches\n exact_matches = @dictionary_words & key_words\n final_words << exact_matches\n\n # Flatten final array by one level.\n p final_words.flatten(1)\n\n\n end",
"title": ""
},
{
"docid": "0bd7d496a10a666461751758aaf1dab8",
"score": "0.58824086",
"text": "def matches(term)\n set = base_search(term)\n set.map do |i|\n # doc_id = get_id(i.to_i)\n # offset = documents.offset_of(doc_id)\n # a,b = nil\n # if offset\n # a = i.to_i - offset\n # b = a + term.length\n # end\n # MatchData.new(doc_id,a,b)\n Match.new(i,term,self)\n end\n end",
"title": ""
},
{
"docid": "954d48abf65dbec57a38cb4bca4db425",
"score": "0.58823234",
"text": "def wordset\n @wordset ||= if content_normalized\n content_normalized.scan(/[\\w']+/).to_set\n end\n end",
"title": ""
},
{
"docid": "44f19a9def3f6581da4797ac65e2fc61",
"score": "0.58771336",
"text": "def query_words(word_list)\n counts = {}\n word_list.each do |word|\n counts[word] = query(word)\n end\n counts\n end",
"title": ""
},
{
"docid": "02fe0f32acf3403eb877dd47da030028",
"score": "0.5876101",
"text": "def ngrams_including_all(*grams)\n ngram_set = NgramSet.new\n\n each_ngram do |ngram|\n ngram_set << ngram if ngram.includes_all?(*grams)\n end\n\n return ngram_set\n end",
"title": ""
},
{
"docid": "9a308237f82938abc650c99f97e4867b",
"score": "0.58716977",
"text": "def match(array_of_words)\n split_word = @word.split(\"\")\n words_matched = []\n \n array_of_words.each do |words|\n split_words_of_array = words.split(\"\")\n if split_word.sort == split_words_of_array.sort\n words_matched << words\n #binding.pry\n end\n #binding.pry\n end\n #binding.pry\n words_matched\n end",
"title": ""
},
{
"docid": "21470969f3681f292485bd1dff6a8791",
"score": "0.5867927",
"text": "def documents(set)\n classes.each_with_object([]) do |klass, documents|\n documents << documents_for_class(klass, set)\n end.flatten\n end",
"title": ""
},
{
"docid": "1d9fbcd200369f674a5dae17d8520556",
"score": "0.58621454",
"text": "def find_words(words)\n rows = ['qwerrtyuiop', 'asdfghjkl', 'zxcvbnm']\n one_row_words = []\n words.each do |word|\n row = rows.select { |a| a.include?(word[0].downcase) }\n pass = false\n word.each_char do |letter|\n unless row[0].include?(letter.downcase)\n pass = true\n break\n end\n end\n next if pass\n one_row_words << word\n end\n one_row_words\nend",
"title": ""
},
{
"docid": "27cacc9ed3cbd13edfb525f479d712f8",
"score": "0.5858481",
"text": "def search_word_combinations(key_words)\n i = 2\n while i < 7\n # Find all matching words from dictionary\n lookup_one = dictionary & key_words.map { |x| x[0..i] }.uniq\n lookup_two = dictionary & key_words.map { |y| y[i + 1..-1] }.uniq\n\n # Combining the lookup result arrays\n merge_lookup = lookup_one.product(lookup_two)\n final_words << merge_lookup unless merge_lookup.empty?\n i += 1\n end\n find_exact_matches(key_words)\n end",
"title": ""
},
{
"docid": "c1b0eb1f9f294cdbb81fa8f3ced53c37",
"score": "0.58504957",
"text": "def found_words\n @word_index.keys\n end",
"title": ""
},
{
"docid": "dc6689717172447558178555416d9d21",
"score": "0.58499163",
"text": "def words\n unless @words\n @words = @string.gsub( /[,\\\"\\\\]/, \"\" ).gsub( /\\+/, \" \" ).split.select do |word|\n case word\n # Ignore really common words.\n when \"a\", \"of\", \"the\", \"to\", \"or\", \"in\", \"is\", \"and\", \"for\", \"+\", \"on\", \"at\", \"!\", \"-\"\n false\n # Ignore things that will generally be Google directives.\n when /^-[a-z]+?:/\n false\n else\n true\n end\n end.uniq\n end\n @words\n end",
"title": ""
},
{
"docid": "9acc1d1d6b81468e61387a5f51c4d50f",
"score": "0.58431476",
"text": "def includes_all? word_array\n\n raise ArgumentError, \"This string is NIL\" if self.nil?\n raise ArgumentError, \"The parameter word array is NIL\" if word_array.nil?\n\n word_array.each do |word|\n\n raise ArgumentError, \"The word array #{word_array} contains a nil value.\" if word.nil?\n return false unless self.include? word\n\n end\n\n return true\n\n end",
"title": ""
},
{
"docid": "fb34eae519930482d678439f4a6cc7e3",
"score": "0.584032",
"text": "def mergeSetWords(*params)\n\tmergedArray = Array.new()\n\t\tparams.each do |wordset|\n\t\t\twordset.each do |eachword|\n\t\t\t\tif(eachword.length<20)\n#\t\t\t\t\ta = Whois.whois(eachword+\".com\")\n#\t\t\t\t\tif(a.available? )\n\t\t\t\t\t\tputs \"#{eachword} available\"\n\t\t\t\t\t\tmergedArray.push(eachword+\".com\")\n#\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tmergedArray.each do |domains|\n\t\t\tputs \"#{domains}\"\n\t\tend\n\t\t\t\n\treturn mergedArray.sort_by{|i| i.length}\nend",
"title": ""
},
{
"docid": "2a360c0576e20ba882115d576ea36cc6",
"score": "0.58380187",
"text": "def words_from_array(all_tweets)\n words = []\n all_tweets.each do |tweet|\n tweet.text.downcase.split(\" \").each do |word|\n if check_noncommon_word(word)\n words.push(word)\n end\n end\n end\n words\n end",
"title": ""
},
{
"docid": "9e5be99650df79ef053a4712e7ef3cf4",
"score": "0.58151585",
"text": "def find_all\n self.words = Array.new\n Word.get_ids_for_letters(self.title) { |id| self.words << id }\n end",
"title": ""
},
{
"docid": "4ce4fcc0c69a378badf5d80cac1a4b81",
"score": "0.5810776",
"text": "def terms_matching_pages(search_term)\n pages_list = site.collections[@configured_collection].resources\n\n Bridgetown::Paginate::PaginationIndexer.index_documents_by(\n pages_list, search_term\n ).keys\n end",
"title": ""
},
{
"docid": "430b34dba0b0b543999e1bd822739b99",
"score": "0.5806584",
"text": "def known(words)\n known_words = words.find_all { |w| @dict_frequency.has_key?(w) }\n known_words.empty? ? nil : known_words\n end",
"title": ""
},
{
"docid": "125df8e81866603f491ecaf0081a88a8",
"score": "0.5805842",
"text": "def real_words(permutations, wordlist)\n realwords = []\n wordlist = wordlist.to_set\n permutations.each { |x| realwords << x if wordlist.include?(x) }\n realwords\nend",
"title": ""
},
{
"docid": "eeef66a143ad634b69848f71d4854385",
"score": "0.5802679",
"text": "def string_matching(words)\n output = []\n words.each.with_index do |word, i|\n words.each.with_index do |word, j|\n if words[i].include?(words[j]) && !output.include?(words[j]) && words[i] != words[j]\n output << words[j]\n end\n end\n end\n return output\nend",
"title": ""
},
{
"docid": "4c119a586cd15c6e13ee2787b71ff8a0",
"score": "0.58003366",
"text": "def check_documents(names, &block)\n model = find_model('Document')\n names = names.split(/,\\s*/)\n model.where(name: names).each(&block)\n end",
"title": ""
},
{
"docid": "97011f76dec31a3b215948e22207acea",
"score": "0.57949364",
"text": "def known(words)\n if words.class == Array\n result = words.delete_if { |word| !NWORDS.has_key?(word) }.uniq\n return nil unless result.any?\n result\n else\n words if NWORDS.has_key?(words)\n end\nend",
"title": ""
},
{
"docid": "908d5c6b5b5fa341df58172c40449598",
"score": "0.57838637",
"text": "def all_words\n Word.all\n end",
"title": ""
},
{
"docid": "bfe838c0f8716a24410b2df825fbfd25",
"score": "0.5780952",
"text": "def words_with(*letters)\n @lines.select{ |term| \n letters.any?{ |letter|\n term.match(/#{letter}/) \n }\n }\n end",
"title": ""
},
{
"docid": "01ac04138b0e10b4fd330ebec8e73312",
"score": "0.57736087",
"text": "def full_text_search(cols, terms, opts = {})\n filter(\"CONTAINS (#{literal(cols)}, #{literal(terms)})\")\n end",
"title": ""
},
{
"docid": "209cbdf7a1f6ef5cb51cb769fba0ca6a",
"score": "0.57675105",
"text": "def contains(*list_of_possible_letters)\n self.select{ |term|\n list_of_possible_letters.any?{ |letter|\n term.match(/#{letter}/)\n }\n }\n end",
"title": ""
},
{
"docid": "9bd74079603b03e5058c4091b3b4dd0a",
"score": "0.574416",
"text": "def search_word_conditions\n params[:q].split(/\\s+/).map { |w| search_word_condition(w) }\n end",
"title": ""
},
{
"docid": "8fdcac1194c9a7e30c0026139c1f9618",
"score": "0.5736014",
"text": "def match(array_of_words)\n array_of_words.select do|element|\n (@word.split(\"\").sort) == (element.split(\"\").sort)\n end\nend",
"title": ""
},
{
"docid": "99421eec718b13899121c40c1cc43fce",
"score": "0.57206404",
"text": "def keyword_search(keywords_array)\n keywords_array.each do |keyword|\n fulltext_search(keyword)\n end\n end",
"title": ""
},
{
"docid": "cb2a8e99029be7959f808d2c57457d95",
"score": "0.5720008",
"text": "def wordsWithLetter(words, letter)\n #only select the words that contain that letter\n words.select{|word| word.include?(letter)} \nend",
"title": ""
},
{
"docid": "323719bd9d6e8f2e90d2392f4fdb5360",
"score": "0.5706637",
"text": "def create_vocabulary(documents)\n vocabulary = Set.new\n documents.each do |d|\n vocabulary = vocabulary | d.to_set # ensure unique\n end\n vocabulary.to_a\n end",
"title": ""
},
{
"docid": "0e3baab23dee65571c7d3525c9e97409",
"score": "0.5703972",
"text": "def hunt_for words, sub\n clean_up_listings(sub).select do |title|\n words.map do |word|\n concat = title.values.join(\" \")\n concat.include?(word)\n end.any?\n end\n end",
"title": ""
},
{
"docid": "05433e6881dcf312821c7505c947c90f",
"score": "0.57032275",
"text": "def test_supplemental_words\n @words = @tester.words(10000, true)\n @words.each {|w| assert @complete_wordlist.include?(w) }\n end",
"title": ""
},
{
"docid": "8bf66feccea4a8447fa0d95e7245d454",
"score": "0.5693578",
"text": "def search(words)\n\n # For each search term\n words.each do |x|\n target = @hash.hashCode(x)\n if(target == $id) # If search term is stored by this node\n puts(@index.getKeywordIndexes(target)) # Get results\n else # If search term stored by another node\n closest_node_ip = @rt.findCloserNode(target, nil) # Find closest routing table entry to the target\n if !closest_node_ip.nil? # If there is a closer node\n @socket.send @msg.SEARCH(x, target, $id), 0, '127.0.0.1', closest_node_ip # Send SEARCH to relevant node\n end\n end\n end\n end",
"title": ""
},
{
"docid": "227d353f963efd403bf96d61815dcd24",
"score": "0.5687644",
"text": "def gram_fuzzy_set(w,d)\n s = [w]\n\n for i in 1..d\n for j in 0..s.size-1\n for k in 0..s[j].length-1\n fuzzy = s[j][0..s[j].length-1]\n fuzzy.slice!(k)\n if !s.include?(fuzzy)\n s << fuzzy\n end\n end\n end\n end\n return s\n end",
"title": ""
},
{
"docid": "78d1db1df863ea847e9d2404d800362e",
"score": "0.5670033",
"text": "def similar_documents\n Document.search do\n fulltext self.title\n end\n end",
"title": ""
},
{
"docid": "c1b7a2bc88e27b027a4775867c0b2f8e",
"score": "0.56663924",
"text": "def known(words)\n result = words.find_all {|w| @dictionary.key?(w) } #find all words for which condition is true\n if result.empty? \n return [] \n else\n return result.sort_by {|e| 1-@dictionary[e]} #sort by descending frequency\n end\n end",
"title": ""
},
{
"docid": "1a5316218ad1d7933e36883426f4fdb4",
"score": "0.5664576",
"text": "def subwords(word, dictionary)\n dictionary.select { |sub| word.include?sub }\nend",
"title": ""
},
{
"docid": "b03bc440e2905913f91224ae6ac39b09",
"score": "0.56625754",
"text": "def match(words)\n words.select {|word| word.split('').sort == @word.split('').sort}\n end",
"title": ""
},
{
"docid": "a3c94c46915810264c34bc84b74a103b",
"score": "0.56584233",
"text": "def get_all_letters_in_array_of_words(array)\nend",
"title": ""
},
{
"docid": "8c319d318408245d382fcddcfd2b6f54",
"score": "0.56538403",
"text": "def find_words(words) \n result_words = []\n \n words.each do |word|\n row_chosen = choose_row(word)\n \n words_in_one_row = true\n \n word.each_char do |char| \n words_in_one_row = false if !row_chosen.include?(char.downcase)\n end\n \n result_words << word if words_in_one_row\n end\n \n result_words\nend",
"title": ""
},
{
"docid": "2bdfb733d4917628b714180d59e122d5",
"score": "0.5653809",
"text": "def scan_words\n @words.scan(files)\n end",
"title": ""
},
{
"docid": "d3fbc152fc8f1ec445f6e69d2943650e",
"score": "0.5651423",
"text": "def match(array_of_words)\n array_of_words.select do |anagram|\n anagram?(anagram)\n end\n end",
"title": ""
},
{
"docid": "bd4b2e813e194ebf7f09dd0b57c7b25e",
"score": "0.5650801",
"text": "def entities\n seen = Set.new\n param_words.each do |word|\n word.entities.each do |entity|\n seen.add(entity)\n end\n end\n seen.each\n end",
"title": ""
},
{
"docid": "8aff32765596dd528daf1d7b48255c2c",
"score": "0.5650253",
"text": "def subwords(word, dictionary)\n subs = substrings(word)\n subs.select {|sub| dictionary.include?(sub)}\nend",
"title": ""
},
{
"docid": "be7b3f4be2586b8681c6511bd889d780",
"score": "0.56412685",
"text": "def search *paths\n sub_set = NodeSet.new(document)\n document.decorate(sub_set)\n each do |node|\n node.search(*paths).each do |sub_node|\n sub_set << sub_node\n end\n end\n sub_set\n end",
"title": ""
},
{
"docid": "6f3fa1c3f7b4264a3c1173883151a710",
"score": "0.56397825",
"text": "def findWord(query, array_of_strings)\n endarray = []\n # array_of_strings.select { |str| str.match(Regexp.new(query, true)) }\n endarray = array_of_strings.select { |str| str =~ Regexp.new(query, true) }\n endarray.empty? ? [\"Empty\"] : endarray\nend",
"title": ""
},
{
"docid": "b4f158fea49bfd2cae9d46d2b0ccde1e",
"score": "0.56349677",
"text": "def search_for_keywords\n keywords = filter_dimensionwords(@processor.words)\n keyword_search(keywords)\n end",
"title": ""
},
{
"docid": "14cb3cdac184f9aa0f6af248565ff15e",
"score": "0.563039",
"text": "def words\n @words ||= begin\n word_suggestions = []\n spellcheck = response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n if suggestions.is_a?(Array)\n # Before solr 6.5 suggestions is an array with the following format:\n # (query term)\n # (hash of term info and term suggestion)\n # ...\n # (query term)\n # (hash of term info and term suggestion)\n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n # We turn it into a hash here so that it is the same format as in solr 6.5 and later\n suggestions = Hash[*suggestions].except('correctlySpelled', 'collation')\n end\n\n suggestions.each_value do |term_info|\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => [{ frequency =>, word => }] # for extended results\n # suggestion => ['word'] # for non-extended results\n orig_freq = term_info['origFreq']\n if term_info['suggestion'].first.is_a?(Hash)\n word_suggestions << term_info['suggestion'].map do |suggestion|\n suggestion['word'] if suggestion['freq'] > orig_freq\n end\n else\n # only extended suggestions have frequency so we just return all suggestions\n word_suggestions << term_info['suggestion']\n end\n end\n end\n end\n word_suggestions.flatten.compact.uniq\n end\n end",
"title": ""
},
{
"docid": "40f60d89a9a72554c7eb617eff33a910",
"score": "0.56294477",
"text": "def four_letters_in_common(word, dictionary)\n\n # Get all four or more consectutive letter combinations i.e. slices\n slices = get_slices(word)\n\n # To store all words that have letters in common with the slices\n matches = Set.new\n\n # Find all the matching words\n dictionary.each do |word|\n \n # Check if the word matches any of the slices\n slices.each do |slice|\n if word.include?(slice)\n matches << word\n end\n\n end\n end\n\n matches\nend",
"title": ""
},
{
"docid": "49a8c589a231b95f1ce2950c6b38efa5",
"score": "0.56262887",
"text": "def found_words\n\t @word_index.keys\n\tend",
"title": ""
},
{
"docid": "b7306511402af3ebf75722a3fea86cb6",
"score": "0.56142145",
"text": "def QWords(beginning, elements); end",
"title": ""
},
{
"docid": "dc34a3db889c0010b2c3e1539bbdbf22",
"score": "0.5605066",
"text": "def bag_of_words( sentence_words, words )\n # Bag of Words\n bag = [0] * words.length\n for s in sentence_words\n if words.include? s\n bag[words.index(s)] = 1\n end\n end\n\n return bag\nend",
"title": ""
},
{
"docid": "c0e1837c01d195b26c788b185b53f2f5",
"score": "0.56021285",
"text": "def search_all\n # Delete keywords from the list as we find them\n @keywords.delete_if {|keyword| search(keyword)}\n end",
"title": ""
},
{
"docid": "47b1d1eda9b2c4c966825f82dad3af81",
"score": "0.55980575",
"text": "def filter\n documents.select { |document| document.matches?(selector) }\n end",
"title": ""
},
{
"docid": "5883d538e08c982c10de23a73fe22daf",
"score": "0.5595829",
"text": "def findAllConcatenations(s, words)\n res = []\n if words.nil? then\n return res\n end\n patternOffset = words[0].size\n patternSize = words.size * patternOffset\n if patternSize > s.size then\n return res\n else\n hash = Hash.new\n words.each{ |word|\n hash.include?(word) ? hash[word]+=1 : hash[word]=1\n }\n (0..s.size-patternSize).each{ |index| \n replicaHash = hash.dup\n (index...index+patternSize).step(patternOffset){ |i| \n tmp = s[i,patternOffset]\n if replicaHash.include?(tmp) then\n if (replicaHash[tmp]-=1) == 0 then\n replicaHash.delete(tmp)\n end\n else\n break\n end\n }\n if replicaHash.size == 0 then\n res << index\n end\n }\n res\n end\nend",
"title": ""
},
{
"docid": "e161fdda5c64f8c46e2911d727f2f238",
"score": "0.55948186",
"text": "def findWord(query, array_of_strings)\n\n\t\tendarray = array_of_strings.select { |s| s.downcase.include?(query.downcase) }\n\t\tendarray.empty? ? [\"Empty\"] : endarray\n\t\n\tend",
"title": ""
},
{
"docid": "d6d04ed7a1e72860ad72696a052ef918",
"score": "0.5593673",
"text": "def words_scanner(words, text)\n matched_words = []\n return matched_words.length if text.nil?\n\n words.each do |word|\n if text.downcase.include?(word)\n matched_words.push(word)\n end\n end\n matched_words.length\n end",
"title": ""
},
{
"docid": "82c1319a284436cfa39fd2f506964b2a",
"score": "0.5593432",
"text": "def getApproxWords(words, wordlist)\n begLetterWords = []\n candidates = []\n\n for word in words\n begLetterWords.push(begLetters(word))\n end\n\n for w in wordlist\n if begLetterWords.include?(begLetters(to_word(w)))\n candidates.push(to_word(w))\n end\n end\n\n return candidates\n end",
"title": ""
},
{
"docid": "55601fb623ac7fb9ac4f2074a959b04d",
"score": "0.55895734",
"text": "def find_all(word)\n [:noun, :verb, :adj, :adv].flat_map do |pos|\n find(word, pos) || []\n end\n end",
"title": ""
},
{
"docid": "d849d9fddca59a2fcc36a5628e2535f1",
"score": "0.55889565",
"text": "def find_matched_words(pattern, trials)\n matched_word = []\n @words.each do |w|\n if w.length != pattern.length\n next\n end\n match = true\n pattern.each_char.with_index do |c, i|\n if c != '_' and c != w[i]\n match = false\n break\n end\n\n if c == '_' and trials.include? w[i]\n match = false\n break\n end\n end\n matched_word << w if match\n end\n matched_word\n end",
"title": ""
},
{
"docid": "d77f7d8e4155e7de3a17e97066c18c90",
"score": "0.55864394",
"text": "def subwords(string)\n words = []\n File.foreach('dictionary.txt') { |line| words << line.chomp }\n all_substrings = substrings(string)\n all_substrings.select { |word| words.include?(word) }\nend",
"title": ""
},
{
"docid": "5618b182c4719c0a6520a4f196994794",
"score": "0.557978",
"text": "def known(words)\n known_words = DictionaryWord.select(\"word, count\").where(word: words).order(count: :desc)\n return known_words.map{|x| x[:word]}\n\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "15b92e6fbbc3646c5e9d5204cb330ce2",
"score": "0.0",
"text": "def installer_params\n params.require(:installer).permit(:employee_key, :first_name, :last_name)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7497917",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69572496",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.6922516",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68935573",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.6785059",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.67461187",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.66838974",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.66376436",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66300017",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66284484",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.6565271",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.64915025",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64800006",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64565504",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64005226",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.638304",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.6364849",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.6342431",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6337064",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6327035",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.6322865",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.6317318",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.6315771",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.63087",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.63019013",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.6300014",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.62980604",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62941355",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62941355",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62815446",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.62744915",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.62697655",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.62576836",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.6254993",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.6254899",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.62387127",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6231534",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.6231406",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.62297785",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.62263423",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.62035394",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61931854",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6186077",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6178427",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61650974",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.61645085",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6157358",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61568296",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.6137819",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.6136603",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.6121303",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118653",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118653",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61151344",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61149",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104937",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104937",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6099561",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6099561",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6089367",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.60875493",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.6087428",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.607999",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.6077648",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.6070825",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6069507",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.60685194",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60674596",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.60662246",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6065706",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60650206",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.6059533",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60525113",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60519487",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60519487",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.60488784",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.60448277",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.603711",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6033319",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.60268354",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6025215",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.60206634",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.60202366",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.6018339",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.6010405",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6010141",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6010141",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.60067576",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60061485",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.6005366",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6003972",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6003972",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6003953",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.60022324",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999867",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999867",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5997153",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5996786",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.5995897",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.5994552",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59927636",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "1dd4e23af35ecda2231a661fe25791fc",
"score": "0.0",
"text": "def creation_category_params\n params.require(:creation_category).permit(:creation_id, :category_id)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7497917",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69572496",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.6922516",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68935573",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.6785059",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.67461187",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.66838974",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.66376436",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66300017",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66284484",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.6565271",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.64915025",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64800006",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64565504",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64005226",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.638304",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.6364849",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.6342431",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6337064",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6327035",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.6322865",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.6317318",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.6315771",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.63087",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.63019013",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.6300014",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.62980604",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62941355",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62941355",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62815446",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.62744915",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.62697655",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.62576836",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.6254993",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.6254899",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.62387127",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6231534",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.6231406",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.62297785",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.62263423",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.62035394",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61931854",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6186077",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6178427",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61650974",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.61645085",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6157358",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61568296",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.6137819",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.6136603",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.6121303",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118653",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118653",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61151344",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61149",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104937",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104937",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6099561",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6099561",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6089367",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.60875493",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.6087428",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.607999",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.6077648",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.6070825",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6069507",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.60685194",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60674596",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.60662246",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6065706",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60650206",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.6059533",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60525113",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60519487",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60519487",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.60488784",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.60448277",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.603711",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6033319",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.60268354",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6025215",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.60206634",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.60202366",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.6018339",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.6010405",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6010141",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6010141",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.60067576",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60061485",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.6005366",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6003972",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6003972",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6003953",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.60022324",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999867",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999867",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5997153",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5996786",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.5995897",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.5994552",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59927636",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
04562a9edd9be132eed06d4d51457809
|
Dumps the contents of this streaming buffer onto the given buffer and closes the queue
|
[
{
"docid": "dfdc2144a5e9f291e4bc249d11b9034c",
"score": "0.64784175",
"text": "def transfer(new_buffer)\n @lock.synchronize do\n until @queue.empty? do new_buffer.push(@queue.pop) end\n @queue.close\n end\n end",
"title": ""
}
] |
[
{
"docid": "fd6dd7a998d37336c31029f5502d86a0",
"score": "0.6720757",
"text": "def write\n while (chunk = @sink_queue.pop)\n @sink << chunk\n end\n end",
"title": ""
},
{
"docid": "0e85e89d337e9ed2c7084ab637448d5f",
"score": "0.65800196",
"text": "def dump_buffer\n self.buf ||= ''\n buffer = self.buf.dup\n reset()\n buffer\n end",
"title": ""
},
{
"docid": "4b98279c0e689b41f70c39259de23aa2",
"score": "0.6572752",
"text": "def flush\n lines = nil\n @lock.synchronize do\n before_flush if respond_to?(:before_flush, true)\n lines = @buffer.pop!\n end\n write_to_stream(lines) if lines\n end",
"title": ""
},
{
"docid": "120064a4da948bea81cf571506e0953e",
"score": "0.64238894",
"text": "def flush\n out = @buffer\n @buffer = ''\n out\n end",
"title": ""
},
{
"docid": "bfc93c3462715805b1b4427366976374",
"score": "0.6391089",
"text": "def close(buffer)\n buffer.close\n end",
"title": ""
},
{
"docid": "23d140e36a928e3626be225bdedb3004",
"score": "0.63525146",
"text": "def flush\n @on_buffered.call(@buffer)\n @buffer = []\n end",
"title": ""
},
{
"docid": "1b2b753489ddae94bf20f0003bcefbb4",
"score": "0.63184327",
"text": "def flush\n outgoing.puts(buffer.join(\"\\n\"))\n @buffer = []\n end",
"title": ""
},
{
"docid": "06b7f62eaf4f84f85037827d10b23dae",
"score": "0.62945545",
"text": "def work\n buf, finished = '', false\n until finished && buf.empty?\n record = @queue.pop\n if record\n buf << Record.serialize(record)\n else\n finished = true\n end\n read, write = IO.select [], [@fd]\n if write and fd = write.first\n lock(fd) { buf = try_write fd, buf }\n end\n end\n @fd.flush\n end",
"title": ""
},
{
"docid": "d3c2184b3b564ed2226eb3325c78470e",
"score": "0.6278731",
"text": "def flush!\n @queue = Device::Buffer.new\n self\n end",
"title": ""
},
{
"docid": "a4dbc448c02045a0f9349c2ba7b7b36c",
"score": "0.62434685",
"text": "def flush\n ensure_open\n @ibuffer.empty_to self\n self\n end",
"title": ""
},
{
"docid": "b50889ce2b0a453e5605fcd7fc36bc1a",
"score": "0.6205756",
"text": "def flush\n return unless buffering?\n \n @buffering = false\n write @buffer\n @buffering = true\n @buffer = ''\n end",
"title": ""
},
{
"docid": "981ff55c6c3b9bb5a2f1aecdfafd925b",
"score": "0.6116573",
"text": "def sink(buffer)\n if @options[:sink]\n #nothing, the sink\n else\n puts buffer\n end\n end",
"title": ""
},
{
"docid": "8d0df9416af10e8421779a013d646f42",
"score": "0.6061816",
"text": "def close_buffer; end",
"title": ""
},
{
"docid": "563fab97538505a422b005341d3705d9",
"score": "0.5967896",
"text": "def flush\n tmp = ''\n @buffer_semaphore.synchronize do\n tmp = @buffer.clone\n @buffer.clear\n end\n tmp\n end",
"title": ""
},
{
"docid": "a457af16ee17563a66c437adb02b1888",
"score": "0.5922723",
"text": "def flush opts={}\n if opts[:drop]\n @buffer = self.class.new_buffer\n return\n elsif @buffer.empty? && !opts[:empty]\n return\n end\n if !opts[:partial]\n padding = opts.fetch(:padding, @padding)\n if padding\n @buffer << padding while @buffer.length < @chunk_size\n len = @buffer.length\n lenX = len - (len % @chunk_size)\n @buffer[lenX..-1] = '' if lenX > 0\n end\n end\n pump true\n nil\n end",
"title": ""
},
{
"docid": "14a315c1d3c69d6082b1b43f16ca9376",
"score": "0.59106565",
"text": "def close_buffer\n return @output_stream if @closed\n\n run_command\n @closed = true\n @output_stream\n end",
"title": ""
},
{
"docid": "1451f4335a8001b544eec31020e817e7",
"score": "0.5886962",
"text": "def stream(message)\n if buffer_stack > 0\n append_buffer message\n else\n super\n end\n end",
"title": ""
},
{
"docid": "1451f4335a8001b544eec31020e817e7",
"score": "0.5886962",
"text": "def stream(message)\n if buffer_stack > 0\n append_buffer message\n else\n super\n end\n end",
"title": ""
},
{
"docid": "ca60e1582f448a316a96fba8745ad741",
"score": "0.58787334",
"text": "def close\n flush\n stream.close\n end",
"title": ""
},
{
"docid": "3af3e4149a1a59d0aa6b1a655a479dbe",
"score": "0.5859714",
"text": "def flushBuffer\n # Write it\n @File.write(@Header.getEncodedString(@Buffer))\n updateProgress(@Buffer.size/@Header.NbrChannels)\n @IdxCurrentBufferSample = 0\n @Buffer = []\n end",
"title": ""
},
{
"docid": "bd142f1735dd6303820cbc6b0838ee72",
"score": "0.58278185",
"text": "def copyTo(out)\n begin\n while true\n data = @queue.pop_with_timeout(10)\n data.nil? and break\n out.write(data)\n end\n rescue Exception => e\n puts \"Warning: problem while streaming content: #{e.message}\"\n end\n end",
"title": ""
},
{
"docid": "a8df0fd254a0060db82027bf167d080d",
"score": "0.5822798",
"text": "def buffer\n @buffer << ''\n end",
"title": ""
},
{
"docid": "a8df0fd254a0060db82027bf167d080d",
"score": "0.5822798",
"text": "def buffer\n @buffer << ''\n end",
"title": ""
},
{
"docid": "8b3bb7c769f299c648924ef4f2df9420",
"score": "0.57888025",
"text": "def clear_buffer\n @buffer.clear\n @pending_message_queue.clear\n end",
"title": ""
},
{
"docid": "8b3bb7c769f299c648924ef4f2df9420",
"score": "0.57888025",
"text": "def clear_buffer\n @buffer.clear\n @pending_message_queue.clear\n end",
"title": ""
},
{
"docid": "aa5e8f274ee49070272c78f6e4a08a75",
"score": "0.5785247",
"text": "def write_flush\n @outbuffer = \"\"\n end",
"title": ""
},
{
"docid": "35d0a28d68ef30dcebc3764f03458194",
"score": "0.5779349",
"text": "def flushbuf\n return @buf.tap{ @buf = EMPTY_BUFFER.dup }\n end",
"title": ""
},
{
"docid": "682a80462ec4ea8697c3b2c5bc28c65c",
"score": "0.5767141",
"text": "def close_buffer\n return @outputStream if @closed\n finalize_current_entry\n update_local_headers\n write_central_directory\n @closed = true\n return @outputStream\n end",
"title": ""
},
{
"docid": "ca668cb0689de570c265dfa37734594d",
"score": "0.57625717",
"text": "def sync_buffer\n @buffer.string = @buffer.read\n end",
"title": ""
},
{
"docid": "579dd749ef4b26df47b0848ef1ee3917",
"score": "0.5760071",
"text": "def close\n queue.close\n end",
"title": ""
},
{
"docid": "15ef9e9ec978c793782568839f40e979",
"score": "0.5757244",
"text": "def flush_queue\n @queue.num_waiting.times { @queue.push(nil) }\n close_queue\n\n # Logs if we're throwing away spans because nothing's\n # waiting to take them off the queue.\n if @queue.num_waiting == 0 && !@queue.empty?\n NewRelic::Agent.logger.warn(\"Discarding #{@queue.size} segments on Streaming Buffer\")\n return\n end\n\n # Only wait a short while for queue to flush\n cutoff = Process.clock_gettime(Process::CLOCK_MONOTONIC) + MAX_FLUSH_WAIT\n until @queue.empty? || Process.clock_gettime(Process::CLOCK_MONOTONIC) >= cutoff do sleep(FLUSH_DELAY) end\n end",
"title": ""
},
{
"docid": "14bb94cc9b931b2aa35b9f391dc9d9bb",
"score": "0.5753997",
"text": "def buffer\n @_buffer\n end",
"title": ""
},
{
"docid": "14bb94cc9b931b2aa35b9f391dc9d9bb",
"score": "0.5753997",
"text": "def buffer\n @_buffer\n end",
"title": ""
},
{
"docid": "56a0d9f6f58b554bb8e9bd1b0a31a641",
"score": "0.57504827",
"text": "def reset_buffering\n @ibuffer.unseek! self\n end",
"title": ""
},
{
"docid": "e5476ef10431ea1849f548fd7fc54cb9",
"score": "0.57391584",
"text": "def << (obj)\n @buffer << obj\n flush if @buffer.size == @size\n end",
"title": ""
},
{
"docid": "5510415f7a56fe786b83810af376195e",
"score": "0.5733901",
"text": "def flush\n if @buffer.pos == @buffer_read_pos\n initialize_buffer\n else\n @buffer.pos = @buffer_read_pos\n initialize_buffer(@buffer.read)\n end\n end",
"title": ""
},
{
"docid": "77bdbce5085e6c627e1d346fa71a4808",
"score": "0.57223266",
"text": "def unbuffer\n @buffer.pop\n end",
"title": ""
},
{
"docid": "77bdbce5085e6c627e1d346fa71a4808",
"score": "0.57223266",
"text": "def unbuffer\n @buffer.pop\n end",
"title": ""
},
{
"docid": "7431841b9e44a4208e28b46065569a99",
"score": "0.5710151",
"text": "def close\n if @buffer\n @buffer.close\n @buffer.unlink if @buffer.respond_to?(:unlink)\n @buffer = nil\n end\n @length = 0\n @state = :closed\n end",
"title": ""
},
{
"docid": "73fc01455bd5eb20eed3db27be52d306",
"score": "0.56990796",
"text": "def flush\n guarded { @stdout.puts prefix + buffer } if buffer != ''\n self.buffer = ''\n end",
"title": ""
},
{
"docid": "7760099a474521531bb17df04433e233",
"score": "0.56923103",
"text": "def flush\n @send_buffer.slice!(0, @send_buffer.length)\n end",
"title": ""
},
{
"docid": "055758cf58e58bb33c8fbd91cb38c4c9",
"score": "0.5685242",
"text": "def pushRawBuffer(iRawBuffer)\n # First, flush eventually remaining buffer to encode\n if (!@Buffer.empty?)\n flushBuffer\n end\n # Then write our raw buffer\n @File.write(iRawBuffer)\n updateProgress(iRawBuffer.size/@SampleSize)\n end",
"title": ""
},
{
"docid": "c3a2cdf18a61761386abef2dd344c588",
"score": "0.5677182",
"text": "def flush\n return unless @buffer.size > 0\n @mutex.synchronize do\n @log.write(@buffer.slice!(0..-1).join(''))\n end\n end",
"title": ""
},
{
"docid": "a551489624b1a50ddfddd74315a3354d",
"score": "0.5672582",
"text": "def with_buffer(*args)\n buffer_stack << ''\n yield(*args)\n buffer_stack.pop\n end",
"title": ""
},
{
"docid": "2b86e689514743ae9879ae1b29384e06",
"score": "0.56723046",
"text": "def start_buffer_broker(output_queue)\n @threadpool.post do\n while !stop?\n output_queue << @buffered_queue.pop_no_timeout\n end\n end\n end",
"title": ""
},
{
"docid": "139c37c8c0a59ff6cac9d1bdcc082e27",
"score": "0.5662416",
"text": "def buffer(buffer, flags = Magic::MIME)\n open(flags).buffer(buffer)\n end",
"title": ""
},
{
"docid": "f9bc5193bd28793f42e11bffe7af19fd",
"score": "0.56573915",
"text": "def write_buffer_to_file\n @sequence_list.sort.each do |sequence|\n @rtp_file.write @payload_data[sequence]\n end\n\n @sequence_list.clear\n @payload_data.clear\n end",
"title": ""
},
{
"docid": "eb27cb9987185d629f6694d1e450d307",
"score": "0.56430376",
"text": "def reset\n clear\n self.puts @buffer\n self\n end",
"title": ""
},
{
"docid": "7775b937bd1b666bf3db48d244fd23aa",
"score": "0.56413645",
"text": "def clear\n @q.clear\n @size = 0\n nil\n ensure\n @buffer.close\n @buffer.unlink\n end",
"title": ""
},
{
"docid": "9d25fe833b79867b798df7e1a3ea3434",
"score": "0.5638068",
"text": "def close\n @mu.synchronize do\n # Send any remaining output on the buffer\n @callback.call(@buffer.dup) if !@buffer.empty?\n # Disable this buffer instance\n @callback = nil\n @buffer.clear\n @buffer.freeze\n end\n self\n end",
"title": ""
},
{
"docid": "a252432d27cff37b286049dda6c3c162",
"score": "0.5635538",
"text": "def buffer\n @logfile.string if @backend == :buffer\n end",
"title": ""
},
{
"docid": "6ae64895fa7f8ea288bab98c6d19c68c",
"score": "0.56278896",
"text": "def read_flush\n @inbuffer = \"\"\n end",
"title": ""
},
{
"docid": "ecea03f6d3de982afe728329691e581f",
"score": "0.56067663",
"text": "def flush\n out_stream.flush\n self\n end",
"title": ""
},
{
"docid": "dd3a166fbb9ecb096e38e5a213a9e3da",
"score": "0.5581194",
"text": "def buffer(&block)\n bufferring = output.sync\n # Immediately flush output\n output.sync = true\n value = block.call if block_given?\n output.sync = bufferring\n value\n end",
"title": ""
},
{
"docid": "03883a2d0c1de918a28b5440af5880fd",
"score": "0.557462",
"text": "def write_buffer(io = ::StringIO.new(\"\"))\n zos = new(io, true)\n yield zos\n zos.close_buffer\n end",
"title": ""
},
{
"docid": "9e8493b4b31c50c3d32a5d38301e834e",
"score": "0.55468225",
"text": "def buffer\n @buffer\n end",
"title": ""
},
{
"docid": "ffaee162bc4cd0afe8a14cfb50897b1c",
"score": "0.55467975",
"text": "def flush\n\t\t\t\treturn if @write_buffer.empty?\n\t\t\t\t\n\t\t\t\t@writing.acquire do\n\t\t\t\t\t# Flip the write buffer and drain buffer:\n\t\t\t\t\t@write_buffer, @drain_buffer = @drain_buffer, @write_buffer\n\t\t\t\t\t\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@io.write(@drain_buffer)\n\t\t\t\t\tensure\n\t\t\t\t\t\t# If the write operation fails, we still need to clear this buffer, and the data is essentially lost.\n\t\t\t\t\t\t@drain_buffer.clear\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "a50bf345073a287027d9a9caa06e9b38",
"score": "0.55408746",
"text": "def fill_buffer(chunk)\n @buffer << chunk\n end",
"title": ""
},
{
"docid": "915689d1fb4dc67a9f43e0d434775eaa",
"score": "0.55343676",
"text": "def finalize\n return if @buffer.empty?\n @pump_proc.call( Base64.encode64 @buffer )\n nil\n end",
"title": ""
},
{
"docid": "361f63a0c054db7eb93b23831b6b45e2",
"score": "0.55221117",
"text": "def read\n while (chunk = @source.read(@read_sz))\n @source_queue << chunk\n end\n @source_queue << nil\n end",
"title": ""
},
{
"docid": "1de79f96669f5e3c58262740d26738c2",
"score": "0.55086833",
"text": "def with_buffer; end",
"title": ""
},
{
"docid": "825fce0b2d8c9d11163826ad4477600a",
"score": "0.5502434",
"text": "def internal_flush\n ary = [] \n while !buffer.empty?\n ary << buffer.deq\n end\n @channel << [:add_messages, ary] if ary.length > 0 \n end",
"title": ""
},
{
"docid": "415a6f5f52a80747632d054b3b07ce61",
"score": "0.5472435",
"text": "def finalize\n return if @buffer.empty?\n if @padding\n @buffer << @padding while @buffer.length < @chunk_size\n len = @buffer.length\n lenX = len - (len % @chunk_size)\n @buffer[lenX..-1] = '' if lenX > 0\n end\n pump(true)\n nil\n end",
"title": ""
},
{
"docid": "91223e1a6f983bb062a73cd1901c7899",
"score": "0.5468261",
"text": "def open_buffer\n @buffer = true\n end",
"title": ""
},
{
"docid": "869ba0ad9345647dd1d3bd00186cd470",
"score": "0.5452864",
"text": "def buffer\n @buffer ||= StringIO.new\n end",
"title": ""
},
{
"docid": "6d0c7812c3ae7a91246ab001451c0cd6",
"score": "0.5450341",
"text": "def close(_drain)\n @output.flush\n end",
"title": ""
},
{
"docid": "9af9a2be0bf9d8efb8daa48f174bad37",
"score": "0.5444925",
"text": "def write(buffer)\n @struct.write(buffer)\n nil\n end",
"title": ""
},
{
"docid": "b9c2f67a7ad798e843009de924b85478",
"score": "0.5443881",
"text": "def push_buffer\r\n raise Shells::NotRunning unless running?\r\n # push the buffer so we can get the output of a command.\r\n debug 'Pushing buffer >>'\r\n sync do\r\n output_stack.push [ stdout, stderr, output ]\r\n self.stdout = ''\r\n self.stderr = ''\r\n self.output = ''\r\n end\r\n end",
"title": ""
},
{
"docid": "26439f5550742c423ee2a56ad9296686",
"score": "0.5435835",
"text": "def push str\n @buffer << str\n pump\n self\n end",
"title": ""
},
{
"docid": "3cdeabe4e274eaea4266d1c60b5c27da",
"score": "0.5431291",
"text": "def flush\n raise ClosedStream if @closed\n @io.flush if @io.respond_to?(:flush)\n end",
"title": ""
},
{
"docid": "50fe766d00cd75edefdc7109793f6af9",
"score": "0.5415615",
"text": "def flush\n if @streaming_body && !@template.output_buffer.nil?\n push @template.output_buffer.slice!(0..-1)\n end\n end",
"title": ""
},
{
"docid": "50fe766d00cd75edefdc7109793f6af9",
"score": "0.5415615",
"text": "def flush\n if @streaming_body && !@template.output_buffer.nil?\n push @template.output_buffer.slice!(0..-1)\n end\n end",
"title": ""
},
{
"docid": "8c05519d9982b36ff86fda6042c5eef5",
"score": "0.54145586",
"text": "def flush\n buffer.each do |message|\n log(message[:severity], message[:body])\n end\n clear_buffer\n end",
"title": ""
},
{
"docid": "a313bb864ed23cdf258de36e091c309b",
"score": "0.54123527",
"text": "def flush\n syswrite(@buffer)\n @buffer = ''\n end",
"title": ""
},
{
"docid": "62c9d59fa8550a518cd34e175e36dccf",
"score": "0.54105633",
"text": "def write_buffer(chunk, &hndlr)\n @j_del.writeBuffer(chunk._to_java_buffer)\n self\n end",
"title": ""
},
{
"docid": "62c9d59fa8550a518cd34e175e36dccf",
"score": "0.54105633",
"text": "def write_buffer(chunk, &hndlr)\n @j_del.writeBuffer(chunk._to_java_buffer)\n self\n end",
"title": ""
},
{
"docid": "bfab1f4a44115aabf37386eeb1bb165a",
"score": "0.5410086",
"text": "def buffer( commit = true )\n return self if @stream.nil?\n \n state = [@stream, @at_bol, @indent]\n @stream = buffer = \"\"\n @at_bol = false\n @indent = \"\"\n \n begin\n yield\n ensure\n @stream, @at_bol, @indent = *state\n end\n\n self << buffer if commit\n buffer\n end",
"title": ""
},
{
"docid": "5ad5c5614970671c67f24040caf5a459",
"score": "0.5408133",
"text": "def flush\n @input << @tail\n buffer = @input.join\n @input.clear\n @tail = \"\" # @tail.clear is slightly faster, but not supported on 1.8.7\n buffer\n end",
"title": ""
},
{
"docid": "177e5e8877af55e142b6f26419028e0c",
"score": "0.5407766",
"text": "def buffer\n input(BUFFER)\n end",
"title": ""
},
{
"docid": "639bb1f2d86c2bcf02f8d4f2e055991b",
"score": "0.54024416",
"text": "def flush_log_buffer\n @@buffer_enabled = false\n self.log(@@buffer_log)\n @@buffer_log = ''\n end",
"title": ""
},
{
"docid": "216520367c8bf693525d8c7492b6985d",
"score": "0.5393566",
"text": "def flush\n raise ClosedStream if @closed\n @io.flush if @io.respond_to?(:flush)\n end",
"title": ""
},
{
"docid": "216520367c8bf693525d8c7492b6985d",
"score": "0.5393566",
"text": "def flush\n raise ClosedStream if @closed\n @io.flush if @io.respond_to?(:flush)\n end",
"title": ""
},
{
"docid": "e2cbe6c46c4d80fb5708fdad2b9aade3",
"score": "0.5392093",
"text": "def pop_buffer\n poped = nil\n\n if buffer_stack\n poped = buffer_stack.pop\n # We need to delete the whole array to prevent a memory leak\n # from piling threads\n @buffer.delete(Thread.current.object_id) unless buffer_stack.any?\n end\n poped\n end",
"title": ""
},
{
"docid": "da1d28aa915b98aa34f494393edf38d0",
"score": "0.53871197",
"text": "def add_buffer(buffer)\n add_varbytes buffer.raw\n self\n end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "d1e3c14ae0a194bb1aa74b1ff181bf83",
"score": "0.5373037",
"text": "def buffer; end",
"title": ""
},
{
"docid": "4b258e2bf396a5e683d2bbc469b318bd",
"score": "0.53717583",
"text": "def write(buffer)\n struct.write(buffer)\n nil\n end",
"title": ""
},
{
"docid": "6fa430366ecc2072e48e56afbcce6fb7",
"score": "0.5368008",
"text": "def flush_async\n @monitor.instrument(\n 'buffer.flushed_async',\n producer_id: id,\n messages: @messages\n ) { flush(false) }\n end",
"title": ""
},
{
"docid": "d61d77a094ada3569710aed3cee87207",
"score": "0.536606",
"text": "def feedbuffer(buffer, params={})\n tmpfeed = create_tmpfeed(params.merge({:buffer => buffer}))\n feed_stream_file(tmpfeed, params.merge({:file => tmpfeed, :localfile => true}))\n end",
"title": ""
},
{
"docid": "99acf113bf5f97fd3166cca01bc44d6c",
"score": "0.5361235",
"text": "def buffer\n @bufs.last\n end",
"title": ""
},
{
"docid": "32681cb190419ced43f80e45d4c8f4ed",
"score": "0.5359086",
"text": "def shutdown\n queue.close\n end",
"title": ""
},
{
"docid": "7dbc94001eb1f33ab44168adbc27890f",
"score": "0.53522843",
"text": "def flush!\n reap\n flush(-1)\n end",
"title": ""
},
{
"docid": "7dbc94001eb1f33ab44168adbc27890f",
"score": "0.53522843",
"text": "def flush!\n reap\n flush(-1)\n end",
"title": ""
},
{
"docid": "7dbc94001eb1f33ab44168adbc27890f",
"score": "0.53522843",
"text": "def flush!\n reap\n flush(-1)\n end",
"title": ""
}
] |
a0ae9b0354dbf40000f7b4483f4461bb
|
recipe can be either a String, or an Executable host_dns is optional and will default to objects self.dns_name
|
[
{
"docid": "e58b825fca727bce0b5d78515aa8e14e",
"score": "0.6487825",
"text": "def run_recipe_with_ssh(recipe, ssh_key=nil, host_dns=self.dns_name)\n raise \"FATAL: run_script called on a server with no dns_name. You need to run .settings on the server to populate this attribute.\" unless self.dns_name\n if recipe.is_a?(Executable)\n recipe = recipe.recipe\n end\n tail_command =\"tail -f -n1 /var/log/messages\"\n expect = /RightLink.*RS> ([completed|failed]+: < #{recipe} >)/\n run_this = \"rs_run_recipe -n '#{recipe}'\"\n run_and_tail(run_this, tail_command, expect, ssh_key)\n end",
"title": ""
}
] |
[
{
"docid": "837ad6e0adf99a7fc37e2dff6d08fc29",
"score": "0.6111741",
"text": "def recipe(arg=nil)\n set_or_return(\n :recipe,\n arg,\n :kind_of => [ String ]\n )\n end",
"title": ""
},
{
"docid": "22672094a272d74ae3b2b07ece3c2538",
"score": "0.6059728",
"text": "def recipe(recipe_name, desc=nil)\n recipe_name = 'default' if recipe_name == name\n recipe_name = recipe_name.gsub(/^#{name}::/, \"\")\n #\n desc = (recipe_name == 'default' ? \"Base configuration for #{name}\" : recipe_name.titleize) if (desc.blank? || desc == recipe_name.titleize)\n filename = file_in_cookbook(\"recipes/#{recipe_name}.rb\")\n @all_recipes[recipe_name] ||= RecipeFile.read(self, recipe_name, desc, filename)\n @all_recipes[recipe_name].desc ||= desc if desc.present?\n @all_recipes[recipe_name]\n end",
"title": ""
},
{
"docid": "241cdadf6d946ec9c0f43a0ee50254bd",
"score": "0.5930713",
"text": "def custom_install_tasks_for(o) \n [\n # \"if [ -z $(grep -v '#' /etc/hosts | grep '#{o.name}') ]; then echo \\\"$(curl http://169.254.169.254/latest/meta-data/public-ipv4) #{o.name}\\\" >> /etc/hosts; fi\",\n \"if [ -z \\\"$(grep -v '#' /etc/hosts | grep '#{o.name}')\\\" ]; then echo '127.0.0.1 #{o.name}' >> /etc/hosts; fi\",\n \"hostname #{o.name}\",\n \"echo #{o.name} > /etc/hostname\"\n ]\n end",
"title": ""
},
{
"docid": "241cdadf6d946ec9c0f43a0ee50254bd",
"score": "0.5930713",
"text": "def custom_install_tasks_for(o) \n [\n # \"if [ -z $(grep -v '#' /etc/hosts | grep '#{o.name}') ]; then echo \\\"$(curl http://169.254.169.254/latest/meta-data/public-ipv4) #{o.name}\\\" >> /etc/hosts; fi\",\n \"if [ -z \\\"$(grep -v '#' /etc/hosts | grep '#{o.name}')\\\" ]; then echo '127.0.0.1 #{o.name}' >> /etc/hosts; fi\",\n \"hostname #{o.name}\",\n \"echo #{o.name} > /etc/hostname\"\n ]\n end",
"title": ""
},
{
"docid": "12d994c1544992489255cc7096c1fbf6",
"score": "0.58533925",
"text": "def run_recipe(recipe, client_opts: CHEF_CLIENT_OPTS)\n chef_client(\"-o '#{recipe}'\", client_opts: client_opts)\n end",
"title": ""
},
{
"docid": "dfd66a811623cf9af9382d2207bcaeae",
"score": "0.5837106",
"text": "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gdns::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end",
"title": ""
},
{
"docid": "8d6bee8ee6dca3f3295c1525c4d07b25",
"score": "0.58007663",
"text": "def name\n recipe = statement.parameters.first.jump(:string_content, :ident).source\n recipe = recipe.split(\"::\")[1] if recipe =~ /::/\n recipe = 'default' if recipe == cookbook.name.to_s\n recipe\n end",
"title": ""
},
{
"docid": "610ae333c293f3f0317e06853fe8fa79",
"score": "0.57452154",
"text": "def chef_recipe(recipe_name, options={})\n @chef_recipes ||= {}\n\n # if recipe_name is a symbol\n # it's implicitely a toque recipe, so prefix that shit\n if recipe_name.class == Symbol\n recipe_name = \"toque::#{recipe_name}\"\n end\n\n @chef_recipes[recipe_name] = options\n end",
"title": ""
},
{
"docid": "782a7f852ccd3f1abba7c3b948d424cc",
"score": "0.5653584",
"text": "def cook recipe, &block\n @configuration.recipes << recipe\n @configuration.public_send(recipe, &block)\n end",
"title": ""
},
{
"docid": "93c3b43b1f8efa412c5ff92947181098",
"score": "0.5601269",
"text": "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end",
"title": ""
},
{
"docid": "5eb83ecbc5df2ce3927966fc88ca14f7",
"score": "0.5574662",
"text": "def mb_recipe(recipe_name, &block)\n Recipe.new(recipe_name).instance_exec(&block)\n end",
"title": ""
},
{
"docid": "dfd8bcb953f92dc69284aa356a3a3448",
"score": "0.54868865",
"text": "def recipe(arg = nil, &block)\n arg ||= block\n set_or_return(\n :recipe,\n arg,\n kind_of: [Proc],\n )\nend",
"title": ""
},
{
"docid": "9815fbd5eb3a7834993d6414e96ca829",
"score": "0.54733175",
"text": "def recipe name, local = false\n load \"#{local ? site_capistrano_recipes : capistrano_recipes}/#{name.to_s}.rb\"\nend",
"title": ""
},
{
"docid": "3964dfa6a78c2edfb91700745c877c57",
"score": "0.5466577",
"text": "def setup_recipe(target_name = next_target_name, mode=0700)\n Recipe.new(self, target_name, mode)\n end",
"title": ""
},
{
"docid": "4d60441646c1073ade4d92bb1cfff3a1",
"score": "0.54462916",
"text": "def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end",
"title": ""
},
{
"docid": "735160b04160b7fd599aa7b7e8c64e23",
"score": "0.5441322",
"text": "def loaded_fully_qualified_recipe?(cookbook, recipe)\n loaded_recipes_hash.key?(\"#{cookbook}::#{recipe}\")\n end",
"title": ""
},
{
"docid": "44a38db75a51fa53f00775e640f2972f",
"score": "0.5430699",
"text": "def recipe\n 'docker_init'\n end",
"title": ""
},
{
"docid": "f8d80983599bd23d6485f47fb74b3014",
"score": "0.5401048",
"text": "def run_recipe_command(opts)\n payload = opts[:options] || {}\n target = {}\n target[:tags] = payload.delete(:tags) if payload[:tags]\n target[:scope] = payload.delete(:scope) if payload[:scope]\n target[:selector] = payload.delete(:selector) if payload[:selector]\n if (target[:tags] && !target[:tags].empty?) || target[:scope] || (target[:selector] == :all)\n send_push(\"/instance_scheduler/execute\", opts[:conn], payload, target)\n else\n run_request(\"/forwarder/schedule_recipe\", opts[:conn], payload)\n end\n end",
"title": ""
},
{
"docid": "4aef3b2b437569c1182426768ca4239b",
"score": "0.53946024",
"text": "def add_recipe(name)\n name = \"recipe[#{name}]\" unless name =~ /^recipe\\[(.+?)\\]$/\n run_list << name\n end",
"title": ""
},
{
"docid": "7a13a2d1aa46f2750b77b69df8a79da2",
"score": "0.5383815",
"text": "def recipe_for(name)\n\t\t\tRecipe.new(self, name)\n\t\tend",
"title": ""
},
{
"docid": "7e47fe60af4580cea0d11b9f4d60304f",
"score": "0.5374908",
"text": "def recipe(&block)\n rules.last.recipe = block\n end",
"title": ""
},
{
"docid": "329968955b423a7b88289f12b48e55a1",
"score": "0.5374301",
"text": "def set_recipe\n @recipe = find_instance\n end",
"title": ""
},
{
"docid": "d7e0999fbe7f8113de8c2c476674ee46",
"score": "0.533205",
"text": "def ingredient_handler(ingredient)\r\n\r\n case ingredient[:type] \r\n\r\n # installer\r\n when :installer\r\n\r\n # handle 32/64bit\r\n source_url = ingredient[:source_url]\r\n return if source_url.nil?\r\n\r\n windows_package ingredient[:package_name] do\r\n source source_url\r\n # checksum node['SublimeText']['checksum']\r\n installer_type ingredient[:installer_type]\r\n options ingredient[:installer_options]\r\n action :install\r\n end\r\n\r\n # portable binary\r\n when :portable\r\n\r\n # handle 32/64bit\r\n source_url = ingredient[:source_url]\r\n return if source_url.nil?\r\n\r\n filename = File.basename(URI.parse(source_url).path)\r\n dst_filepath = File.join(ingredient[:destination], filename)\r\n\r\n remote_file dst_filepath do\r\n source source_url\r\n action :create\r\n end\r\n\r\n\r\n # zip archive type\r\n when :zip\r\n windows_zipfile ingredient[:destination] do\r\n source source_url\r\n action :unzip\r\n overwrite true\r\n end \r\n\r\n when :registry\r\n\r\n\r\n when :file\r\n\r\n source_url = ingredient[:source_url]\r\n encoded_url = URI.encode(source_url)\r\n filename = File.basename(URI.parse(encoded_url).path)\r\n dst_filepath = File.join(ingredient[:destination], filename)\r\n\r\n remote_file dst_filepath do\r\n source source_url\r\n action :create\r\n end\r\n\r\n when :template\r\n destination = expand_windows_variables(ingredient[:destination])\r\n cookbook_path = run_context.cookbook_collection[cookbook_name].root_dir\r\n source_path = File.join(cookbook_path, 'templates', recipe_name, ingredient[:source_file])\r\n\r\n template destination do\r\n local true\r\n source source_path\r\n action ingredient[:action]\r\n end\r\n\r\n\r\n else\r\n raise \"Unknown ingredient type #{ingredient[:type]}\"\r\n end\r\n\r\nend",
"title": ""
},
{
"docid": "1505cf0c408341c134f75b0c70bf6e2f",
"score": "0.53302735",
"text": "def add_recipe(name, options = {}, &block)\n Fiveruns::Dash.register_recipe(name, options, &block) if block_given?\n if Fiveruns::Dash.recipes[name]\n Fiveruns::Dash.recipes[name].each do |recipe|\n if !recipes.include?(recipe) && recipe.matches?(options)\n recipes << recipe\n with_recipe_settings(options.reject { |k, _| k == :url }) do\n recipe.add_to(self) \n end\n end\n end\n else\n raise ArgumentError, \"No such recipe: #{name}\"\n end\n end",
"title": ""
},
{
"docid": "b627eb3a981e3c3a54925e84c8d7b91b",
"score": "0.5329579",
"text": "def find_recipe(cookbook, recipe_name = nil)\n recipes = cookbook.recipe_filenames_by_name.merge(cookbook.recipe_yml_filenames_by_name)\n if recipe_name.nil?\n default_recipe = recipes[\"default\"]\n raise NoDefaultRecipe.new(cookbook.root_dir, cookbook.name) if default_recipe.nil?\n\n default_recipe\n else\n recipe = recipes[recipe_name]\n raise RecipeNotFound.new(cookbook.root_dir, recipe_name, recipes.keys, cookbook.name) if recipe.nil?\n\n recipe\n end\n end",
"title": ""
},
{
"docid": "7932427e9f6e3bc7859ba19704e6334e",
"score": "0.5310421",
"text": "def recipes(target_name)\n Blazing::Commands.run(:recipes, :target_name => target_name, :options => options)\n end",
"title": ""
},
{
"docid": "c1f3c1160de170bd2fa6323d4d3a610b",
"score": "0.53024197",
"text": "def imagemagick_recipe(name, recipe, version = nil)\n if @imagemagick_macro_helper.nil?\n raise(ActionControllerError, \"Use imagemagick_for before you use imagemagick_recipe.\")\n end\n\n @imagemagick_macro_helper.add_recipe(name, recipe, version)\n end",
"title": ""
},
{
"docid": "485db2885762bb18eab470f2e9765933",
"score": "0.529996",
"text": "def execute_recipes!\n config = SwitchTower::Configuration.new\n config.logger.level = options[:verbose]\n config.set :password, options[:password]\n config.set :pretend, options[:pretend]\n\n options[:pre_vars].each { |name, value| config.set(name, value) }\n\n # load the standard recipe definition\n config.load \"standard\"\n\n options[:recipes].each { |recipe| config.load(recipe) }\n options[:vars].each { |name, value| config.set(name, value) }\n\n actor = config.actor\n options[:actions].each { |action| actor.send action }\n end",
"title": ""
},
{
"docid": "6d1c9b06a3ecb105450eb7aa776c14ee",
"score": "0.5291498",
"text": "def recipe_code\n code = <<-RECIPE_CODE\nchef_version = '#{chef_version}'\nprerelease = #{prerelease}\n\nplatform = node[:platform]\nplatform_version = if node[:product_type] == 1 # Not server\n case node[:platform_version]\n when /6\\.1\\./\n \"7\"\n when /6\\.2\\./\n \"8\"\n end\nelse # server\n case node[:platform_version]\n when /5\\.2\\.3/\n \"2003r2\"\n when /6\\.0\\./\n \"2008\"\n when /6\\.1\\./\n \"2008r2\"\n when /6\\.2\\./\n \"2012\"\n when /6\\.3\\./\n \"2012r2\"\n end\nend\n\nmachine = node[:kernel][:machine]\nnightlies = false\n\nurl = 'http://www.opscode.com/chef/download'\nurl_args = [ \"p=\\#{platform}\", \"pv=\\#{platform_version}\", \"m=\\#{machine}\", \"v=\\#{chef_version}\", \"prerelease=\\#{prerelease}\", \"nightlies=\\#{nightlies}\" ]\n\ncomposed_url = \"\\#{url}?\\#{url_args.join '&'}\"\n\n#{direct_url.nil? ? \"full_url = composed_url\" : \"full_url = \\\"#{direct_url}\\\"\"}\nrequest = Chef::REST::RESTRequest.new(:head, URI.parse(full_url), nil)\nresult = request.call\n\nif result.kind_of?(Net::HTTPRedirection)\n full_url = result['location']\nend\n\nfile_name = ::File.basename(full_url)\nfile_download_path = \"C:\\\\\\\\chef\\\\\\\\update\\\\\\\\\\#{file_name}\"\n\nremote_file file_download_path do\n source full_url\n backup false\n action :create_if_missing\nend\n\nfile_extension = ::File.extname(file_name)\n\nRECIPE_CODE\n escape_and_echo(code)\n end",
"title": ""
},
{
"docid": "6e653012818d5a93d824ba5160d6f263",
"score": "0.5290689",
"text": "def expand_by_recipe(params)\n property = params[1]\n# recipes:cujo-service\\\\:\\\\:es-old\n recipe = params[0].gsub(':','\\:')\n nodes = search(:node, \"chef_environment:#{node.chef_environment} AND recipe:#{recipe}\")\n nodes.sort_by!{ |n| n[:ipaddress] }\n nodes.each do |n|\n property += params[2].gsub(\"{ip}\", n[:ipaddress])\n property += params[3] unless n.equal? nodes.last\n end\n if params.length >= 5\n property += params[4]\n end\n return property\nend",
"title": ""
},
{
"docid": "ae33e07c554148eba0f7ce367868dcee",
"score": "0.528409",
"text": "def process_recipe(r)\n begin\n include_recipe \"scalr-server::#{r}\"\n rescue Chef::Exceptions::RecipeNotFound\n log \"loader-#{r}\" do\n level :warn\n message \"Did not load recipe: #{r}: recipe not found. OK TO CONTINUE.\"\n end\n end\nend",
"title": ""
},
{
"docid": "cb5a311f8ed4e5a6cb483270889f61f8",
"score": "0.52748823",
"text": "def check_cookbook_name\n fail 'Please specify the recipe name' if @opts[:recipe].nil?\n end",
"title": ""
},
{
"docid": "993cdb24c6add53a3a5a9a12bc206300",
"score": "0.5274074",
"text": "def set_specific_recipes\n if cli_arguments.is_a?(Array) &&\n (cli_arguments.empty? || cli_arguments.all? { |file| File.file?(file) } )\n chef_config[:specific_recipes] =\n cli_arguments.map { |file| File.expand_path(file) }\n else\n Chef::Application.fatal!(\"Invalid argument; could not find the following recipe files: \\\"\" +\n cli_arguments.select { |file| !File.file?(file) }.join('\", \"') + '\"')\n end\n end",
"title": ""
},
{
"docid": "6bda56ba11543fe5ac9c46e7199f54cf",
"score": "0.5262213",
"text": "def chef_resource(options={})\n install_chef unless chef_installed?\n resource = options.delete(:resource)\n action = options.delete(:action)\n\n\n if resource=~/(.*)\\[(.*)\\]/\n resource_type=$1\n resource_name=$2\n attributes = options.collect do |k,v|\n \"#{k} #{v}\"\n end.join(\"\\n\")\n recipe=<<-EOF\n\n #{resource_type} \"#{resource_name}\" do\n #{attributes}\n #{resource_action_to_s(action)}\n end\n\n EOF\n File.open('/tmp/recipe.rb', 'w') do |f|\n f.write(recipe)\n end\n upload!(remote_path: '/tmp/recipe.rb', local_path: '/tmp/recipe.rb')\n ssh!(command: 'sudo chef-apply /tmp/recipe.rb')\n else\n raise ArgumentError, \"Invalid resource '#{resource}'\" \n end\n end",
"title": ""
},
{
"docid": "3ac0ddf86fe2d8c6313b7730950bcf9b",
"score": "0.52547807",
"text": "def handle\n [recipe_name, options[:port]].compact.map(&:to_s).join('_')\n end",
"title": ""
},
{
"docid": "70c092bddeca372a81882176ed32ad24",
"score": "0.52425104",
"text": "def execute_recipes!\n config = Backup::Configuration.new\n #config.logger.level = options[:verbose]\n #options[:pre_vars].each { |name, value| config.set(name, value) }\n options[:vars].each { |name, value| config.set(name, value) }\n\n # load the standard recipe definition\n config.load \"standard\"\n options[:recipes].each do |recipe| \n global = options[:global] || File.dirname(recipe) + \"/global.rb\"\n config.load global if File.exists? global # cache this?\n end\n\n options[:recipes].each_with_index do |recipe,i|\n config.load(recipe) \n $state = setup_saved_state(recipe, config) \n warn \"DEPRICATED: Using multiple recipes with one command is deprecated for the time being. Just run a different command if you want to do two recipes at the same time\" if i > 0\n\n end\n\n #options[:vars].each { |name, value| config.set(name, value) }\n\n actor = config.actor\n actor.start_process! # eventually make more options, like the ability\n # to run each action individually\n #options[:actions].each { |action| actor.send action }\n end",
"title": ""
},
{
"docid": "6882eb32f79407bdc2ed8049f058113a",
"score": "0.5241701",
"text": "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gstorage::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end",
"title": ""
},
{
"docid": "4250fa7ff82124c0277d42b1089920e7",
"score": "0.5212013",
"text": "def recipe(arg=nil, &block)\n arg ||= block\n set_or_return(\n :recipe,\n arg,\n :kind_of => [ Proc ]\n )\nend",
"title": ""
},
{
"docid": "d293197516fae73fd941b2932c5388be",
"score": "0.51851404",
"text": "def installation_task(task, erb_binding: binding, config_dir: nil)\n case task[:type]\n when \"dns_hostnames\"\n begin\n changed = false\n dyn = get_dyn\n erb_binding.local_variable_get(:hosts).each do |host|\n if !host.has_hostname?\n changed = true\n host[:fix_hostnames] = true\n dns_record = host[:cloud_instance_name] || rand_str(3, :dns)\n dns_record = dns_record.gsub(\"_\",\"-\")\n dns_record = \"#{dns_record}.#{dns_component}\"\n dyn.dyn_create_a_records(dns_record, host.ip)\n end\n end\n dyn.publish if changed\n ensure\n dyn.close if changed\n end\n when \"wildcard_dns\"\n begin\n dyn = get_dyn\n\n hosts = erb_binding.local_variable_get(:hosts)\n ips = hosts.select {|h| h.has_any_role? task[:roles]}.map(&:ip)\n dns_record = \"*.#{dns_component}\"\n fqdn = dyn.dyn_create_a_records(dns_record, ips)\n if task[:store_in]\n erb_binding.local_variable_set task[:store_in].to_sym, fqdn\n end\n dyn.publish\n ensure\n dyn.close\n end\n when \"playbook\"\n inventory_erb = ERB.new(readfile(task[:inventory], config_dir))\n inventory_erb.filename = task[:inventory]\n inventory_str = inventory_erb.result(erb_binding)\n inventory = Host.localhost.absolutize basename(task[:inventory])\n puts \"Ansible inventory #{File.basename inventory}:\\n#{inventory_str}\"\n File.write(inventory, inventory_str)\n run_ansible_playbook(localize(task[:playbook]), inventory,\n retries: (task[:retries] || 1), env: task[:env])\n end\n end",
"title": ""
},
{
"docid": "cdb669af7675d805945d5b33d10b72f7",
"score": "0.51653886",
"text": "def recipe_usage(cookbook_dir, cookbook, recipe)\n recipe_content = File.read(\"#{@platform.repository_path}/#{cookbook_dir}/#{cookbook}/recipes/#{recipe}.rb\")\n # Check for include_recipe\n used_recipes = recipe_content.\n scan(/include_recipe\\s+[\"'](\\w+(::\\w+)?)[\"']/).\n map { |(recipe_def, _sub_grp)| @platform.decode_recipe(recipe_def) }\n # Check for some helpers we know include some recipes\n @config.known_helpers_including_recipes.each do |helper_name, used_recipes_by_helper|\n if recipe_content =~ Regexp.new(/(\\W|^)#{Regexp.escape(helper_name)}(\\W|$)/)\n used_recipes.concat(used_recipes_by_helper.map { |recipe_def| @platform.decode_recipe(recipe_def) })\n used_recipes.uniq!\n end\n end\n sources = []\n recipe_content.\n scan(/source\\s+([\"'])(.+?)\\1/).\n each do |(_sub_grp, source)|\n sources << source unless source =~ %r{^https?://}\n end\n erb_sources = sources.select { |source| File.extname(source).downcase == '.erb' }\n non_erb_sources = sources - erb_sources\n erb_sources.concat(recipe_content.scan(/template:?\\s+([\"'])(.+?)\\1/).map { |(_sub_grp, source)| source })\n # Check for known resources and library methods\n used_cookbooks = []\n known_resources.each do |itr_cookbook, methods|\n used_cookbooks << itr_cookbook if methods.any? { |method_name| recipe_content.include?(method_name) }\n end\n known_library_methods.each do |itr_cookbook, methods|\n used_cookbooks << itr_cookbook if methods.any? { |method_name| recipe_content.include?(method_name) }\n end\n {\n included_recipes: used_recipes,\n used_templates: erb_sources,\n used_files: non_erb_sources,\n used_cookbooks: used_cookbooks.uniq\n }\n end",
"title": ""
},
{
"docid": "035214382a115043cf4f0e843935245b",
"score": "0.5163402",
"text": "def run_recipe_command(opts)\n send_request('/forwarder/schedule_recipe', opts[:conn], opts[:options])\n end",
"title": ""
},
{
"docid": "fba2da5a78b9a567e3f70152141129c0",
"score": "0.5152881",
"text": "def get_platform_recipe\n # TODO: we may want to move the path from the top level\n path = \"#{config[:kitchen_root]}/recipes/#{instance.platform.name}.rb\"\n file = File.open(path, \"rb\")\n contents = file.read\n file.close\n contents\n end",
"title": ""
},
{
"docid": "5ac8bf6787590f9e5be61850e786a4a1",
"score": "0.514542",
"text": "def recipe(name, &block)\n name = name.to_sym\n if block_given?\n define_recipe(name, &block)\n else\n activate_recipe(name)\n end\n end",
"title": ""
},
{
"docid": "c44d9aca7d06d292abbc540b2b74ea9b",
"score": "0.5143869",
"text": "def retrieve_artifact!\n recipe_eval do\n if Chef::Artifact.from_http?(new_resource.artifact_location)\n Chef::Log.info \"artifact_deploy[retrieve_artifact!] Retrieving artifact from #{artifact_location}\"\n retrieve_from_http\n elsif Chef::Artifact.from_nexus?(new_resource.artifact_location)\n Chef::Log.info \"artifact_deploy[retrieve_artifact!] Retrieving artifact from Nexus using #{artifact_location}\"\n retrieve_from_nexus\n elsif Chef::Artifact.from_s3?(new_resource.artifact_location)\n Chef::Log.info \"artifact_deploy[retrieve_artifact!] Retrieving artifact from S3 using #{artifact_location}\"\n retrieve_from_s3\n elsif ::File.exist?(new_resource.artifact_location)\n Chef::Log.info \"artifact_deploy[retrieve_artifact!] Retrieving artifact local path #{artifact_location}\"\n retrieve_from_local\n else\n msg = \"Cannot retrieve artifact #{artifact_location}! Please make sure the artifact exists in the specified location.\"\n puts \"***FAULT:FATAL=#{msg}\"\n Chef::Application.fatal!(msg)\n end\n end\n end",
"title": ""
},
{
"docid": "05eab11840005fed1a027b771f34ffd4",
"score": "0.5130252",
"text": "def loaded_recipe?(recipe)\n cookbook, recipe_name = Chef::Recipe.parse_recipe_name(recipe)\n loaded_fully_qualified_recipe?(cookbook, recipe_name)\n end",
"title": ""
},
{
"docid": "05eab11840005fed1a027b771f34ffd4",
"score": "0.5130252",
"text": "def loaded_recipe?(recipe)\n cookbook, recipe_name = Chef::Recipe.parse_recipe_name(recipe)\n loaded_fully_qualified_recipe?(cookbook, recipe_name)\n end",
"title": ""
},
{
"docid": "45e6b9ce9688ab33edfb1691f169920f",
"score": "0.50980985",
"text": "def add_recipe(name, options=nil)\n run_list [] if run_list.nil?\n run_list << \"recipe[#{name}]\"\n if options\n empty_hash = {}\n self.dna = {} if self.dna.nil?\n self.dna.merge!(options)\n end\n end",
"title": ""
},
{
"docid": "7892a7efe39c67edd2a25ac5812c4e9b",
"score": "0.5093739",
"text": "def recipes(target_name)\n Blazing::Runner.new(target_name, options).recipes\n end",
"title": ""
},
{
"docid": "32ae65f2bdc0c3c9c4917139c7c4593a",
"score": "0.50897676",
"text": "def method_missing(meth_name, *args, &block)\n raise \"No method named: #{meth_name}\" unless recipe.respond_to? meth_name\n recipe.send(meth_name, *args, &block)\n end",
"title": ""
},
{
"docid": "a3fa0ea2c6a14395c014d503e8a34d50",
"score": "0.5079448",
"text": "def recipe name\n run_list << name\n end",
"title": ""
},
{
"docid": "a3fa0ea2c6a14395c014d503e8a34d50",
"score": "0.5079448",
"text": "def recipe name\n run_list << name\n end",
"title": ""
},
{
"docid": "8e33695b9fd7041aaa2debd0d896ebd5",
"score": "0.5077956",
"text": "def recipe_not_found(exception); end",
"title": ""
},
{
"docid": "3fbccce276bf378958ff500721ae41e6",
"score": "0.5065455",
"text": "def configure(recipes_regexp=nil,app_names_regexp=nil,service_names_regexp=nil,manifest_file_path=nil,opts=nil)\n man = load_manifest(manifest_file_path)\n recipes_regexp = as_regexp(recipes_regexp)\n app_names_regexp = as_regexp(app_names_regexp)\n service_names_regexp = as_regexp(service_names_regexp)\n configurer = VMC::KNIFE::RecipesConfigurationApplier.new(man,client,recipes_regexp,app_names_regexp,service_names_regexp,opts)\n if VMC::Cli::Config.trace\n display \"Pending updates\"\n display JSON.pretty_generate(configurer.updates_pending)\n end\n configurer.execute\n end",
"title": ""
},
{
"docid": "03c5c4cb82838f47b8a00168d9ab9229",
"score": "0.505585",
"text": "def loaded_recipe(cookbook, recipe)\n loaded_recipes_hash[\"#{cookbook}::#{recipe}\"] = true\n end",
"title": ""
},
{
"docid": "cfa518271c6fcb61924ce5ccd3bdd3f5",
"score": "0.5052456",
"text": "def recipe_file_loaded(path, recipe); end",
"title": ""
},
{
"docid": "dcf47b7776da3e3aa8c8638ec6275149",
"score": "0.50374067",
"text": "def includes_recipe?(recipe_name, node = __getnode)\n node.recipe?(recipe_name)\n end",
"title": ""
},
{
"docid": "f3069ddce5ae1c1ae2bf9e53b7f5c640",
"score": "0.5031671",
"text": "def main(node: \"labs01\", provider: \"virtualbox\", retest: false, guestint: true, verbose: true, dependencies: false)\n [node, provider, retest, guestint, verbose]\n $node = node\n options = {}\n\n $chef_dir = \"\"\n $vagrant_dir = $chef_dir + \"nodes/\"\n $bats_test_tmp = $vagrant_dir + \"bats_tmp/\"\n\n $vagrant_file = $vagrant_dir + $node + \"/Vagrantfile\"\n #$vagrant_chef_dir = %x[ cd #{$vagrant_dir}#{node}; vagrant ssh -c \"find /tmp/vagrant-chef/ -maxdepth 2 -type d -name cookbooks ]\n #\"/tmp/vagrant-chef/chef-solo-1/\"\n\n puts \"### node: #{$node} (#{$vagrant_dir + $node}) ###\"\n recipes = []\n\n\n if not (Dir.exists?($vagrant_dir + $node) and File.exists?($vagrant_file))\n $stderr.puts \"No such Vagrant node #{ $node }\"\n exit 1\n end\n\n # ----------------------------------------------------------------------------------\n # Start Vagrant or run provision on an already running node\n\n cwd_to_node = \"cd #{ $vagrant_dir + $node}; \"\n\n v_status = %x[ cd #{ $vagrant_dir + $node}; vagrant status ]\n runlist_file = \"/tmp/#{$node}_testbeat.runlist\";\n if /poweroff/.match(v_status) or /not created/.match(v_status)\n puts \"Vagrant node not running, start and provision...\"\n if File.exists?(runlist_file)\n File.delete(runlist_file)\n end\n vagrant_cmd = cwd_to_node + \"vagrant up --provider=#{provider}\"\n elsif /running/.match(v_status)\n # Add \"if runlist file older than 1 h, assume force_long\"\n if retest and File.exists?(runlist_file)\n write_hosts_custom()\n old_run = File.read(runlist_file)\n #run_match = /Run List expands to \\[(.*?)\\]/.match(old_run)\n recipes = old_run.split(\", \")\n print \"Recipes (rerun based on #{runlist_file}): \"\n puts recipes\n all_cookbooks = recipes\n if dependencies\n # Try to find dependencies for cookbooks identified at provision\n all_cookbooks = CookbookDecompiler.resolve_dependencies(recipes).to_a\n puts \"All cookbooks included: \" + all_cookbooks.join(\", \")\n end\n # code duplicated from uncached runlist below\n rspec_ok = true\n if guestint\n rspec_ok = rspec_ok && run_integration_tests(all_cookbooks)\n end\n rspec_ok = rspec_ok && run_tests(all_cookbooks, node)\n delete_hosts_custom()\n if not rspec_ok\n puts \"There were test failures!\"\n exit 1\n end\n puts \"All tests for cached runlist passed\"\n exit 0\n else\n puts \"Vagrant node running, provision...\"\n # Some providers, like 'aws', require reload in order to sync updated cookbooks before provision.\n # Execute individual tests instead when quick iterations are needed.\n # TODO: consider condition based on #{provider}.\n vagrant_cmd = cwd_to_node + \"vagrant reload --provision\"\n end\n else\n $stderr.puts \"Unknown Vagrant state: #{v_status}\"\n end\n\n # ----------------------------------------------------------------------------------\n # Build an array consisting of custom tests to be compared with Vagrant provision\n # output\n\n # First we look up tests for our custom Vagrant output checker\n test_collection = []\n\n if options[:tests]\n tests = options[:tests].split(\",\")\n tests.each do |opt|\n test_file_path = opt\n if File.exists?(test_file_path)\n contents = File.read(test_file_path)\n obj = JSON.parse(contents)\n obj[\"tests\"].each do |test|\n test_collection.push(test)\n end\n end\n end\n end\n\n #vagrant_run_output = %x[ export LANG=en_US.UTF-8; #{vagrant_cmd} ]\n vagrant_run_output = ''\n IO.popen(vagrant_cmd, :err=>[:child, :out], :external_encoding=>\"UTF-8\") do |io|\n io.each do |line|\n if verbose then puts line end\n vagrant_run_output << line + \"\\n\"\n end\n end\n result = $?.success?\n\n if not result\n $stderr.puts \"Vagrant run failed! See output below\"\n $stderr.puts vagrant_run_output\n exit 1\n else\n puts \"Vagrant provision completed.\"\n write_hosts_custom()\n\n # Run List expands to [repos-channel::haproxy, cms-base::folderstructure, repos-apache2, repos-subversion, repos-rweb, repos-trac, repos-liveserver, repos-indexing, repos-snapshot, repos-vagrant-labs]\n run_match = /Run List expands to \\[(.*?)\\]/.match(vagrant_run_output)\n if run_match\n dump_file = File.new(\"/tmp/#{$node}_testbeat.runlist\",\"w+\",0755)\n dump_file.write(run_match[1]) # should be run_match[1] but role-leanserver edit above...\n dump_file.close()\n\n recipes = run_match[1].split(\", \")\n puts \"Run list extracted from Vagrant: \" + recipes.join(\", \")\n all_cookbooks = CookbookDecompiler.resolve_dependencies(recipes).to_a\n puts \"All cookbooks included: \" + all_cookbooks.join(\", \")\n puts \"test_collection (presumably not used anymore): \" + test_collection.join(\", \");\n # the run code has been duplicated for cached runlist above\n rspec_ok = true\n if guestint\n rspec_ok = rspec_ok && run_integration_tests(all_cookbooks)\n end\n rspec_ok = rspec_ok && run_tests(all_cookbooks, node)\n delete_hosts_custom()\n if not rspec_ok\n exit 1\n end\n else\n puts \"Unable to find text 'Run List expands to' in Vagrant output :(\"\n end\n end\n\nend",
"title": ""
},
{
"docid": "a5c7445abc18db6a5e9863a9e0b94b2e",
"score": "0.5013044",
"text": "def maybe_chef_platform_lookup\n Chef::Resource.resource_matching_short_name(resource)\n end",
"title": ""
},
{
"docid": "f67f0afc5a76230cf7b9964b777b6e65",
"score": "0.50128245",
"text": "def load_recipe(recipe_name)\n Chef::Log.debug(\"Loading Recipe #{recipe_name} via include_recipe\")\n\n cookbook_name, recipe_short_name = Chef::Recipe.parse_recipe_name(recipe_name)\n if loaded_fully_qualified_recipe?(cookbook_name, recipe_short_name)\n Chef::Log.debug(\"I am not loading #{recipe_name}, because I have already seen it.\")\n false\n else\n loaded_recipe(cookbook_name, recipe_short_name)\n\n cookbook = cookbook_collection[cookbook_name]\n cookbook.load_recipe(recipe_short_name, self)\n end\n end",
"title": ""
},
{
"docid": "348ea4423b9e65eb6e343c6e3157de3e",
"score": "0.4996367",
"text": "def build_recipe(target_name, recipe_name=target_name, mode=0700)\n path = recipe_path(recipe_name)\n recipe = setup_recipe(target_name, mode)\n recipe.instance_eval(File.read(path), path)\n recipe.close\n \n self\n end",
"title": ""
},
{
"docid": "db42bc8688893141e9ecdef38c76badd",
"score": "0.4992027",
"text": "def create_recipe(app_name, name, content)\n app = App.find_by_name_or_create(app_name)\n recipe = Recipe.create app: app, name: name, content: content\n return false unless recipe.valid?\n return recipe\n end",
"title": ""
},
{
"docid": "e666d06bdfc26bdf1285360fe46be7d1",
"score": "0.49918216",
"text": "def host( host_name, *roles )\n if host_name =~ @host_pattern\n Rake::RemoteTask.host( host_long_name( host_name ), :all, *roles )\n end\n end",
"title": ""
},
{
"docid": "56f542d19c7d15ed52cb1274edf8f973",
"score": "0.4986486",
"text": "def write_recipe(content, cookbook_name = 'example')\n write_file \"cookbooks/#{cookbook_name}/recipes/default.rb\", content.strip\n end",
"title": ""
},
{
"docid": "6a24e79a1ba41baf0c95819ce4442a4c",
"score": "0.4979839",
"text": "def recipe_name() self.class.recipe_name ; end",
"title": ""
},
{
"docid": "daf327a07b5c9ec7eb6b8013352f8145",
"score": "0.49791327",
"text": "def fetch_host_command\n if cap_version < \"3.0.0\"\n Command.new.clean.cap!(self.name, '-Ff', \"#{cap2_lib_path}/revision.rake\", 'remote:fetch_host')\n else\n Command.new.clean.cap!(self.name, '-R', cap3_lib_path, 'remote:fetch_host')\n end\n end",
"title": ""
},
{
"docid": "f1ea71ace1cc9335ae4b45878e0e48d9",
"score": "0.49786696",
"text": "def custom_repo_recipe\n node['chef-ingredient']['custom-repo-recipe']\n end",
"title": ""
},
{
"docid": "da65e6cc4cc4821ec989cd41b28e07a3",
"score": "0.49775925",
"text": "def run_proc_delegate(name)\n proc = new_resource.send(name)\n proc_name = name.to_s\n Chef::Log.info \"neu_service_deploy[run_proc::#{proc_name}] Determining whether to execute #{proc_name} proc.\"\n if proc\n Chef::Log.debug \"neu_service_deploy[run_proc::#{proc_name}] Beginning execution of #{proc_name} proc.\"\n recipe_eval(&proc)\n Chef::Log.debug \"neu_service_deploy[run_proc::#{proc_name}] Ending execution of #{proc_name} proc.\"\n else\n Chef::Log.info \"neu_service_deploy[run_proc::#{proc_name}] Skipping execution of #{proc_name} proc because it was not defined.\"\n end\nend",
"title": ""
},
{
"docid": "066cf40aaee405cdbd84e7552fbf30c7",
"score": "0.49774024",
"text": "def execute_on(picture, configuration)\n if configuration[:local_recipes].has_key?(@command.to_sym)\n recipe = configuration[:local_recipes][@command.to_sym].first\n elsif (!entered_by_user || [:global,:builtin].member?(configuration[:max_recipe_level])) &&\n GlobalRecipes.has_key?(@command.to_sym)\n recipe = GlobalRecipes[@command.to_sym].first\n elsif (!entered_by_user || configuration[:max_recipe_level]==:builtin) &&\n BuiltinRecipes.has_key?(@command.to_sym)\n recipe = BuiltinRecipes[@command.to_sym].first\n else\n raise \"Command \" + @command.to_s + \" not found.\"\n end\n\n # recipes may return Strings. continue solving those\n # Strings until the result is an image, at which point\n # the rendering is finished.\n until recipe.is_a?(Magick::Image)\n # reorganize: Symbol points to a method on the controller\n # Class should have a method execute_recipe_on\n if recipe.is_a?(Symbol)\n recipe = configuration[:controller].method(recipe)\n elsif recipe.respond_to?(:execute_recipe_on)\n recipe = recipe.method(:execute_recipe_on)\n end\n\n begin\n if recipe.is_a?(Proc) || recipe.is_a?(Method)\n recipe = recipe.call(picture, *@data.to_s.split(/,/))\n elsif recipe.is_a?(String)\n # a string with other imagemagick commands\n recipe = MagickCommandList.from_s(recipe, false).execute_on(picture, configuration)\n end\n rescue Exception=>e\n raise \"Error while executing \" + @command.to_s + \": \" + e.to_s\n end\n end\n\n picture = recipe\n\n return picture\n end",
"title": ""
},
{
"docid": "18124a02adcba84dcbb43bd3cf678959",
"score": "0.4959282",
"text": "def look_up (recipe)\n if @recipes.key?(recipe.to_sym)\n @recipes.fetch(recipe.to_sym)\n else\n \"Recipe not found\"\n end \n end",
"title": ""
},
{
"docid": "9e928c87a326c33d35c3369e9b680899",
"score": "0.4942977",
"text": "def custom_fetch(recipe)\n @recipes.fetch(recipe.to_sym)\n end",
"title": ""
},
{
"docid": "0f7b7506609bac271f3fcee049897b41",
"score": "0.49313843",
"text": "def add\n #ask the user what is the recipe\n name = @view.ask_for_name\n description = @view.ask_for_description\n rating = @view.ask_for_rating\n #get name, descr, rating gets.chomp\n #Create a new instance of `recipe`\n new_recipe = Recipe.new(name, description, rating)\n #Store the instance in the cookbook\n @cookbook.add(new_recipe)\n end",
"title": ""
},
{
"docid": "5db2ce817a60a30d8f317b62a168e956",
"score": "0.49261767",
"text": "def recipe_channel\n \"recipes\"\n end",
"title": ""
},
{
"docid": "9db4354c394344468bf0049ee09cefe6",
"score": "0.49238232",
"text": "def chef_safe_resource(name)\n case name\n when :exec\n \"execute\"\n else\n name\n end\n end",
"title": ""
},
{
"docid": "4da66f8423b7dce99d110adfa1817053",
"score": "0.49114487",
"text": "def recipes\n @_recipes ||= (\n %w[dorc **/*.rake].map { |f| Dir[File.join(DO_PATH, f)] }.flatten +\n %w[./do/**/*.rake].map { |f| Dir[File.expand_path(f)] }.flatten +\n %w[./Do ./Dofile].map { |f| File.expand_path(f) } <<\n File.expand_path('../common.rb', __FILE__)\n ).reject { |f| !File.exist?(f) }\n end",
"title": ""
},
{
"docid": "3f191c33ba7cf28b73b9939d4531d33e",
"score": "0.49041334",
"text": "def cookbook\n if @halite_gemspec\n halite_gem = Halite::Gem.new(Array(@halite_gemspec).first)\n Chef::Cookbook::Metadata.new.tap do |metadata|\n metadata.name(halite_gem.cookbook_name)\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "6d03b9cf4bbc86d9571da43c5e367112",
"score": "0.48951662",
"text": "def install(&block)\n Event.events.listen(:install) do\n # TODO: DRY this\n recipe_name = name\n\n self.class.class_eval do\n source_root \"#{Playmo::ROOT}/recipes/templates/#{recipe_name}_recipe\"\n end\n \n self.instance_eval &block\n end\n end",
"title": ""
},
{
"docid": "9dd9e3cdff03dd2884ddcc55e9894b67",
"score": "0.48907217",
"text": "def set_recipe\n query = params[:id].split('-')\n if !query[1]\n @recipe = Recipe.where(name: query[0]).includes(packages: [:repo, :architecture]).order('version DESC').first\n else\n @recipe = Recipe.includes(packages: [:repo, :architecture]).find_by(name: query[0], version: query[1])\n end\n if !@recipe\n # Invalid builder or token, redirect to root\n redirect_to '/', notice: 'Package by that name not found!'\n return\n end\n end",
"title": ""
},
{
"docid": "809be2566367d000dcf905cb0fa166eb",
"score": "0.48862952",
"text": "def execute!\n #if !@options[:recipes].empty? # put backk\n execute_recipes!\n # elsif @options[:apply_to]\n # execute_apply_to!\n #end\n end",
"title": ""
},
{
"docid": "5a75b0080478da449e8a3bdf856ce8df",
"score": "0.4884507",
"text": "def collector_source\n solo_run? ? \"chef_solo\" : \"chef_client\"\n end",
"title": ""
},
{
"docid": "ec4b06952f53a8403e76a05540636741",
"score": "0.4878485",
"text": "def is_Recipe?(inp)\n\t\tinp.upcase!\n\t\tb = false\n\t\tb = true if @database[inp].is_a?Recipe\n\t\treturn b\n\tend",
"title": ""
},
{
"docid": "d0541e7418ad8cf827a2ce9860dea88d",
"score": "0.48773733",
"text": "def run!\n @cap = Boucher::Capistrano.new\n\n @meatgrinder.load_into(@cap, @hostname)\n\n @cap.run_recipe\n end",
"title": ""
},
{
"docid": "409a02340b5bf42fd9bfd9abe4d6aa07",
"score": "0.4872862",
"text": "def copy_recipe\n puts name.underscore\n puts name.classify\n template(\"service_template.rb\", \"app/services/#{name.underscore}.rb\")\n end",
"title": ""
},
{
"docid": "4f2c8b7ce126d8c2f115c6cbae0630e4",
"score": "0.48673874",
"text": "def cookbook( &block )\n # @debug = debug\n @debug = true\n raise \"Cookbook accepts a block\" unless block\n @tasks = {}\n @run_list = {}\n cook = instance_eval( &block )\n generate_run_lists\n return cook\n end",
"title": ""
},
{
"docid": "88b7d230aca8a0e52c76d21efaccb18d",
"score": "0.48670912",
"text": "def cookbook_resolution_failed(expanded_run_list, exception); end",
"title": ""
},
{
"docid": "88b7d230aca8a0e52c76d21efaccb18d",
"score": "0.48670912",
"text": "def cookbook_resolution_failed(expanded_run_list, exception); end",
"title": ""
},
{
"docid": "a1f15d384efa83c44dff0934d8859dc0",
"score": "0.48660576",
"text": "def recipe\n @recipe ||= Recipe.new\n end",
"title": ""
},
{
"docid": "5df115a9a14c1bc4a4cc6330ecf95e8a",
"score": "0.486601",
"text": "def recipes\n @_recipes ||= (\n %w[dorc *.rake].map { |f| Dir[File.join(DO_PATH, f)] }.flatten +\n %w[./Do ./Dofile].map { |f| File.expand_path(f) }\n ).reject { |f| !File.exist?(f) }\n end",
"title": ""
},
{
"docid": "c59591441bd35ad68ff06dd73225f6ed",
"score": "0.48562244",
"text": "def use_custom_repo_recipe?\n node['chef-ingredient'].attribute?('custom-repo-recipe')\n end",
"title": ""
},
{
"docid": "96abc055681ffce1dd72d5d3d00c478d",
"score": "0.48536527",
"text": "def load_current_resource\n @current_resource = Chef::Resource::AixEtcresolv.new(@new_resource.name)\n # entry types could be domain, search, nameserver, options\n @current_resource.exists = false\n # set command for all entries for /etc/resolv.conf\n namerslv = shell_out(\"namerslv -s | grep #{@new_resource.address}\")\n if !namerslv.error?\n namerslv_array = namerslv.stdout.split(' ')\n Chef::Log.debug('etcresolv: resource exists')\n @current_resource.exists = true\n else\n Chef::Log.debug('etcresolv: resource does not exists')\n end\n\n # If resource exists , load values into a hash\n if @current_resource.exists\n Chef::Log.debug('etcresolv: resource exists loading attributes')\n @current_resource.name(namerslv_array[0])\n Chef::Log.debug(\"etcresolv: current resource name: #{namerslv_array[0]}\")\n @current_resource.address(namerslv_array[1])\n Chef::Log.debug(\"etcresolv: current resource address: #{namerslv_array[1]}\")\n puts \"#{namerslv_array[0]} #{namerslv_array[1]}\"\n end\nend",
"title": ""
},
{
"docid": "f555b97baa13292ed703046b6f038bdf",
"score": "0.48457283",
"text": "def recipe_from_right_script(script)\n raise RightScale::Exceptions::Application, 'cannot create recipe after cookbook repo has been saved' if @saved\n path = script_path(script.nickname)\n recipe_name = File.basename(path)\n @recipes[recipe_name] = script.nickname\n recipe_content = <<-EOS\nright_script #{script.nickname.inspect} do\n parameters(node[#{script.nickname.inspect}][\"parameters\"])\n cache_dir '#{cache_dir(script)}'\n source_file '#{path}'\n display_version #{script.display_version.to_s.strip.inspect}\nend\n EOS\n File.open(path, 'w') { |f| f.puts script.source }\n File.chmod(0744, path)\n recipe_path = \"#{path}.rb\"\n File.open(recipe_path, 'w') { |f| f.puts recipe_content }\n\n recipe = RecipeInstantiation.new(\"#{COOKBOOK_NAME}::#{recipe_name}\",\n { script.nickname => { \"parameters\" => script.parameters } },\n script.id, script.ready)\n\n end",
"title": ""
},
{
"docid": "2d48596aa0be113a877de447a251a813",
"score": "0.4835288",
"text": "def eval_and_converge(&blk)\n tmp_collection = Chef::ResourceCollection.new\n tmp_recipe = Chef::Recipe.new(@cookbook_name, @recipe_name, @node, tmp_collection)\n tmp_recipe.instance_eval(&(blk))\n Chef::Runner.new(@node,tmp_collection).converge\nend",
"title": ""
},
{
"docid": "9793d27872c1f7a246cf01187c58239c",
"score": "0.48259267",
"text": "def recipe(&block)\n let(:chef_run) do\n chef_runner.converge_block(&block)\n end\n end",
"title": ""
},
{
"docid": "3f4fc85428a4479fe64e1eaccdd7b7f3",
"score": "0.4822457",
"text": "def recipe\nend",
"title": ""
},
{
"docid": "66a057b16fa092ca2e3f349f89b44af2",
"score": "0.48169926",
"text": "def recipe_for_url(url)\n recipes.find {|recipe| recipe.scraper_for_url(url) }\n end",
"title": ""
},
{
"docid": "a3b6e84649e7d0c85a916250166af7eb",
"score": "0.48083043",
"text": "def add_recipe(recipe)\n @recipes[recipe.title.to_sym] = recipe\n end",
"title": ""
},
{
"docid": "7ab5de5e87994056167370aedbe9095e",
"score": "0.4803433",
"text": "def recipe_name\n recipe.name\n end",
"title": ""
},
{
"docid": "e300b96158845bdd10e5aab5778e4f3c",
"score": "0.47997954",
"text": "def register_recipe link_or_page_or_hash, extractions={}\n link_or_page =\n if link_or_page_or_hash.is_a? Hash\n title = link_or_page_or_hash[:title]\n link_or_page_or_hash[:url]\n else\n link_or_page_or_hash\n end\n recipe_link =\n if link_or_page.is_a?(Mechanize::Page)\n title ||= link_or_page.search('title').try :text\n extractions.merge!('Title': title) if title\n link_or_page.uri.to_s\n else\n link_or_page\n end\n recipe = CollectibleServices.find_or_create({url: absolutize(recipe_link), title: title}.compact,\n extractions,\n Recipe)\n Rails.logger.info \"!!!Scraper Defined Recipe at #{absolutize recipe_link}:\"\n extractions.each { |key, value| Rails.logger.info \"!!!Scraper Defined Recipe #{key}: '#{value}'\" }\n Rails.logger.info ''\n recipe\n end",
"title": ""
},
{
"docid": "30bacd9738cc5d79c14f73a05a178922",
"score": "0.47976378",
"text": "def initialize chefRecipe\n super(chefRecipe.cookbook_name, chefRecipe.recipe_name, chefRecipe.run_context)\n\n # TODO: Support other distributions besides 'linux'\n node.default[\"serf\"][\"binary_url\"] = File.join node[\"serf\"][\"base_binary_url\"], \"#{node[\"serf\"][\"version\"]}_linux_#{node[\"serf\"][\"arch\"]}.zip\"\n\n currentVersion = getSerfInstalledVersion\n if currentVersion\n Chef::Log.info \"Current Serf Version : [#{currentVersion}]\"\n end\n end",
"title": ""
},
{
"docid": "5754c5778f7c70e39692732a9c43970c",
"score": "0.47974446",
"text": "def recipe\n object.recipe\n end",
"title": ""
},
{
"docid": "fc4b8009fc37cf809de0a0316b81911c",
"score": "0.47964504",
"text": "def reconfigure\n super\n\n raise Chef::Exceptions::PIDFileLockfileMatch if Chef::Util::PathHelper.paths_eql? (Chef::Config[:pid_file] || \"\" ), (Chef::Config[:lockfile] || \"\")\n\n set_specific_recipes\n\n Chef::Config[:fips] = config[:fips] if config.key? :fips\n\n Chef::Config[:chef_server_url] = config[:chef_server_url] if config.key? :chef_server_url\n\n Chef::Config.local_mode = config[:local_mode] if config.key?(:local_mode)\n\n if Chef::Config.key?(:chef_repo_path) && Chef::Config.chef_repo_path.nil?\n Chef::Config.delete(:chef_repo_path)\n Chef::Log.warn \"chef_repo_path was set in a config file but was empty. Assuming #{Chef::Config.chef_repo_path}\"\n end\n\n if Chef::Config.local_mode && !Chef::Config.key?(:cookbook_path) && !Chef::Config.key?(:chef_repo_path)\n Chef::Config.chef_repo_path = Chef::Config.find_chef_repo_path(Dir.pwd)\n end\n\n if Chef::Config[:recipe_url]\n if !Chef::Config.local_mode\n Chef::Application.fatal!(\"recipe-url can be used only in local-mode\")\n else\n if Chef::Config[:delete_entire_chef_repo]\n Chef::Log.trace \"Cleanup path #{Chef::Config.chef_repo_path} before extract recipes into it\"\n FileUtils.rm_rf(Chef::Config.chef_repo_path, secure: true)\n end\n Chef::Log.trace \"Creating path #{Chef::Config.chef_repo_path} to extract recipes into\"\n FileUtils.mkdir_p(Chef::Config.chef_repo_path)\n tarball_path = File.join(Chef::Config.chef_repo_path, \"recipes.tgz\")\n fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)\n Mixlib::Archive.new(tarball_path).extract(Chef::Config.chef_repo_path, perms: false, ignore: /^\\.$/)\n config_path = File.join(Chef::Config.chef_repo_path, \"#{ChefUtils::Dist::Infra::USER_CONF_DIR}/config.rb\")\n Chef::Config.from_string(IO.read(config_path), config_path) if File.file?(config_path)\n end\n end\n\n Chef::Config.chef_zero.host = config[:chef_zero_host] if config[:chef_zero_host]\n Chef::Config.chef_zero.port = config[:chef_zero_port] if config[:chef_zero_port]\n\n if config[:target] || Chef::Config.target\n Chef::Config.target_mode.host = config[:target] || Chef::Config.target\n if URI.parse(Chef::Config.target_mode.host).scheme\n train_config = Train.unpack_target_from_uri(Chef::Config.target_mode.host)\n Chef::Config.target_mode = train_config\n end\n Chef::Config.target_mode.enabled = true\n Chef::Config.node_name = Chef::Config.target_mode.host unless Chef::Config.node_name\n end\n\n if Chef::Config[:daemonize]\n Chef::Config[:interval] ||= 1800\n end\n\n if Chef::Config[:once]\n Chef::Config[:interval] = nil\n Chef::Config[:splay] = nil\n end\n\n # supervisor processes are enabled by default for interval-running processes but not for one-shot runs\n if Chef::Config[:client_fork].nil?\n Chef::Config[:client_fork] = !!Chef::Config[:interval]\n end\n\n if Chef::Config[:interval]\n if Chef::Platform.windows?\n Chef::Application.fatal!(windows_interval_error_message)\n elsif !Chef::Config[:client_fork]\n Chef::Application.fatal!(unforked_interval_error_message)\n end\n end\n\n if Chef::Config[:json_attribs]\n config_fetcher = Chef::ConfigFetcher.new(Chef::Config[:json_attribs])\n @chef_client_json = config_fetcher.fetch_json\n end\n end",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102
|
Update properties of this object
|
[
{
"docid": "22e76e1764e442b78e4fc718304e8f7b",
"score": "0.0",
"text": "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @disallow_ads_personalization = args[:disallow_ads_personalization] if args.key?(:disallow_ads_personalization)\n @display_name = args[:display_name] if args.key?(:display_name)\n @name = args[:name] if args.key?(:name)\n @parameter_name = args[:parameter_name] if args.key?(:parameter_name)\n @scope = args[:scope] if args.key?(:scope)\n end",
"title": ""
}
] |
[
{
"docid": "184b1b1ed771473d3eb9f338c0734c38",
"score": "0.73066413",
"text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end",
"title": ""
},
{
"docid": "5076c5a88404ae72986f958710f5687a",
"score": "0.72631145",
"text": "def update(properties)\n @__hash__.update(properties)\n end",
"title": ""
},
{
"docid": "60506d5995c168a570c84bcbafd6d01b",
"score": "0.7164913",
"text": "def update props\n # not an alias because doc\n put props\n end",
"title": ""
},
{
"docid": "ec25850e7b3d73876b69868b5e566a7a",
"score": "0.71243227",
"text": "def update_properties(hash)\n hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"title": ""
},
{
"docid": "22938231f10efd60d4530259d1ab7161",
"score": "0.7061904",
"text": "def update_props(properties)\n fail 'not implemented'\n end",
"title": ""
},
{
"docid": "22938231f10efd60d4530259d1ab7161",
"score": "0.7061904",
"text": "def update_props(properties)\n fail 'not implemented'\n end",
"title": ""
},
{
"docid": "150fa2bdc1fc43d28ac45e2278a1f797",
"score": "0.7012263",
"text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"title": ""
},
{
"docid": "b46342a57789464175130c5171865a4f",
"score": "0.69842774",
"text": "def update_properties(props)\n load_properties(force: true)\n\n deep_merge = proc do |_, old_value, new_value|\n if old_value.is_a?(Hash) && new_value.is_a?(Hash)\n old_value.merge(new_value, &deep_merge)\n else\n new_value\n end\n end\n\n props = properties.merge(props || {}, &deep_merge)\n save_properties(properties.merge(props || {}))\n self\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.69181895",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "4aa62f56c7ec71b9c7d914558501001b",
"score": "0.67206186",
"text": "def update\n update_obj\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "b0508d605628b9b1ec78fe5f0697a746",
"score": "0.67057854",
"text": "def update_properties(hash)\n hash.each_pair do |k, v|\n self.set_property_value(k.to_s, v)\n end\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.6696149",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "d9b090f93fdffad34c5489c4c437c6f3",
"score": "0.6662612",
"text": "def update_properties(properties_element)\n end",
"title": ""
},
{
"docid": "b7ed68c679d7eaccf546a282fab6e985",
"score": "0.66259164",
"text": "def apply\n update_keys\n update_columns\n update_properties\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6571848",
"text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6571848",
"text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "137759bf2b87f1ca55eb78e668747d15",
"score": "0.6539236",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end",
"title": ""
},
{
"docid": "862f7aa179e3e1751693f78772c09a99",
"score": "0.65159345",
"text": "def assign_properties(properties); end",
"title": ""
},
{
"docid": "328c68b6c30673dac05ca930f5da533c",
"score": "0.6458067",
"text": "def update_attributes(attrs)\n self.update(attrs)\n end",
"title": ""
},
{
"docid": "328c68b6c30673dac05ca930f5da533c",
"score": "0.6458067",
"text": "def update_attributes(attrs)\n self.update(attrs)\n end",
"title": ""
},
{
"docid": "d8b3bf9ec121e23dad3af2edca6e6094",
"score": "0.6421526",
"text": "def update(attributes); end",
"title": ""
},
{
"docid": "63cce5e99d8dc677403b00708afc27c9",
"score": "0.641709",
"text": "def update\n @prop.update_attributes(prop_params)\n respond_with @prop, location: backstage_scene_props_path\n end",
"title": ""
},
{
"docid": "3dc790e8b6e9e65eb288c97798a4c7f2",
"score": "0.64154994",
"text": "def set_properties inst\n model.properties.find_all { |p| model.updatable?(p.name) }.each do |p|\n inst.send(\"#{p.name}=\".to_sym, params[p.name.to_s]) if params.has_key?(p.name.to_s)\n end\n inst\n end",
"title": ""
},
{
"docid": "9373755ebb61f1f274f6c8504a5acace",
"score": "0.64146614",
"text": "def reload(props = {})\n reset_changes\n super\n assign_attributes(props)\n self\n end",
"title": ""
},
{
"docid": "fb68247cb1373a6c71a42a2aa69f1dcb",
"score": "0.64143723",
"text": "def update(attrs)\n @attrs = attrs\n self\n end",
"title": ""
},
{
"docid": "fb68247cb1373a6c71a42a2aa69f1dcb",
"score": "0.64143723",
"text": "def update(attrs)\n @attrs = attrs\n self\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.6389745",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end",
"title": ""
},
{
"docid": "71d6a0160cffce28db4d0a25d6dbda13",
"score": "0.6385747",
"text": "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "9b95f8bc66f32e7ebbe7e63224d1ebaf",
"score": "0.6364864",
"text": "def update(attributes)\n attributes.each do |name, value|\n self[name] = value\n end\n end",
"title": ""
},
{
"docid": "575f3d0c94f466263e302883e13868a6",
"score": "0.6330631",
"text": "def _update\n update!\n end",
"title": ""
},
{
"docid": "7c6d5966289f9347f75aa7b24903a328",
"score": "0.6327251",
"text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type]))) unless attribute_get(property).nil?\n end\n end\n @attributes[:original][property] = attribute_get(property)\n @dirty[property] = nil\n @attributes[:copied][property] = NOT_SET\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"title": ""
},
{
"docid": "210886bcfd68fae88847f8b3464d4058",
"score": "0.6325362",
"text": "def update_properties!(scraper)\n log \"Updating assets for #{self.slug}\"\n# only update active properties\n Property.where(source_id: self.id, status: 1).find_each do |prop|\n begin\n scraper.update_property(prop)\n rescue Exception => e\n log \"there was a connection error #{e.message} - #{e.class}\"\n end\n end\n end",
"title": ""
},
{
"docid": "da63345424fc9aecef032928485bd149",
"score": "0.6319025",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "749afa4ff068e21c7d78bbad94c19d6c",
"score": "0.6313444",
"text": "def update!(attributes); end",
"title": ""
},
{
"docid": "e8639be61ed6393bc612a8aef27789d3",
"score": "0.6312355",
"text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fields = args[:fields] if args.key?(:fields)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n end",
"title": ""
},
{
"docid": "6284f332cbe8c998b16d5e816c5d21ed",
"score": "0.6291622",
"text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end",
"title": ""
},
{
"docid": "6284f332cbe8c998b16d5e816c5d21ed",
"score": "0.6291622",
"text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end",
"title": ""
},
{
"docid": "5a8e82caac01cee661bc875a5b0cf723",
"score": "0.6283673",
"text": "def refresh\n set_attributes\n end",
"title": ""
},
{
"docid": "9e076ce17f1607b2a6248469b63b9c05",
"score": "0.62797445",
"text": "def training_updated_properties=(value)\n @training_updated_properties = value\n end",
"title": ""
},
{
"docid": "309d8f89c45737b781ca7c15a61b00a5",
"score": "0.6273536",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end",
"title": ""
},
{
"docid": "309d8f89c45737b781ca7c15a61b00a5",
"score": "0.6273536",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.6269463",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "7a41bc9d5a07220fb8626d1fa90d2d79",
"score": "0.62639254",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "f88ac8dac0e7b4769636f755e65a14ba",
"score": "0.6261997",
"text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "afd53a32bf51a2ff3c438cbf011b1ee6",
"score": "0.6261246",
"text": "def update!\n saved = false\n retries = RETRIES\n while !saved\n begin\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n saved = true\n rescue Exception => ex\n raise ex if ex.http_code != 409\n if(retries > 0)\n @new_properties = Persistence::Setup.db.get(@properties['_id'])\n @properties.each_pair do |k,v|\n if k != \"_rev\" && k != \"_id\"\n @new_properties[k] = v\n end\n end\n @properties = @new_properties\n else\n raise ex\n end\n end\n end\n :ok\n end",
"title": ""
},
{
"docid": "118090da310d688caa13dea348732f3c",
"score": "0.62579167",
"text": "def update(attributes={})\n self.class.update(self, attributes)\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.62170374",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.62170374",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "6249943d1eeff63f8f611fcf73254058",
"score": "0.62152076",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "1c12f310aca206a2cefff8c291007668",
"score": "0.6210263",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "3dfb66c3e13f181393bb4510e9fcd51f",
"score": "0.62083745",
"text": "def set_update(attrs = {})\n @movement.attributes = attrs.slice(*attributes_for_update)\n set_details\n\n @movement.balance = get_updated_balance\n @movement.gross_total = original_total\n @movement.set_state_by_balance!\n @movement.discounted = ( discount > 0 )\n\n @movement.balance_inventory = balance_inventory\n @movement.delivered = @movement.details.all? {|v| v.balance <= 0}\n\n @errors.new(movement).set_errors\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6204041",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "5d229ea224b1dfa7ac9ce6808ca63fc4",
"score": "0.62017816",
"text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"title": ""
},
{
"docid": "6992c0833b982296b329ec1d8c7289de",
"score": "0.6201711",
"text": "def update(attributes = {})\n self.attributes = attributes\n _update\n end",
"title": ""
},
{
"docid": "2beb42793217599eea1dac4b91640e41",
"score": "0.6196084",
"text": "def update_attributes\n server_update_data.each_pair do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"title": ""
},
{
"docid": "67f76e6622d1021031437ad609613c63",
"score": "0.6192824",
"text": "def update(obj)\n obj.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n self\n end",
"title": ""
},
{
"docid": "30aa07725af2114280d6e8f916ab079f",
"score": "0.6183338",
"text": "def update!\n\t\t\tconstruct!(self, &@update)\n\t\t\t@update = nil\n\t\t\t\n\t\t\treturn self\n\t\tend",
"title": ""
},
{
"docid": "f1f71f298690a3bd1f5832b15038d8bb",
"score": "0.6174291",
"text": "def updated_properties\n @updated_properties ||= ActiveSupport::HashWithIndifferentAccess.new\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "ed1b58af16fd466e308ffc9229115e36",
"score": "0.6145399",
"text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end",
"title": ""
},
{
"docid": "ed1b58af16fd466e308ffc9229115e36",
"score": "0.6145399",
"text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "7f11aed7030229ef429116ccba78c00f",
"score": "0.61400205",
"text": "def update_properties\n # t_init = 0, t_mod = 0, t_formula = 0, t_formula_mod = 0, t_post_init = 0\n # t_update_properties = Benchmark.measure do\n # Reset values for everything except formulas\n # t_init = Benchmark.measure do\n character_properties.reject { |p| p.is_a?(CharacterFormula) }.each do |p|\n p.init(self)\n end\n # end\n\n # Apply modifiers to attributes, skills and resistances (formulas later)\n mods = []\n # t_mod = Benchmark.measure do\n mods << race.property_modifiers if race\n mods << birthsign.property_modifiers if birthsign\n mods.flatten!\n mods.reject { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # Now start to process formulas\n # t_formula = Benchmark.measure do\n character_properties.select { |p| p.is_a?(CharacterFormula) }.each do |f|\n f.init(self)\n end\n # end\n\n # Apply modifiers to formulas\n # t_formula_mod = Benchmark.measure do\n mods.select { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # t_post_init = Benchmark.measure do\n character_properties.each do |prop|\n prop.post_init(self)\n end\n # end\n # end\n\n # logger.warn(\"## Init: #{(t_init.real*1000).to_i}ms\")\n # logger.warn(\"## Mofifiers: #{(t_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Formula: #{(t_formula.real*1000).to_i}ms\")\n # logger.warn(\"## Formula Modifiers: #{(t_formula_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Post Init: #{(t_post_init.real*1000).to_i}ms\")\n # logger.warn(\"### Update Properties: #{(t_update_properties.real*1000).to_i}ms\")\n end",
"title": ""
},
{
"docid": "22a21a1959eeb926dfe475d8878239d7",
"score": "0.6127356",
"text": "def update\n connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end",
"title": ""
}
] |
a6d6e7336f175bfce29a114962055222
|
Add any value related data to a coded entry from this data criteria.
|
[
{
"docid": "653b9b37dc278d9d1d3d15173bfba094",
"score": "0.6092706",
"text": "def modify_entry_with_values(entry, value_sets)\n return nil unless entry.present? && values.present?\n\n # If the value itself has a code, it will be a Coded type. Otherwise, it's just a regular value with a unit.\n entry.values ||= []\n values.each do |value|\n if value.type == \"CD\"\n entry.values << CodedResultValue.new({codes: Coded.select_codes(value.code_list_id, value_sets), description: HQMF::Coded.select_value_sets(value.code_list_id, value_sets)[\"display_name\"]})\n else\n entry.values << PhysicalQuantityResultValue.new(value.format)\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "cc2a1ddfe1d9afe298ebe19d267d3dfe",
"score": "0.6099036",
"text": "def add_data(key,value)\n update(self.value.merge({key => value}))\n end",
"title": ""
},
{
"docid": "affa257f3c77268c6625bd361e93b75f",
"score": "0.58183813",
"text": "def add(value)\n return if value.nil?\n source_data_set_id = current_source_data_set.id\n value = value.value if value.kind_of? Atlas::PlaceValue\n if value.kind_of? Array\n value.each {|v| add(v, source_data_set_id)}\n else\n values.build(:value => value.to_s, :source_data_set_id => source_data_set_id) unless values.map(&:value).include?(value.to_s) || value.to_s.blank?\n end\n end",
"title": ""
},
{
"docid": "c602ce7dd8384449c0203f7f34c22f75",
"score": "0.57213664",
"text": "def add_data_criteria(dc)\n @data_criteria << dc\n end",
"title": ""
},
{
"docid": "472634d6de4b5cc0d5332820db945c3c",
"score": "0.5713096",
"text": "def addData(newData)\n if newData[0]['valid'] != nil \n newData = newData.select{|newData| newData['valid']==1}\n end\n newData.each do |newValidDatum|\n if (index = findData(newValidDatum))\n @data[index]['value'] = newValidDatum['value']\n @data[index]['valid'] = 1\n else\n puts 'Unable to find entry matching mask_name and position'\n puts newValidDatum\n end\n end\n sortData()\n end",
"title": ""
},
{
"docid": "77b95455612a0ad053622856c37a31fd",
"score": "0.5692583",
"text": "def add_value\n @report = current_user.reports.find(params[:id])\n @value = @report.values.build(value_params)\n if @value.mitag == \"\"\n @value.mitag = 'No-Mapping'\n end\n if @value.description == \"\"\n @value.description = 'No-description'\n end\n @value.save\n end",
"title": ""
},
{
"docid": "c6189e5748c1b0cdd375a8b73c22a27d",
"score": "0.56609523",
"text": "def constuct_and_add_to_data value, entity_name, item_key, key\n return if value.blank?\n\n if (value.instance_of? String) || (value.kind_of? Numeric)\n add_to_data(value.to_s, entity_name, item_key, key)\n elsif value.instance_of? Array\n value.each_with_index do |v, i|\n add_to_data(v.to_s, entity_name,item_key, key, i.to_s)\n end\n end\n end",
"title": ""
},
{
"docid": "a7442f140e7426e0a608e62a7a3cb8f3",
"score": "0.5586414",
"text": "def add_if_relevant(data)\n return if ! relevant?(data)\n\n @datas << data\n end",
"title": ""
},
{
"docid": "098f60f84179b545eaf03b62b519c361",
"score": "0.556692",
"text": "def add_data_item(datatype, value)\n # <assert> RGFA::Line::FIELD_DATATYPE.include?(datatype)\n case datatype\n when :A\n add_fixlenstr(value)\n when :Z\n add_cstr(value)\n when :J\n value = value.to_gfa_datastring(:J) if value.kind_of?(String)\n add_cstr(value)\n when :i\n add_int(value)\n when :f\n add_double(value)\n when :B\n add_numeric_array(value)\n when :H\n add_byte_array(value)\n end\n return nil\n end",
"title": ""
},
{
"docid": "009327a66fffd38655f1ddfc04bbeb6e",
"score": "0.5538762",
"text": "def add_data(data)\n @data.merge! data\n end",
"title": ""
},
{
"docid": "19302ed219828a784bfbf21b636bcc48",
"score": "0.54863125",
"text": "def add_value(val)\n @values += val\n end",
"title": ""
},
{
"docid": "73cd40bdc01666bd6c48195c6b2c30cd",
"score": "0.5480874",
"text": "def add(label, value)\r\n @values.push Value.new(self, label, value)\r\n end",
"title": ""
},
{
"docid": "da68146dfa051ecb4cac3975678d60dd",
"score": "0.5438498",
"text": "def modify_entry_with_fields(entry, value_sets)\n return nil unless entry.present? && field_values.present?\n\n field_values.each do |name, field|\n next if field.nil?\n\n # Format the field to be stored in a Record.\n if field.type == \"CD\"\n field_value = Coded.select_code(field.code_list_id, value_sets)\n field_value[\"title\"] = HQMF::Coded.select_value_sets(field.code_list_id, value_sets)[\"display_name\"] if field_value\n else\n field_value = field.format\n end\n \n field_accessor = nil\n # Facilities are a special case where we store a whole object on the entry in Record. Create or augment the existing facility with this piece of data.\n if name.include? \"FACILITY\"\n facility = entry.facility\n facility ||= Facility.new\n facility_map = {\"FACILITY_LOCATION\" => :code, \"FACILITY_LOCATION_ARRIVAL_DATETIME\" => :start_time, \"FACILITY_LOCATION_DEPARTURE_DATETIME\" => :end_time}\n \n facility.name = field.title if type == \"CD\"\n facility_accessor = facility_map[name]\n facility.send(\"#{facility_accessor}=\", field_value)\n \n field_accessor = :facility\n field_value = facility\n end\n\n begin\n field_accessor ||= HQMF::DataCriteria::FIELDS[name][:coded_entry_method]\n entry.send(\"#{field_accessor}=\", field_value)\n rescue\n # Give some feedback if we hit an unexpected error. Some fields have no action expected, so we'll suppress those messages.\n noop_fields = [\"LENGTH_OF_STAY\", \"START_DATETIME\", \"STOP_DATETIME\"]\n unless noop_fields.include? name\n field_accessor = HQMF::DataCriteria::FIELDS[name][:coded_entry_method]\n puts \"Unknown field #{name} was unable to be added via #{field_accessor} to the patient\" \n end\n end\n end\n end",
"title": ""
},
{
"docid": "4e6abca7f36c4ab59c7ccd45f237cfa9",
"score": "0.5419691",
"text": "def full_data_with_change_codes\n data + full_extra_data_with_change_code\n end",
"title": ""
},
{
"docid": "d00bfea41094a90ab2f256ce331d9164",
"score": "0.5406264",
"text": "def add_value(value)\n @values << value\n end",
"title": ""
},
{
"docid": "a50078e736b608ccf5d7d3698300281c",
"score": "0.53680587",
"text": "def add_merge_data(key, value)\n @merge_data.push(MergeData.new(key, value))\n end",
"title": ""
},
{
"docid": "61ab00109c481e514995e2f173a3be28",
"score": "0.53674793",
"text": "def add(entry)\n if exists?(entry)\n @values_table[entry.keys.first].merge!(entry.values.first)\n else\n @values_table.merge!(entry)\n end\n end",
"title": ""
},
{
"docid": "9a7d2ed3406839469fc97304a80c3583",
"score": "0.531989",
"text": "def record_data_entry(attribute_name, value, source, priority: nil)\n exiting_data_entry = filter_loaded_data_entries(attributes: attribute_name, sources: source).first\n if exiting_data_entry\n exiting_data_entry.value = value\n exiting_data_entry.priority = priority\n else\n data_entries.build(attribute_name: attribute_name, value: value, source_id: source, priority: priority)\n end\n end",
"title": ""
},
{
"docid": "dda6db95675ec70ac6428bbcf7ab281b",
"score": "0.5318847",
"text": "def add_value(name, value)\n\t\tend",
"title": ""
},
{
"docid": "47757bc7a2f3dcd44e6fa8f72213b03a",
"score": "0.5312127",
"text": "def append_raw_data(data_bag,databag_item,raw_item,value)\n data_item = Chef::DataBagItem.new\n data_item.data_bag(data_bag)\n data_value = Chef::DataBagItem.load(data_bag,databag_item)\n ((data_value.raw_data).to_hash).each do |k,v|\n if k == raw_item\n v.push(value)\n data_value.save\n return true\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "41eaddd16b85f2f19dc2bb335f844610",
"score": "0.52903956",
"text": "def add_data(data)\n @data += data.to_s\n self\n end",
"title": ""
},
{
"docid": "39c0b1563bdf6a80ed46c22d97648640",
"score": "0.528302",
"text": "def <<( value )\n data[ translate_address( idx == 'A' ? data.rows + 1 : data.rows ) ] = value\n end",
"title": ""
},
{
"docid": "9f43d60c163d6228ca77bc13dd6fcc99",
"score": "0.5281595",
"text": "def add_value!(value)\n value = case value\n when Value then value.dup(self)\n else Value.new(self, value)\n end\n @values[value.value] = value\n end",
"title": ""
},
{
"docid": "461a6c022f92be7a58fef1974db19dfc",
"score": "0.5267962",
"text": "def add_related_thing(value)\n @children['related-thing'][:value] << value\n end",
"title": ""
},
{
"docid": "70886d0135a235912667c9e7ac9b0b85",
"score": "0.52657944",
"text": "def add_value(term, value)\n vals = values(term).to_a << value\n set_values(term, vals)\n end",
"title": ""
},
{
"docid": "117dfd883962878fef500c747f9799c5",
"score": "0.5263253",
"text": "def add_value(line)\n\n\t\tline = line[11..-1] # chop off the @ATTRIBUTE tag\n\t\tline = line.split(/\\t+| /, 2)\n\n\t\tattr_name = line[0]\n\t\tattr_val = line[1]\n\n\t\tif attr_val[0] == '{' then\n\t\t\t# split up the list of @attributes\n\n\t\t\tattr_val[attr_val.index('{')] = ''\n\t\t\tattr_val[attr_val.index('}')] = ''\n\n\t\t\tattr_val = attr_val.split(',')\n\n\t\t\t# turns the values into a hash so we can count the occurances\n\t\t\tvalues = Hash.new()\n\t\t\tattr_val.each do |_attr|\n\t\t\t\tvalues[_attr] = 0\n\t\t\tend\n\n\t\t\tattr_val = values\n\t\t\t@types.push('cat')\n\t\telse\n\t\t\t#puts attr_name\n\t\t\tattr_val = 0\n\t\t\t@types.push('num')\n\t\tend\n\n\t\t@classes.each do |_key, _val|\n\t\t\tname = _key\n\t\t\t@final[name].push(Hash['name' => attr_name, 'val' => attr_val])\n\t\t\t#puts name\n\t\t\t#puts \"Name:\",@final[name]\n\t\tend\n\n\n\tend",
"title": ""
},
{
"docid": "35b71623cb6d5e8e80baf914f5414370",
"score": "0.5255183",
"text": "def add_data(data)\n @data += data.to_s\n self\n end",
"title": ""
},
{
"docid": "bf6e1e7926e2d03b1a8b876582f94ddf",
"score": "0.5252265",
"text": "def backfill_derived_code_lists\n data_criteria_by_id = {}\n @data_criteria.each {|criteria| data_criteria_by_id[criteria.id] = criteria}\n @data_criteria.each do |criteria|\n if (criteria.derived_from)\n derived_from = data_criteria_by_id[criteria.derived_from]\n criteria.definition = derived_from.definition\n criteria.status = derived_from.status\n criteria.code_list_id = derived_from.code_list_id\n end\n end\n end",
"title": ""
},
{
"docid": "09692342a5efedd8b4b705ef2a130220",
"score": "0.5246224",
"text": "def add_data data\n options = data.clone\n options.delete_if do |k, v|\n k.to_s.start_with? \"i\"\n end\n options[:time_interval] = @interval\n\n # fill cell_name and distance information\n dis_value = calc_distance data\n cell = relate_cell\n if dis_value && cell\n options[:distance] = dis_value\n options[:cell_name] = cell[:cellname]\n end\n\n data.each do |k, v|\n if k.to_s.start_with? \"i\"\n @ie_nodes[k] ||= IENode.new k\n ienode = @ie_nodes[k]\n ienode.add(v, options)\n end\n end\n end",
"title": ""
},
{
"docid": "086ba62e30fea78ccf57e68370f59470",
"score": "0.52216154",
"text": "def collect_sum_data\n remaining_ic_ids = value_holder_ids.dup\n\n values.each do |val|\n selected_ic_ids = PropertyValue.find_all_by_value_holder_id_and_value_holder_type_and_property_id_and_value(\n remaining_ic_ids, value_holder_type, property.id, val)\n selected_ic_ids.map! { |pv| pv.value_holder_id }\n \n remaining_ic_ids -= selected_ic_ids\n\n used_values = PropertyValue.find_all_by_value_holder_id_and_value_holder_type_and_property_id(\n selected_ic_ids, value_holder_type, summed_property.id).map { |v| v.value.to_i }\n\n data.add val, used_values.sum\n end\n end",
"title": ""
},
{
"docid": "7f02144724554e081d19bcc51f616d67",
"score": "0.5213334",
"text": "def add\n model.add_intent(key) { |intent| add_value(intent) }\n end",
"title": ""
},
{
"docid": "db8300252b1c2d7ab556ba4d273c4105",
"score": "0.52006",
"text": "def add_batting_data(bd)\n @batting_data[bd.year][bd.league][bd.team] += bd\n end",
"title": ""
},
{
"docid": "c3e574a537b092d6fbabb1958711bc5c",
"score": "0.51971966",
"text": "def add_value(type_uri, value)\n @data[type_uri] = @data[type_uri] << value\n end",
"title": ""
},
{
"docid": "e2c639691feb630a1fc43875f1f23867",
"score": "0.51971585",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "b53ae076b9318c5a9a1e3cfc784cefc1",
"score": "0.51807535",
"text": "def <<(value)\n @values.push(value) # Add the value to the list of all values\n @values_sorted = false # Added a new value, so no longer sorted.\n # Call super last, so it can return what it needs to, consistently.\n super\n end",
"title": ""
},
{
"docid": "c9bab89dcf5fb132ead91693cf84e0d8",
"score": "0.51762164",
"text": "def add_related_to(ruby_value)\n self.related_to_property << RiCal::PropertyValue::Text.convert(self, ruby_value)\n end",
"title": ""
},
{
"docid": "83a0ace48874f937630718ee8af7281c",
"score": "0.51755726",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "83a0ace48874f937630718ee8af7281c",
"score": "0.51755726",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "9fef03232591325e05367ddc93e8b712",
"score": "0.5150137",
"text": "def add_data(data)\n @data << data\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e2bcfdec77c7e6f324e54530251de94f",
"score": "0.514664",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "ffb6876b4243299206b09e947ccbdabb",
"score": "0.51462233",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "ffb6876b4243299206b09e947ccbdabb",
"score": "0.51462233",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "ffb6876b4243299206b09e947ccbdabb",
"score": "0.51462233",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e92060cccfc87771351490df4682970e",
"score": "0.5144934",
"text": "def add_value(new_value_with_entity)\n ## Makes sure values exist and has a value and id as well.\n if new_value_with_entity.id.nil? || new_value_with_entity.one_value_to_json == \"null\"\n raise NotCorrectSchema.new(\"The current BodyJson object passed in does not have either an \\\"id\\\" or a \\\"value\\\" defined.\")\n end\n return @client.post(\"/entities/#{new_value_with_entity.id}/values\", new_value_with_entity.one_value_to_json)\n end",
"title": ""
},
{
"docid": "0f667cddd13b9f4befd7a6e3f8045698",
"score": "0.51425743",
"text": "def []= name, value\n value = value.to_s\n if existing = find_subject_data(name)\n if value.empty? && existing.attributes[:id]\n # this is how values are deleted in highrise\n existing.id = -existing.id\n value = nil\n elsif !value.empty? && existing.attributes[:id] && existing.attributes[:id] < 0\n # if we marked it for deletion, and it now has a value, unmark it\n existing.id = -existing.id\n end\n existing.value = value\n else\n raise \"unknown custom field #{name}\" unless subject_field_id(name)\n if not @owner.attributes[:subject_datas]\n @owner.subject_datas = []\n end\n @owner.subject_datas << SubjectData.new(\n :subject_field_label => name, \n :value => value,\n :subject_field_id => subject_field_id(name)\n )\n end\n end",
"title": ""
},
{
"docid": "e87a1b460becebdf48ebad58adee18b7",
"score": "0.51329976",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "1583ba32432f799de911da052b708257",
"score": "0.5123813",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "1583ba32432f799de911da052b708257",
"score": "0.5123813",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "1583ba32432f799de911da052b708257",
"score": "0.5123813",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "bae7295163e79910e838a89c495f4502",
"score": "0.51234776",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "e01aa0487762186f85c9da6d1a44b559",
"score": "0.5123286",
"text": "def add_value(new_value) # this?\n self.value = new_value\n end",
"title": ""
},
{
"docid": "0f8c17502ba77870c063a61184cca7e8",
"score": "0.5120094",
"text": "def add_data(p0) end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "487909b3ea50f6e7b72745fa4bcc72c9",
"score": "0.51186913",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "175d4c6d704b8c1b2909116996ac1151",
"score": "0.51169366",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "67cc10e591f96bcfbd8a5bddc4fdc3cb",
"score": "0.511025",
"text": "def enrich_with_additional_data(entry)\n entry\n end",
"title": ""
},
{
"docid": "f81d3373b94e54e9dab6ac69b33a1224",
"score": "0.5108538",
"text": "def metadatum_add_or_update(key, val)\n m = metadata.find_by(key: key.to_s)\n unless m\n # Create the entry\n m = Metadatum.new\n m.key = key\n m.data_type = Metadatum::KEY_TO_TYPE[key.to_sym]\n m.sample = self\n end\n m.edit_value(val)\n m.save!\n end",
"title": ""
},
{
"docid": "6508659ebba9b5ac1399d658554bdb56",
"score": "0.5104703",
"text": "def add_value(type_uri, value); end",
"title": ""
},
{
"docid": "93c48c752366b1a99eebc2c1afbbc996",
"score": "0.51027614",
"text": "def vital_value_coded(vital)\n\n vital_exist = Vital.find_by_vitals_id(vital['obs_id'].to_i)\n\n concept_id = get_master_def_id(vital['concept_id'], 'concept_name')\n value_coded = get_master_def_id(vital['value_coded'], 'concept_name')\n\n if vital_exist.blank?\n begin\n vitals = Vital.new\n vitals.vitals_id = vital['obs_id'].to_i\n vitals.encounter_id = vital['encounter_id']\n vitals.concept_id = concept_id\n vitals.value_coded = begin\n value_coded\n rescue StandardError\n nil\n end\n vitals.value_numeric = begin\n vital['value_numeric']\n rescue StandardError\n nil\n end\n vitals.value_text = begin\n vital['value_text']\n rescue StandardError\n nil\n end\n vitals.value_modifier = begin\n vital['value_modifier']\n rescue StandardError\n nil\n end\n vitals.value_min = begin\n ''\n rescue StandardError\n nil\n end\n vitals.value_max = begin\n ''\n rescue StandardError\n nil\n end\n vitals.value_max = begin\n ''\n rescue StandardError\n nil\n end\n vitals.app_date_created = vital['date_created']\n vitals.app_date_updated = vital['date_changed']\n vitals.voided = vital['voided']\n vitals.voided_by = vital['voided_by']\n vitals.voided_date = vital['date_voided']\n vitals.void_reason = vital['void_reason']\n vitals.save!\n\n remove_failed_record('vitals', vital['obs_id'].to_i)\n\n rescue Exception => e\n log_error_records('vitals', vital['obs_id'].to_i, e)\n end\n elsif (vital['date_changed'] || vital['date_created']).to_date > \n (vital_exist['app_date_updated'] || vital_exist['app_date_created']).to_date\n vital_exist.update(voided: vital['voided'],\n voided_by: vital['voided_by'],\n voided_date: vital['date_voided'],\n void_reason: vital['void_reason'])\n\n end\nend",
"title": ""
},
{
"docid": "7953f3e4f40885c0bb4538ebae7ca469",
"score": "0.50897264",
"text": "def add_data_values(user)\r\n\r\n # remove any previous accepted values so that we can keep a track of what has been updated\r\n sqlclean = \"select clear_datacolumn_accepted_values(#{id})\"\r\n # this bit will need to change once we change the column datatype to be an integer\r\n case self.import_data_type\r\n when \"text\"\r\n datatype = Datatypehelper.find_by_id(1)\r\n when \"year\"\r\n datatype = Datatypehelper.find_by_id(2)\r\n when \"date(2009-07-14)\"\r\n datatype = Datatypehelper.find_by_id(3)\r\n when \"date(14.07.2009)\"\r\n datatype = Datatypehelper.find_by_id(4)\r\n when \"category\"\r\n datatype = Datatypehelper.find_by_id(5)\r\n when \"number\"\r\n datatype = Datatypehelper.find_by_id(7)\r\n else\r\n #unknown\r\n datatype = Datatypehelper.find_by_id(8)\r\n end\r\n # I would like to change this so that the SQL is in one function but it wasn't working\r\n # TODO: I will look at this again - SR\r\n if(datatype.name == \"text\") then\r\n sql = \"select accept_text_datacolumn_values(#{id})\"\r\n else\r\n dataset = Dataset.find(self.dataset_id)\r\n comment = \"\"\r\n unless dataset.nil?\r\n comment = dataset.title\r\n end\r\n sql = \"select accept_datacolumn_values(#{datatype.id}, #{id}, #{datagroup_id}, #{user.id}, '#{comment}')\"\r\n end\r\n\r\n begin\r\n connection = ActiveRecord::Base.connection()\r\n connection.begin_db_transaction\r\n connection.execute(sqlclean)\r\n connection.execute(sql)\r\n\r\n connection.commit_db_transaction\r\n rescue\r\n connection.rollback_db_transaction\r\n raise\r\n end\r\n\r\n end",
"title": ""
},
{
"docid": "12f4642e824fc9ee8463d0896f7aed28",
"score": "0.5080162",
"text": "def add_value(value, key)\n YamlLint.logger.debug { \"add_value: #{value.inspect}, #{key.inspect}\" }\n\n case @complex_type.last\n when :hash\n @key_components.push(key)\n check_for_overlap!\n @key_components.pop\n when :array\n @key_components.push(@array_positions.last)\n check_for_overlap!\n @array_positions[-1] += 1\n @key_components.pop\n end\n end",
"title": ""
},
{
"docid": "8750d410f46ad6fbfae6412fb62d393e",
"score": "0.506831",
"text": "def add(key, value)\n @data[key.to_s] ||= []\n @data[key.to_s] << value\n self\n end",
"title": ""
},
{
"docid": "e9bbae0c54906c67d4497e3cb8490f11",
"score": "0.5065441",
"text": "def add_values(emma_data, fields, values, unique: true, single: nil)\n field = find_field(emma_data, fields) or return\n current = emma_data[field]\n return current if values.blank?\n single = current && !current.is_a?(Array) if single.nil?\n changed = [*current, *values].compact_blank!\n changed.uniq! if unique\n changed = changed.join(\"\\n\") if single\n emma_data[field] = changed\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.5065096",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.5064934",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.50645036",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.5063645",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.5063629",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.50634485",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
},
{
"docid": "292a971459848590dc5af5205c2020a3",
"score": "0.50634485",
"text": "def additional_data=(value)\n @additional_data = value\n end",
"title": ""
}
] |
9da6e7e9d4e40daaefdd9198f4582446
|
Process a Retina XML file
|
[
{
"docid": "7a36084b13c9be83b84f86c32e9e325a",
"score": "0.7038728",
"text": "def import_retina_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_retina_xml(args.merge(:data => data))\n end",
"title": ""
}
] |
[
{
"docid": "b996d1e777211107356ce38c2eac9e5f",
"score": "0.5608331",
"text": "def parse_xml\n \n if @noko and @noko.content\n \n self.location = @noko.content.to_s.strip || nil\n self.height = @noko['height'] ? @noko['height'].to_i : 0 \n self.width = @noko['width'] ? @noko['width'].to_i : 0\n lang = @noko['xml:lang'] || :en\n \n @metadata_pixels = height * width\n \n log.debug \" Derived logo #{url} from XML\"\n \n end\n end",
"title": ""
},
{
"docid": "58d0c39a4e549ca6e9c2cf429e3f5978",
"score": "0.55498767",
"text": "def weave_image_size_to_xml(xmlstr, xpath_prefix='')\n doc = REXML::Document.new(xmlstr)\n doc.elements.each(xpath_prefix + 'IMAGE') do |img_e|\n img_file_path = nil\n img_e.each_element('SOURCE') do |src_e|\n img_file_path = src_e.get_text.to_s\n end # img_file_path must not be nil\n size_e = REXML::Element.new('SIZE')\n if FileTest.exist?(img_file_path)\n text = File.size(img_file_path).to_s\n else\n text = '-'\n end\n size_e.add(REXML::Text.new(text))\n img_e.add(size_e)\n end\n doc\n end",
"title": ""
},
{
"docid": "77f708a0f768ac118dbbb8d09b6cb191",
"score": "0.54718137",
"text": "def get_image_data_from_file(xml_file_path)\n document = Nokogiri::XML(File.open(xml_file_path))\n recording = document.at_xpath('//Recordings//Recording')\n img_path = \"dvd#{recording.at_xpath('//URL/@root').to_s[-1]}/#{recording.at_xpath('//URL/@relative')}\"\n\n ImageData.from_xml(recording.at_xpath('//Subject'), img_path)\nend",
"title": ""
},
{
"docid": "c293a80f30ddf6c9cd7a724470323cc3",
"score": "0.51461077",
"text": "def get_xmlinfo\n def do_xmlget(imagepath)\n xmlinfo = %x{imagex info --xml #{imagepath}}\n @xmlinfo = REXML::Document.new xmlinfo\n return @xmlinfo\n end\n if defined?(@xmlinfo) then return @xmlinfo else @xmlinfo = nil end\n search = File.join(@path, 'sources/install.wim')\n wimage = Dir.glob(search, File::FNM_CASEFOLD)\n if wimage.length > 0\n return do_xmlget(wimage.first)\n end\n search = File.join(@path, 'sources/boot.wim')\n bimage = Dir.glob(search, File::FNM_CASEFOLD)\n if bimage.length > 0\n return do_xmlget(bimage.first)\n end\n @xmlinfo\n end",
"title": ""
},
{
"docid": "3ea9cff1641a68978a1329d86cf13579",
"score": "0.51321936",
"text": "def process(raw)\n # set up some temp filenames\n rgb = raw.gsub \"raw\", \"rgb\"\n tif = raw.gsub \"raw\", \"tif\"\n\n # calculate the strip size\n bytes = File.size raw\n bytes -= 16 # remove the header bytes from the calculation\n size = { width: bytes / 6 / HEIGHT, height: HEIGHT }\n\n puts \"Processing #{raw} as #{size[:width]}x#{size[:height]}px..\"\n\n # rename to rgb\n `mv #{raw} #{rgb}`\n\n # convert to tiff and normalize channels while at it, then crop into equal tiles\n `convert -size #{size[:width]}x#{size[:height]} -depth 16 -interlace plane -channel ALL -normalize -contrast-stretch 1.5x0.03% -crop #{size[:width] / WIDTH }x1@ +repage #{rgb} %d_#{tif}`\n\n # rename to raw\n `mv #{rgb} #{raw}`\nend",
"title": ""
},
{
"docid": "a76f8818a5718d875eddba30603efedb",
"score": "0.4993541",
"text": "def optimize_retina!(name)\n attachment = attachment_definitions[name]\n\n ## Check for style definitions\n styles = attachment[:styles]\n\n retina_options = if attachment[:retina].is_a?(Hash)\n attachment[:retina]\n else\n { :quality => 60 }\n end\n\n ## Get retina quality\n retina_quality = retina_options[:quality] || 40\n\n if styles\n\n retina_styles = {}\n retina_convert_options = {}\n convert_options = attachment[:convert_options]\n\n ## Iterate over styles and set optimzed dimensions\n styles.each_pair do |key, value|\n dimensions = value.kind_of?(Array) ? value[0] : value\n new_dimensions = dimensions.gsub(/\\d+/) { |dimension| dimension.to_i * 2}\n retina_styles[key.to_sym] = value.kind_of?(Array) ? [new_dimensions, value[1]] : new_dimensions\n\n ## Set quality convert option\n convert_option = convert_options[key] if convert_options\n convert_option = convert_option ? \"#{convert_option} -quality #{retina_quality}\" : \"-quality #{retina_quality}\"\n retina_convert_options[key.to_sym] = convert_option\n\n end\n\n ## Override styles with new retina dimensions\n attachment[:styles].merge!(retina_styles)\n\n ## Set quality convert options\n attachment[:convert_options] = {} if attachment[:convert_options].nil?\n attachment[:convert_options].merge!(retina_convert_options)\n\n ## Set save dimensions processor\n if attachment[:processors]\n attachment[:processors] << :save_dimensions\n attachment[:processors] << :thumbnail\n else\n attachment[:processors] = [:thumbnail, :save_dimensions]\n end\n\n end\n end",
"title": ""
},
{
"docid": "20572216751f42c542ed9aba972c739e",
"score": "0.49914476",
"text": "def parse_xml(filename)\n @parser = Parser.new :pregenerated => filename\n @parser.parse\n end",
"title": ""
},
{
"docid": "346365bc8a5115380ae7e84d240582de",
"score": "0.49334678",
"text": "def to_mzXML\n puts \"\\n--------------------------------\"\n puts \"Transforming raw file to mzXML format...\\n\\n\"\n \n system(\"wine readw.exe --mzXML #{@file}.raw #{$path}../data/spectra/#{File.basename(@file + \".raw\", \".raw\")}.mzXML 2>/dev/null\")\n end",
"title": ""
},
{
"docid": "fe7d5e08e92e24f7a8da60f007a97e05",
"score": "0.49285275",
"text": "def retina_image_path(name_at_1x)\n asset_path(name_at_1x.gsub(%r{\\.\\w+$}, '@2x\\0'))\n end",
"title": ""
},
{
"docid": "fcbcda4f79c2cf0dfac8c7640ac16e7f",
"score": "0.4917841",
"text": "def process_pxe_image_type(pxes, task)\n process_elements(pxes, PxeImageType, task)\n end",
"title": ""
},
{
"docid": "fcbcda4f79c2cf0dfac8c7640ac16e7f",
"score": "0.4917841",
"text": "def process_pxe_image_type(pxes, task)\n process_elements(pxes, PxeImageType, task)\n end",
"title": ""
},
{
"docid": "13711b16f5f3ef1d902257eea5c1420e",
"score": "0.48976234",
"text": "def parse_xml(file)\n @data_pts = Array.new\n doc = REXML::Document.new File.new(file)\n doc.elements.each('data/pt'){|pt|\n value = nil\n error = nil\n vars = Hash.new\n pt.attributes.each{|tag,val|\n\tif(tag == 'value')\n\t value = val.to_f\n\telsif(tag == 'error')\n\t error = val.to_f\n\telse\n\t vars[tag] = val.to_f\n\tend\t\n }\n @data_pts.push(DataPt.new(value,error,vars))\n }\n end",
"title": ""
},
{
"docid": "91077b1c865b483a0c3e1d1bc5abd205",
"score": "0.48939547",
"text": "def parsePhotoRequestReponseXMl\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n project = doc.root.child\n project.children.each { |shotGrp|\n if shotGrp.name == 'ShotGroup'\n puts shotGrp.name #puts node.children.first.name\n puts 'SalsifyID: ' + shotGrp['SalsifyID']\n puts 'ShotGroupStatus: ' + shotGrp['ShotGroupStatus']\n puts '------------'\n shotGrp.children.each { |image|\n puts image.name\n puts image.values\n puts '-----------'\n image.children.each { |sample|\n puts sample.name\n puts sample.values\n puts '##########'\n }\n }\n end\n }\n end\n end",
"title": ""
},
{
"docid": "6c9c989724ffd557ab2221258fd9fc88",
"score": "0.48710027",
"text": "def parse(file)\n doc = Nokogiri::XML( File.open( file ) )\n @type = doc.xpath(\"/probe/header/@type\").to_s\n @vendor = doc.xpath(\"/probe/header/@vendor\").to_s\n @services = \"<TODO>\"\n @indexes = \"<TODO>\"\n end",
"title": ""
},
{
"docid": "3f5b47c96d9062c01a91d6f5c8bd1aca",
"score": "0.48546433",
"text": "def render\n \n raise \"files not specified\" if self.files.empty?\n \n self.xml.instruct! :xml, version: \"1.0\", encoding: \"UTF-8\"\n self.xml.metalink( xmlns: \"urn:ietf:params:xml:ns:metalink\" ) do |metalink|\n \n metalink.generator(\"Sudrien/metalink-ruby 0.2.0\") #may\n metalink.origin( self.origin, dynamic: self.origin_dynamic ) if self.origin\n \n metalink.published( self.published.strftime('%FT%T%:z') ) if self.published\n metalink.updated( self.updated.strftime('%FT%T%:z') ) if self.updated\n \n self.files.each do |file|\n file.render(self, metalink)\n end\n end\n self.xml.target!\n end",
"title": ""
},
{
"docid": "12bc3a951dc449219008c7627be75a4f",
"score": "0.4852992",
"text": "def parse_thumb\n return if public_xml_doc.nil?\n\n thumb = public_xml_doc.xpath('//thumb')\n # first try and parse what is in the thumb node of publicXML, but fallback to the first image if needed\n if thumb.size == 1\n thumb.first.content\n elsif thumb.size == 0 && parse_sw_image_ids.size > 0\n parse_sw_image_ids.first\n end\n end",
"title": ""
},
{
"docid": "563da0ab5d7c1ad8f79390e88fad324b",
"score": "0.4834921",
"text": "def parse_photo_request_reponse_xml\n logger.debug('PARSING FILES.')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n begin\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n parse_xml(doc)\n rescue StandardError? => e\n logger.debug('Error is processing file ' + file + ' ' + e.message)\n next\n end\n end\n puts salsify_ids_map\n logger.debug('PARSING COMPLETED.')\n end",
"title": ""
},
{
"docid": "5c341847a3a6b97d732320869a8b3cbd",
"score": "0.4818118",
"text": "def process_file file\n ifile = ImageFile.new file, @options\n throw \"'#{file}' does not contain any image\" unless ifile.loaded?\n puts \"#{ifile.size} images loaded from #{ifile.file_name}\" if @options[:verbose]\n @files << ifile\n# new_pages = []\n ifile.images.each do |image|\n image.info\n @images << image\n# new_pages = image.analyse\n @pages += image.analyse\n image.free_data!\n image.pages.each{|page| page.free_data!}\n end\n=begin\n new_pages.each_with_index do |page, i|\n page.content.fill_invert\n page.threshold!\n page.export_data(\"page-%04d.tif\" % [@page_number_start + @pages.size*@page_number_step + @page_number_step*i])\n page.free_data!\n end\n @images.each {|img| img.free_data!}\n @pages += new_pages\n=end\n end",
"title": ""
},
{
"docid": "19aa10bc740c0431cd0dc865f63af4f2",
"score": "0.48040456",
"text": "def get_xml\n header = \"<DESIGN></DESIGN>\"\n path = 'public/users_xml/'+@visitor_id+'.xml'\n f = File.new(path, 'w+') \n f.write header \n f.close\n \n doc = Document.new File.new(path)\n root = doc.root\n \n ###Genes\n gen_bits_string = ''\n gen_bits.each do |g|\n gen_bits_string += g.to_s\n end\n \n genes = Element.new \"genes\"\n genes.attributes[\"string\"] = gen_bits_string\n \n root.add_element genes\n \n ###Colors\n foreground = Element.new \"foreground\"\n @colors.length.times do |n|\n color = Element.new \"fg_color\"\n color.attributes[\"red\"]= @colors[n].red.to_s\n color.attributes[\"green\"]= @colors[n].green.to_s\n color.attributes[\"blue\"]= @colors[n].blue.to_s\n color.attributes[\"n\"]=n.to_s\n \n foreground.add_element color\n end\n root.add_element foreground\n \n background = Element.new \"background\"\n @bg_colors.length.times do |n|\n color = Element.new \"bg_color\"\n color.attributes[\"red\"]= @bg_colors[n].red.to_s\n color.attributes[\"green\"]= @bg_colors[n].green.to_s\n color.attributes[\"blue\"]= @bg_colors[n].blue.to_s\n color.attributes[\"n\"]=n.to_s\n \n background.add_element color\n end\n root.add_element background\n \n ###Fonts\n fonts = Element.new \"fonts\"\n\n p = Element.new \"font\"\n p.attributes[\"type\"] = \"primary\"\n p.attributes[\"font\"] = @primary_font \n fonts.add_element p\n s = Element.new \"font\"\n s.attributes[\"type\"] = \"secondary\"\n s.attributes[\"font\"] = @secondary_font\n fonts.add_element s\n \n root.add_element fonts\n \n File.open(path, 'w') do |f| \n f.puts root \n end\n\n return path\n \n end",
"title": ""
},
{
"docid": "2e6dcc74e16d5b9e3204c00ea1b04031",
"score": "0.47998348",
"text": "def process_xml\n parser = Parser.new(@bigframe_home)\n @xml = parser.parse_xml\n volume = \"bigframe.datavolume\"\n path_rel = \"bigframe.data.hdfspath.relational\"\n path_graph = \"bigframe.data.hdfspath.graph\"\n path_nested = \"bigframe.data.hdfspath.nested\"\n path_text = \"bigframe.data.hdfspath.text\"\n data_variety = \"bigframe.datavariety\"\n @data_variety = \"\"\n if @data_variety_rel == \"1\"\n @data_variety = @data_variety + \"relational, \"\n end\n if @data_variety_text == \"1\"\n @data_variety = @data_variety + \"nested, \"\n end\n if @data_variety_graph == \"1\"\n @data_variety = @data_variety + \"graph\"\n end\n if @data_variety[-2] == \",\"\n @data_variety = @data_variety[0..-3]\n end\n @xml[volume] = @data_volume\n @xml[path_rel] = @data_output + \"/\" + @xml[path_rel]\n @xml[path_graph] = @data_output + \"/\" + @xml[path_graph] \n @xml[path_nested] = @data_output + \"/\" + @xml[path_nested]\n @xml[path_text] = @data_output + \"/\" + @xml[path_text]\n @xml[data_variety] = @data_variety\n parser.build_xml(@xml)\n end",
"title": ""
},
{
"docid": "42f688e4b2afd9067e99fb95fc91e01e",
"score": "0.47875237",
"text": "def read_tmx(file)\n filename = File.basename(file)\n map_name = filename.gsub('.tmx', '')\n\n tmx = File.open(file) { |f| Nokogiri::XML(f) }\n map_count = tmx.css('map').count\n map = tmx.css('map').first\n\n tiles_wide = map.attributes['width'].value.to_i\n tiles_high = map.attributes['height'].value.to_i\n\n # ========== Make sure that sucker is valid ==============\n raise \"No maps in this tmx?? #{filename}\" if map_count < 1\n raise \"More than one map in a tmx?? #{filename}\" if map_count > 1\n\n if map.attributes['orientation'].value != 'orthogonal'\n raise \"The tilemap #{filename} isn't orthogonal\"\n elsif map.attributes['tilewidth'].value != '32' || map.attributes['tileheight'].value != '32'\n raise \"The tilemap #{filename} doesn't use 32x32 tiles\"\n end\n\n # ============ Grab tilesets =============\n tilesets = []\n map.css('tileset').each do |tileset|\n attrs = tileset.attributes\n image = tileset.css('image').first # assuming one image lol...\n\n tilesets << Tileset.new(\n attrs['firstgid'].value.to_i,\n attrs['name'].value,\n attrs['tilewidth'].value.to_i,\n attrs['tileheight'].value.to_i,\n attrs['tilecount'].value.to_i,\n image.attributes['source'].value.gsub('assets/', ''),\n image.attributes['width'].value.to_i / 32\n )\n end\n # First tileset should be the one with the largest firstgid\n tilesets.sort! { |a, b| b.firstgid <=> a.firstgid }\n\n # ============== Grab layers ================\n layers = []\n found_collision_layer = false\n map.css('layer').each do |layer|\n attrs = layer.attributes\n data = layer.css('data').first # Assuming 1 data lol\n raise \"Tile encoding must be csv #{filename}\" if data.attributes['encoding'].value != 'csv'\n\n layers << Layer.new(\n attrs['name'].value.downcase.strip,\n attrs['width'].value.to_i,\n attrs['height'].value.to_i,\n data.content.split(',').map(&:to_i),\n {} # Sublayers come from multiple tilesets being used in one layer\n )\n\n if layers.last.collision?\n if found_collision_layer\n raise \"Two collision layers found in tilemap #{filename}\"\n else\n found_collision_layer = true\n end\n end\n end\n raise \"No collision layer found in tilemap #{filename} (intentional or no?)\" unless found_collision_layer\n\n # ============ Populate sublayers ============\n\n layers.each do |layer|\n layer.raw_data.each_with_index do |num, i|\n next if num == 0\n\n global_index = (num & 0x00FFFFFF)\n flags = (num & 0xFF000000) >> 24\n\n if (flags & (1 << 6)) != 0\n puts \"WARNING: #{filename} layer \\\"#{layer.name}\\\" tile #{i} is y-flipped - ignoring this flip.\"\n flags &= ~(1 << 6)\n end\n\n tileset = tilesets.find do |t|\n global_index - t.firstgid >= 0\n end\n index = global_index - tileset.firstgid\n\n layer.sublayers[tileset] ||= Sublayer.new(tileset, Array.new(layer.raw_data.size, -1), [])\n layer.sublayers[tileset].data[i] = (index | (flags << 24))\n end\n\n # Flip the sublayer data upside-down (for 0=bottom)\n layer.sublayers.values.each do |sublayer|\n new_data = sublayer.data.clone\n (0...tiles_wide).each do |x|\n (0...tiles_high).each do |y|\n new_data[y * tiles_wide + x] = sublayer.data[(tiles_high - y - 1) * tiles_wide + x]\n end\n end\n sublayer.data = new_data\n end\n\n # Compress sublayer data if necessary\n if layer.collision?\n # Collision layer should not be compressed and only have one sublayer\n raise \"collision layer has more than one tileset. #{filename}\" if layer.sublayers.size > 1\n else\n # Non-collision layers should all be compressed\n layer.sublayers.each do |tileset, sublayer|\n new_data = []\n compress_tilemap_data(sublayer.data).each do |entry|\n case entry\n when TileRepetition\n new_data += [entry.count, entry.tile_index]\n\n when TileAlternation\n new_data << -entry.count\n tile_indices = sublayer.data[entry.first_index...(entry.first_index + entry.count)]\n new_data += tile_indices\n\n else\n raise \"what\"\n end\n end\n sublayer.compressed_data = new_data\n end\n end\n end\n\n # ===== Grab imagelayers for parallax backgrounds =====\n image_layers = []\n map.css('imagelayer').each do |imagelayer|\n attrs = imagelayer.attributes\n\n struct = ImageLayer.new\n struct.name = attrs['name'].value\n struct.x = attrs['x'] ? attrs['x'].value : '0'\n struct.y = attrs['y'] ? attrs['y'].value : '0'\n struct.filename = imagelayer.css('image').first.attributes['source'].value\n\n IMAGE_LAYER_DEFAULTS.each do |field, default_value|\n if element = imagelayer.css(\"properties property[name='#{field}']\").first\n value = element.attributes['value'].value\n else\n value = default_value\n end\n struct.send(\"#{field}=\", value)\n end\n\n image_layers << struct\n end\n\n # ===== Grab object layers for whatever =====\n map_height = tiles_high.to_i * 32\n map_objects = []\n map.css('objectgroup object').each do |object|\n attrs = object.attributes\n\n struct = MapObject.new\n struct.id = attrs['id'].value\n struct.name = attrs['name'] ? attrs['name'].value : '<unnamed>'\n struct.x = (attrs['x'] ? attrs['x'].value : '0').to_i\n struct.y = map_height - (attrs['y'] ? attrs['y'].value : '0').to_i\n struct.width = (attrs['width'] ? attrs['width'].value : '0').to_i\n struct.height = (attrs['height'] ? attrs['height'].value : '0').to_i\n struct.type = attrs['type'].value.downcase.to_sym if attrs['type']\n struct.properties = {}\n\n object.css('properties property').each do |property|\n prop_attrs = property.attributes\n struct.properties[prop_attrs['name'].value] = prop_attrs['value'].value\n end\n\n map_objects << struct\n end\n\n map_options = MapOptions.new(1.15, 0.025)\n\n tmx.css('map > properties > property').each do |prop|\n attrs = prop.attributes\n\n case attrs['name'].value\n when 'gravity' then map_options.gravity = eval(attrs['value'].value)\n when 'drag' then map_options.drag = eval(attrs['value'].value)\n else puts \"UNKNOWN MAP PROPERTY #{attrs['name'].inspect}\"\n end\n end\n\n # === DONE ===\n Struct.new(:layers, :image_layers, :map_objects, :tiles_high, :tiles_wide, :name, :filename, :height, :options)\n .new( layers, image_layers, map_objects, tiles_high, tiles_wide, map_name, filename, map_height, map_options)\nend",
"title": ""
},
{
"docid": "b4ca0b155cb2fe004836a4b97fb46123",
"score": "0.47742614",
"text": "def ScrapAnalyseOneMovie(oneMovieXML)\n movie_info = {}\n \n movie_info['id'] = oneMovieXML.elements['id'].text\n movie_info['id_allocine'] = oneMovieXML.elements['id_allocine'].text\n movie_info['id_imdb'] = oneMovieXML.elements['id_imdb'].text\n movie_info['last_change'] = oneMovieXML.elements['last_change'].text\n movie_info['url'] = oneMovieXML.elements['url'].text\n movie_info['title'] = oneMovieXML.elements['title'].text\n movie_info['originaltitle'] = oneMovieXML.elements['originaltitle'].text\n movie_info['year'] = oneMovieXML.elements['year'].text\n movie_info['runtime'] = oneMovieXML.elements['runtime'].text\n movie_info['plot'] = oneMovieXML.elements['plot'].text\n \n movie_info['images'] = {}\n images = oneMovieXML.elements[\"images\"]\n if not images.nil?\n images.each_element(\"image\") do |image|\n img_id = image.attributes['id']\n img_size = image.attributes['size']\n \n if not movie_info['images'].has_key? img_id\n movie_info['images'][img_id] = {}\n end\n \n movie_info['images'][img_id]['type'] = image.attributes['type']\n if not movie_info['images'][img_id].has_key? img_size\n movie_info['images'][img_id][img_size] = {}\n end\n movie_info['images'][img_id][img_size]['url'] = image.attributes['url']\n movie_info['images'][img_id][img_size]['width'] = image.attributes['width']\n movie_info['images'][img_id][img_size]['height'] = image.attributes['height']\n end\n end\n \n movie_info['ratings'] = {}\n movie_info['ratings']['cinepassion'] = {}\n movie_info['ratings']['allocine'] = {}\n movie_info['ratings']['imdb'] = {}\n ratings = oneMovieXML.elements[\"ratings\"]\n ratings_cinepassion = ratings.elements[\"rating[@type='cinepassion']\"]\n movie_info['ratings']['cinepassion']['votes'] = ratings_cinepassion.attributes['votes']\n movie_info['ratings']['cinepassion']['value'] = ratings_cinepassion.text\n ratings_allocine = ratings.elements[\"rating[@type='allocine']\"]\n movie_info['ratings']['allocine']['votes'] = ratings_allocine.attributes['votes']\n movie_info['ratings']['allocine']['value'] = ratings_allocine.text\n ratings_imdb = ratings.elements[\"rating[@type='imdb']\"]\n movie_info['ratings']['imdb']['votes'] = ratings_imdb.attributes['votes']\n movie_info['ratings']['imdb']['value'] = ratings_imdb.text\n \n nfo_base = \"#{@siteurl}/scraper/index.php?id=#{movie_info['id']}&Download=1\"\n movie_info['nfo'] = {}\n movie_info['nfo']['Babylon'] = {}\n movie_info['nfo']['Camelot'] = {}\n nfo_babylon = \"#{nfo_base}&Version=0\"\n movie_info['nfo']['Babylon']['fr'] = \"#{nfo_babylon}&Lang=fr&OK=1\"\n movie_info['nfo']['Babylon']['en'] = \"#{nfo_babylon}&Lang=en&OK=1\"\n nfo_camelot = \"#{nfo_base}&Version=1\"\n movie_info['nfo']['Camelot']['fr'] = \"#{nfo_camelot}&Lang=fr&OK=1\"\n movie_info['nfo']['Camelot']['en'] = \"#{nfo_camelot}&Lang=en&OK=1\"\n \n return movie_info\n end",
"title": ""
},
{
"docid": "6bb4484684034428b55f1f4ecb9af45b",
"score": "0.4704339",
"text": "def read_config\n config_file = File.join(@www, 'config.xml')\n\n if File.exists?(config_file)\n require 'rexml/document'\n f = File.new config_file\n doc = REXML::Document.new(f)\n @config = {}\n @config[:id] = doc.root.attributes[\"id\"]\n @config[:version] = doc.root.attributes[\"version\"]\n @config[:icons] = {}\n defaultIconSize = 0\n doc.root.elements.each do |n|\n @config[:name] = n.text.gsub('-','').gsub(' ','') if n.name == 'name'\n @config[:description] = n.text if n.name == 'description'\n @config[:content] = n.attributes[\"src\"] if n.name == 'content'\n if n.name == 'icon'\n if n.attributes[\"width\"] == '72' && n.attributes[\"height\"] == '72'\n @config[:icons][\"drawable-hdpi\".to_sym] = n.attributes[\"src\"]\n if 72 > defaultIconSize\n @config[:icon] = n.attributes[\"src\"]\n defaultIconSize = 72\n end\n elsif n.attributes[\"width\"] == '48' && n.attributes[\"height\"] == '48'\n @config[:icons][\"drawable-mdpi\".to_sym] = n.attributes[\"src\"]\n if 48 > defaultIconSize\n @config[:icon] = n.attributes[\"src\"]\n defaultIconSize = 48\n end\n elsif n.attributes[\"width\"] == '36' && n.attributes[\"height\"] == '36'\n @config[:icons][\"drawable-ldpi\".to_sym] = n.attributes[\"src\"]\n if 36 > defaultIconSize\n @config[:icon] = n.attributes[\"src\"]\n defaultIconSize = 36\n end\n else\n @config[:icon] = n.attributes[\"src\"]\n end\n end\n\n\n if n.name == \"preference\" && n.attributes[\"name\"] == 'javascript_folder'\n @config[:js_dir] = n.attributes[\"value\"]\n end\n end\n\n # extract android specific stuff\n @config[:versionCode] = doc.elements[\"//android:versionCode\"] ? doc.elements[\"//android:versionCode\"].text : 3\n @config[:minSdkVersion] = doc.elements[\"//android:minSdkVersion\"] ? doc.elements[\"//android:minSdkVersion\"].text : 1\n # will change the name from the directory to the name element text\n @name = @config[:name] if @config[:name]\n # set the icon from the config\n @icon = File.join(@www, @config[:icon]) if @config[:icon]\n @icons = @config[:icons] if @config[:icons].length > 0\n # sets the app js dir where phonegap.js gets copied\n @app_js_dir = @config[:js_dir] ? @config[:js_dir] : ''\n # sets the start page\n @content = @config[:content] ? @config[:content] : 'index.html'\n end\n end",
"title": ""
},
{
"docid": "b745861225315c2678825c7873891f9c",
"score": "0.46980625",
"text": "def load_rop(file_path)\n f = File.open(file_path, 'rb')\n xml = REXML::Document.new(f.read(f.stat.size))\n f.close\n return xml\n end",
"title": ""
},
{
"docid": "1494f1ebfab658d02491371d24f9aa4d",
"score": "0.46963948",
"text": "def rmagik_info(file)\n puts \"- - - - - :rmagik-S\"\n puts file\n puts \">> Checking for oversized file > 430px wide\"\n img = Magick::Image::read(file).first\n puts \"Geometry: #{img.columns}x#{img.rows} - #{img.columns.class}x#{img.rows.class}\"\n\n if img.columns > 430 # resize to 430 wide\n \n scale = (430.0 / img.columns.to_f).round(6) # calculate scaling factor for image\n \n puts \"RESIZING before copying x#{scale}\"\n \n file_large = file.sub(File.extname(file), '_LRG.jpg') # copy to image_name_LRG.jpg\n FileUtils.cp( file, \"scratch/#{file_large}\")\n \n img_430 = img.scale(scale)\n \n img_430.write(file)\n \n end\n \n #img = Magick::Image::read(file).first\n #puts \" Format: #{img.format}\"\n #puts \" Geometry: #{img.columns}x#{img.rows}\"\n #puts \" Class: \" + case img.class_type\n # when Magick::DirectClass\n # \"DirectClass\"\n # when Magick::PseudoClass\n # \"PseudoClass\"\n # end\n #puts \" Depth: #{img.depth} bits-per-pixel\"\n #puts \" Colors: #{img.number_colors}\"\n #puts \" Filesize: #{img.filesize}\"\n #puts \" Resolution: #{img.x_resolution.to_i}x#{img.y_resolution.to_i} \"+\n # \"pixels/#{img.units == Magick::PixelsPerInchResolution ?\n # \"inch\" : \"centimeter\"}\"\n #if img.properties.length > 0\n # puts \" Properties:\"\n # img.properties { |name,value|\n # puts %Q| #{name} = \"#{value}\"|\n # }\n #end\n puts \"- - - - - :rmagik-E\"\nend",
"title": ""
},
{
"docid": "b00008a21ed536ee56905df0e7611831",
"score": "0.46652234",
"text": "def process_xml\n @doc.css(\"Details\").children.each do |ir8arecord|\n data_map = {}\n\n # IR8ARecord --> ESubmissionSDSC --> IR8AST\n\n ir8arecord.child.child.children.each do |data|\n data_map[data.name] = data.content\n end\n\n @xml_map << data_map\n end\n\n @xml_map\n\n end",
"title": ""
},
{
"docid": "ca5c695c84e15d302a9ec3464d9110d0",
"score": "0.4649654",
"text": "def read_pf_vf_info\n begin\n doc = REXML::Document.new \"<nicinfo/>\"\n @nic_pfs = Nic.find(:all,:conditions => [\"nic_type = ?\",\"PF\"])\n pfs_count = Nic.find(:all,:conditions => [\"nic_type = ?\",\"PF\"]).size \n #pf_num = doc.root.add_element \"pf_num\"\n #pf_num.text = pfs_count\n @nic_pfs.each do |pf|\n pf_node = doc.root.add_element \"pf\"\n \n #<bsf>00:19.0</bsf>\n pf_bsf_node = pf_node.root.add_element \"bsf\"\n pf_bsf_node.text = pf.bsf_address\n pf_node.add pf_bsf_node\n \n #<vf_num>0</vf_num>\n @nic_vfs = Nic.find(:all,:conditions => [\"nic_type = ? and vf_belongto_pf = ? \",\"VF\",pf.bsf_address])\n vfs_count = @nic_vfs.size\n vf_num_node = pf_node.root.add_element \"vf_num\"\n vf_num_node.text = vfs_count\n pf_node.add vf_num_node\n \n if vfs_count == 0\n #<vmdomid>3</vmdomid>\n @vm = Nic.find(:first,:conditions => [\"bsf_address = ? and virtual_machine_instance_id != -1 \",pf.bsf_address])\n if @vm\n vmdomid_node = pf_node.root.add_element \"vmdomid\"\n vmdomid_node.text = @vm.virtual_machine_instance_id\n pf_node.add vmdomid_node\n end \n #doc.add pf_node\n else\n @nic_vfs.each do |vf|\n #<vf>\n vf_node = pf_node.root.add_element \"vf\"\n #<bsf>02:10.3</bsf>\n vf_bsf_node = vf_node.root.add_element \"bsf\"\n vf_bsf_node.text = vf.bsf_address\n vf_node.add vf_bsf_node\n #<vmdomid>3</vmdomid>\n @vm = Nic.find(:first,:conditions => [\"bsf_address = ? and virtual_machine_instance_id != -1\",vf.bsf_address])\n if @vm\n vmdomid_node = vf_node.root.add_element \"vmdomid\"\n vmdomid_node.text = @vm.virtual_machine_instance_id\n vf_node.add vmdomid_node\n end\n pf_node.add vf_node\n end\n #doc.add pf_node\n end\n end\n #puts doc.to_s\n render :inline => doc.to_s\n rescue Exception => e\n puts \"kkk\" \n end\n end",
"title": ""
},
{
"docid": "7c9ad5a969e611af7c39ee0bb36b2f1f",
"score": "0.46289626",
"text": "def parse_fnt_file(filename)\n fontFile = File.open(filename)\n \n fontFile.each_line { |line|\n \n entries = line.split(\" \")\n \n case entries[0]\n # Info about the font\n when \"info\"\n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"size\", \"stretchH\", \"spacing\", \"outline\"\n @info[key_value[0].to_sym] = key_value[1].to_i\n when \"bold\", \"italic\", \"unicode\", \"smooth\", \"aa\"\n @info[key_value[0].to_sym] = (key_value[1].to_i == 1)\n end\n end\n \n # Info common to all characters\n when \"common\"\n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"lineHeight\", \"base\", \"scaleW\", \"scaleH\", \"pages\"\n @common[key_value[0].to_sym] = key_value[1].to_i\n when \"packed\"\n @common[key_value[0].to_sym] = (key_value[1].to_i == 1)\n end\n end\n \n # Info about the bitmap pages that contain the characters\n when \"page\"\n page = Page.new\n \n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"id\"\n page[key_value[0].to_sym] = key_value[1].to_i\n when \"file\"\n page[key_value[0].to_sym] = key_value[1].tr(\"\\\"\", \"\")\n end\n end\n \n @pages[page.id] = page\n \n # Info about individual characters\n when \"char\"\n char = Char.new\n \n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"id\", \"x\", \"y\", \"width\", \"height\", \"xoffset\", \"yoffset\", \"xadvance\", \"page\"\n char[key_value[0].to_sym] = key_value[1].to_i\n end\n end\n \n @chars[char.id] = char\n end\n }\n end",
"title": ""
},
{
"docid": "e844a582dc5fb87a235d9ed4a48e2d5f",
"score": "0.46111444",
"text": "def import_nmap_xml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_nmap_xml(args.merge(:data => data))\n\tend",
"title": ""
},
{
"docid": "89d29f0f2a7585646ab0489c40786549",
"score": "0.46088585",
"text": "def process()\n @file_info = FileInfoFile.new(@file_info_file)\n @namespace = @file_info.default_namespace\n \n namespaces_file = NamespacesFile.new(@uploads_directory, @scan_only)\n namespaces_file.add_namespace(@namespace)\n namespaces_file.write()\n @prefix = namespaces_file.prefix(@namespace)\n \n create_image_files_where_needed()\n end",
"title": ""
},
{
"docid": "c3523c5b315d4b5ced1aca3ac56a4ea6",
"score": "0.46085513",
"text": "def process_xml(xml)\n doc = REXML::Document.new xml\n @message_identifier = doc.text(\"//imsx_statusInfo/imsx_messageIdentifier\").to_s\n @code_major = doc.text(\"//imsx_statusInfo/imsx_codeMajor\")\n @code_major.downcase! if @code_major\n @severity = doc.text(\"//imsx_statusInfo/imsx_severity\")\n @severity.downcase! if @severity\n @description = doc.text(\"//imsx_statusInfo/imsx_description\")\n @description = @description.to_s if @description\n @message_ref_identifier = doc.text(\"//imsx_statusInfo/imsx_messageRefIdentifier\")\n @operation = doc.text(\"//imsx_statusInfo/imsx_operationRefIdentifier\")\n @score = doc.text(\"//readResultResponse//resultScore/textString\")\n @score = @score.to_s if @score\n end",
"title": ""
},
{
"docid": "abb585938d12b379da270941c9dcb1e2",
"score": "0.46040067",
"text": "def test_dimension_attributes_replace_values\n output = tested 'dimension_attributes_replace_values rms.jpg'\n\n assert_equal '100', output.at_css('img')['width']\n assert_equal '89', output.at_css('img')['height']\n end",
"title": ""
},
{
"docid": "3421a3c2075be89c54568764e89b3d1b",
"score": "0.46025258",
"text": "def parse_sw_image_ids\n public_xml_doc.xpath('//resource[@type=\"page\" or @type=\"image\" or @type=\"thumb\"]').map do |node|\n node.xpath('./file[@mimetype=\"image/jp2\"]/@id').map do |x|\n \"#{@druid.gsub('druid:', '')}/\" + x\n end << node.xpath('./externalFile[@mimetype=\"image/jp2\"]').map do |y|\n \"#{y.attributes['objectId'].text.split(':').last}\" + '/' + \"#{y.attributes['fileId']}\"\n end\n end.flatten\n end",
"title": ""
},
{
"docid": "5427861f2c341d921e228bda19e7cdef",
"score": "0.45957306",
"text": "def get_mediainfo_xml file\n if system(\"which #{Mediainfo.path} > /dev/null\") && File.exists?(file)\n Nokogiri::XML::Document.parse(Mediainfo.new(file).raw_response)\n end\n end",
"title": ""
},
{
"docid": "28fa7d39f99c74ad93d7527d4a6f87d8",
"score": "0.45945558",
"text": "def import_qualys_xml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_qualys_xml(args.merge(:data => data))\n\tend",
"title": ""
},
{
"docid": "bc547bc5928eb4ef8ac8948a3d5cfa00",
"score": "0.4592381",
"text": "def parse_xml\n\n raise \"parse_xml method has not been implemented in this class\"\n \n end",
"title": ""
},
{
"docid": "c1b7d6a10bfd91b1de3f97b8ff10d3f3",
"score": "0.4580019",
"text": "def process_gml\n Rails.logger.debug \"Tag #{id}: process_gml\"\n doc = gml_document\n return if doc.nil?\n\n header = (doc/'header')\n if header.blank?\n Rails.logger.error \"Tag.process_gml: no header found in GML\"\n # TODO raise exception\n return nil\n end\n\n attrs = {}\n attrs[:filename] = (header/'filename')[0].inner_html rescue nil\n\n obj = (header/'client')[0] rescue nil\n attrs[:client] = (obj/'name').inner_html rescue nil\n\n # STDERR.puts \"Tag.process_gml: #{attrs.inspect}\"\n # self.application = attrs[:client] unless attrs[:client].blank?\n self.remote_image = attrs[:filename] unless attrs[:filename].blank?\n\n return attrs\n rescue\n Rails.logger.error \"Tag.process_gml error: #{$!}\"\n return nil\n end",
"title": ""
},
{
"docid": "bed40afb706f65f32d0f577e50f91e2f",
"score": "0.4578224",
"text": "def parsePhotoRequestReponseXMl\n logger.debug(\"PARSING FILES.\")\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n begin\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n project = doc.root.child\n project.children.each do |shotGrp|\n if shotGrp.name == \"ShotGroup\"\n puts shotGrp.name\n puts \"SalsifyID: \" + shotGrp[\"SalsifyID\"]\n puts \"ShotGroupStatus: \" + shotGrp[\"ShotGroupStatus\"]\n #products[shotGrp[\"SalsifyID\"]] = shotGrp[\"ShotGroupStatus\"]\n end\n end\n rescue Exception => e\n logger.debug(\"Error is processing file \" + file + \" \" + e.message)\n next\n end\n end\n products\n logger.debug(\"PARSING COMPLETED.\")\n end",
"title": ""
},
{
"docid": "17a47a9f40938e4cf276221fda17c748",
"score": "0.45758834",
"text": "def parse(file)\n Nmap::XML.new('scan.xml') do |xml|\n xml.each_up_host do |host|\n host.each_open_port do |port|\n port.define_singleton_method(:title) do\n url = \"http://#{host.ip}:#{port.number}\"\n begin\n Mechanize.new.get(url).title\n rescue\n \"Couldn't get title.\"\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b6ebc02b5aa778514aab7af728adf7e9",
"score": "0.45717606",
"text": "def modify_file\n file_path = \"./app/views/hocr_files/_p#{self.filename}_hocr.html\"\n file = File.open(file_path, \"r\")\n data = file.read\n data = self.replace_bbox(data)\n data = self.add_image(data)\n File.open(file_path, 'w') {|f| f.write(data) }\n end",
"title": ""
},
{
"docid": "783aa5a4e5d5f7f3c975b373e4715559",
"score": "0.45663714",
"text": "def test_picture_markup\n output = tested('auto rms.jpg')\n\n assert errors_ok? output\n\n sources = output.css('source')\n ss1 = '/generated/rms-25-c87b11253.webp 25w,' \\\n ' /generated/rms-50-c87b11253.webp 50w,' \\\n ' /generated/rms-100-c87b11253.webp 100w'\n\n assert_equal ss1, sources[0]['srcset']\n assert_equal std_rms_ss, sources[1]['srcset']\n\n assert_equal 'image/webp', sources[0]['type']\n assert_equal 'image/jpeg', sources[1]['type']\n\n assert_equal rms_url, output.at_css('img')['src']\n end",
"title": ""
},
{
"docid": "3c96e646073cd315fc0e44614fb1b0f6",
"score": "0.4558063",
"text": "def process_plists\n\n Dir.glob(\"#{app.source}/**/_*.{plist,strings}\").each do |fileName|\n\n puts_cyan \"Middlemac is processing plist file #{fileName}.\"\n\n file = File.open(fileName)\n doc = Nokogiri.XML(file)\n file.close\n\n doc.traverse do |node|\n if node.text?\n node.content = node.content.gsub('{$CFBundleIdentifier}', options.Targets[options.Target][:CFBundleID])\n node.content = node.content.gsub('{$CFBundleName}', options.CFBundleName)\n end\n end\n\n dst_path = File.dirname(fileName)\n dst_file = File.basename(fileName)[1..-1]\n\n File.open(File.join(dst_path, dst_file),'w') {|f| doc.write_xml_to f}\n\n end\n end",
"title": ""
},
{
"docid": "73ce2a4b133dfed6f1022562cecdc1b8",
"score": "0.45497772",
"text": "def netdev_resxml_edit( xml ) \n return xml\n end",
"title": ""
},
{
"docid": "cd8bcea343a273ea3dc7a853c7aed1f4",
"score": "0.4545387",
"text": "def upRes(file_path)\t\n\t\toriginal_image = Magick::Image.read(file_path) { self.density = \"300.0x300.0\" }\n\t\toriginal_image.each do |image|\n\t\t\t image = image.resample(300.0, 300.0)\n\t\t\t image.write(file_path) { self.quality = 100 }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "714eba4b5747caf30c9c1c865627058c",
"score": "0.45390263",
"text": "def characterize\n fits_xml, ffprobe_xml = self.content.extract_metadata\n self.characterization.ng_xml = fits_xml\n fix_mxf_characterization!\n self.ffprobe.ng_xml = ffprobe_xml if ffprobe_xml\n self.append_metadata\n self.filename = self.label\n save unless self.new_object?\n end",
"title": ""
},
{
"docid": "3ff6d89dab01c1977064c9d529d3cd41",
"score": "0.45380285",
"text": "def XML_cleanup(_in, out)\n ycpin = XML.XMLToYCPFile(_in)\n Builtins.y2debug(\"Writing clean XML file to %1, YCP is (%2)\", out, ycpin)\n XML.YCPToXMLFile(:profile, ycpin, out)\n end",
"title": ""
},
{
"docid": "3601f9185c9002875480ea2a31178924",
"score": "0.4522987",
"text": "def process\n case filetype\n when 'PNG'\n process_png(@data)\n when 'JPG'\n process_jpg(@data)\n when 'BMP'\n process_bmp(@data)\n # The 14 byte header of the BMP is stripped off.\n @data[0, 13] = ''\n # A checksum of the new image data is also required.\n @checksum2 = image_checksum(@data, @id, @id)\n # Adjust size -14 (header) + 16 (extra checksum).\n @size += 2\n end\n end",
"title": ""
},
{
"docid": "5d753a7f94e85508ae48e4dd67bb20d3",
"score": "0.4521027",
"text": "def optimize_retina!(name, options={})\n config = versions[name]\n options[:retina] = false\n\n processors = if config.respond_to?(:processors)\n config.processors.dup\n else\n config[:uploader].processors.dup\n end\n dimensions_processor = nil\n\n ## Check if there's a resize processor to get the dimensions\n processors.each do |p|\n dimensions_processor = processors.delete(p) if p[0].to_s.scan(/resize_to_fill|resize_to_limit|resize_to_fit|resize_and_pad/).any?\n end\n\n ## Define a retina version if processor is present\n if dimensions_processor\n dimensions = dimensions_processor[1].dup\n\n width = dimensions[0] * 2\n height = dimensions[1] * 2\n\n 2.times { dimensions.delete_at(0) }\n\n dimensions.insert(0, height)\n dimensions.insert(0, width)\n\n ## Reset the processors\n if config.respond_to?(:processors)\n config.processors = []\n else\n config[:uploader].processors = []\n end\n\n ## Override version with double height and width\n version name, options do\n process dimensions_processor[0] => dimensions\n\n quality_processor = nil\n\n ## Set other processors\n processors.each do |processor|\n process processor[0] => processor[1]\n\n quality_processor = true if processor[0] == :retina_quality\n end\n\n ## Set default quality if retina_quality is not defined\n process :retina_quality => 60 if quality_processor.nil?\n\n ## Store dimensions\n process :store_retina_dimensions\n end\n end\n end",
"title": ""
},
{
"docid": "78346ccc75d02f3104751f0b183c6283",
"score": "0.4520604",
"text": "def pixel\n image_name_list = get_image_name_list ELEMENTS_PATH\n image_name_list.each { |image_name| minimize(image_name) }\n end",
"title": ""
},
{
"docid": "f41bc78ca62781f57ea9f59f122d392b",
"score": "0.45151797",
"text": "def run(filename, css); end",
"title": ""
},
{
"docid": "9020bba9eb9ea333b60da15b6317ad4b",
"score": "0.45118588",
"text": "def parse_xml(file)\n\t\tdata = []\n\t\t# Break open XML and go through nodes\n\t\tbegin\n\t\t\tfile = file_sanitizer(file)\n\t\t\tdata = XmlSimple.xml_in(file, {'ForceArray' => false })\n\t\trescue Exception => e\n\t\t\traise e\n\t\tend\n\t\tdata\n\tend",
"title": ""
},
{
"docid": "4b0994277ff01a64da8baffd50041f11",
"score": "0.4509482",
"text": "def process_xml(xml)\n doc = REXML::Document.new xml\n @message_identifier = doc.text(\"//imsx_POXRequestHeaderInfo/imsx_messageIdentifier\")\n @lis_result_sourcedid = doc.text(\"//resultRecord/sourcedGUID/sourcedId\")\n\n if REXML::XPath.first(doc, \"//deleteResultRequest\")\n @operation = DELETE_REQUEST\n elsif REXML::XPath.first(doc, \"//readResultRequest\")\n @operation = READ_REQUEST\n elsif REXML::XPath.first(doc, \"//replaceResultRequest\")\n @operation = REPLACE_REQUEST\n @score = doc.get_text(\"//resultRecord/result/resultScore/textString\")\n end\n extention_process_xml(doc)\n end",
"title": ""
},
{
"docid": "b57add71c84b245c5d29863dca9df565",
"score": "0.45053285",
"text": "def graphic(number)\n File.open(\"#{frame_id(number)}.svg\", \"w\") do |file|\n file.write render(\"bit101_style.erb\")\n end\n\n system(\"convert #{frame_id(number)}.svg #{frame_id(number)}.jpg\")\n # system(\"java -jar ~/Downloads/batik-1.7/batik-rasterizer.jar #{frame_id(number)}.svg\")\n File.unlink(\"#{frame_id(number)}.svg\")\n\n print \"+\"\nend",
"title": ""
},
{
"docid": "2e505d7d88c9db8f23e4393c2722caf5",
"score": "0.4497959",
"text": "def meta_file(url)\n Nokogiri::XML(open(url + '.meta4'))\n end",
"title": ""
},
{
"docid": "03bf3965165d9920e8f37ed44c343443",
"score": "0.44737256",
"text": "def parse_file(with_z, with_m)\n data = @gpx.read\n @file_mode = data =~ /trkpt/ ? '//trkpt' : (data =~ /wpt/ ? '//wpt' : '//rtept')\n Nokogiri.HTML(data).search(@file_mode).each do |tp|\n z = z.inner_text.to_f if with_z && z = tp.at('ele')\n m = m.inner_text if with_m && m = tp.at('time')\n @points << GeoRuby::SimpleFeatures::Point.from_coordinates([tp['lon'].to_f, tp['lat'].to_f, z, m], 4326, with_z, with_m)\n end\n close\n @record_count = @points.length\n envelope\n rescue => e\n raise MalformedGpxException.new(\"Bad GPX. Error: #{e}\")\n # trackpoint.at(\"gpxdata:hr\").nil? # heartrate\n end",
"title": ""
},
{
"docid": "ed59bc1e901819f7bd733e63126fad89",
"score": "0.44661263",
"text": "def resize_retina_image(image_filename)\n \n image_name = File.basename(image_filename)\n \n image = Magick::Image.read(image_filename).first # Read the image\n new_image = image.scale(SCALE_BY)\n \n if new_image.write(image_filename) # Overwrite image file\n puts \"Resizing Image (#{SCALE_BY}): #{image_name}\"\n else\n puts \"Error: Couldn't resize image #{image_name}\"\n end\n \nend",
"title": ""
},
{
"docid": "05f6d49c7107cf88c964f5497e13c051",
"score": "0.44597352",
"text": "def xml\n File.read(\"#{@file_path}.xml\")\n end",
"title": ""
},
{
"docid": "381716e33141a14367c1cf738d1c3570",
"score": "0.44596183",
"text": "def cleanup_xml\n return nil unless xml\n xml.gsub!(/<EFFICIENCY>-<\\/EFFICIENCY>/, '<EFFICIENCY>0.0</EFFICIENCY>')\n end",
"title": ""
},
{
"docid": "7c3ddf29d6a2f6305bb52a8c2b483d91",
"score": "0.4458898",
"text": "def replace_image_tags(xml_text)\n doc = Nokogiri::XML(xml_text)\n doc.xpath(\"//image\").each { |c| c.name = \"seed_image\" }\n return doc.to_xml\n end",
"title": ""
},
{
"docid": "f570564931e57048c52635eaf163519e",
"score": "0.44414285",
"text": "def parse_std(doc,root_tag)\n data = [[]]\n i = 0\n doc.elements.each(\"r#{root_tag}/#{root_tag}\") {|element|\n # Single entries\n data[i][0] << element.attributes[\"id\"]\n data[i][1] << element.attributes[\"name\"]\n data[i][2] << element.attributes[\"desc_id\"]\n data[i][3] << element.attributes[\"worth\"]\n data[i][4] << element.attributes[\"weight\"]\n data[i][5] << element.attributes[\"sockets\"]\n data[i][6] << element.attributes[\"rhand\"]\n data[i][7] << element.attributes[\"rarity\"]\n data[i][8] << element.attributes[\"material\"]\n data[i][9] << element.attributes[\"set_index_id\"]\n\n # Multiple entries\n data[i][10] << element.attributes[\"stat_index\"].scan(/[^,]+/)\n data[i][11] << element.attributes[\"stat_change_index\"].scan(/[^,]+/)\n data[i][12] << element.attributes[\"stat_change_value\"].scan(/[^,]+/)\n data[i][13] << element.attributes[\"char_usage_index\"].scan(/[^,]+/)\n data[i][14] << element.attributes[\"script_event_id\"].scan(/[^,]+/)\n data[i][15] << element.attributes[\"element_change_index\"].scan(/[^,]+/)\n data[i][16] << element.attributes[\"element_change_value\"].scan(/[^,]+/)\n \n # Animations\n data[i][17] << element.attributes[\"user_animation_loop\"]\n\n # Path\n data[i][18] << element.attributes[\"icon_path\"]\n i += 1\n }\n return data\n end",
"title": ""
},
{
"docid": "e266f175b79ded22d5b0de7423f5407e",
"score": "0.44268027",
"text": "def parse(doc)\n mime = doc.properties[:mime_type]\n pdoc = PlanR::ParsedDocument.new(name, doc)\n begin\n ['text/html', 'application/xhtml+xml'].include?(mime) ?\n parse_html(pdoc, doc.contents) :\n parse_xml(pdoc, doc.contents)\n rescue Exception => e\n $stderr.puts 'Nokigiri :parse_doc Exception: ' + e.message\n $stderr.puts e.backtrace[0..5].join(\"\\n\")\n end\n pdoc\n end",
"title": ""
},
{
"docid": "226afdbb83dea4fac02bae53b5a1d3cb",
"score": "0.44023508",
"text": "def process_xml(string)\n xml_processor_helper(create_document(string))\nend",
"title": ""
},
{
"docid": "6290236a720656bd81a902e2da8cc71b",
"score": "0.43988952",
"text": "def parse_process_xml (xml)\n\n elt = REXML::Document.new(xml).root\n elt = elt.owfe_first_elt_child 'paused'\n\n {\n :paused => (elt.text.downcase == 'true')\n }\n end",
"title": ""
},
{
"docid": "d04d1f9f6e161f2882347959efc121f8",
"score": "0.4380013",
"text": "def mediainfo_run! filename, mediainfo_object\n command = \"#{mediainfo_path_verified} '#{filename}' --Output=XML\"\n raw_xml_response = `#{command} 2>&1`\n unless $? == 0\n raise RuntimeError, \"Execution of `#{command}` failed: #{raw_xml_response.inspect}\"\n end\n parse! raw_xml_response, mediainfo_object\n end",
"title": ""
},
{
"docid": "bcdeee69bd95092d3ca2a39b1cab9a85",
"score": "0.43756405",
"text": "def render_xml\n end",
"title": ""
},
{
"docid": "91ac21e93e0f6dcb73bc665029fe9406",
"score": "0.43661386",
"text": "def proteinInfo2hash (xmlRes)\n\n#\t\txmlDoc = Document.new xmlRes\n#\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\txmlDoc = Nokogiri::XML(xmlRes)\n\t\tentries = xmlDoc.css('uniprot > entry')\n# just take the very first entry\n\t\tmain_entry = entries.first\n\n\t\trecommended_name = main_entry.css('protein > recommendedName > fullName').collect {\n\t\t\t|node| node.text\n\t\t}\n\t\tsynonyms = main_entry.css('protein > alternativeName > fullName').collect {\n\t\t\t|alt_name| alt_name.text\n\t\t}\n\t\tkeywords = main_entry.css('keyword').collect { |keyw| keyw.text }\n\n\t\torganism = main_entry.css('organism > name').collect { |org|\n\t\t\tif org['type'] == 'scientific' then org.text end\n\t\t}\n\t\tfunction = main_entry.css(\"comment[type='function']\").collect { |func|\n\t\t\tfunc.text\n\t\t}\n\t\tlocation = main_entry.css(\"comment[type='subcellular location'] > subcellularLocation > location\").collect { |loc|\n\t\t\tloc.text\n\t\t}\n\n\t\tmolWeight = nil\n\t\tseqLength = nil\n\t\tseq = nil\n\t\tmain_entry.css(\"/sequence\").collect { |theSeq|\n\t\t\tmolWeight = theSeq.attributes['mass'].value\n\t\t\tseqLength = theSeq.attributes['length'].value\n\t\t\tseq = theSeq.text\n\t\t}\n\n# the very first pdb reference is got. a comparison based on resolution can improve the choice\n\t\tpdbs = main_entry.css(\"dbReference[type='PDB']\").collect { |pdb|\n\t\t\tpdb\n\t\t}\n\t\tpdbNodeMalformed = false\n\t\tpdbs.each { |node|\n\t\t\tresolution = node.css(\"property[type='resolution']\")\n\t\t\tif resolution.nil? || resolution.length == 0 then\n\t\t\t\tpdbNodeMalformed = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\t\tif pdbs.empty? == false && pdbNodeMalformed == false\n# sort by value resolution to get the element with lowes resolution value\n\t\t\tpdbs = pdbs.sort_by{ |node|\n\t\t\t\tnode.css(\"property[type='resolution']\").first['value']\n\t\t\t}\n\t\tend\n\n\n\t\tpdbResult = ''\n\t\tif pdbs.empty? == false\n\t\t\tpdbResult = 'http://www.pdb.org/pdb/explore/explore.do?structureId='\n#\t\t\tpdbResult += pdbs[0].css(\"property[type='resolution']\").first['value']\n\t\t\tpdbResult += pdbs[0].attributes['id'].value\n\t\tend\n\t\thash_result = Hash.new\n\t\thash_result[:target_name] = \"#{recommended_name[0]} (#{organism[0]})\"\n\t\thash_result[:target_type] = 'PROTEIN'\n\t\thash_result[:description] = recommended_name[0]\n\t\thash_result[:synonyms] = synonyms.join('; ')\n\t\thash_result[:organism] = organism[0]\n\t\thash_result[:keywords] = keywords.join('; ')\n\t\thash_result[:cellularLocations] = location.join('; ')\n\t\thash_result[:molecularWeight] = molWeight\n\t\thash_result[:numberOfResidues] = seqLength\n\t\thash_result[:sequence] = seq\n\t\thash_result[:specificFunction] = function.join('; ')\n\t\thash_result[:pdbIdPage] = pdbResult\n\t\thash_result[:theoreticalPi] = nil\n\n\t\thash_result\n\tend",
"title": ""
},
{
"docid": "6824d14376a566bd8cbdd5825555c1d0",
"score": "0.4361747",
"text": "def fix_sources doc, srcdir, destdir, serverdir, tag='img', attr='src', &bl\n\tputs \"\\tFixing #{tag} tags' #{attr} attribute\"\n\n\ttags = doc.css(tag)\n\tpostregex = %r{https?://[^/]*posterous.com/}\n\ttags.each do |img|\n\t\tnext unless img[attr] =~ postregex\n\n\t\tshortname = img[attr].split('/').last.split('.scaled').first\n\t\text = shortname.split('.').last.downcase\n\t\tputs \"\\t#{tag}: #{shortname}\"\n\n\t\tif block_given?\n\t\t\timg[attr] = yield img, img[attr]\n\t\telse\n\t\t\tif srcdir == nil\n\t\t\t\t# Download the file\n\t\t\t\tputs \"\\t\\tDownloading #{shortname}\"\n\t\t\t\tFile.open(File.join(destdir, shortname), \"w\") do |file|\n\t\t\t\t\tfile.write(URI.parse(img[attr]).read)\n\t\t\t\tend\n\t\t\t\tin_img = shortname\n\t\t\telse\n\t\t\t\t# Find matching files\n\t\t\t\tmatches = Dir.entries(srcdir).select {|imgfile|\n\t\t\t\t\timgfile.downcase.end_with?(ext) &&\n\t\t\t\t\t\timgfile.gsub(/\\s+/, '_').include?(shortname.split('.').first)\n\t\t\t\t}\n\n\t\t\t\tif matches.length == 0\n\t\t\t\t\tmatches = Dir.entries(srcdir).select {|imgfile|\n\t\t\t\t\t\timgfile.gsub(/\\s+/, '_').include?(shortname.split('.').first)\n\t\t\t\t\t}\n\t\t\t\t\tif matches.length == 0\n\t\t\t\t\t\tputs \"\\n\\n\\n########\\nNo match found for #{img[attr]} in #{srcdir}\\n########\\n\\n\"\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif matches.length > 1\n\t\t\t\t\treduced = matches.select {|imgfile|\n\t\t\t\t\t\timgfile.include?(shortname)\n\t\t\t\t\t}\n\t\t\t\t\tif reduced.length == 1\n\t\t\t\t\t\tmatches = reduced\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"\\n\\n\\n########\\nMore than one match found for #{shortname}:\"\n\t\t\t\t\t\tputs matches\n\t\t\t\t\t\tputs \"You will need to double-check #{tag} tags in #{filename}\\n\\n\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tin_img = matches.first\n\n\t\t\t\tputs \"\\t\\tUsing #{in_img} for #{shortname}\"\n\n\t\t\t\t# Copy the file into the destination directory\n\t\t\t\tFileUtils.cp(File.join(srcdir, in_img), destdir)\n\t\t\tend\n\n\t\t\t# Update the tag's attribute\n\t\t\timg[attr] = EscapeUtils.escape_uri(File.join(serverdir, in_img))\n\t\tend\n\n\t\t# Remove a link wrapping the image, if one exists\n\t\tparent = img.parent\n\t\tif parent.node_name == 'a' && parent['href'] =~ postregex\n\t\t\tputs \"\\t\\tRemoving parent link: #{parent['href']}\"\n\t\t\tparent.replace(img)\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "535a41cf9a5140714fd1135d158b55f4",
"score": "0.4361064",
"text": "def import_nmap_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_nmap_xml(args.merge(:data => data))\n end",
"title": ""
},
{
"docid": "ed34c31a3083a11ccd44e686f9d90ab0",
"score": "0.43604118",
"text": "def parse_xml xml_doc\n return nil if xml_doc.at(\"title\").nil?\n @id = id\n\n %w[title description upload_date number_of_likes number_of_plays width height number_of_comments url duration].each do |attribute|\n instance_variable_set(\"@#{attribute}\", xml_doc.at(attribute).inner_html)\n end\n\n @owner = User.new\n %w[id username display_name is_plus is_staff profileurl realname username videosurl].each do |attribute|\n @owner.instance_variable_set(\"@#{attribute}\", xml_doc.at(\"owner\").attributes[attribute])\n end\n\n (xml_doc/:thumbnail).each do |thumbnail|\n @thumbs << build_thumbnail(thumbnail)\n end\n end",
"title": ""
},
{
"docid": "1c3763ac7a1e2555c640704e7ac8dd3b",
"score": "0.43572772",
"text": "def parse_file_to_ar(f)\n pp_ok \"STARTING PARSE for file #{f}...\"\n\n @doc = Nokogiri::XML(File.open(f), 'UTF-8') do |config|\n config.options = Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NOBLANKS\n end\n\n # Extend name space to include METS\n # couldn't get the following to work\n # example: node.xpath('.//foo:name', {'foo' => 'http://example.org/'})\n # example: node.xpath('.//xmlns:name', node.root.namespaces)\n # my try: puts @doc.xpath(\"xmlns:METS\", {\"METS\" => \"http://www.loc.gov/METS/\"})\n\n # The following actually modifies the xml, which we don't want. But it works.\n ns = @doc.root.add_namespace_definition(\"xmlns:METS\", \"http://www.loc.gov/METS/\")\n\n\n\n pp_ok \"Current file is: #{f}\"\n # issue information -------------\n # note: issue_id is autoincremented by the db\n # and we will want to select it from the last row created\n\n pp_ok \"ISSUE INFO:\"\n hathitrust = @doc.xpath(\"//MODS:identifier[@type='hathitrust']/text()\").to_s\n pp_ok \"hathitrust value is #{hathitrust}\"\n\n volume = @doc.xpath(\"//MODS:detail[@type='volume']/MODS:number/text()\").to_s\n pp_ok \"volume value is #{volume}\"\n\n issue_no = @doc.xpath(\"//MODS:detail[@type='issue']/MODS:number/text()\").to_s\n pp_ok \"issues value is #{issue_no}\"\n\n edition = @doc.xpath(\"//MODS:detail[@type='edition']/MODS:number/text()\").to_s\n pp_ok \"edition value is #{edition}\"\n\n date_issued = @doc.xpath(\"//MODS:dateIssued/text()\").to_s\n pp_ok \"dateIssued value is #{date_issued}\"\n\n newspaper = @doc.xpath(\"/METS:mets/@LABEL\").to_s\n newspaper = newspaper.split(\",\").first.strip\n pp_ok \"newspaper is #{newspaper}\"\n\n\n issue_id = add_data_issue_ar(hathitrust, volume, issue_no, edition, date_issued, newspaper)\n\n pp_ok \"ISSUE ID IS: #{issue_id}\"\n\n # page information -------------\n # note: page_id is autoincremented by the db\n\n pages_target = \"//METS:structMap/METS:div[@TYPE='np:issue'][@DMDID='issueModsBib']/METS:div[@TYPE='np:page']\"\n\n pages = @doc.xpath(pages_target)\n\n @doc.xpath(pages_target).each do |node|\n\n pp_ok \"PAGE INFO:\"\n\n pp_ok \"issue_id value is #{issue_id}\"\n\n page_no = node.xpath(\"@ORDERLABEL\").to_s\n pp_ok \"page_no value is #{page_no}\"\n\n sequence = node.xpath(\"@ORDER\").to_s.to_i\n pp_ok \"sequence value is #{sequence}\"\n\n text_link = node.xpath(\"METS:mptr[1]/@xlink:href\").to_s\n pp_ok \"text_link value is #{text_link}\"\n\n img_link = node.xpath(\"METS:mptr[2]/@xlink:href\").to_s\n pp_ok \"img_link value is #{img_link}\"\n\n add_data_page_ar(issue_id, page_no, sequence, text_link, img_link)\n\n end # each\n\n pp \"File #{f} processed\"\n\n end",
"title": ""
},
{
"docid": "9ddaac16b9989d8de84094ac9e8ea653",
"score": "0.43565792",
"text": "def resize\n check_page_element(params) do |page_element|\n page_element.\n update_attributes({ :x => params[:x], :y => params[:y], \n :width => params[:width], :height => params[:height],\n :z_index => params[:z_index]})\n end\n end",
"title": ""
},
{
"docid": "0c527900239d20006d3573326a8c958f",
"score": "0.43516764",
"text": "def save_file(xml)\n\t\tFile.open(Rails.root.to_s + '/public/system/rsm.xml', \"w+\") do |f|\n\t\t\tf.write(xml)\t\n\t\tend\t\t\n\tend",
"title": ""
},
{
"docid": "8b195897c6e061320a10ac7f44f6ecdb",
"score": "0.43499723",
"text": "def get_xml\n @link += \"&maxwidth=\" + @options[:maxwidth] if @options[:maxwidth]\n @link += \"&maxheight=\" + @options[:maxheight] if @options[:maxheight]\n xml = Nokogiri::XML(open(@link))\n xml.xpath('/oembed').children.each do |row|\n self[row.name] = row.text\n end\n end",
"title": ""
},
{
"docid": "f4729f31a9db2ebbaf4e787c9e419bcf",
"score": "0.43485314",
"text": "def read_XML_file(xfile)\n result_array = []\n if File.file?(xfile)\n puts \"\\n\\nOPENING #{xfile}\"\n f = File.open(xfile)\n doc = Nokogiri::XML(f)\n if is_squish?(doc)\n result_array = squish_parser(doc)\n else\n result_array = rspec_parser(doc)\n end\n else\n puts \"\\nNot a file: #{xfile} - verify options (-x for directory, -f for a specific file)\"\n end\n return result_array \n end",
"title": ""
},
{
"docid": "b30de945a0b0646ad5e119daf6b0c6df",
"score": "0.43384442",
"text": "def parse_xml(pdoc, data)\n # TODO: DTD, etc\n src = ::Nokogiri::XML(data)\n extract_plaintext(src.root, pdoc)\n pdoc.content_type=\"application/xml; charset=#{src.encoding}\"\n end",
"title": ""
},
{
"docid": "cd0cd6cde535338959839005eadb115a",
"score": "0.43260503",
"text": "def content_preprocess(size=nil)\n return content if size.nil? || content.blank?\n\n doc = Nokogiri.HTML(content)\n\n if !doc.nil?\n doc.search('img').each do |img|\n img_src = img.attributes['src'].value\n image_name = img_src.split('/').last\n\n if !URI.parse(img_src).path.nil?\n image_path = URI.parse(img_src).path.gsub!(image_name, '')\n img_src.gsub!(image_name, '')\n\n if resize(File.join(Rails.public_path, image_path), image_name, size)\n img.attributes['src'].value = \"#{img_src}thumbnails/#{id}/#{size}_#{image_name}\"\n end\n end\n end\n\n doc.at(\"body\").inner_html\n end\n end",
"title": ""
},
{
"docid": "b60560983b820e156a7e95f2f6f1eef9",
"score": "0.43158126",
"text": "def test_more\n xmlsource = fixture_path(\"testsrc.xml\")\n xpathtests = fixture_path(\"xp.tst\")\n\n doc = File.open(xmlsource) {|f| REXML::Document.new(f) }\n #results = \"\"\n results = REXML::Document.new\n results.add_element \"test-results\"\n File.foreach(xpathtests) do |line|\n line.strip!\n begin\n doc.root\n #puts \"#\"*80\n #print \"\\nDoing #{line} \" ; $stdout.flush\n doc.elements.each(line) do |el|\n #print \".\" ; $stdout.flush\n results.root << el.clone\n #results << el.to_s\n end\n #ObjectSpace.garbage_collect\n GC::start\n rescue Exception => z\n #puts \"\\n'#{line}' failed\"\n fail(\"Error on line #{line}:\\n#{z.message}\\n\"+z.backtrace[0,10].join(\"\\n\"))\n #results.root.add_element( \"error\", {\"path\"=>line}).text = z.message+\"\\n\"+z.backtrace[0,10].join(\"\\n\")\n #results << \"<error path='\"+line+\"'>\"+z.message+\"</error>\"\n end\n end\n end",
"title": ""
},
{
"docid": "898b8f7a4b70373505561484ae9ad877",
"score": "0.43122983",
"text": "def import_nexpose_simplexml_file(args={})\n\t\tfilename = args[:filename]\n\t\twspace = args[:wspace] || workspace\n\n\t\tf = File.open(filename, 'rb')\n\t\tdata = f.read(f.stat.size)\n\t\timport_nexpose_simplexml(args.merge(:data => data))\n\tend",
"title": ""
},
{
"docid": "f325ba1a4cb1b45c8fb96f279bb251ab",
"score": "0.43092677",
"text": "def metadata_xml\n Nokogiri::XML(original_file.content)\n end",
"title": ""
},
{
"docid": "e7e393eb8744decb38e9971beb50cdcc",
"score": "0.4309033",
"text": "def process_contents\n @img_tags = @contents.xpath( '//img[@src]' )\n @img_tags.each do |tag|\n download_resource(File.join('http://wiki.dublincore.org', tag[:src]), File.join(@image_dir, File.basename(tag[:src])))\n end\n find_links\n end",
"title": ""
},
{
"docid": "26f8248653755dae48b67d5a6290543a",
"score": "0.43059582",
"text": "def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n raw_xml = File.read(file_path)\n\n # Parse raw_xml using Nokogiri.\n parsed_doc = Nokogiri.XML(raw_xml)\nend",
"title": ""
},
{
"docid": "279cf1566271155939a2991089f88aff",
"score": "0.43054557",
"text": "def read_xml(xml)\n REXML::Document.new(File.read(xml)).root\nend",
"title": ""
},
{
"docid": "c2da249fc69c5203c5769a73751d2dcb",
"score": "0.42996952",
"text": "def process_png(data)\n @type = 6 # Excel Blip type (MSOBLIPTYPE).\n @width = data[16, 4].unpack(\"N\")[0]\n @height = data[20, 4].unpack(\"N\")[0]\n end",
"title": ""
},
{
"docid": "3dc83ff04e6adff726ddb7a948c4fddf",
"score": "0.42990845",
"text": "def draw(stream)\n @xml = Builder::XmlMarkup.new(:target=>stream, :indent=>2)\n @xml.instruct!\n @xml.declare! :DOCTYPE, :svg, :PUBLIC, \"-//W3C//DTD SVG 1.1//EN\", \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"\n @xml.svg(:width=>\"#{PHYSICAL_WIDTH}#{PHYSICAL_UNITS}\",\n :height=>\"#{PHYSICAL_HEIGHT}#{PHYSICAL_UNITS}\",\n :viewBox=>\"#{MIN_X} #{MIN_Y} #{WIDTH} #{HEIGHT}\",\n :xmlns=>NAMESPACE,\n :version=>VERSION) do |page|\n @slist.each_with_index do |series, i|\n page.g(:transform=>\"translate(#{MARGIN}, #{i * @spacing})\") do |panel|\n panel.g(:transform=>\"scale(#{@yscale})\") do |caption|\n caption.text(:x=>\"-#{TSIZE}\",\n :y=>\"#{MARGIN}\",\n :'font-size'=>\"#{TSIZE}\",\n :'font-family'=>\"Verdana\",\n :'text-anchor'=>\"end\") do |textlabel|\n textlabel.text! series.name\n end\n end\n widthscale = Float(WIDTH - MARGIN)/series.total\n boxdepth = DEPTH/widthscale\n panel.g(:transform=>\"scale(#{widthscale})\") do |core|\n core.rect(:x=>\"0\", :y=>\"0\", :width=>\"#{series.total}\", :height=>\"#{boxdepth}\", :fill=>\"goldenrod\")\n cx = (-series.offset).to_s\n series.rings.inject(0) do |x, ring|\n ring_width, ring_start = ring\n ew_width = 0.75 * ring_width\n r_e, r_w = ring_start + ew_width, ring_start + ring_width\n p_a_x, p_b_x = x + ew_width, x + ring_width\n data = \"M#{p_a_x},0 H#{p_b_x} A#{r_w},#{r_w} 0 0,1 \"\n data << case\n when r_w <= boxdepth\n p_c_y, p_d_y = Math.sqrt(r_w**2 - series.offset**2), Math.sqrt(r_e**2 - series.offset**2)\n \"0,#{p_c_y} V#{p_d_y} A#{r_e},#{r_e} 0 0,0 \"\n when r_e > boxdepth && Math.sqrt(r_e**2 - boxdepth**2) > series.offset\n p_c_x, p_d_x = Math.sqrt(r_w**2 - boxdepth**2) - series.offset, Math.sqrt(r_e**2 - boxdepth**2) - series.offset\n \"#{p_c_x},#{boxdepth} H#{p_d_x} A#{r_e},#{r_e} 0 0,0 \"\n when Math.sqrt(r_w**2 - boxdepth**2) <= series.offset\n p_c_y, p_d_y = Math.sqrt(r_w**2 - series.offset**2), Math.sqrt(r_e**2 - series.offset**2)\n \"0,#{p_c_y} V#{p_d_y} A#{r_e},#{r_e} 0 0,0 \"\n else\n p_c_x, = Math.sqrt(r_w**2 - boxdepth**2) - series.offset\n p_d_y = Math.sqrt(r_e**2 - series.offset**2)\n \"#{p_c_x},#{boxdepth} H0 V#{p_d_y} A#{r_e},#{r_e} 0 0,0 \"\n end\n data << \"#{p_a_x},0 Z\"\n core.path(:d=>data, :'stroke'=>\"none\", :fill=>\"saddlebrown\")\n p_b_x\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a87799e029b8d9f6c792e059f57fdb78",
"score": "0.42966613",
"text": "def to_xml_file(path, &block)\n\n yield(:status, STATUS_START, \"report\") if block_given?\n extract_target_entries\n report_file = ::File.open(path, \"wb\")\n\n report_file.write %Q|<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n|\n report_file.write %Q|<MetasploitV5>\\n|\n report_file.write %Q|<generated time=\"#{Time.now.utc}\" user=\"#{myusername}\" project=\"#{myworkspace.name.gsub(/[^A-Za-z0-9\\x20]/n,\"_\")}\" product=\"framework\"/>\\n|\n\n yield(:status, STATUS_START, \"hosts\") if block_given?\n report_file.write %Q|<hosts>\\n|\n report_file.flush\n extract_host_info(report_file)\n report_file.write %Q|</hosts>\\n|\n\n yield(:status, STATUS_START, \"events\") if block_given?\n report_file.write %Q|<events>\\n|\n report_file.flush\n extract_event_info(report_file)\n report_file.write %Q|</events>\\n|\n\n yield(:status, STATUS_START, \"services\") if block_given?\n report_file.write %Q|<services>\\n|\n report_file.flush\n extract_service_info(report_file)\n report_file.write %Q|</services>\\n|\n\n yield(:status, STATUS_START, \"web sites\") if block_given?\n report_file.write %Q|<web_sites>\\n|\n report_file.flush\n extract_web_site_info(report_file)\n report_file.write %Q|</web_sites>\\n|\n\n yield(:status, STATUS_START, \"web pages\") if block_given?\n report_file.write %Q|<web_pages>\\n|\n report_file.flush\n extract_web_page_info(report_file)\n report_file.write %Q|</web_pages>\\n|\n\n yield(:status, STATUS_START, \"web forms\") if block_given?\n report_file.write %Q|<web_forms>\\n|\n report_file.flush\n extract_web_form_info(report_file)\n report_file.write %Q|</web_forms>\\n|\n\n yield(:status, STATUS_START, \"web vulns\") if block_given?\n report_file.write %Q|<web_vulns>\\n|\n report_file.flush\n extract_web_vuln_info(report_file)\n report_file.write %Q|</web_vulns>\\n|\n\n yield(:status, STATUS_START, \"module details\") if block_given?\n report_file.write %Q|<module_details>\\n|\n report_file.flush\n extract_module_detail_info(report_file)\n report_file.write %Q|</module_details>\\n|\n\n\n report_file.write %Q|</MetasploitV5>\\n|\n report_file.flush\n report_file.close\n\n yield(:status, STATUS_COMPLETE, \"report\") if block_given?\n\n report_file.path\n end",
"title": ""
},
{
"docid": "63e2bcd2d1f4ba2da7adaee728b49726",
"score": "0.42963848",
"text": "def initialize(filename)\n @metadata = {}\n @char_metrics = {}\n @char_metrics_by_code = {}\n @kern_pairs = []\n File.open(filename) do |file|\n mode = :meta\n file.each_line do |line|\n case(line)\n when /^StartFontMetrics/ ; mode = :meta\n when /^StartCharMetrics/ ; mode = :char_metrics\n when /^EndCharMetrics/ ; mode = :meta\n when /^StartKernData/ ; mode = :kern_data\n when /^StartKernPairs/ ; mode = :kern_pairs\n when /^EndKernPairs/ ; mode = :kern_data\n when /^EndKernData/ ; mode = :meta\n else\n case(mode)\n when :meta\n if match = line.match(/^([\\w]+) (.*)$/)\n @metadata[match[1]] = match[2]\n end\n when :char_metrics\n metrics = {}\n metrics[:charcode] = match[1].to_i if match = line.match(/C (-?\\d+) *?;/)\n metrics[:wx] = match[1].to_i if match = line.match(/WX (-?\\d+) *?;/)\n metrics[:name] = match[1] if match = line.match(/N ([.\\w]+) *?;/)\n if match = line.match(/B (-?\\d+) (-?\\d+) (-?\\d+) (-?\\d+) *?;/)\n metrics[:boundingbox] = [match[1].to_i, match[2].to_i, match[3].to_i, match[4].to_i] \n end\n @char_metrics[metrics[:name]] = metrics if metrics[:name]\n @char_metrics_by_code[metrics[:charcode]] = metrics if metrics[:charcode] && metrics[:charcode] > 0\n when :kern_pairs\n if match = line.match(/^KPX ([.\\w]+) ([.\\w]+) (-?\\d+)$/)\n @kern_pairs << [match[1], match[2], match[3].to_i]\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "87a64f8de0a1e10e82e07b486ac0882b",
"score": "0.42960328",
"text": "def nokogiri_xml(file_path)\n Nokogiri::XML(File.open(file_path), nil, 'UTF-8')\n end",
"title": ""
},
{
"docid": "24550b639488673ccf51a09f748031bf",
"score": "0.42838874",
"text": "def process\n format = directives.fetch(:format, 'jpg')\n encode_file(format, directives)\n end",
"title": ""
},
{
"docid": "dc019ffe298d2dd8af33f9815b12e6a7",
"score": "0.42787072",
"text": "def parse_page(doc)\n\t\t @hashes.tags_weights.each do |tag, weight|\n\t\t\t doc.xpath(\"//#{tag}\").each do |node|\n\t\t\t\t\tparse_node(node.text, weight) \n\t\t\t\tend\n\t\t end\n\t\t @hashes.special_tags_weights.each do |tag, desc_weight|\n\t\t \tdoc.xpath(\"//#{tag}\").each do |node|\n\t\t \t parse_node(node.attr(desc_weight[0]), desc_weight[1])\n\t\t \tend\n\t\t end\n\t\tend",
"title": ""
},
{
"docid": "92967e6543f6382b4811402fde94cf0a",
"score": "0.4278164",
"text": "def moddify_document(path)\n doc = nil\n File.open(path,'r+') do | file|\n xml_string = file.read\n doc = process_xml(xml_string) if valid_xml?(xml_string)\n end\n doc\nend",
"title": ""
},
{
"docid": "4d33f0376475e8c0318b11079a2e5979",
"score": "0.4269063",
"text": "def extract(file,myurl)\n STDERR.puts \"# Scanning: #{myurl} via file:#{file}\"\n doc=\"\"\n dct='http://purl.org/dc/terms/'\n # rdf = \"<dc:Document rdf:about='#{myurl}' xmlns:dc='http://purl.org/dc/terms/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\\n\"\n nt = ''\n File.read(file).each do |x| \n doc += x\n end\n doc.gsub!(/\\n/, \"\")\n doc.gsub!(/\\s+/, \" \")\n\n if (doc =~ /<title>\\s*([^<]*)\\s*<\\/title>/) \n # puts \"title: #{$1}\"\n t = $1\n t.gsub!(/\\s*$/,\"\")\n nt += \"<#{myurl}> <#{dct}title> \\\"#{t}\\\" . \\n\"\n end\n doc.scan(/<meta name=\"([^\"]*)\" con∫tent=\"([^\"]*)\"\\s*\\/>/) do\n p=$1\n v=$2\n p.downcase!\n puts \"#{p}: #{v}\" \n end\n doc.scan(/<div\\s+class=\"arr\">\\s*<a\\s+href=\"([^\"]*)\">\\s*([^<]*)\\s*<\\/a>\\s*<\\/div>/) do\n rt = $2\n rl = $1\n n = normal(file,rl)\n # puts \"# Starting dotfix with #{n}\"\n n = dotfix(n)\n n.chomp!\n nt += \"<#{myurl}> <#{dct}relation> <#{n}> .\\n\"\n rt.chomp!\n rt.gsub!(/\\s*$/,\"\")\n nt += \"<#{n}> <#{dct}title> \\\"#{rt}\\\" .\\n\"\n end\n puts \"\\n\"\n puts nt\nend",
"title": ""
},
{
"docid": "8d44213fa44892da0fa32e131d2e1d00",
"score": "0.4268877",
"text": "def fix_casting_cost(node)\n node.search('//x:img', 'x' => 'http://www.w3.org/1999/xhtml').each do |img|\n symbol = case img['alt']\n when 'Red' then \"R\"\n when 'Green' then 'G'\n when 'White' then 'W'\n when 'Black' then 'B'\n when 'Blue' then 'U'\n else\n img['alt']\n end\n \n #puts self.multiverse_id\n #pp img\n \n img.replace \"[#{symbol}]\"\n end\n \n return node\n end",
"title": ""
},
{
"docid": "054f7fc663dfd528a248d321f74392b5",
"score": "0.4268655",
"text": "def initialize( xml_file, *options )\n @node_name = \"00000\"\n\t @show_text = true\n\t @show_attributes = true\n\n if options and options[0]\n options[0].each do |xKey, xValue|\n case xKey.to_s\n when \"text\"\n @show_text = xValue\n\t\t options[0].delete( xKey )\n when \"attrs\"\n @show_attributes = xValue\n\t\t options[0].delete( xKey )\n end\n end\n end\n\n @rexml_document = REXML::Document::new( File::new( xml_file ) )\n @graph = GraphViz::new( \"XML\", *options )\n parse_xml_node( @rexml_document.root() )\n end",
"title": ""
},
{
"docid": "ca97148fffce4c1b17740947744e4ac9",
"score": "0.42619047",
"text": "def load_xml(xml_url)\n\t\t\tfile = File.new(xml_url)\n\t\t\tload_map(file)\n\t\t\tfile.close\n\t\tend",
"title": ""
},
{
"docid": "6f5d4fc7bee47daf118f3620fc72e7f1",
"score": "0.4258756",
"text": "def xml_processor_helper(document)\n document.each_element do |element|\n if TAGS.include?(element.name)\n @@LANGS.each do |lang| \n temp_doc = create_document(\"<metadata name='#{element.name}' xml:lang='#{lang}'>#{TEXT}</metadata>\\n\")\n element.parent.add(temp_doc) unless element_exists(element.parent,element.name,lang) \n end\n end\n process_child(element)\n end\n document\nend",
"title": ""
},
{
"docid": "a085bd2ef53f7157e7238b6b68e95c9b",
"score": "0.42555547",
"text": "def rexml? ; false end",
"title": ""
},
{
"docid": "8e4ec3cca6618ddb39ac668734c21934",
"score": "0.42529795",
"text": "def redify(file, range, off)\n \n Magick::Image.read(file)[0].each_pixel do |pixel|\n pixel.each do |r,g,b|\n ary.bsearch {|x| block } → elem # find matching X in array, apply block...\n \n end\n end \nend",
"title": ""
},
{
"docid": "5ee985b5b5321afd00b7e9a8e9122225",
"score": "0.42489022",
"text": "def test_sizes\n output = tested('sizes rms.jpg')\n\n assert errors_ok? output\n\n assert_equal '(max-width: 600px) 80vw, 50%', output.at_css('img')['sizes']\n end",
"title": ""
},
{
"docid": "746d021231b586ab0af91317659571d3",
"score": "0.4244727",
"text": "def as_process(xml)\n xml.process(version: version,\n priority: priority,\n note: note,\n lifecycle: lifecycle,\n laneId: lane_id,\n elapsed: elapsed,\n attempts: attempts,\n datetime: created_at.to_time.iso8601,\n status: status,\n name: process)\n end",
"title": ""
},
{
"docid": "90cb7472e0c573056cc06a4e13633696",
"score": "0.42436147",
"text": "def assemble_xml_file # :nodoc:\n write_xml_declaration do\n # Write the c:chartSpace element.\n write_chart_space do\n # Write the c:lang element.\n write_lang\n # Write the c:style element.\n write_style\n # Write the c:protection element.\n write_protection\n # Write the c:chart element.\n write_chart\n # Write the c:spPr element for the chartarea formatting.\n write_sp_pr(@chartarea)\n # Write the c:printSettings element.\n write_print_settings if @embedded && @embedded != 0\n end\n end\n end",
"title": ""
}
] |
0ada8cb674384bcf03dd8dacd7c249fb
|
Computes cos of input elementwise.
|
[
{
"docid": "ab8f1a9000047f507e4b40f243bce814",
"score": "0.777574",
"text": "def cos(input, name: nil)\n check_allowed_types(input, FLOATING_POINT_TYPES)\n _op(:cos, input, name: name)\n end",
"title": ""
}
] |
[
{
"docid": "821d3d0277994a9367cf86cdf29dd36d",
"score": "0.8383694",
"text": "def cos\n apply_lambda_flat(->(x){Math.cos(x)})\n end",
"title": ""
},
{
"docid": "65b08d03eea3d3da93b2fadc74cdb75e",
"score": "0.76940924",
"text": "def cos(input_a, name: nil)\n check_allowed_types(input_a, TensorStream::Ops::FLOATING_POINT_TYPES)\n _op(:cos, input_a, name: name)\n end",
"title": ""
},
{
"docid": "682112159774a073d7a8e992f097d722",
"score": "0.7619645",
"text": "def cos\n math :cos\n end",
"title": ""
},
{
"docid": "682112159774a073d7a8e992f097d722",
"score": "0.7619645",
"text": "def cos\n math :cos\n end",
"title": ""
},
{
"docid": "bdd9a8e98a61f4b18cb72e1471c9f730",
"score": "0.76022345",
"text": "def cos(z)\n begin\n if z.real?\n\tcos!(z)\n else\n\tComplex(cos!(z.real) * cosh!(z.imag),\n\t\t-sin!(z.real) * sinh!(z.imag))\n end\n rescue NoMethodError\n handle_no_method_error\n end\n end",
"title": ""
},
{
"docid": "b50566f25e52592218e525b17c859e12",
"score": "0.74401945",
"text": "def acos\n apply_lambda_flat(->(x){Math.acos(x)})\n end",
"title": ""
},
{
"docid": "a6d2f22f600f2ec2b4e2cf76cb41ed8f",
"score": "0.73985076",
"text": "def cosine\n cos(@radians) #before - Math::cos ; after - cos\n end",
"title": ""
},
{
"docid": "d1f21a06ecb879f4e565b1aaddf8605c",
"score": "0.6909599",
"text": "def cos(n1)\r\n\r\n @num1=n1\r\n print \"The cosine of #{@num1} is : #{Math.cos(@num1.to_i)}\"\r\n\r\n end",
"title": ""
},
{
"docid": "3d7c8ab1b6cba5b9fba782a65f8a10da",
"score": "0.6876333",
"text": "def cos_between_vectors(other_vector)\n scalar_multiplication(other_vector) / (length * other_vector.length).to_f\n end",
"title": ""
},
{
"docid": "8d95ad53059ed657805ec8a550b26d4a",
"score": "0.68420064",
"text": "def acos(input, name: nil)\n check_allowed_types(input, FLOATING_POINT_TYPES)\n _op(:acos, input, name: name)\n end",
"title": ""
},
{
"docid": "f73890c62ea6c820e5f0b4037f5a89ee",
"score": "0.67665297",
"text": "def cos_taper(*dims)\n if dims.length < 1\n\traise ArgumentError,'You have to specify one or more dimensions'\n end\n dims.sort!.uniq!\n val = self.data.val\n dims.each{|dim|\n\tdim = dim_index(dim) if dim.is_a?(String)\n\tdim += rank if dim < 0\n\traise ArgumentError,\"dim #{dim} does not exist\" if dim<0 || dim>rank\n nx = shape[dim]\n\twgt = NArray.float(nx).fill!(1)\n x = 10.0 / nx * (NArray.float(nx).indgen!+0.5) \n\twskl = x.lt(1).where\n\twskr = x.gt(9).where\n\twgt[wskl] = 0.5*( 1.0 - NMath::cos(Math::PI*x[wskl]) )\n\twgt[wskr] = 0.5*( 1.0 - NMath::cos(Math::PI*x[wskr]) )\n\twgt.reshape!( *([1]*dim + [nx] + [1]*(rank-dim-1)) )\n\tval = val*wgt\n }\n to_ret = self.copy\n to_ret.data.val = val\n to_ret\n end",
"title": ""
},
{
"docid": "cb40ea800937d99a22310f46cdde2b59",
"score": "0.67401654",
"text": "def cos(x, prec)\n raise ArgumentError, \"Zero or negative precision for cos\" if prec <= 0\n return BigDecimal(\"NaN\") if x.infinite? || x.nan?\n n = prec + BigDecimal.double_fig\n one = BigDecimal(\"1\")\n two = BigDecimal(\"2\")\n x = -x if x < 0\n if x > (twopi = two * BigMath.PI(prec))\n if x > 30\n x %= twopi\n else\n x -= twopi while x > twopi\n end\n end\n x1 = one\n x2 = x.mult(x,n)\n sign = 1\n y = one\n d = y\n i = BigDecimal(\"0\")\n z = one\n while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)\n m = BigDecimal.double_fig if m < BigDecimal.double_fig\n sign = -sign\n x1 = x2.mult(x1,n)\n i += two\n z *= (i-one) * i\n d = sign * x1.div(z,m)\n y += d\n end\n y\n end",
"title": ""
},
{
"docid": "134a9df0ebf7cf54a640015ea175cd6c",
"score": "0.6684428",
"text": "def lcos(x)\n \n ret = 0.0\n rep = $TRIG_ITER\n\t\t\n while rep > 1\n \n rep -= 1\n\tret += pow(-1, rep) * pow(x, 2 * rep) / fact(2 * rep)\n\t\t\t\t\t\n end\n \n return ret\n \nend",
"title": ""
},
{
"docid": "c36c8068244369b4eaac8bff92f5b8a6",
"score": "0.6682373",
"text": "def acos(x)\n deg(Math.acos(x))\n end",
"title": ""
},
{
"docid": "c997f7d3488d3b37bdec61cc04a71efc",
"score": "0.6675741",
"text": "def acos\n math :acos\n end",
"title": ""
},
{
"docid": "c997f7d3488d3b37bdec61cc04a71efc",
"score": "0.6675741",
"text": "def acos\n math :acos\n end",
"title": ""
},
{
"docid": "a9e28e7fc893a0428daf608b6b2d178d",
"score": "0.6630072",
"text": "def cosine(value, options={:eval_variables => true})\n if value.is_a?(Variable)\n if options[:eval_variables]\n \n end\n elsif value.is_a?(Fixnum)\n \n end\n end",
"title": ""
},
{
"docid": "27fa34fec774d1b333ac68827033963b",
"score": "0.6540682",
"text": "def acos(z)\n begin\n if z.real? and z >= -1 and z <= 1\n\tacos!(z)\n else\n\t(-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))\n end\n rescue NoMethodError\n handle_no_method_error\n end\n end",
"title": ""
},
{
"docid": "c434da08fe26e3d2b0a26c5b8e96986b",
"score": "0.6421307",
"text": "def cosine(degrees)\n #Math.cos(Utility.degress_to_radian(degrees))\n Math.cos(degrees * Math::PI / 180)\n end",
"title": ""
},
{
"docid": "11a157961daf4c2a9186083bc921db29",
"score": "0.64103824",
"text": "def cosh(z)\n begin\n if z.real?\n\tcosh!(z)\n else\n\tComplex(cosh!(z.real) * cos!(z.imag),\n\t\tsinh!(z.real) * sin!(z.imag))\n end\n rescue NoMethodError\n handle_no_method_error\n end\n end",
"title": ""
},
{
"docid": "fdf7f16b8fe306697b593a08c5b18b9b",
"score": "0.6382146",
"text": "def acos(x, prec)\n # Handle angle with no tangent.\n return PI / 2 if x == 0\n\n # Tangent of angle is y / x, where x^2 + y^2 = 1.\n a = atan(sqrt(1 - x * x, prec) / x, prec)\n if a < 0\n a + PI(prec)\n else\n a\n end\nend",
"title": ""
},
{
"docid": "de0aabb63419b714e2a83ebc4ab57d6d",
"score": "0.63454556",
"text": "def cosine(vector1, vector2)\n return 0 if vector1.nil? || vector2.nil?\n vector1.dot(vector2) / (vector1.norm * vector2.norm)\n end",
"title": ""
},
{
"docid": "29c2309bb8a4e55e0c4ef8d570985aa1",
"score": "0.625743",
"text": "def cosine(x, precision = 10)\n return -1 unless precision > 0\n\n sum = 0\n cache = FactorialCache.new(0 => 1)\n\n (0..precision).each do |k|\n power = 2*k\n denominator = cache[power]\n\n sum += kth_term(x, k, power, denominator)\n end\n\n sum\n end",
"title": ""
},
{
"docid": "511e2ec91d8c941a8a7650cc8e94c2a2",
"score": "0.6199649",
"text": "def function(x,y)\n return Math::cos(x*y)\nend",
"title": ""
},
{
"docid": "dd042848ee3f2a6a7dae31ff32f6257b",
"score": "0.61684763",
"text": "def cosine(vector1, vector2)\n dot_product = vector1.inner_product(vector2)\n dot_product / (vector1.r * vector2.r) # Vector#r is same as ||v||\n end",
"title": ""
},
{
"docid": "652e816740be7c4e49f3687024e40aeb",
"score": "0.59992754",
"text": "def arccos_degrees(x)\n degrees(Math.acos(x).to_degrees)\n end",
"title": ""
},
{
"docid": "f0395ebcf97b52f7ce09d567b54b906e",
"score": "0.599692",
"text": "def cs(x)\n cos(PI * x / 180)\n end",
"title": ""
},
{
"docid": "c7df70c3039b9abbbd0d9349052e3704",
"score": "0.59035724",
"text": "def cos_sim(tweet_vec, line_vec)\n total = 0.0\n \n tweet_vec.each do |term, count|\n total += count*line_vec[term]\n end\n \n total\n end",
"title": ""
},
{
"docid": "0219b5abe4897671894914f42cd15e11",
"score": "0.586489",
"text": "def test_Math_ClassMethods_cos\n\t\tassert_equal(0.40808206181339198606226786092764, Math.cos(20))\n\t\tassert_equal(0.15425144988758405071866214661421, Math.cos(30))\n\tend",
"title": ""
},
{
"docid": "5c228d0e4b0914f7dea5e9821263f050",
"score": "0.583933",
"text": "def acos(degrees)\n Math.acos(degrees) * RADS_PER_DEG\n end",
"title": ""
},
{
"docid": "19cc6543bd65b31671093a37ae3e3f45",
"score": "0.56760705",
"text": "def cosine_degrees(theta)\n Math.cos(theta.to_radians)\n end",
"title": ""
},
{
"docid": "e6831b3282c96826bf3aebc16f7e3071",
"score": "0.56125087",
"text": "def cos=(value)\n @property_flush[:cos] = value\n end",
"title": ""
},
{
"docid": "8ab09ce75d17bdc81524209e35bbe9d8",
"score": "0.5471499",
"text": "def alpha(v, cosined=false)\n len = abs(true)\n cos = dot(v) / Math.sqrt(len * len)\n cosined ? cos : Math.acos(cos) * 180 / Math::PI\n end",
"title": ""
},
{
"docid": "e542f07ed2360c572cfafdbc78078631",
"score": "0.53931683",
"text": "def cosine_omega\r\n(sin(-0.8333 * $radians_multiplier) /\r\ncos($latitude * $radians_multiplier) *\r\ncos(declination * $radians_multiplier)) -\r\n(sin($latitude * $radians_multiplier) *\r\nsin(declination * $radians_multiplier) /\r\ncos($latitude * $radians_multiplier) *\r\ncos(declination * $radians_multiplier))\r\nend",
"title": ""
},
{
"docid": "49ac5188ff5fa54fcbd52fb40f0b5e7b",
"score": "0.53904665",
"text": "def x\r\n c_radius*Math.cos(theta)\r\n end",
"title": ""
},
{
"docid": "285966c4d8385c0d8171e7687fb75b97",
"score": "0.53564936",
"text": "def arccot(x, unity)\n xpow = unity / x\n n = 1\n sign = 1\n sum = 0\n loop do\n term = xpow / n\n break if term == 0\n sum += sign * (xpow/n)\n xpow /= x*x\n n += 2\n sign = -sign\n end\n sum\n end",
"title": ""
},
{
"docid": "ae67e052aff35cd0bf94970010128f02",
"score": "0.52839035",
"text": "def angle_with vector\r\n cos_angle =[1, [(self.dot vector) / (self.mag * vector.mag), -1].max].min\r\n\r\n # sign of angle ?\r\n sign = (self.cross vector).z <=> 0.0\r\n sign = 1 if sign == 0\r\n\r\n Math.acos(cos_angle) * sign\r\n end",
"title": ""
},
{
"docid": "3be0949380a6058f8ae7c5a0e6e02c5f",
"score": "0.5225374",
"text": "def f(a)\n return lsin(a) + calcpi() / 2\nend",
"title": ""
},
{
"docid": "18723e90f856e4e1fad30617f77e2dec",
"score": "0.5225102",
"text": "def cosineSimilarity(obj1, obj2)\r\n\tcos = dotProduct(obj1, obj2)/(magnitude(obj1) * magnitude(obj2))\r\n\t(1.0 + cos)/2.0\r\nend",
"title": ""
},
{
"docid": "e3ce7883c9529925f7b9ae747d601f70",
"score": "0.5165306",
"text": "def tan(x, prec)\n sin(x, prec) / cos(x, prec)\nend",
"title": ""
},
{
"docid": "ec131d3dd4dc8a2f9dc817cdacba6e2a",
"score": "0.5149798",
"text": "def cosine_similarity(x, y = nil)\n x_norm = Numo::NMath.sqrt((x**2).sum(axis: 1))\n x_norm[x_norm.eq(0)] = 1\n x /= x_norm.expand_dims(1)\n if y.nil?\n x.dot(x.transpose)\n else\n y_norm = Numo::NMath.sqrt((y**2).sum(axis: 1))\n y_norm[y_norm.eq(0)] = 1\n y /= y_norm.expand_dims(1)\n x.dot(y.transpose)\n end\n end",
"title": ""
},
{
"docid": "25dc75282210ffe56adc02126e14743e",
"score": "0.5108535",
"text": "def cosine_similarity(a, b)\n dot_product(a, b) / (magnitude(a) * magnitude(b))\n end",
"title": ""
},
{
"docid": "916c91106a6ac347d52b5df144cca446",
"score": "0.5103458",
"text": "def sinc(x)\n sin(x) / x\n end",
"title": ""
},
{
"docid": "e1e510b84e48ecb127392bb6f1ebb55e",
"score": "0.50853944",
"text": "def cosine_similarity(dis,dat)\n\tdis_length = Math.sqrt(dotproduct(dis,dis))\n\tdat_length = Math.sqrt(dotproduct(dat,dat))\n\t(dotproduct(dat,dis)) /(dis_length * dat_length)\nend",
"title": ""
},
{
"docid": "436e4cf9a7a17a91620a72a816b830e2",
"score": "0.5031158",
"text": "def dottie\n current=1\n previous=-10\n until (current-previous).abs<0.000001\n previous=current\n current=Math.cos(current)\n end\n return current\nend",
"title": ""
},
{
"docid": "bc147a2dcdfcf8dc088ff335ca06d1a5",
"score": "0.501282",
"text": "def cosine_rank(vector1, vector2)\n cos = cosine(vector1, vector2)\n \n if cos > 0\n cos / 1 * 100\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "840d1ee9b50dc0d486ec87c2e26dbaf0",
"score": "0.500763",
"text": "def sin\n apply_lambda_flat(->(x){Math.sin(x)})\n end",
"title": ""
},
{
"docid": "0c6b4259903e7c1d3f708a73f5e66341",
"score": "0.50025445",
"text": "def angle(a)\n acos(dot(a))\n end",
"title": ""
},
{
"docid": "b01448db2848e289b14026aa7c36b486",
"score": "0.49814537",
"text": "def trig(n)\n return ((n+1) * n) / 2\nend",
"title": ""
},
{
"docid": "93974940c0d083cf393e1951c893ddc0",
"score": "0.49294683",
"text": "def conjugate\n Complex(@real, -@imag)\n end",
"title": ""
},
{
"docid": "f529412e30110405c03537c117fad600",
"score": "0.49247724",
"text": "def z\r\n s_radius*Math.cos(phi);\r\n end",
"title": ""
},
{
"docid": "64baf0e8fd5d91481643f6dc61f313e3",
"score": "0.49216872",
"text": "def test_Math_ClassMethods_acos\n\t\tassert_equal(0, Math.acos(1))\n\t\tassert_equal(1.5707963267948966, Math.acos(0))\n\tend",
"title": ""
},
{
"docid": "97fa347fbc7c0e10034e84da432ac333",
"score": "0.49034193",
"text": "def acosh(z)\n begin\n if z.real? and z >= 1\n\tacosh!(z)\n else\n\tlog(z + sqrt(z * z - 1.0))\n end\n rescue NoMethodError\n handle_no_method_error\n end\n end",
"title": ""
},
{
"docid": "8563e749a1c5504d30abfe9ff7661585",
"score": "0.4903394",
"text": "def ctof(celsius); ((celsius.to_f * 1.8) + 32) end",
"title": ""
},
{
"docid": "e803685e52287bcce721372a5bd57c51",
"score": "0.48617408",
"text": "def sinh(z)\n begin\n if z.real?\n\tsinh!(z)\n else\n\tComplex(sinh!(z.real) * cos!(z.imag),\n\t\tcosh!(z.real) * sin!(z.imag))\n end\n rescue NoMethodError\n handle_no_method_error\n end\n end",
"title": ""
},
{
"docid": "08cb65d5cd4f3dced38a9d0495edfc4d",
"score": "0.48231998",
"text": "def arg\n\t\tr_cos = real\n\t\tr_sin = imag.norm\n\t\tMath.atan2(r_sin, r_cos)\n\tend",
"title": ""
},
{
"docid": "9d58bd3fea7974d24b6600eac11f6a68",
"score": "0.48229313",
"text": "def acc( abscissa, container=nil )\n angle = Range::Angle.sample( abscissa ) + @initangle\n container ||=V2D[]\n container.x = -self.radius * Math.cos( angle )\n container.y = -self.radius * Math.sin( angle )\n return container\n end",
"title": ""
},
{
"docid": "973e2d25e2c231de1975506bd9b2384f",
"score": "0.4820009",
"text": "def f(x)\n return x*Math::sin(x)\nend",
"title": ""
},
{
"docid": "9a5a43e1288cdc11be094ac01c2433bf",
"score": "0.48156565",
"text": "def centroid(points) #INPUT: an Array of Points\n x = 0\n z = 0\n points.each do |p|\n x = p.x + x\n z = p.z + z\n end\n x = x / points.size\n z = z / points.size\n return x, z\n end",
"title": ""
},
{
"docid": "20ccbc986644d1883d2ccad2d38f4a99",
"score": "0.47984317",
"text": "def cdf(x); return (1.0 + erf(x / sqrt(2.0))) / 2.0; end",
"title": ""
},
{
"docid": "9962ba3184bca90190e20a01883b7c4f",
"score": "0.47964478",
"text": "def setup\n size 640, 360\n coswave = (0..width).map { |i| cos(map1d(i, (0..width), (0..PI))).abs }\n coswave.each_with_index do |value, i|\n stroke(value * 255)\n line(i, 0, i, height / 3)\n stroke(value * 255 / 4)\n line(i, height / 3, i, height / 3 * 2)\n stroke(255 - value * 255)\n line(i, height / 3 * 2, i, height)\n end\nend",
"title": ""
},
{
"docid": "269a5ad4b5c9feb07cbebfaa091e1e7a",
"score": "0.478852",
"text": "def ctof(celsius)\n fahrenheit = (celsius * (9.0/5.0)) + 32\nend",
"title": ""
},
{
"docid": "1bab83eeca18ef4bf227dea526f78b9b",
"score": "0.47772634",
"text": "def cosine_similarity(vector1,vector2) \n\t\tpenalty = [vector1.size,8].min/8\n\t\tnumerator = dot_product(vector1,vector2)\n\t\tdenominator1 = dot_product(vector1,vector1)\n\t\tdenominator2 = dot_product(vector2,vector2)\n\t\tcossim = penalty*numerator/Math::sqrt(denominator1*denominator2)\n\t\treturn cossim\n\tend",
"title": ""
},
{
"docid": "65a95dc4a998d6af6edf5bbd12823da4",
"score": "0.47729868",
"text": "def sin(z)\n begin\n if z.real?\n\tsin!(z)\n else\n\tComplex(sin!(z.real) * cosh!(z.imag),\n\t\tcos!(z.real) * sinh!(z.imag))\n end\n rescue NoMethodError\n handle_no_method_error\n end\n end",
"title": ""
},
{
"docid": "1c0a0e7ddd2e24ee5ccdb85829ad39b6",
"score": "0.47669557",
"text": "def ctof(degrees_c)\n (degrees_c) / (5.0 / 9.0) + 32.0\nend",
"title": ""
},
{
"docid": "f92f4b5b0af3fe0bc7942da316d22f05",
"score": "0.4760797",
"text": "def ctof(celsius)\n\tfahrenheit = ((celsius * 9.0/5).to_f + 32)\nend",
"title": ""
},
{
"docid": "570899d0f5f5bc3adf4a8f78545045ab",
"score": "0.47437167",
"text": "def test_Math_ClassMethods_cosh\n\t\tassert_equal(242582597.70489514, Math.cosh(20))\n\t\tassert_equal(5343237290762.2314, Math.cosh(30))\n\tend",
"title": ""
},
{
"docid": "804403ed97ba0f97f779000443df5c32",
"score": "0.4734808",
"text": "def ctof(celsius)\n celsius * 1.8 + 32\nend",
"title": ""
},
{
"docid": "1b02d93e6ead8ac0b4a69284f56d64c5",
"score": "0.4732182",
"text": "def ctof(celsius)\n tempA = (celsius.to_f * 9.0/5.0) + 32\n return tempA\nend",
"title": ""
},
{
"docid": "2015cc90d61be63cb81ee8734bc0069d",
"score": "0.4729075",
"text": "def cosine_similarity(other)\n assert_equal_dimmensions(other)\n product_of_magnitudes = magnitude * other.magnitude\n return 0 if product_of_magnitudes == 0.0\n dot_product(other) / product_of_magnitudes\n end",
"title": ""
},
{
"docid": "a513bbd5e16daed314837c8e77288970",
"score": "0.47242236",
"text": "def ctof (celsius_degrees)\n fahrenheit_degrees = (celsius_degrees * 9.0/5) + 32\n return fahrenheit_degrees\nend",
"title": ""
},
{
"docid": "2a682c293418a49548b898b66895786a",
"score": "0.47225645",
"text": "def rotate_x(x, y, cos, sin)\n\t\tcos * x + sin * y\n\tend",
"title": ""
},
{
"docid": "c923cd89b38fbb7632729e4cdb1b5179",
"score": "0.4722506",
"text": "def compute_cosine_similarity(r, l)\n scores = {}\n r.each do |docid, score|\n y = Page.where(:docid => docid).fields(:vector_length).first.vector_length\n # Cosine similarity\n scores[docid] = score.to_f / (l * y).to_f\n end\n scores\n end",
"title": ""
},
{
"docid": "de5585f649ca2f6d07ebee731aa595e4",
"score": "0.4717307",
"text": "def calculate\n (central_angle * EARTH_RADIUS).round(1)\n end",
"title": ""
},
{
"docid": "1969912fd1164606f2e619aaeea90d42",
"score": "0.47133404",
"text": "def cosine_distance(x, y = nil)\n dist_mat = 1 - cosine_similarity(x, y)\n dist_mat[dist_mat.diag_indices] = 0 if y.nil?\n dist_mat.clip(0, 2)\n end",
"title": ""
},
{
"docid": "bd6d01d12fb9c571a46d52f106090783",
"score": "0.47108835",
"text": "def cubed(arr)\r\n arr.map { |e| e ** 3 }\r\nend",
"title": ""
},
{
"docid": "0c461b6b77f850c4fb3b3cb8eccf4ace",
"score": "0.47103924",
"text": "def oddscalc(x)\n increment = 0\n total = []\n while increment < x\n total.push(odds)\n increment += 1\nend\n return total.sum / total.size.to_f\nend",
"title": ""
},
{
"docid": "8dba8c697eeafaa9f5fe843f91044a87",
"score": "0.4704451",
"text": "def objective_function(vector)\n return vector.inject(0.0) {|sum, x| sum + (Math.cos(x**3 - 4*x**2 -2*x + 6))}\nend",
"title": ""
},
{
"docid": "34e5a452453a0c5f5da1aa8a794ea163",
"score": "0.4696625",
"text": "def fccuadro(fila,columna)\n i = (fila) / 3\n j = (columna) / 3\n cuadro = i * 3 + j \n cuadro\nend",
"title": ""
},
{
"docid": "5d409f69b174008cfc797966dfe22141",
"score": "0.46884912",
"text": "def ctof(c)\n f = c * 9.0/5.0 + 32.0\nend",
"title": ""
},
{
"docid": "ffcb01ccb49ee44c8e428e99a2c2b79a",
"score": "0.4680217",
"text": "def cube x\n\tx * x * x\nend",
"title": ""
},
{
"docid": "631ae2b5bf7ed30b2fcb7a5581a3e8e6",
"score": "0.46768087",
"text": "def sin(x)\n p Math.sin(Math::PI/x)\nend",
"title": ""
},
{
"docid": "97e40074471ff81bbfbe695c904a6711",
"score": "0.46718466",
"text": "def ctof\n ( @celsius * ( 9.0 / 5.0 )) + 32\n end",
"title": ""
},
{
"docid": "0f28a5050405cd605fd5249466edae02",
"score": "0.46708706",
"text": "def cosify_hash(l_hash)\n # create empty hash with the following keys:\n cos_hash = Hash.new\n cos_hash[:cos_lat] = []\n cos_hash[:cos_lng] = []\n cos_hash[:product] = []\n\n # convert each latitude from l_hash into degrees (lat*PI/180)\n # calculate the cos of the degree value & push it into the hash\n # as the value for key :cos_lat\n l_hash[:lat].each do |lat|\n cos_hash[:cos_lat] << (cos(lat * PI/180))\n end\n # convert each longitude from l_hash into degrees (lng*PI/180)\n # calculate the cos of the degree value & push it into the hash\n # as the value for key :cos_lng\n l_hash[:lng].each do |lng|\n cos_hash[:cos_lng] << (cos(lng * PI/180))\n end\n\n # multiply the cosified degree lat with the cosified degree lng\n # push it as values for the :product key\n cos_hash[:product] = cos_hash[:cos_lat].zip(cos_hash[:cos_lng]).map{|lat,lng| (lat*lng)}\n # add all the values in the product key\n cos_hash[:product].reduce(0){|sum, num| sum+num}\n end",
"title": ""
},
{
"docid": "0e0c3d07fa9786cbba0b34722eeaae73",
"score": "0.46503356",
"text": "def ctof(degrees)\n\t(degrees * (9.0/5.0)) + 32\nend",
"title": ""
},
{
"docid": "374faca74f00faebbb47c2a527991832",
"score": "0.46494097",
"text": "def c_to_f (input)\n\t#output = input*(9.0/5)+32\n\t#return output\n\tinput*(9.0/5)+32\nend",
"title": ""
},
{
"docid": "0e343a1a663269cc7a88f88a186c73b5",
"score": "0.46142474",
"text": "def conjugate\r\n Quaternion.new([@p[0], -@p[1]])\r\n end",
"title": ""
},
{
"docid": "c82982b84831d361a3587901e261ecd6",
"score": "0.46109992",
"text": "def frobenius x\n # TODO: verify if checking only the changed values is sufficient\n Math.sqrt (x**2).reduce :+\nend",
"title": ""
},
{
"docid": "c81b59933b713a41676168fc709286d6",
"score": "0.46072724",
"text": "def sin\n math :sin \n end",
"title": ""
},
{
"docid": "c81b59933b713a41676168fc709286d6",
"score": "0.46072724",
"text": "def sin\n math :sin \n end",
"title": ""
},
{
"docid": "2e1ad6e389a41fe644a3e531d4fd5d30",
"score": "0.4606277",
"text": "def sin(input, name: nil)\n check_allowed_types(input, FLOATING_POINT_TYPES)\n _op(:sin, input, name: name)\n end",
"title": ""
},
{
"docid": "911aa4003fbb176696834f5b1fe06aa0",
"score": "0.45998815",
"text": "def ctof (celsius)\n return celsius.to_f* (9.0/5.0) +32.0 \nend",
"title": ""
},
{
"docid": "893457a18823f35b494299707e7b6a9b",
"score": "0.4596005",
"text": "def sin(input_a, name: nil)\n check_allowed_types(input_a, TensorStream::Ops::FLOATING_POINT_TYPES)\n _op(:sin, input_a, name: name)\n end",
"title": ""
},
{
"docid": "16ef510ee9d44fe70fbc65668e95b028",
"score": "0.45937183",
"text": "def radians_to_cartesian; [Math::cos(self), Math::sin(self)]; end",
"title": ""
},
{
"docid": "fe0cee9f4d7334d3d94928b9b5c758c4",
"score": "0.45886245",
"text": "def cdf(x)\n (0.5 * (1.0 + Math.erf((x*1.0)/(282.842712474619*Math.sqrt(2)))))\n end",
"title": ""
},
{
"docid": "1cd21e7098d19586e58677e43d620530",
"score": "0.4588467",
"text": "def ctof(degrees)\n\treturn degrees * 9/5.to_f + 32.to_f\nend",
"title": ""
},
{
"docid": "5cf24ca17ece0583ab05321294c7ed37",
"score": "0.45862633",
"text": "def ctof(celsius)\n fahrenheit = (9.0/5.0 * celsius) + 32\nend",
"title": ""
},
{
"docid": "ab64ad124a338c252686eb2f98bd71cb",
"score": "0.457687",
"text": "def circumference_of_circle(radius)\r\n 2 * Pi * radius\r\nend",
"title": ""
},
{
"docid": "a626cb7df44a4a618efa6a91d59d98a4",
"score": "0.45742524",
"text": "def asin\n apply_lambda_flat(->(x){Math.asin(x)})\n end",
"title": ""
},
{
"docid": "3cb5a7df19d5e0f729e822260fa95292",
"score": "0.45698062",
"text": "def caar(e)\n car(car(e))\n end",
"title": ""
}
] |
6c6eb0a1e87daeddabd66c2c92b98f0d
|
PATCH/PUT /familia/1 PATCH/PUT /familia/1.json
|
[
{
"docid": "4a480caa04f29c3df6b427aac5da852b",
"score": "0.6385046",
"text": "def update\n respond_to do |format|\n if @familium.update(familium_params)\n format.html { redirect_to @familium, notice: 'Familium was successfully updated.' }\n format.json { render :show, status: :ok, location: @familium }\n else\n format.html { render :edit }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "d0677deb429289072f1f1c66ca72b8f2",
"score": "0.67716855",
"text": "def update\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n if @familium.update_attributes(params[:familium])\n format.html { redirect_to @familium, notice: 'Familia fue actualizada existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "61c66428414122f5898ba89e54fc3612",
"score": "0.666405",
"text": "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fd19515d038098ac18b8e5ccb58fafe",
"score": "0.66315323",
"text": "def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @familia.update(familia_params) \n \n format.html { redirect_to familias_path(:id => @familia.padre_id), notice: 'Familia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"title": ""
},
{
"docid": "d7212fb12792e69d87527c159db95e3c",
"score": "0.6610846",
"text": "def update\n @familia = Familia.find(params[:id])\n\n respond_to do |format|\n if @familia.update_attributes(params[:familia])\n flash[:notice] = 'Família foi atualizado(a) com sucesso.'\n format.html { redirect_to(@familia) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @familia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b2c71fbeebc192ce80dd21f1ee3701c1",
"score": "0.66043866",
"text": "def update\n @familia = Familia.find(params[:id])\n\n respond_to do |format|\n if @familia.update_attributes(params[:familia])\n flash[:notice] = 'Familia was successfully updated.'\n format.html { redirect_to(@familia) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @familia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8a564babc91a1874282f7bf8c021821d",
"score": "0.6517608",
"text": "def update\n @familia_producto = FamiliaProducto.find(params[:id])\n\n respond_to do |format|\n if @familia_producto.update_attributes(params[:familia_producto])\n format.html { redirect_to @familia_producto, notice: 'Familia producto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familia_producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "851c9c03027ad0b0e1cab2781f1dcc83",
"score": "0.6360473",
"text": "def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4fea5d511e320e86d4f834cc3b2a7cf3",
"score": "0.6327146",
"text": "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa735ab556d37c70906f6b499be5d74a",
"score": "0.6263997",
"text": "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "303060a263c85fea20750fedc6eae2bb",
"score": "0.6263596",
"text": "def update\n @ficha = Ficha.find(params[:id])\n\n respond_to do |format|\n if @ficha.update_attributes(params[:ficha])\n format.html { redirect_to @ficha, notice: 'Ficha alterada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7663d0348b74542ff1d2f4fd96156fe",
"score": "0.6254761",
"text": "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"title": ""
},
{
"docid": "08a0fd96e378ecd9f676516ecd3f66c9",
"score": "0.62547517",
"text": "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a211c5f1153a600adb88c2a81cb6e48b",
"score": "0.6254322",
"text": "def update\n respond_to do |format|\n if @ficheiro.update(ficheiro_params)\n format.html { redirect_to @ficheiro, notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ficheiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3bf9043803c2a42f7a1ca055b255dc4a",
"score": "0.6251231",
"text": "def update\n @subfamilia = Subfamilia.find(params[:id])\n\n respond_to do |format|\n if @subfamilia.update_attributes(params[:subfamilia])\n flash[:notice] = 'Subfamília foi atualizado(a) com sucesso.'\n format.html { redirect_to(@subfamilia) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subfamilia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fef85c70676f65d316f8e9975598b735",
"score": "0.6245994",
"text": "def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c673f95dbea8b9737cac0e02d3826bc4",
"score": "0.62412196",
"text": "def update\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n if @fluxomatricula.update_attributes(params[:fluxomatricula])\n format.html { redirect_to @fluxomatricula, notice: 'Fluxomatricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fluxomatricula.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "12faf70207ae533ec70a6f13e34e9a58",
"score": "0.6231094",
"text": "def update\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n if @frais_repa.update_attributes(params[:frais_repa])\n format.html { redirect_to @frais_repa, :notice => 'Le frais de repas a bien été modifé' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_repa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5272fe85d53d6fa2a180cbb84ab4644",
"score": "0.6220133",
"text": "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"title": ""
},
{
"docid": "2ea53bcc6a6ea5f92852634bb0af13b6",
"score": "0.62178487",
"text": "def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "30049483ea20dd3f8258dc77545ab656",
"score": "0.62094796",
"text": "def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fd4a80089a1cff5ea9aa68a6f0bddfa4",
"score": "0.61961526",
"text": "def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ea7bdb00cf81f7423be1bcf34fb2f602",
"score": "0.61874825",
"text": "def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html {redirect_to personas_url, notice: 'Persona was successfully updated.'}\n format.json {render :show, status: :ok, location: @persona}\n else\n format.html {render :edit}\n format.json {render json: @persona.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "3e5010e425e354ba4cbeed1cecd200c9",
"score": "0.6183652",
"text": "def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1a1ccbf7153d90ad6ce5ccc7b894b68d",
"score": "0.61817575",
"text": "def update\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n if @fortune.update_attributes(params[:fortune])\n format.html { redirect_to @fortune, notice: 'Piosenka pozytywnie zaktualizowana.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95db6e768803a2f7299c9fbe3b15cd20",
"score": "0.6179681",
"text": "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"title": ""
},
{
"docid": "db6b4cf47aad145f986c5823260bb10e",
"score": "0.61765605",
"text": "def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84f2d68dc84d9c8be9bb908304afea8f",
"score": "0.6167057",
"text": "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0d1496a82804b0fb270890727ba4d403",
"score": "0.6162218",
"text": "def update\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n if @formulario.update_attributes(params[:formulario])\n format.html { redirect_to @formulario, notice: 'Formulario was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa6aea3f0f4f44347ec25f10b1164a54",
"score": "0.61579967",
"text": "def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html { redirect_to @persona, notice: 'Persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona }\n else\n format.html { render :edit }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1dea1e3fe2651bfb44c2a8469f9eaa2a",
"score": "0.61533105",
"text": "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a38799e1c0229700f1b7abf61121b177",
"score": "0.6139079",
"text": "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c60d3ce58d6d30fead16fbd527f86e68",
"score": "0.6118898",
"text": "def update\n respond_to do |format|\n if @problema.update(problema_params)\n format.html { redirect_to @problema, notice: 'Problema was successfully updated.' }\n format.json { render :show, status: :ok, location: @problema }\n else\n format.html { render :edit }\n format.json { render json: @problema.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0fb2e4292bb5accb28d0c948a357a3d",
"score": "0.6116825",
"text": "def update\n respond_to do |format|\n if @ficha.update(ficha_params)\n format.html { redirect_to @ficha, notice: 'Ficha was successfully updated.' }\n format.json { render :show, status: :ok, location: @ficha }\n else\n format.html { render :edit }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0fb2e4292bb5accb28d0c948a357a3d",
"score": "0.6116825",
"text": "def update\n respond_to do |format|\n if @ficha.update(ficha_params)\n format.html { redirect_to @ficha, notice: 'Ficha was successfully updated.' }\n format.json { render :show, status: :ok, location: @ficha }\n else\n format.html { render :edit }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b805e5e5b03653cb7f8c409698011948",
"score": "0.61038244",
"text": "def update\n @persona = Persona.find(params[:id])\n #@persona = Persona.find(:all, :conditions => {:screen_name => params[:id] }).first\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to persona_path(@persona.screen_name), notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "407b8bf71f4e73639d8569de23b76d87",
"score": "0.6093105",
"text": "def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dc63934cbc7810f8bcbf80740fd94b37",
"score": "0.60914195",
"text": "def update\n respond_to do |format|\n if @aluguel.update(aluguel_params)\n format.html { redirect_to @aluguel, notice: 'Aluguel was successfully updated.' }\n format.json { render :show, status: :ok, location: @aluguel }\n else\n format.html { render :edit }\n format.json { render json: @aluguel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3274a725bc68efcc2cebde4a5a9038e3",
"score": "0.60838014",
"text": "def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "748d0fdbddb3f646872554d67945a351",
"score": "0.6080952",
"text": "def update\n respond_to do |format|\n if @basico_persona_juridica.update(basico_persona_juridica_params)\n format.html { redirect_to @basico_persona_juridica, notice: 'Persona juridica was successfully updated.' }\n format.json { render :show, status: :ok, location: @basico_persona_juridica }\n else\n format.html { render :edit }\n format.json { render json: @basico_persona_juridica.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e0e59715d19dce2a47fccc2c67326dd",
"score": "0.608066",
"text": "def patch!\n request! :patch\n end",
"title": ""
},
{
"docid": "c3fc4c7dfddfeea7a59b7bc061071f0d",
"score": "0.6080563",
"text": "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b90fb19040b453b0881001efec106ea0",
"score": "0.60787374",
"text": "def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e3fd9fcf8f01b222f74ea9350f91a7a2",
"score": "0.60739505",
"text": "def update\n @futbolada = Futbolada.find(params[:id])\n\n respond_to do |format|\n if @futbolada.update_attributes(params[:futbolada])\n format.html { redirect_to gestion_url, notice: 'Futbolada was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @futbolada.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7928749c00b9de719d6eff90de530fe6",
"score": "0.6062557",
"text": "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end",
"title": ""
},
{
"docid": "0137cb33004ea3e07d88a8c670faa085",
"score": "0.60618466",
"text": "def update\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n if @chaine.update_attributes(params[:chaine])\n format.html { redirect_to @chaine, notice: 'Chaine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chaine.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95115ebb256d1ee07d0d56c3ec19681c",
"score": "0.6056165",
"text": "def update\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa editada com sucesso.' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "75fbc07f3efec2f6f39339b970203f9a",
"score": "0.60520947",
"text": "def update\n @jugador = Jugador.find(params[:id])\n @clubes = Club.all\n @equipos = Equipo.all\n respond_to do |format|\n if @jugador.update_attributes(params[:jugador])\n format.html { redirect_to @jugador, notice: 'Jugador fue actualizado adecuadamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jugador.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "98b73e37a9e0b24c006b91976a4e1735",
"score": "0.6050496",
"text": "def update\n respond_to do |format|\n if @anio.update(anio_params)\n format.html { redirect_to @anio, notice: 'Anio was successfully updated.' }\n format.json { render :show, status: :ok, location: @anio }\n else\n format.html { render :edit }\n format.json { render json: @anio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2982ab2cb90712443fb24049fa360324",
"score": "0.60385287",
"text": "def update\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n if @colegiatura.update_attributes(params[:colegiatura])\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5e82cd590aa777f50099b2e20947e83",
"score": "0.60364294",
"text": "def update\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n if @funcionario.update_attributes(params[:funcionario])\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @funcionario, :status => :created, :location => @funcionario }\n else\n format.html { render :json => ( (@funcionario.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @funcionario.errors.empty?\n end\n end\n end",
"title": ""
},
{
"docid": "c0fdcca7f0bd33ee62ff453d8c4a484b",
"score": "0.6034956",
"text": "def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "838ab86dcd3ee3c1efda458a9960b3c5",
"score": "0.60340935",
"text": "def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b51488247eb5efa2822d481a54c0b909",
"score": "0.60315055",
"text": "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6fa5979cf5ca6559fd05a4447dd7f203",
"score": "0.6027939",
"text": "def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a03b0110c7a3e07c188d9c2b08ad38f1",
"score": "0.60270303",
"text": "def update\n respond_to do |format|\n if @tipo_persona.update(tipo_persona_params)\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_persona }\n else\n format.html { render :edit }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d6a61f3186174209e44862cb0ae05d7",
"score": "0.6025797",
"text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"title": ""
},
{
"docid": "4637975e8c43aad96003d845bf7994c0",
"score": "0.6024844",
"text": "def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "151be24d388cef3cc16fb3554df684e4",
"score": "0.6021826",
"text": "def update\r\n respond_to do |format|\r\n if @sivic_participantecelula.update(sivic_participantecelula_params)\r\n format.html { redirect_to @sivic_participantecelula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_participantecelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "74865db7f5b9f5e53f9c8b92e12e9e10",
"score": "0.60192716",
"text": "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0447f7e6afe12d34bde491b7f52e4dc0",
"score": "0.60184854",
"text": "def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f4e5001c5a27e0af6217b667edd32e1f",
"score": "0.60147953",
"text": "def update\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n if @agronomiaquimica.update_attributes(params[:agronomiaquimica])\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0cb852a216396be15abf7ac0c8952c68",
"score": "0.60147667",
"text": "def update\n respond_to do |format|\n if @faltante.update(faltante_params)\n format.html { redirect_to @faltante, notice: 'Faltante was successfully updated.' }\n format.json { render :show, status: :ok, location: @faltante }\n else\n format.html { render :edit }\n format.json { render json: @faltante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "349e1db6dff2a9fbe50b6ebdb9a7c1ab",
"score": "0.6011704",
"text": "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "81dcde176dffc5d6552fa34e066787ea",
"score": "0.6011444",
"text": "def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9514999ec34049df6c3290cb322e8cff",
"score": "0.60074353",
"text": "def update\n @mixproducto = Mixproducto.find(params[:id])\n\n respond_to do |format|\n if @mixproducto.update_attributes(params[:mixproducto])\n format.html { redirect_to @mixproducto, notice: 'Mixproducto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mixproducto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f136e3b7cde2fcbcac4d0e6788571ef",
"score": "0.6006322",
"text": "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cedd8f854de0b8b39c552debfd3a30cf",
"score": "0.6006154",
"text": "def update\n @fuga = Fuga.find(params[:id])\n\n respond_to do |format|\n if @fuga.update_attributes(params[:fuga])\n format.html { redirect_to(@fuga, :notice => 'Fuga was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fuga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "14759bfc29723936a59582e63ebcf8b1",
"score": "0.6002128",
"text": "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c2e55661f6c415d15db1cc734f6e0738",
"score": "0.60017127",
"text": "def update\n @quiniela = Quiniela.find(params[:id])\n\n respond_to do |format|\n if @quiniela.update_attributes(params[:quiniela])\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "22479815e1f1fb93b6842f9fc177fb22",
"score": "0.60009235",
"text": "def update\n respond_to do |format|\n if @fabrica.update(fabrica_params)\n format.html { redirect_to @fabrica, notice: 'Fabrica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fabrica.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2fdd86756d7b4fb9477b4aac46ebc233",
"score": "0.5999331",
"text": "def update\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n if @asignatura.update_attributes(params[:asignatura])\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6738e62a0ba111914d71538cc1571390",
"score": "0.5990868",
"text": "def update\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n if @escola.update_attributes(params[:escola])\n format.html { redirect_to @escola, :notice => 'Escola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @escola.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f18579b471b3bc486f0d2761450ea96",
"score": "0.59891725",
"text": "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b198d1d8c216d9355ca7d944cb38e2f0",
"score": "0.59855175",
"text": "def update\n respond_to do |format|\n if @fertilizante.update(fertilizante_params)\n format.html { redirect_to @fertilizante, notice: 'Fertilizante was successfully updated.' }\n format.json { render :show, status: :ok, location: @fertilizante }\n else\n format.html { render :edit }\n format.json { render json: @fertilizante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6ba77b73cfe2fe254a241f673cfaaf15",
"score": "0.5983727",
"text": "def update\n respond_to do |format|\n if @formalizacao.update(formalizacao_params)\n format.html { redirect_to @formalizacao, notice: 'Formalizacao was successfully updated.' }\n format.json { render :show, status: :ok, location: @formalizacao }\n else\n format.html { render :edit }\n format.json { render json: @formalizacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3fa01c76d64c1ccbe6de3b696b2817a8",
"score": "0.59829104",
"text": "def update\n respond_to do |format|\n if @fotografia.update(fotografia_params)\n format.html { redirect_to @fotografia, notice: 'Fotografia was successfully updated.' }\n format.json { render :show, status: :ok, location: @fotografia }\n else\n format.html { render :edit }\n format.json { render json: @fotografia.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a683b79d0abd8ce18248a8ffa765c27",
"score": "0.5982419",
"text": "def update\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n if @fiction.update_attributes(params[:fiction])\n format.html { redirect_to @fiction, notice: 'Fiction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "df2e8406880c08a490daa7936da0d2da",
"score": "0.5982203",
"text": "def update\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n if @sugerencia.update_attributes(params[:sugerencia])\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "97ccfc37e3c31ffd544aeb84448313be",
"score": "0.59794474",
"text": "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "437c4807fbe94945224ce58461c997e7",
"score": "0.5977585",
"text": "def update\n @foro = Foro.find(params[:id])\n\n respond_to do |format|\n if @foro.update_attributes(params[:foro])\n format.html { redirect_to @foro, notice: 'Foro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foro.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab2cabde1ed842e750cf89c87b0a4008",
"score": "0.59769124",
"text": "def update\n respond_to do |format|\n if @famille.update(famille_params)\n format.html { redirect_to @famille, notice: 'Famille was successfully updated.' }\n format.json { render :show, status: :ok, location: @famille }\n\t else\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "efbe7b58aa26b4b51366c84e6c266bd0",
"score": "0.5976473",
"text": "def update\n respond_to do |format|\n if @ingresso.update(ingresso_params)\n format.html { redirect_to @ingresso, notice: 'Ingresso was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingresso }\n else\n format.html { render :edit }\n format.json { render json: @ingresso.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "317ac281da222717478d577575ff970a",
"score": "0.5975636",
"text": "def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "517abd6cc935b061c85a250697d7a7d1",
"score": "0.59750885",
"text": "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "30da94e41d8ee5f186582dfb86d28f27",
"score": "0.59743345",
"text": "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"title": ""
},
{
"docid": "d747794f109381b479f8aa4720dd88d8",
"score": "0.597413",
"text": "def update\n respond_to do |format|\n if @profilsekolah.update(profilsekolah_params)\n format.html { redirect_to @profilsekolah, notice: 'Profilsekolah was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profilsekolah.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0fadcb3ecbeb33e91159116d6b87950f",
"score": "0.5973124",
"text": "def update\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n if @sabio.update_attributes(params[:sabio])\n format.html { redirect_to @sabio, notice: 'El Sabio fue actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "60a16d698b116508b08fafa669fa51f5",
"score": "0.59704494",
"text": "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac9229526c1019056095681dbf3df0d0",
"score": "0.5968879",
"text": "def update\n @forma_entrega = FormaEntrega.find(params[:id])\n\n respond_to do |format|\n if @forma_entrega.update_attributes(params[:forma_entrega])\n format.html { redirect_to @forma_entrega, notice: 'Forma entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forma_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "209ec30e6fe35e0cd8332588c24b4a90",
"score": "0.59682304",
"text": "def update\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n if @funcionario.update_attributes(params[:funcionario])\n format.html { redirect_to @funcionario, notice: 'Funcionario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ff2514517ec976e4f2386cd6035ff1d",
"score": "0.596574",
"text": "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "57d009bb8775104a4aa805c98e4af16a",
"score": "0.5961636",
"text": "def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "940daa9fd1f01d3dcfd94f8e0e18aaa8",
"score": "0.59613526",
"text": "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02ff7d7c4afd644788c5a805ac4f0431",
"score": "0.5958574",
"text": "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"title": ""
},
{
"docid": "9ecb78c04fda60cf9d1ef914b42e359e",
"score": "0.59510076",
"text": "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2961463c279341e53c5324264e16f565",
"score": "0.5948432",
"text": "def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8079e1fe4c64f0dd9f31d22b389fecf4",
"score": "0.5947197",
"text": "def update\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n if @receipe.update_attributes(params[:receipe])\n format.html { redirect_to @receipe, notice: 'Receipe was successfully updated.' }\n format.json { head :no_content }\n else\n @receipe.fix_highest_aroma_percentage!\n format.html do\n @selectable_aromas = Aroma.all\n render action: \"edit\"\n end\n format.json { render json: @receipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ba1e573fca43b27ce353ecaf4ea1445",
"score": "0.5946186",
"text": "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"title": ""
},
{
"docid": "5ba1e573fca43b27ce353ecaf4ea1445",
"score": "0.5946186",
"text": "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"title": ""
},
{
"docid": "7fd1a9352e4ec31f6bd0f26c51afca04",
"score": "0.5946161",
"text": "def update\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n if @lieu.update_attributes(params[:lieu])\n format.html { redirect_to @lieu, notice: 'Lieu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lieu.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
9992e354df782d906ddff8e98f1b1f72
|
POST /pages POST /pages.json
|
[
{
"docid": "19f0aa8d44efeb677002d9d144fa2258",
"score": "0.6717724",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "64808f4537c5e34ea99a48cbfcb7da26",
"score": "0.7101859",
"text": "def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n format.html { render json: @page }\n format.json { render json: @page, status: :created}\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "10fbae53e2c055fb50ebee11e8c3f110",
"score": "0.7017283",
"text": "def create\n\n #Can also be created with:\n # => curl -X POST -H \"Content-Type: application/json; charset=UTF-8\" -d '{\"page\": {\"ppm\": \"400\",\"device_id\": \"1\"}}' localhost:3000/pages.json\n # => curl -X POST -H \"Content-Type: application/json; charset=UTF-8\" -d '{\"page\": {\"ppm\": \"400\", \"device_address\": \"42\"}}' localhost:3000/pages.json\n\n @page = Page.new(page_params)\n authorize @page\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d2d9f6d43d2ba78d83bc84a5a1dd6161",
"score": "0.6945888",
"text": "def create\n @pages = Pages.new(tl_params)\n\n if @pages.save\n render json: @pages, status: :created\n else\n render json: @pages.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f61b8f3173396b5573fca3c5f51e61f7",
"score": "0.6921416",
"text": "def create\n @page = Page.new(params[:page])\n @tags = Tag.all\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, :notice => 'Page was successfully created.' }\n format.json { render :json => @page, :status => :created, :location =>@page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0b6e39bd4c4eeab856f7b41764b0364a",
"score": "0.68882537",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n after_save_page(@page)\n\n format.html { redirect_to '/nodes/'+(@page.node).path, notice: 'Page was successfully created.' }\n #format.json { render json: '/nodes/'+(@page.node).path, status: :created, location: list_path }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "3b92e3b36b197c06f90ad618f587b68c",
"score": "0.6875734",
"text": "def create\n @page = Page.new(params[:page])\n @page.status ||= \"draft\"\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_path, notice: 'Page was successfully created.' }\n format.json { render action: 'index', status: :created, location: @page }\n else\n format.html { render action: 'index' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c25ab226a4fa3b50feff3c6b8b30bc15",
"score": "0.68531007",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, :notice => 'Страница успешно создана' }\n format.json { render :json => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c647c463511592085d5841cdc7d2d184",
"score": "0.6834769",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3912e31aa4d660fa7ad1bf9937c649ba",
"score": "0.6772403",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, :notice => 'Page was successfully created.' }\n format.json { render :json => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3912e31aa4d660fa7ad1bf9937c649ba",
"score": "0.6772403",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, :notice => 'Page was successfully created.' }\n format.json { render :json => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "abd1685f8c1d3fadb033cb14ca4c8722",
"score": "0.675857",
"text": "def create\n url = params[:url] || params[:page][:url]\n page = Page.find_or_initialize_by(url: url)\n page.parsing = true\n page.page_elements = []\n if page.save\n Resque.enqueue(PageParserWorker, page.id)\n render json: page, status: 201, location: [:api, :v1, page]\n else\n render json: { errors: page.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "f80b7bef35fd8a57b37ebe71a33bcbd2",
"score": "0.6742145",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to(@page, :notice => 'Page was successfully created.') }\n format.json { render :json => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f80b7bef35fd8a57b37ebe71a33bcbd2",
"score": "0.6742145",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to(@page, :notice => 'Page was successfully created.') }\n format.json { render :json => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6a1170f198e962caf06e300bf954e5d8",
"score": "0.67214423",
"text": "def create\n attrs = params[:page]\n no = attrs[\"no\"]\n if no.is_a?(String) && /\\d+/ =~ no\n attrs[\"no\"] = no.to_i\n end\n puts \"ATTRS: #{attrs}\"\n @page = Page.new(attrs)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1eae4f9014b86862ffdaf9ef1e1646fe",
"score": "0.6705782",
"text": "def create\n # @page = Page.new(params[:page])\n @page = current_user.pages.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "774a8184d8b395a03a658896ce606c13",
"score": "0.6697997",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, :notice => 'Page was successfully created.' }\n format.json { render :json => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9c35e620f33e51d5f084148428a2c2eb",
"score": "0.66797656",
"text": "def create\n @page = Page.new(params[:page])\n @page.save\n respond_with(@page)\n end",
"title": ""
},
{
"docid": "ad82db10725022d7ae8475947a6a73ae",
"score": "0.66458946",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b4eb19888cb4b2010cf288219c283c4",
"score": "0.6624546",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_url(id: @page.page_name),\n notice: t('.page_was_successfully_created') }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c06f301e4f6194fb49d27a04a3679c9",
"score": "0.66243964",
"text": "def create\n @page = @website.pages.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page.path, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ffce8b6fef9662e2a8d94b28314eb2c",
"score": "0.6624085",
"text": "def create\n @page.save\n respond_with @page\n end",
"title": ""
},
{
"docid": "85880f0c0c4bececa59826d3e65ca805",
"score": "0.66122115",
"text": "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: \"\\\"#{@page.title}\\\" was successfully created.\" }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae4778c64e362d493981efb8ccf3ffb7",
"score": "0.6581327",
"text": "def index\n @pages = Page.all\n respond_to do |format|\n format.html\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "be58a49692ce4ab7bb2ecbfb6dc093ab",
"score": "0.6564927",
"text": "def new\n # @page = Page.new\n @page = current_user.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "b9a129958e0d964acfb34cd23df17683",
"score": "0.655911",
"text": "def create\n pathname = get_formal_pathname params[:pages]\n path = pathname.to_s\n parent_pathname = pathname.parent\n parent = Page.find_by_pathname(parent_pathname)\n title = get_title pathname\n\n if Page.find_by_pathname(pathname).nil? && (parent != nil || is_root_path?(pathname))\n @page = Page.new(\n user: current_user,\n title: title,\n parent: parent,\n )\n else\n raise MajorError.bad_request\n end\n\n\n respond_to do |format|\n if @page.save\n format.html { redirect_back fallback_location: path, notice: \"Page was successfully created.\" }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8201581191756efcffe3ca47e78f3344",
"score": "0.65584296",
"text": "def index\n @pages = Page.order(\"updated_at DESC\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end",
"title": ""
},
{
"docid": "4cbe434fdd904aacc4f9ac77e3dcbd9f",
"score": "0.65515745",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to \"/#{@page.url}\", notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "dc0a0ee446f124d50e7cfc43c9e9211b",
"score": "0.654196",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72adaacb10ac2dd13300f9817219756a",
"score": "0.65410465",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b2e29bfcfd56b75d26914e769d1dea2",
"score": "0.6512656",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_url, notice: 'New Page was created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n @page.documents.build unless @page.documents.any?\n @page.images.build unless @page.images.any?\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "0698572fe3a463d469c7707c6a3c21ba",
"score": "0.6510782",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "65a01f1f6ac23e65504a5f30414589f6",
"score": "0.6510707",
"text": "def create\n @page = Page.new(params[:page])\n\n if @page.save\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity }\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "188208ea27e649f35c5202c61fff1b88",
"score": "0.6489101",
"text": "def new\n @page = Page.new\n @tags = Tag.all\n respond_to do |format|\n format.html \n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"docid": "639ed5a848234ea07bee034c2897c739",
"score": "0.6479322",
"text": "def index\n @pages = Page.all\n render json: @pages, status: 200\n end",
"title": ""
},
{
"docid": "cd98dc14962aca6e5525a5ab6abd2193",
"score": "0.64691216",
"text": "def create\n authorize! :create, Page\n @page = @section.pages.new(page_params)\n @page.creator = current_user\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @section, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "affd1a1cb35dc36c8f56a49c6c9137f4",
"score": "0.6463457",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page }\n end\n end",
"title": ""
},
{
"docid": "affd1a1cb35dc36c8f56a49c6c9137f4",
"score": "0.6463457",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page }\n end\n end",
"title": ""
},
{
"docid": "affd1a1cb35dc36c8f56a49c6c9137f4",
"score": "0.6463457",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page }\n end\n end",
"title": ""
},
{
"docid": "e6f18b57fe7e14cb9bb4beddc9fff8f4",
"score": "0.6459133",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end",
"title": ""
},
{
"docid": "e6f18b57fe7e14cb9bb4beddc9fff8f4",
"score": "0.6459133",
"text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end",
"title": ""
},
{
"docid": "50cf45a6d1f54ad00ed24ae373323ae8",
"score": "0.6441884",
"text": "def create\n #TODO Force the nav item to have a title e.g. by defaulting to page title\n # Create the new page - this automatically creates the nav item as well\n @page = Page.new(params[:page])\n \n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: t('pages.created') }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ada0d67fc5f973e12160824003b5f628",
"score": "0.64415026",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to slug_path(@page.slug), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da0bf49037b3b18e28277d710645ff03",
"score": "0.6431964",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to [:admin, @page], notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "05011f838cd5a2abc9037afb555a3daa",
"score": "0.6431453",
"text": "def index\n # Show list of all pages\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"title": ""
},
{
"docid": "29e9de382ce478b9d5b7c4b112414b0a",
"score": "0.6431175",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page }\n end\n end",
"title": ""
},
{
"docid": "29e9de382ce478b9d5b7c4b112414b0a",
"score": "0.6431175",
"text": "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @page }\n end\n end",
"title": ""
},
{
"docid": "04e230ab9d1e4d6b426e2614e9b0acb2",
"score": "0.642647",
"text": "def create\n\t@page = Page.new(page_params)\n\trespond_to do |format|\n\t if @page.save\n\t format.html { redirect_to @page}\n\t format.json { render :show, status: :created, location: @page }\n\t else\n\t format.html { render :new }\n\t format.json { render json: @page.errors, status: :unprocessable_entity }\n\t end\n\tend\n\tend",
"title": ""
},
{
"docid": "a24ad8225a1aedb31d00ac17ee1c3ad6",
"score": "0.6408772",
"text": "def create\n @page = Page.new(page_params)\n @page.user = current_user\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfc47bc18d4fadd776aa5a5df74ce3c1",
"score": "0.63975656",
"text": "def create\n @pages = Page.new(params[:pages])\n\n respond_to do |format|\n if @pages.save\n flash[:notice] = 'Admin::Pages was successfully created.'\n format.html { redirect_to(@pages) }\n format.xml { render :xml => @pages, :status => :created, :location => @pages }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pages.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8e2cfebc13935107754d2e4a8ccdd3ef",
"score": "0.6388308",
"text": "def create\n @page = Page.new(page_params)\n @page.status = 'draft'\n @page.slug = URI.escape(@page.title.gsub(' ', '-'))\n respond_to do |format|\n if @page.save\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render :edit, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f94d9da00983f8ccddce02a87c835de4",
"score": "0.63864684",
"text": "def create\n # creating page moved to before_filter\n\n\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Страница создана.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "939b0b4eaf5ca43158c84f04991519ca",
"score": "0.6383085",
"text": "def index\n @pages = Page.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end",
"title": ""
},
{
"docid": "065b95d110a87b4eb91a80ff1da52bc4",
"score": "0.6379444",
"text": "def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Seite wurde erfolgreich erstellt.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5a583c0b4b60678654ad31587f362a3",
"score": "0.63783383",
"text": "def create\n\t\t@page = Page.new(params[:page])\n\n\t\trespond_to do |format|\n\t\t\tif @page.save\n\t\t\t\tformat.html { redirect_to pages_url, notice: 'Page was successfully created.' }\n\t\t\t\tformat.json\t{ render json: @page, status: :created, :location => @page }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json\t{ render json: @page.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2f0b47f25ff628242a4aa875809b4f74",
"score": "0.63782644",
"text": "def create\n @page = Page.find_or_initialize_by(\n name: page_params[:name].strip.gsub('<br>', ''),\n site_id: page_params[:site_id]\n )\n\n respond_to do |format|\n if @page.update_attributes(page_params)\n format.json { render json: @page, status: :created }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c47b699f9462caafa5e035de58a22321
|
declares a class as ferretsearchable. ====options: fields:: names all fields to include in the index. If not given, all attributes of the class will be indexed. You may also give symbols pointing to instance methods of your model here, i.e. to retrieve and index data from a related model. additional_fields:: names fields to include in the index, in addition to those derived from the db scheme. use if you want to add custom fields derived from methods to the db fields (which will be picked by aaf). This option will be ignored when the fields option is given, in that case additional fields get specified there. index_dir:: declares the directory where to put the index for this class. The default is RAILS_ROOT/index/RAILS_ENV/CLASSNAME. The index directory will be created if it doesn't exist. single_index:: set this to true to let this class use a Ferret index that is shared by all classes having :single_index set to true. :store_class_name is set to true implicitly, as well as index_dir, so don't bother setting these when using this option. the shared index will be located in index//shared . store_class_name:: to make search across multiple models useful, set this to true. the model class name will be stored in a keyword field named class_name ====ferret_options: or_default:: whether query terms are required by default (the default, false), or not (true) analyzer:: the analyzer to use for query parsing (default: nil, which means the ferret StandardAnalyzer gets used) default_field:: use to set one or more fields that are searched for query terms that don't have an explicit field list. This list should not contain any untokenized fields. If it does, you're asking for trouble (i.e. not getting results for queries having stop words in them). Aaf by default initializes the default field list to all tokenized fields. Note that this is not true for shared indexes, so if you use :single_index, you should use this option to specify the field names of your shared index you want to search by default here.
|
[
{
"docid": "49f2f9860a7e1c0e3ca5c1f35206d7d0",
"score": "0.790699",
"text": "def acts_as_ferret(options={}, ferret_options={})\n\n # force local mode if running inside the Ferret server\n options.delete(:remote) if ActsAsFerret::Remote::Server.running\n if options[:remote] && options[:remote] !~ /^druby/\n # read server location from config/ferret_server.yml\n options[:remote] = ActsAsFerret::Remote::Config.load(\"#{RAILS_ROOT}/config/ferret_server.yml\")\n end\n\n\n extend ClassMethods\n extend SharedIndexClassMethods if options[:single_index]\n\n include InstanceMethods\n include MoreLikeThis::InstanceMethods\n\n # AR hooks\n after_create :ferret_create\n after_update :ferret_update\n after_destroy :ferret_destroy \n\n cattr_accessor :aaf_configuration\n\n # default config\n self.aaf_configuration = { \n :index_dir => \"#{ActsAsFerret::index_dir}/#{self.name.underscore}\",\n :store_class_name => false,\n :name => self.table_name,\n :class_name => self.name,\n :single_index => false,\n :ferret => {\n :or_default => false, \n :handle_parse_errors => true,\n :default_field => '*'\n #:max_clauses => 512,\n #:analyzer => Ferret::Analysis::StandardAnalyzer.new,\n # :wild_card_downcase => true\n }\n }\n\n # merge aaf options with args\n aaf_configuration.update(options) if options.is_a?(Hash)\n\n # list of indexed fields will be filled later\n aaf_configuration[:ferret_fields] = Hash.new\n\n # apply appropriate settings for shared index\n if aaf_configuration[:single_index] \n aaf_configuration[:index_dir] = \"#{ActsAsFerret::index_dir}/shared\" \n aaf_configuration[:store_class_name] = true \n end\n\n # merge default ferret options with args\n aaf_configuration[:ferret].update(ferret_options) if ferret_options.is_a?(Hash)\n\n # these properties are somewhat vital to the plugin and shouldn't\n # be overwritten by the user:\n aaf_configuration[:ferret].update(\n :key => (aaf_configuration[:single_index] ? [:id, :class_name] : :id),\n :path => aaf_configuration[:index_dir],\n :auto_flush => true,\n :create_if_missing => true\n )\n \n if aaf_configuration[:fields]\n add_fields(aaf_configuration[:fields])\n else\n add_fields(self.new.attributes.keys.map { |k| k.to_sym })\n add_fields(aaf_configuration[:additional_fields])\n end\n\n ActsAsFerret::ensure_directory aaf_configuration[:index_dir] unless options[:remote]\n\n # now that all fields have been added, we can initialize the default\n # field list to be used by the query parser.\n # It will include all content fields *not* marked as :untokenized.\n # This fixes the otherwise failing CommentTest#test_stopwords \n #\n # However this is not very useful with a shared index (see\n # http://projects.jkraemer.net/acts_as_ferret/ticket/85)\n # You should consider specifying the default field list to search for as\n # part of the ferret_options hash in your call to acts_as_ferret.\n aaf_configuration[:ferret][:default_field] = aaf_configuration[:ferret_fields].keys.select do |f| \n aaf_configuration[:ferret_fields][f][:index] != :untokenized\n end unless aaf_configuration[:single_index]\n logger.debug \"set default field list to #{aaf_configuration[:ferret][:default_field].inspect}\"\n end",
"title": ""
}
] |
[
{
"docid": "9b513c255f657338644adaf9ccc4a793",
"score": "0.8208757",
"text": "def acts_as_ferret(options={}, ferret_options={})\n configuration = { \n :index_dir => \"#{FerretMixin::Acts::ARFerret::index_dir}/#{self.name.underscore}\",\n :store_class_name => false,\n :single_index => false,\n }\n ferret_configuration = {\n :or_default => false, \n :handle_parse_errors => true,\n :default_field => '*'\n #:max_clauses => 512,\n #:analyzer => Ferret::Analysis::StandardAnalyzer.new,\n # :wild_card_downcase => true\n }\n configuration.update(options) if options.is_a?(Hash)\n\n # apply appropriate settings for shared index\n if configuration[:single_index] \n configuration[:index_dir] = \"#{FerretMixin::Acts::ARFerret::index_dir}/shared\" \n configuration[:store_class_name] = true \n end\n ferret_configuration.update(ferret_options) if ferret_options.is_a?(Hash)\n # these properties are somewhat vital to the plugin and shouldn't\n # be overwritten by the user:\n ferret_configuration.update(\n\n :key => (configuration[:single_index] ? [:id, :class_name] : :id),\n :path => configuration[:index_dir],\n :auto_flush => true,\n :create_if_missing => true\n )\n \n class_eval <<-EOV\n include FerretMixin::Acts::ARFerret::InstanceMethods\n\n\n after_create :ferret_create\n after_update :ferret_update\n after_destroy :ferret_destroy \n \n cattr_accessor :fields_for_ferret \n cattr_accessor :configuration\n cattr_accessor :ferret_configuration\n \n @@fields_for_ferret = Hash.new\n @@configuration = configuration\n @@ferret_configuration = ferret_configuration\n\n if configuration[:fields]\n add_fields(configuration[:fields])\n else\n add_fields(self.new.attributes.keys.map { |k| k.to_sym })\n add_fields(configuration[:additional_fields])\n end\n\n EOV\n FerretMixin::Acts::ARFerret::ensure_directory configuration[:index_dir]\n\n # now that all fields have been added, we can initialize the default\n # field list to be used by the query parser.\n # It will include all content fields *not* marked as :untokenized.\n # This fixes the otherwise failing CommentTest#test_stopwords \n ferret_configuration[:default_field] = fields_for_ferret.keys.select do |f| \n fields_for_ferret[f][:index] != :untokenized\n end\n logger.debug \"set default field list to #{ferret_configuration[:default_field].inspect}\"\n end",
"title": ""
},
{
"docid": "ab3317f91c602551d8c7bb354d705893",
"score": "0.8170854",
"text": "def acts_as_ferret(options={})\n\n extend ClassMethods\n\n include InstanceMethods\n include MoreLikeThis::InstanceMethods\n\n if options[:rdig]\n cattr_accessor :rdig_configuration\n self.rdig_configuration = options[:rdig]\n require 'rdig_adapter'\n include ActsAsFerret::RdigAdapter\n end\n\n unless included_modules.include?(ActsAsFerret::WithoutAR)\n # set up AR hooks\n after_create :ferret_create\n after_update :ferret_update\n after_destroy :ferret_destroy \n end\n\n cattr_accessor :aaf_configuration\n\n # apply default config for rdig based models\n if options[:rdig]\n options[:fields] ||= { :title => { :boost => 3, :store => :yes },\n :content => { :store => :yes } }\n end\n\n # name of this index\n index_name = options.delete(:index) || self.name.underscore\n\n index = ActsAsFerret::register_class_with_index(self, index_name, options)\n self.aaf_configuration = index.index_definition.dup\n logger.debug \"configured index for class #{self.name}:\\n#{aaf_configuration.inspect}\"\n\n # update our copy of the global index config with options local to this class\n aaf_configuration[:class_name] ||= self.name\n aaf_configuration[:if] ||= options[:if]\n\n # add methods for retrieving field values\n add_fields options[:fields]\n add_fields options[:additional_fields]\n add_fields aaf_configuration[:fields]\n add_fields aaf_configuration[:additional_fields]\n\n end",
"title": ""
},
{
"docid": "758c573ffc4803f62bfe5adf8fe0250d",
"score": "0.8140597",
"text": "def acts_as_ferret(options={}, ferret_options={})\n configuration = { \n :fields => nil,\n :index_dir => \"#{FerretMixin::Acts::ARFerret::index_dir}/#{self.name}\",\n :store_class_name => false\n }\n ferret_configuration = {\n :occur_default => Ferret::Search::BooleanClause::Occur::MUST,\n :handle_parse_errors => true,\n :default_search_field => '*',\n # :analyzer => Analysis::StandardAnalyzer.new,\n # :wild_lower => true\n }\n configuration.update(options) if options.is_a?(Hash)\n ferret_configuration.update(ferret_options) if ferret_options.is_a?(Hash)\n # these properties are somewhat vital to the plugin and shouldn't\n # be overwritten by the user:\n ferret_configuration.update(\n :key => 'id',\n :path => configuration[:index_dir],\n :auto_flush => true,\n :create_if_missing => true\n )\n \n class_eval <<-EOV\n include FerretMixin::Acts::ARFerret::InstanceMethods\n\n before_create :ferret_before_create\n before_update :ferret_before_update\n after_create :ferret_create\n after_update :ferret_update\n after_destroy :ferret_destroy \n \n cattr_accessor :fields_for_ferret \n cattr_accessor :configuration\n cattr_accessor :ferret_configuration\n \n @@fields_for_ferret = Array.new\n @@configuration = configuration\n @@ferret_configuration = ferret_configuration\n \n if configuration[:fields].respond_to?(:each_pair)\n configuration[:fields].each_pair do |key,val|\n define_to_field_method(key,val) \n end\n elsif configuration[:fields].respond_to?(:each)\n configuration[:fields].each do |field| \n define_to_field_method(field)\n end \n else\n @@fields_for_ferret = nil\n end\n EOV\n FerretMixin::Acts::ARFerret::ensure_directory configuration[:index_dir]\n end",
"title": ""
},
{
"docid": "3b50fd4d50a0f80b7dff2df70f5faeee",
"score": "0.79872984",
"text": "def acts_as_ferret(options={}, ferret_options={})\n\n # force local mode if running *inside* the Ferret server - somewhere the\n # real indexing has to be done after all :-)\n options.delete(:remote) if ActsAsFerret::Remote::Server.running\n\n if options[:remote] && options[:remote] !~ /^druby/\n # read server location from config/ferret_server.yml\n options[:remote] = ActsAsFerret::Remote::Config.load(\"#{RAILS_ROOT}/config/ferret_server.yml\")[:uri]\n end\n\n\n extend ClassMethods\n extend SharedIndexClassMethods if options[:single_index]\n\n include InstanceMethods\n include MoreLikeThis::InstanceMethods\n\n # AR hooks\n after_create :ferret_create\n after_update :ferret_update\n after_destroy :ferret_destroy \n\n cattr_accessor :aaf_configuration\n\n # default config\n self.aaf_configuration = { \n :index_dir => \"#{ActsAsFerret::index_dir}/#{self.name.underscore}\",\n :store_class_name => false,\n :name => self.table_name,\n :class_name => self.name,\n :single_index => false,\n :ferret => {\n :or_default => false, \n :handle_parse_errors => true,\n :default_field => nil # will be set later on\n #:max_clauses => 512,\n #:analyzer => Ferret::Analysis::StandardAnalyzer.new,\n # :wild_card_downcase => true\n }\n }\n\n # merge aaf options with args\n aaf_configuration.update(options) if options.is_a?(Hash)\n\n # list of indexed fields will be filled later\n aaf_configuration[:ferret_fields] = Hash.new\n\n # apply appropriate settings for shared index\n if aaf_configuration[:single_index] \n aaf_configuration[:index_dir] = \"#{ActsAsFerret::index_dir}/shared\" \n aaf_configuration[:store_class_name] = true \n end\n\n # merge default ferret options with args\n aaf_configuration[:ferret].update(ferret_options) if ferret_options.is_a?(Hash)\n\n # these properties are somewhat vital to the plugin and shouldn't\n # be overwritten by the user:\n aaf_configuration[:ferret].update(\n :key => (aaf_configuration[:single_index] ? [:id, :class_name] : :id),\n :path => aaf_configuration[:index_dir],\n :auto_flush => true, # slower but more secure in terms of locking problems TODO disable when running in drb mode?\n :create_if_missing => true\n )\n \n if aaf_configuration[:fields]\n add_fields(aaf_configuration[:fields])\n else\n add_fields(self.new.attributes.keys.map { |k| k.to_sym })\n add_fields(aaf_configuration[:additional_fields])\n end\n\n ActsAsFerret::ensure_directory aaf_configuration[:index_dir] unless options[:remote]\n\n # now that all fields have been added, we can initialize the default\n # field list to be used by the query parser.\n # It will include all content fields *not* marked as :untokenized.\n # This fixes the otherwise failing CommentTest#test_stopwords. Basically\n # this means that by default only tokenized fields (which is the default)\n # will be searched. If you want to search inside the contents of an\n # untokenized field, you'll have to explicitly specify it in your query.\n #\n # Unfortunately this is not very useful with a shared index (see\n # http://projects.jkraemer.net/acts_as_ferret/ticket/85)\n # You should consider specifying the default field list to search for as\n # part of the ferret_options hash in your call to acts_as_ferret.\n aaf_configuration[:ferret][:default_field] ||= if aaf_configuration[:single_index]\n logger.warn \"You really should set the acts_as_ferret :default_field option when using a shared index!\"\n '*'\n else\n aaf_configuration[:ferret_fields].keys.select do |f| \n aaf_configuration[:ferret_fields][f][:index] != :untokenized\n end\n end\n logger.info \"default field list: #{aaf_configuration[:ferret][:default_field].inspect}\"\n end",
"title": ""
},
{
"docid": "54e0527fdf559857d99e4eb5155fc02d",
"score": "0.69238037",
"text": "def ferret_index\n ensure_index_exists\n @ferret_index ||= Ferret::Index::Index.new(aaf_configuration[:ferret])\n end",
"title": ""
},
{
"docid": "e4bb365d67be53a265a78da7441468d8",
"score": "0.68969333",
"text": "def ferret_searcher\n if @ferret_searcher and !@ferret_searcher.reader.latest?\n # reopen searcher\n @ferret_searcher.close\n @ferret_searcher = nil\n end\n unless @ferret_searcher\n @ferret_searcher = Ferret::Search::Searcher.new(@ferret_config.path)\n @query_parser.fields = @ferret_searcher.reader.field_names.to_a\n end\n @ferret_searcher\n end",
"title": ""
},
{
"docid": "1045614035aa5c12f730f3c0284d3832",
"score": "0.6750239",
"text": "def ferret_index\n ensure_index_exists\n returning @ferret_index ||= Ferret::Index::Index.new(index_definition[:ferret]) do\n @ferret_index.batch_size = index_definition[:reindex_batch_size]\n @ferret_index.logger = logger\n end\n end",
"title": ""
},
{
"docid": "d3ee148f7534dd3d27236796a45ff129",
"score": "0.66302127",
"text": "def register_class(clazz, options = {})\n logger.info \"register class #{clazz} with index #{index_name}\"\n\n if force = options.delete(:force_re_registration)\n index_definition[:registered_models].delete(clazz)\n end\n\n if index_definition[:registered_models].map(&:name).include?(clazz.name)\n logger.info(\"refusing re-registration of class #{clazz}\")\n else\n index_definition[:registered_models] << clazz\n @registered_models_config[clazz] = options\n\n # merge fields from this acts_as_ferret call with predefined fields\n already_defined_fields = index_definition[:ferret_fields]\n field_config = ActsAsFerret::build_field_config options[:fields]\n field_config.update ActsAsFerret::build_field_config( options[:additional_fields] )\n field_config.each do |field, config|\n if already_defined_fields.has_key?(field)\n logger.info \"ignoring redefinition of ferret field #{field}\" if shared? \n else\n already_defined_fields[field] = config\n logger.info \"adding new field #{field} from class #{clazz.name} to index #{index_name}\"\n end\n end\n\n # update default field list to be used by the query parser, unless it \n # was explicitly given by user.\n #\n # It will include all content fields *not* marked as :untokenized.\n # This fixes the otherwise failing CommentTest#test_stopwords. Basically\n # this means that by default only tokenized fields (which all fields are\n # by default) will be searched. If you want to search inside the contents \n # of an untokenized field, you'll have to explicitly specify it in your \n # query.\n unless index_definition[:user_default_field]\n # grab all tokenized fields\n ferret_fields = index_definition[:ferret_fields]\n index_definition[:ferret][:default_field] = ferret_fields.keys.select do |field|\n ferret_fields[field][:index] != :untokenized\n end\n logger.info \"default field list for index #{index_name}: #{index_definition[:ferret][:default_field].inspect}\"\n end\n end\n\n return index_definition\n end",
"title": ""
},
{
"docid": "8c96a2f7456f76c0bcccdf8860413058",
"score": "0.6627398",
"text": "def ferret_index\n ferret_indexes[class_index_dir] ||= create_index_instance\n end",
"title": ""
},
{
"docid": "8c96a2f7456f76c0bcccdf8860413058",
"score": "0.6627398",
"text": "def ferret_index\n ferret_indexes[class_index_dir] ||= create_index_instance\n end",
"title": ""
},
{
"docid": "d4a4cb7c1042ce23497af801ead1f565",
"score": "0.649503",
"text": "def get_ferret_index\n Index::Index.new(:path => './data/search-indexes')\nend",
"title": ""
},
{
"docid": "abfb23e5d524983d24841f4fe0a9be74",
"score": "0.6312603",
"text": "def by_fulltext_index(query, options = {})\n if self == Document\n client = Riddle::Client.new\n else\n client = Riddle::Client.new(fulltext_opts[:server],\n fulltext_opts[:port])\n\n query = query + \" @classname #{self}\"\n end\n\n client.match_mode = options[:match_mode] || :extended\n\n if (limit = options[:limit])\n client.limit = limit\n end\n\n if (max_matches = options[:max_matches])\n client.max_matches = max_matches\n end\n\n if (sort_by = options[:sort_by])\n client.sort_mode = :extended\n client.sort_by = sort_by\n end\n \n if (filter = options[:with])\n client.filters = options[:with].collect{ |attrib, value|\n Riddle::Client::Filter.new attrib.to_s, value\n }\n end\n \n \n if (page_size = options[:page_size] || 20)\n page_size = 20 if (page_size.to_i == 0) # Justin Case\n client.limit = page_size\n end\n \n if (page = options[:page] || 1)\n page = 1 if (page.to_i == 0) # Justin Case\n client.offset = (page-1) * client.limit\n end\n\n result = client.query(query)\n\n #TODO\n if result and result[:status] == 0 and result[:total_found] > 0 and (matches = result[:matches])\n classname = nil\n ids = matches.collect do |row|\n classname = MongoSphinx::MultiAttribute.decode(row[:attributes]['csphinx-class'])\n row[:doc]\n # (classname + '-' + row[:doc].to_s) rescue nil\n end.compact\n\n return ids if options[:raw]\n query_opts = {:_sphinx_id => ids}\n options[:select] and query_opts[:select] = options[:select]\n documents = Object.const_get(classname).all(query_opts).sort_by{|x| ids.index(x._sphinx_id)}\n return MongoSphinx::SearchResults.new(result, documents, page, page_size)\n else\n return MongoSphinx::SearchResults.new(result, [], page, page_size)\n end\n end",
"title": ""
},
{
"docid": "14d38f12fe4e19fd8c21eb1878f8c011",
"score": "0.62468773",
"text": "def by_fulltext_index(query, options = {})\n if self == Document\n client = Riddle::Client.new\n else\n client = Riddle::Client.new(fulltext_opts[:server], fulltext_opts[:port])\n query = query + \" @classname #{self}\"\n end\n \n client.match_mode = options[:match_mode] || :extended\n\n if (limit = options[:limit])\n client.limit = limit\n end\n\n if (max_matches = options[:max_matches])\n client.max_matches = matches\n end\n\n if (sort_by = options[:sort_by])\n client.sort_mode = :extended\n client.sort_by = sort_by\n end\n \n index_names = \"\"\n class_names = (self == Document ? options[:classes] || [] : [self.to_s])\n class_names.each do |class_name|\n class_name = class_name.to_s\n index_names += \"#{class_name.underscore}_core \"\n index_names += \"#{class_name.underscore}_delta \" if class_name.camelize.constantize.has_delta_index\n end\n debugger\n index_names = \"*\" if index_names.blank?\n result = client.query(query, index_names)\n\n if result and result[:status] == 0 and !(sphinx_matches = result[:matches]).empty?\n matches = sphinx_matches.collect do |row|\n {:classname => MongoSphinx::MultiAttribute.decode(row[:attributes]['csphinx-class']), :id => (row[:doc].to_i)} rescue nil\n end.compact\n return matches if options[:raw]\n objects = []\n matches.each do |match|\n objects << match[:classname].constantize.find_by_sphinx_id(match[:id])\n end\n return objects\n else\n return []\n end\n end",
"title": ""
},
{
"docid": "53f78571ccda566b511382d681b1bd5b",
"score": "0.61441094",
"text": "def index_all\n ::MojoDNA::Searchable::Ferret::Indexer::index_all( self )\n end",
"title": ""
},
{
"docid": "ce297c011de8f83c041afcb46296bbdc",
"score": "0.6122655",
"text": "def index options = {}, &block\n name = options[:name]\n dictionary = options[:dictionary]\n search_name = ['search', name].compact.join('_')\n index_name = [table_name, name, 'fts_idx'].compact.join('_')\n this_index = FullTextIndex.new(index_name, dictionary, self, &block)\n\n (self.full_text_indexes ||= []) << this_index\n\n scope_lambda = lambda { |term, *options|\n # Let's extract the individual terms to allow for quoted and wildcard terms.\n term = term.scan(/\"([^\"]+)\"|(\\S+)/).flatten.compact.map do |lex|\n [' ', ':', '(', ')', '|'].each do |jinx|\n lex.gsub!(\"#{jinx}\", \"\\\\#{jinx}\")\n lex.gsub!('&', '*')\n end\n lex =~ /(.+)\\*\\s*$/ ? \"#{$1}:*\" : lex\n end.join(' & ')\n\n order = (options.first == :no_order ? nil : 'rank DESC')\n\n {\n :select => \"#{table_name}.*, ts_rank_cd((#{this_index.to_s}),\n to_tsquery(#{connection.quote(dictionary)}, #{connection.quote(term)})) as rank\",\n :conditions =>\n [\"#{this_index.to_s} @@ to_tsquery(?,?)\", dictionary, term],\n :order => order\n }\n }\n\n create_named_scope search_name, scope_lambda\n end",
"title": ""
},
{
"docid": "fdcd041194d89c48d5e1871d7450869c",
"score": "0.6058074",
"text": "def search_class; end",
"title": ""
},
{
"docid": "fdcd041194d89c48d5e1871d7450869c",
"score": "0.6058074",
"text": "def search_class; end",
"title": ""
},
{
"docid": "735688c2090113de7ba2d62c2bf9d375",
"score": "0.5972777",
"text": "def search_index_tank(query, options={})\n SearchResult.new(index_tanked.add_fields_to_query(query, options), @index_tanked.index, scoped({}), options)\n end",
"title": ""
},
{
"docid": "aeee1f6a9ba31626f39e7d5887702cf6",
"score": "0.59450513",
"text": "def rebuild_index(*models)\n models << self\n # default attributes for fields\n fi = Ferret::Index::FieldInfos.new(:store => :no, \n :index => :yes, \n :term_vector => :no,\n :boost => 1.0)\n # primary key\n fi.add_field(:id, :store => :yes, :index => :untokenized) \n # class_name\n if configuration[:store_class_name]\n fi.add_field(:class_name, :store => :yes, :index => :untokenized) \n end\n # collect field options from all models\n fields = {}\n models.each do |model|\n fields.update(model.fields_for_ferret)\n end\n logger.debug(\"class #{self.name}: fields for index: #{fields.keys.join(',')}\")\n fields.each_pair do |field, options|\n fi.add_field(field, { :store => :no, \n :index => :yes }.update(options)) \n end\n fi.create_index(ferret_configuration[:path])\n\n index = Ferret::Index::Index.new(ferret_configuration.dup.update(:auto_flush => false))\n #index = Ferret::Index::Index.new(ferret_configuration.dup.update(:auto_flush => true))\n batch_size = 1000\n models.each do |model|\n # index in batches of 1000 to limit memory consumption (fixes #24)\n model.transaction do\n 0.step(model.count, batch_size) do |i|\n model.find(:all, :limit => batch_size, :offset => i).each do |rec|\n index << rec.to_doc\n end\n end\n end\n end\n logger.debug(\"Created Ferret index in: #{class_index_dir}\")\n index.flush\n index.optimize\n index.close\n # close combined index readers, just in case\n # this seems to fix a strange test failure that seems to relate to a\n # multi_index looking at an old version of the content_base index.\n @@multi_indexes.each_pair do |key, index|\n # puts \"#{key} -- #{self.name}\"\n # TODO only close those where necessary (watch inheritance, where\n # self.name is base class of a class where key is made from)\n index.close #if key =~ /#{self.name}/\n end\n @@multi_indexes = Hash.new\n end",
"title": ""
},
{
"docid": "85a60d72927bf1f2bdb56c021d8d51c9",
"score": "0.58708465",
"text": "def search_query(index_name, query, options = SearchOptions.new) end",
"title": ""
},
{
"docid": "7f59e667e239c70bbd26871370c6f1ec",
"score": "0.58350486",
"text": "def search_on(klass, &default)\n class_name = klass.to_s\n \n # Expose this class to the views\n @filter_class = class_name\n\n if session[:filter] && session[:filter][class_name] && session[:filter][class_name].any?\n begin\n filter = session[:filter][class_name].dup\n\n filter.delete(:full)\n query = filter.delete(:query)\n conditions = filter\n\n query = klass.search(query, :conditions => conditions,\n :with => {:account_id => current_account.id}, \n :page => params[:page], :per_page => 30,\n :mode => :extended)\n\n # Force the search to happen here so we can catch\n # any errors that might get thrown\n query.results\n\n return query\n rescue => ex\n flash.now[:warning] = SPHINX_WARNING\n Mailer.deliver_exception_thrown(ex, \"Sphinx Search Error\")\n end\n end\n\n # Fall-through: just return the value of the defaults block\n default.call\n end",
"title": ""
},
{
"docid": "626f2e7ee988b6af00b877499f8539cf",
"score": "0.5791004",
"text": "def advanced_search\n \n end",
"title": ""
},
{
"docid": "e4b179100488383df0316b9e92db83af",
"score": "0.57662916",
"text": "def by_fulltext_index(query, options = {})\n if self == Document\n client = Riddle::Client.new\n else\n client = Riddle::Client.new(fulltext_opts[:server],\n fulltext_opts[:port])\n\n query = query + \" @classname #{self}\"\n end\n\n client.match_mode = options[:match_mode] || :extended\n\n if (limit = options[:limit])\n client.limit = limit\n end\n\n if (max_matches = options[:max_matches])\n client.max_matches = matches\n end\n\n if (sort_by = options[:sort_by])\n client.sort_mode = :extended\n client.sort_by = sort_by\n end\n\n result = client.query(query)\n\n #TODO\n if result and result[:status] == 0 and (matches = result[:matches])\n classname = nil\n ids = matches.collect do |row|\n classname = MongoSphinx::MultiAttribute.decode(row[:attributes]['csphinx-class'])\n (classname + '-' + row[:doc].to_s) rescue nil\n end.compact\n\n return ids if options[:raw]\n return Object.const_get(classname).find(ids)\n else\n return []\n end\n end",
"title": ""
},
{
"docid": "d1dd8e86757f920469197b7f5e5b3182",
"score": "0.5762403",
"text": "def index\n @flexible_searches = ransack_result\n # @fields = FIELDS\n # @headers = HEADERS\n end",
"title": ""
},
{
"docid": "561c9b50ee7aaba624bd7edd804e2b6c",
"score": "0.5751006",
"text": "def search(query, options = {})\n sphinx = Sphinx::Client.new\n\n @host ||= Sphincter::Configure.get_conf['sphincter']['host']\n @port ||= Sphincter::Configure.get_conf['sphincter']['port']\n\n sphinx.SetServer @host, @port\n\n options[:conditions] ||= {}\n options[:conditions].each do |column, values|\n values = sphincter_convert_values Array(values)\n sphinx.SetFilter column.to_s, values\n end\n\n options[:between] ||= {}\n options[:between].each do |column, between|\n min, max = sphincter_convert_values between\n\n sphinx.SetFilterRange column.to_s, min, max\n end\n\n @default_per_page ||= Sphincter::Configure.get_conf['sphincter']['per_page']\n\n per_page = options[:per_page] || @default_per_page\n page_offset = options.key?(:page) ? options[:page] - 1 : 0\n offset = page_offset * per_page\n\n sphinx.SetLimits offset, per_page\n\n index_name = options[:index] || table_name\n\n sphinx_result = sphinx.Query query, index_name\n\n matches = sphinx_result['matches'].sort_by do |id, match|\n -match['index'] # #find reverses, lame!\n end\n\n ids = matches.map do |id, match|\n (id - match['attrs']['sphincter_index_id']) /\n Sphincter::Configure.index_count\n end\n\n results = Results.new\n\n results.records = find ids\n results.total = sphinx_result['total_found']\n results.per_page = per_page\n\n results\n end",
"title": ""
},
{
"docid": "cb87fa053963be4491b78daeef82b0f7",
"score": "0.5729985",
"text": "def ferret_analyzer\n nil\n end",
"title": ""
},
{
"docid": "db53e6feb7a306ea1043275900526369",
"score": "0.5716237",
"text": "def full_text_search_with_ferret\n clean = @query.split(\" \").collect { |q| \"+*:#{q}*\" }.join(\" \")\n repository(:search).search(\"+_type:User #{clean}\")[User]\n end",
"title": ""
},
{
"docid": "ca3452d4af0506a01897a88fb2ede880",
"score": "0.5701499",
"text": "def search(query=nil, options={})\n\n options ||= {}\n\n # setup empty search definition\n @search_definition = {\n query: {},\n filter: {},\n facets: {},\n }\n\n # Prefill and set the filters (top-level `filter` and `facet_filter` elements)\n __set_filters = lambda do |key, f|\n\n @search_definition[:filter][:and] ||= []\n @search_definition[:filter][:and] |= [f]\n\n @search_definition[:facets][key.to_sym][:facet_filter][:and] ||= []\n @search_definition[:facets][key.to_sym][:facet_filter][:and] |= [f]\n end\n\n # facets\n @search_definition[:facets] = search_facet_fields.each_with_object({}) do |a,hsh|\n hsh[a.to_sym] = {\n terms: {\n field: a\n },\n facet_filter: {}\n }\n end\n\n # query\n unless query.blank?\n @search_definition[:query] = {\n bool: {\n should: [\n { multi_match: {\n query: query,\n # limit which fields to search, or boost here:\n fields: search_text_fields,\n operator: 'and'\n }\n }\n ]\n }\n }\n else\n @search_definition[:query] = { match_all: {} }\n end\n\n # add filters for facets\n options.each do |key,value|\n next unless search_facet_fields.include?(key)\n\n f = { term: { key.to_sym => value } }\n\n __set_filters.(key, f)\n __set_filters.(key, f)\n\n end\n\n # execute Elasticsearch search\n __elasticsearch__.search(@search_definition)\n\n end",
"title": ""
},
{
"docid": "6aefaa16280ca3a332d36b38949aa081",
"score": "0.56946784",
"text": "def sunspot_search\n return @search if @search\n @search = Sunspot.new_search(@klass)\n @where_values.each do |wv|\n wv.each do |k,v|\n @search.build { with k, v.blank? ? nil : SolandraObject::Relation.downcase_query(v) }\n end\n end\n \n @where_not_values.each do |wnv|\n wnv.each do |k,v|\n @search.build { without k, v.blank? ? nil : SolandraObject::Relation.downcase_query(v) }\n end\n end\n \n @greater_than_values.each do |gtv|\n gtv.each do |k,v|\n @search.build { with(k).greater_than(v.blank? ? nil : SolandraObject::Relation.downcase_query(v)) }\n end\n end\n \n @less_than_values.each do |ltv|\n ltv.each do |k,v|\n @search.build { with(k).less_than(v.blank? ? nil : SolandraObject::Relation.downcase_query(v)) }\n end\n end\n \n @order_values.each do |ov|\n ov.each do |k,v|\n if(@reverse_order_value)\n @search.build { order_by k, (v == :asc ? :desc : :asc) }\n else\n @search.build { order_by k, v }\n end\n end\n end\n \n @group_values.each do |gv|\n @search.build { group gv }\n end\n \n @fulltext_values.each do |ftv|\n @search.build do \n fulltext SolandraObject::Relation.downcase_query(ftv[:query]) do\n if(ftv[:fields])\n fields ftv[:fields]\n end\n if(ftv[:highlight])\n highlight ftv[:fields]\n end\n end\n end\n end\n \n # We have to put these in local variables because the block doesn't\n # get access to our instance variables\n pv, ppv, ov = @page_value, @per_page_value, @offset_value\n @search.build { paginate :page => pv, :per_page => ppv, :offset => ov }\n \n qpv = @query_parser_value\n \n if qpv\n @search.build do\n adjust_solr_params do |params|\n params[:defType] = qpv\n end\n end\n else\n @search.build do\n adjust_solr_params do |params|\n params.delete :defType\n end\n end\n end\n \n @search_values.each do |sv|\n @search.build(&sv)\n end\n @search\n end",
"title": ""
},
{
"docid": "937d5e8ad0724e8aaa0623f110c6595e",
"score": "0.56803274",
"text": "def index\n\t\tfederation = Federation.find_by({ name: params[:federation] })\n\t\tip = request.headers['REMOTE_ADDR']\n\t\tif federation && ip == federation.ip\n\t\t\tbegin\n\t\t\t\tquery_params = QueryFormat.locals_format()\n\t\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\t\tquery = QueryFormat.create_solr_query(query_params, params, nil)\n\t\t\t\tquery.merge!(QueryFormat.transform_highlight(\"hl\", \"on\")) if params[:q]\n\t\t\t\tstraighten_out_visible(query)\n\n\t\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\t\tsolr = Solr.factory_create(is_test, federation.name)\n\n\t\t\t\t@results = solr.search(query, { :field_list => [ 'key', 'title', 'object_type', 'object_id', 'last_modified' ], :key_field => 'key', :no_facets => true })\n\t\t\t\tif params[:object_type]\n\t\t\t\t\t# now do the same search as if there were no query, just to get the total\n\t\t\t\t\tparams.delete(:object_type)\n\t\t\t\t\tparams[:max] = \"1\"\n\t\t\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\t\t\tquery = QueryFormat.create_solr_query(query_params, params, nil)\n\t\t\t\t\tstraighten_out_visible(query)\n\t\t\t\t\tr2 = solr.search(query, { :field_list => [ 'key' ], :key_field => 'key', :no_facets => true })\n\t\t\t\t\t@results[:total_documents] = r2[:total]\n\t\t\t\telse\n\t\t\t\t\t@results[:total_documents] = @results[:total]\n\t\t\t\tend\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html { render :template => '/locals/index' }\n\t\t\t\t\tformat.xml { render :template => '/locals/index' }\n\t\t\t\tend\n\t\t\trescue ArgumentError => e\n\t\t\t\trender_error(e.to_s)\n\t\t\trescue SolrException => e\n\t\t\t\trender_error(e.to_s, e.status())\n\t\t\trescue Exception => e\n\t\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\t\tend\n\t\telse\n\t\t\trender_error(\"You do not have permission to do this.\", :unauthorized)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d9689a0f4f9e67afb8995229dc3ecfda",
"score": "0.56629306",
"text": "def search(query=nil, options={})\n options ||= {}\n @search_definition = {\n query: {},\n filter: {},\n facets: {},\n }\n\n __set_filters = lambda do |key, f|\n\n @search_definition[:filter][:and] ||= []\n @search_definition[:filter][:and] |= [f]\n\n @search_definition[:facets][key.to_sym][:facet_filter][:and] ||= []\n @search_definition[:facets][key.to_sym][:facet_filter][:and] |= [f]\n end\n\n @search_definition[:facets] = search_facet_fields.each_with_object({}) do |a,hsh|\n hsh[a.to_sym] = {\n terms: {\n field: a\n },\n facet_filter: {}\n }\n end\n\n unless query.blank?\n @search_definition[:query] = {\n bool: {\n should: [\n { multi_match: {\n query: query,\n # limit which fields to search, or boost here:\n fields: search_text_fields,\n operator: 'and'\n }\n }\n ]\n }\n }\n else\n @search_definition[:query] = { match_all: {} }\n end\n\n options.each do |key,value|\n next unless search_facet_fields.include?(key)\n f = { term: { key.to_sym => value } }\n __set_filters.(key, f)\n end\n\n __elasticsearch__.search(@search_definition)\n\n\n end",
"title": ""
},
{
"docid": "0b3d6fac97a5224229928cf05373d469",
"score": "0.56409895",
"text": "def add_class_search_index(index)\n debug_msg \" generating class search index\"\n \n self.data.each do |mod_name, mod| \n index[:searchIndex].push( search_string(mod.title) )\n index[:longSearchIndex].push( search_string(mod.title) )\n index[:info].push([\n mod.title,\n '',\n mod.title + '.html',\n '', \n snippet(mod.summary),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "57bfef0a28037385fbb11d08b87ea1d9",
"score": "0.5567034",
"text": "def index\n\t\tif params[:search_term]\n\n\t\t\tsearch_term = ThinkingSphinx::Query.escape(params[:search_term])\n\t\t\tsearch_term.strip!\n\t\t\tsearch_term = ThinkingSphinx::Query.wildcard(search_term)\n\t\t\t#search_term = search_term.gsub(\" \", \" & \")\n\n\t\t\t### Rentog Database\n\t\t\t# rentog_devs = Listing.search(search_term, ranker: :wordcount, per_page: 100, with: {price_cents: 0..99999999}).map do |x|\n\t\t\t# \tmanufacturer = Maybe(x.title.split(\" (\")[1]).sub!(\")\", \"\").or_else(\"\")\n\t\t\t# \tmodel = x.title.split(\" (\")[0]\n\t\t\t# \tif manufacturer.present?\n\t\t\t# \t\tmanufacturer + \" | \" + model\n\t\t\t# \telse\n\t\t\t# \t\tmodel\n\t\t\t# \tend\n\t\t\t# end\n\n\t\t\t### Price Comparison Database\n\t\t\t#devices = PriceComparisonDevice.search(search_term, per_page: 100, with: {price_cents: 0..99999999}).map do |x|\n\t\t\tdevices = ThinkingSphinx.search(search_term, classes: [PriceComparisonDevice, Listing], per_page: 100, with: {price_cents: 0..99999999}).map do |x|\n\t\t\t\t# price comparison device\n\t\t\t\tif x.has_attribute? \"model\"\n\t\t\t\t\tif x.model.present? and x.manufacturer.present? and !x.model.downcase.include?(x.manufacturer.downcase)\n\t\t\t\t\t\tx.manufacturer + \" | \" + x.model\n\t\t\t\t\telsif x.model.present?\n\t\t\t\t\t\tx.model\n\t\t\t\t\telse\n\t\t\t\t\t\tx.title\n\t\t\t\t\tend\n\t\t\t\t# Rentog Listing\n\t\t\t\telse\n\t\t\t\t\tmanufacturer = Maybe(x.title.split(\" (\")[1]).sub!(\")\", \"\").or_else(\"\")\n\t\t\t\t\tmodel = x.title.split(\" (\")[0]\n\t\t\t\t\tif manufacturer.present?\n\t\t\t\t\t\tmanufacturer + \" | \" + model\n\t\t\t\t\telse\n\t\t\t\t\t\tmodel\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\telse\n\t\t\tdevices = \"\"\n\t\tend\n\n\t\t# remove duplicates\n\t\t#devices = (rentog_devs + devices).uniq\n\t\tdevices = devices.uniq\n\n\t\t# return answer as json\n\t\trender :json => {devices: devices} and return\n\tend",
"title": ""
},
{
"docid": "aa7bbde9d79e514a6a52b9400aae0ab7",
"score": "0.5565163",
"text": "def single_index_find_by_contents(q, options = {}, find_options = {})\n result = []\n\n unless options[:models] == :all # search needs to be restricted by one or more class names\n options[:models] ||= [] \n # add this class to the list of given models\n options[:models] << self unless options[:models].include?(self)\n # keep original query \n original_query = q\n \n # work around ferret bug in #process_query (doesn't ensure the\n # reader is open)\n ferret_index.synchronize do\n ferret_index.send(:ensure_reader_open)\n original_query = ferret_index.process_query(q)\n end if q.is_a? String\n\n q = Ferret::Search::BooleanQuery.new\n q.add_query(original_query, :must)\n model_query = Ferret::Search::BooleanQuery.new\n options[:models].each do |model|\n model_query.add_query(Ferret::Search::TermQuery.new(:class_name, model.name), :should)\n end\n q.add_query(model_query, :must)\n end\n #puts q.to_s\n total_hits = find_id_by_contents(q, options) do |model, id, score|\n o = Object.const_get(model).find(id, find_options.dup)\n o.ferret_score = score\n result << o\n end\n return SearchResults.new(result, total_hits)\n end",
"title": ""
},
{
"docid": "c7c598d860bdd970d2da1a73c7d040d6",
"score": "0.5559307",
"text": "def add_class_search_index(index)\n debug_msg \" generating class search index\"\n \n @classes.select { |klass| \n klass.document_self_or_methods\n }.sort.each do |klass|\n index[:searchIndex].push( search_string(klass.name) )\n index[:longSearchIndex].push( search_string(klass.parent.name) )\n index[:info].push([\n klass.name, \n klass.parent.full_name, \n klass.path, \n klass.module? ? '' : (klass.superclass ? \" < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}\" : ''), \n snippet(klass.comment),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "3adc09c490c574a292c295f174844230",
"score": "0.55436355",
"text": "def add_class_search_index(index)\n debug_msg \"generating class search index\"\n\n classes.select { |klass| klass.document_self_or_methods }.sort.each do |klass|\n modulename = klass.module? ? '' : (klass.superclass ? (String === klass.superclass ? klass.superclass : klass.superclass.full_name) : '')\n index[:searchIndex].push( search_string(klass.name) )\n index[:longSearchIndex].push( search_string(klass.parent.full_name) )\n index[:info].push([\n klass.name,\n klass.parent.full_name,\n klass.path,\n modulename ? \" < #{modulename}\" : '',\n snippet(klass.comment),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "f4821698de57fe672973f353d469482d",
"score": "0.5542997",
"text": "def initialize(settings)\n @ferret_config = settings\n @query_parser = Ferret::QueryParser.new(settings.marshal_dump)\n ferret_searcher\n end",
"title": ""
},
{
"docid": "690961733ea6bbd969365d7f4a23ffbf",
"score": "0.55416006",
"text": "def to_doc\n logger.debug \"creating doc for class: #{self.ferret_key}\"\n returning Ferret::Document.new do |doc|\n # store the id and class name of each item, and the unique key used for identifying the record\n # even in multi-class indexes.\n doc[:key] = self.ferret_key\n doc[:id] = self.id.to_s\n doc[:class_name] = self.class.name\n \n # iterate through the fields and add them to the document\n aaf_configuration[:defined_fields].each_pair do |field, config|\n doc[field] = self.send(\"#{field}_to_ferret\") unless config[:ignore]\n end\n if aaf_configuration[:boost]\n if self.respond_to?(aaf_configuration[:boost])\n boost = self.send aaf_configuration[:boost]\n doc.boost = boost.to_i if boost\n else\n logger.error \"boost option should point to an instance method: #{aaf_configuration[:boost]}\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "c296f4e1c71eb651029b991561068097",
"score": "0.5525533",
"text": "def find_by_contents(q, options = {}, find_options = {})\n # handle shared index\n return single_index_find_by_contents(q, options, find_options) if configuration[:single_index]\n results = {}\n total_hits = find_id_by_contents(q, options) do |model, id, score|\n # stores ids, index of each id for later ordering of\n # results, and score\n results[id] = [ results.size + 1, score ]\n end\n result = []\n begin\n # TODO: in case of STI AR will filter out hits from other \n # classes for us, but this\n # will lead to less results retrieved --> scoping of ferret query\n # to self.class is still needed.\n # from the ferret ML (thanks Curtis Hatter)\n # > I created a method in my base STI class so I can scope my query. For scoping\n # > I used something like the following line:\n # > \n # > query << \" role:#{self.class.eql?(Contents) '*' : self.class}\"\n # > \n # > Though you could make it more generic by simply asking\n # > \"self.descends_from_active_record?\" which is how rails decides if it should\n # > scope your \"find\" query for STI models. You can check out \"base.rb\" in\n # > activerecord to see that.\n # but maybe better do the scoping in find_id_by_contents...\n if results.any?\n conditions = combine_conditions([ \"#{table_name}.#{primary_key} in (?)\", results.keys ], \n find_options[:conditions])\n result = self.find(:all, \n find_options.merge(:conditions => conditions))\n # correct result size if the user specified conditions\n total_hits = result.length if find_options[:conditions]\n end\n rescue ActiveRecord::RecordNotFound\n logger.warn \"REBUILD YOUR INDEX! One of the id's in the index didn't have an associated record\"\n end\n\n # order results as they were found by ferret, unless an AR :order\n # option was given\n unless find_options[:order]\n result.sort! { |a, b| results[a.id.to_s].first <=> results[b.id.to_s].first }\n end\n # set scores\n result.each { |r| r.ferret_score = results[r.id.to_s].last }\n \n logger.debug \"Query: #{q}\\nResult ids: #{results.keys.inspect},\\nresult: #{result}\"\n return SearchResults.new(result, total_hits)\n end",
"title": ""
},
{
"docid": "41b974139379179423d247cabe0a8f4a",
"score": "0.5516391",
"text": "def advanced\n @search_fields = RLetters::Solr::Advanced.search_fields\n end",
"title": ""
},
{
"docid": "de343b90ab01afad8a5017df2db6fd55",
"score": "0.5513026",
"text": "def index\n @fators = Fator.all\n if params[:search]\n @fators = Fator.search(params[:search])\n else\n @fators = Fator.all\n end\n end",
"title": ""
},
{
"docid": "250a6bb2155a6b181da20f0bd0669a4c",
"score": "0.5504148",
"text": "def search(options = {})\n if options['q'].blank?\n return []\n end\n\n options = SEARCH_DEFAULTS.merge(options)\n params = {}\n\n page = options['page']\n if page !~ /[0-9]+/ || page.to_i <= 1\n options['page'] = 1\n params['do_search'] = 'Search'\n else\n options['page'] = options['page'].to_i - 1\n params['next_page'] = \">>> #{options['perpage']} more >>>\"\n end\n\n options.each do |key, value|\n name = key.gsub('_','-')\n if SEARCH_MULTIPLE.include? key\n values = options[key].gsub(' ', '').split(',')\n raise FASearchError.new(key, options[key], fa_url('search')) unless values.all?{|v| SEARCH_OPTIONS[key].include? v}\n values.each{|v| params[\"#{name}-#{v}\"] = 'on'}\n elsif SEARCH_OPTIONS.keys.include? key\n raise FASearchError.new(key, options[key], fa_url('search')) unless SEARCH_OPTIONS[key].include? options[key].to_s\n params[name] = value\n elsif SEARCH_DEFAULTS.keys.include? key\n params[name] = value\n end\n end\n\n raw, uri = @cache.add(\"url:serach:#{params.to_s}\") do\n response, uri = post('/search/', params)\n unless response.is_a?(Net::HTTPSuccess)\n raise FAStatusError.new(fa_url('search/'), response.message)\n end\n [response.body, uri]\n end\n html = Nokogiri::HTML(raw)\n [html.css('.gallery > figure').map{|art| build_submission(art)}, uri]\n end",
"title": ""
},
{
"docid": "70e057e13eeeb9d6038394cd434d739b",
"score": "0.54906684",
"text": "def set_fts_attrs\n return unless search_cfg.present?\n\n self.fts_tsearch = joined_resource_fields search_cfg['full']\n self.fts_trigram = joined_resource_fields search_cfg['partial']\n end",
"title": ""
},
{
"docid": "f0cc24a7f105c62504858809cd1dd45e",
"score": "0.54894966",
"text": "def index\n @search = Sunspot.search Firstclassification, Secondclassification do\n fulltext params[:query_classification]\n end\n\n @classifications = @search.results\n respond_to do |format|\n format.html\n format.json { render :json => @classifications.map(&:attributes) }\n end\nend",
"title": ""
},
{
"docid": "32d94a102706d02be4bec728f3256c35",
"score": "0.54823387",
"text": "def search\n index\n end",
"title": ""
},
{
"docid": "83959b6fb98afb87c3002ede6cf171f4",
"score": "0.5471774",
"text": "def field_infos(models)\n # default attributes for fields\n fi = Ferret::Index::FieldInfos.new(:store => :no, \n :index => :yes, \n :term_vector => :no,\n :boost => 1.0)\n # primary key\n fi.add_field(:id, :store => :yes, :index => :untokenized) \n # class_name\n if aaf_configuration[:store_class_name]\n fi.add_field(:class_name, :store => :yes, :index => :untokenized) \n end\n fields = {}\n models.each do |model|\n fields.update(model.aaf_configuration[:ferret_fields])\n end\n fields.each_pair do |field, options|\n fi.add_field(field, { :store => :no, \n :index => :yes }.update(options)) \n end\n return fi\n end",
"title": ""
},
{
"docid": "a98b8f61d006d2aca4795dbed2f043a8",
"score": "0.5469785",
"text": "def view_fees_structure\n @search_query = params[:query]\n end",
"title": ""
},
{
"docid": "9eb87746f5cbf95ebe0f82303aa64172",
"score": "0.54663306",
"text": "def search_implementation(args)\n\n # 'args' should be a normalized search arguments hash including the following elements:\n # :query, :per_page, :start, :page, :search_field, :sort\n Rails.logger.debug(\"mjc12test: #{self.class.name} called. Query is #{args[:query]}}\")\n bento_results = BentoSearch::Results.new\n # solr search must be transformed to match simple search transformation.\n q = SearchController.transform_query args[:query]\n Rails.logger.debug(\"mjc12test: BentoSearch::SolrEngineSingle called. #{__FILE__} #{__LINE__} transformed q = #{q}\")\n #solr = RSolr.connect :url => 'http://da-prod-solr1.library.cornell.edu/solr/blacklight'\n Rails.logger.debug(\"mjc12test: #{self.class.name} #{__FILE__} #{__LINE__} url is #{configuration.solr_url}\")\n solr = RSolr.connect :url => configuration.solr_url\n solr_response = solr.get 'select', :params => {\n :q => q,\n #:fq => \"format:\\\"#{format}\\\"\",\n # :rows => args[:per_page],\n :rows => 20, # from sample single query; should set this dynamically?\n :group => true,\n 'group.field' => 'format_main_facet',\n 'group.limit' => 3,\n 'group.ngroups' => 'true',\n :sort => 'score desc, pub_date_sort desc, title_sort asc',\n :fl => 'id,pub_date_display,format,fulltitle_display,fulltitle_vern_display,author_display,score,pub_info_display,availability_json',\n :mm => 1\n #:defType => 'edismax'\n }\n\n Rails.logger.debug(\"mjc12test: BlacklightEngine2 search called. #{__FILE__} #{__LINE__} solr_response #{solr_response}\")\n # Because all our facets are packaged in a single query, we have to treat this as a single result\n # in order to have bento_search process it correctly. We'll split up into different facets\n # once we get back to the controller!\n result = BentoSearch::ResultItem.new\n result.custom_data = solr_response['grouped']['format_main_facet']['groups']\n bento_results << result\n bento_results.total_items = 1\n return bento_results\n\n end",
"title": ""
},
{
"docid": "5b2b1d0224c3722d2441eaf60e2a2307",
"score": "0.54658014",
"text": "def run_search\n\t\t\tsearch.search\n\t\tend",
"title": ""
},
{
"docid": "d645801730b47ae2030b0e16381a3100",
"score": "0.5461953",
"text": "def search\n info params.inspect\n @query = params[:query]\n searcher = SolrSearcher.new\n @facet = {}\n @page_title = if @query == TEXT_DUMMY\n \"All Documents\"\n else\n \"Search Result for '#{@query}'\"\n end\n begin\n #debugger\n @search_results = searcher.process_request(@query, 'kwd', params.merge(:raw=>true))\n error \"search_results : #{@search_results.inspect}\" \n rescue Exception => e\n error \"Search failed!!\", e\n end\n @rank_list = @search_results.hits.map{|e|{:item=>e.instance, :id=>e.instance.id, :score=>e.score}}\n @query_doc = Item.find_or_create(@query, 'query', :uri=>request.url, \n :content=>@rank_list.map{|e|e[:item].title}.join(\"\\n\"))\n\n @facet[:source_id] = searcher.process_request(@query, 'kwd', params.merge(:facet=>:source_id)).\n find_all{|e|e.instance}.map{|e|[\"#{e.instance.title} (#{e.count})\", e.value]} \n\n @facet[:itype_str] = searcher.process_request(@query, 'kwd', params.merge(:facet=>:itype_str)).\n map{|e|[\"#{e.value} (#{e.count})\", e.value]}\n \n @facet[:basedate] = searcher.process_request(@query, 'kwd', params.merge(:facet=>:basedate)).\n find_all{|e|Time.now - e.value < 86400*7}.map{|e|[\"#{e.value.to_date} (#{e.count})\", e.value]}.reverse\n\n #debugger\n Item.metadata_fields(params[:facet_itype_str]).each do |field, type|\n @facet[field] = searcher.process_request(@query, 'kwd', params.merge(:facet=>field)).\n map{|e|[\"#{e.value} (#{e.count})\", e.value]}\n end\n #@docs = Item.find(@rank_list.map{|e|e[0]}).map_hash{|d|[d.id, d]}\n #debugger\n end",
"title": ""
},
{
"docid": "944c1fe0e5863b9410fbdecb54816f83",
"score": "0.5458172",
"text": "def index\n if params[:search]\n @query = Restaurant.search do\n fulltext params[:search]\n facet :price, :range => 0..100, :range_interval => 5\n with(:price, Range.new(*params[:price_range].split(\"..\").map(&:to_i))) if params[:price_range].present?\n end\n @restaurants = @query.results\n else\n @restaurants = Restaurant.all.order('created_at DESC')\n end\n end",
"title": ""
},
{
"docid": "34be0326ace95d90d016c3ca6871abb7",
"score": "0.54412884",
"text": "def search_engine_class\n AnimalSearch\n end",
"title": ""
},
{
"docid": "bd286831b4b49e88db0d3ea69ab2d642",
"score": "0.5432658",
"text": "def add_class_search_index(index)\n debug_msg \" generating class search index\"\n @classes.uniq.select { |klass|\n klass.document_self_or_methods\n }.sort.each do |klass|\n modulename = klass.module? ? '' : (klass.superclass ? (String === klass.superclass ? klass.superclass : klass.superclass.full_name) : '')\n debug_msg \" #{klass.parent.full_name}::#{klass.name}\"\n index[:searchIndex].push( search_string(klass.name) )\n index[:longSearchIndex].push( search_string(klass.parent.full_name) )\n files = klass.in_files.map{ |file| file.absolute_name }\n index[:info].push([\n klass.name,\n files.include?(klass.parent.full_name) ? files.first : klass.parent.full_name,\n klass.path,\n modulename ? \" < #{modulename}\" : '',\n snippet(klass.comment),\n TYPE_CLASS\n ])\n end\n end",
"title": ""
},
{
"docid": "54965c2566f6c277e79dc5e50db04b32",
"score": "0.5432141",
"text": "def initialize(search_results, eds_config = {}, additional_limiters = {}, options = {}, smarttext_failover = false)\n\n @results = search_results\n\n if @results.is_a?(Hash)\n\n @limiters = additional_limiters\n @raw_options = options\n\n # titleize facets?\n (ENV.has_key? 'EDS_TITLEIZE_FACETS') ?\n if %w(y Y yes Yes true True).include?(ENV['EDS_TITLEIZE_FACETS'])\n @titleize_facets_on = true\n else\n @titleize_facets_on = false\n end :\n @titleize_facets_on = eds_config[:titleize_facets]\n\n # convert all results to a list of records\n @records = []\n if @results['SearchResult']['Data']['Records']\n @results['SearchResult']['Data']['Records'].each { |record|\n\n @records.push(EBSCO::EDS::Record.new(record, eds_config))\n\n # # records hidden in guest mode\n # if record['Header']['AccessLevel']\n # if record['Header']['AccessLevel'].to_i > 1\n # @records.push(EBSCO::EDS::Record.new(record))\n # else\n # @records.push(EBSCO::EDS::Record.new(record))\n # end\n # else\n # @records.push(EBSCO::EDS::Record.new(record))\n # end\n\n }\n end\n\n # create a special list of research starter records\n @research_starters = []\n _related_records = @results.fetch('SearchResult',{}).fetch('RelatedContent',{}).fetch('RelatedRecords',{})\n if _related_records.count > 0\n _related_records.each do |related_item|\n if related_item['Type'] == 'rs'\n rs_entries = related_item.fetch('Records',{})\n if rs_entries.count > 0\n rs_entries.each do |rs_record|\n @research_starters.push(EBSCO::EDS::Record.new(rs_record, eds_config))\n end\n end\n end\n end\n end\n\n # create a special list of exact match publications\n @publication_match = []\n _related_publications = @results.fetch('SearchResult',{}).fetch('RelatedContent',{}).fetch('RelatedPublications',{})\n if _related_publications.count > 0\n _related_publications.each do |related_item|\n if related_item['Type'] == 'emp'\n _publication_matches = related_item.fetch('PublicationRecords',{})\n if _publication_matches.count > 0\n _publication_matches.each do |publication_record|\n @publication_match.push(EBSCO::EDS::Record.new(publication_record, eds_config))\n end\n end\n end\n end\n end\n\n # titleize facets\n @titleize_facets = %w[Language Journal SubjectEDS SubjectGeographic Publisher]\n\n # set flag that query was rerun with smarttext after no results were found\n @smarttext_failover = smarttext_failover\n\n else\n # response isn't a hash (eg, html error page)\n raise EBSCO::EDS::ApiError, 'EBSCO API error: Query failed.'\n end\n\n end",
"title": ""
},
{
"docid": "b46c7c7bb7b1d69de71e389b46245abb",
"score": "0.5431465",
"text": "def search_query(index_name, query, options = Options::Search::DEFAULT)\n resp = @backend.document_search(index_name, JSON.generate(query), options.to_backend)\n\n SearchResult.new do |res|\n res.meta_data = SearchMetaData.new do |meta|\n meta.metrics.max_score = resp[:meta_data][:metrics][:max_score]\n meta.metrics.error_partition_count = resp[:meta_data][:metrics][:error_partition_count]\n meta.metrics.success_partition_count = resp[:meta_data][:metrics][:success_partition_count]\n meta.metrics.took = resp[:meta_data][:metrics][:took]\n meta.metrics.total_rows = resp[:meta_data][:metrics][:total_rows]\n meta.errors = resp[:meta_data][:errors]\n end\n res.rows = resp[:rows].map do |r|\n SearchRow.new do |row|\n row.transcoder = options.transcoder\n row.index = r[:index]\n row.id = r[:id]\n row.score = r[:score]\n row.fragments = r[:fragments]\n unless r[:locations].empty?\n row.locations = SearchRowLocations.new(\n r[:locations].map do |loc|\n SearchRowLocation.new do |location|\n location.field = loc[:field]\n location.term = loc[:term]\n location.position = loc[:position]\n location.start_offset = loc[:start_offset]\n location.end_offset = loc[:end_offset]\n location.array_positions = loc[:array_positions]\n end\n end\n )\n end\n row.instance_variable_set(:@fields, r[:fields])\n row.explanation = JSON.parse(r[:explanation]) if r[:explanation]\n end\n end\n if resp[:facets]\n res.facets = resp[:facets].each_with_object({}) do |(k, v), o|\n facet = case options.facets[k]\n when SearchFacet::SearchFacetTerm\n SearchFacetResult::TermFacetResult.new do |f|\n f.terms =\n if v[:terms]\n v[:terms].map do |t|\n SearchFacetResult::TermFacetResult::TermFacet.new(t[:term], t[:count])\n end\n else\n []\n end\n end\n when SearchFacet::SearchFacetDateRange\n SearchFacetResult::DateRangeFacetResult.new do |f|\n f.date_ranges =\n if v[:date_ranges]\n v[:date_ranges].map do |r|\n SearchFacetResult::DateRangeFacetResult::DateRangeFacet.new(r[:name], r[:count], r[:start_time], r[:end_time])\n end\n else\n []\n end\n end\n when SearchFacet::SearchFacetNumericRange\n SearchFacetResult::NumericRangeFacetResult.new do |f|\n f.numeric_ranges =\n if v[:numeric_ranges]\n v[:numeric_ranges].map do |r|\n SearchFacetResult::NumericRangeFacetResult::NumericRangeFacet.new(r[:name], r[:count], r[:min], r[:max])\n end\n else\n []\n end\n end\n else\n next # ignore unknown facet result\n end\n facet.name = v[:name]\n facet.field = v[:field]\n facet.total = v[:total]\n facet.missing = v[:missing]\n facet.other = v[:other]\n o[k] = facet\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a9f113dd2ecc8391cf8dbf76c5abd00a",
"score": "0.5429057",
"text": "def searcher_class\n @searcher_class ||= Spree::Core::Search::ProductCustomeSearch\n end",
"title": ""
},
{
"docid": "ee7e21c9f579350704e2ef70262763d2",
"score": "0.5423743",
"text": "def rebuild_index\n index = Ferret::Index::Index.new(ferret_configuration.merge(:create => true))\n self.find_all.each { |content| index << content.to_doc }\n logger.debug(\"Created Ferret index in: #{class_index_dir}\")\n index.flush\n index.optimize\n index.close\n end",
"title": ""
},
{
"docid": "dddebc0a60a373b2186851c614d66cfe",
"score": "0.5423538",
"text": "def set_fts_attrs\n return unless search_configuration.present?\n\n self.fts_tsearch = joined_resource_fields(search_configuration.full)\n self.fts_trigram = joined_resource_fields(search_configuration.partial)\n end",
"title": ""
},
{
"docid": "8102e256c9825e2f62fe6b2af2393fd8",
"score": "0.54173094",
"text": "def fsearch\n @foods = Food.search(params[:search])\n end",
"title": ""
},
{
"docid": "30b0476777f7e3ba6e8cc0ea277b0a42",
"score": "0.54162985",
"text": "def search_query(index_name, query, options = Options::Search::DEFAULT)\n resp = @backend.document_search(index_name, JSON.generate(query), options.to_backend(scope_name: @name))\n\n SearchResult.new do |res|\n res.meta_data = SearchMetaData.new do |meta|\n meta.metrics.max_score = resp[:meta_data][:metrics][:max_score]\n meta.metrics.error_partition_count = resp[:meta_data][:metrics][:error_partition_count]\n meta.metrics.success_partition_count = resp[:meta_data][:metrics][:success_partition_count]\n meta.metrics.took = resp[:meta_data][:metrics][:took]\n meta.metrics.total_rows = resp[:meta_data][:metrics][:total_rows]\n meta.errors = resp[:meta_data][:errors]\n end\n res.rows = resp[:rows].map do |r|\n SearchRow.new do |row|\n row.transcoder = options.transcoder\n row.index = r[:index]\n row.id = r[:id]\n row.score = r[:score]\n row.fragments = r[:fragments]\n unless r[:locations].empty?\n row.locations = SearchRowLocations.new(\n r[:locations].map do |loc|\n SearchRowLocation.new do |location|\n location.field = loc[:field]\n location.term = loc[:term]\n location.position = loc[:position]\n location.start_offset = loc[:start_offset]\n location.end_offset = loc[:end_offset]\n location.array_positions = loc[:array_positions]\n end\n end\n )\n end\n row.instance_variable_set(:@fields, r[:fields])\n row.explanation = JSON.parse(r[:explanation]) if r[:explanation]\n end\n end\n if resp[:facets]\n res.facets = resp[:facets].each_with_object({}) do |(k, v), o|\n facet = case options.facets[k]\n when SearchFacet::SearchFacetTerm\n SearchFacetResult::TermFacetResult.new do |f|\n f.terms =\n if v[:terms]\n v[:terms].map do |t|\n SearchFacetResult::TermFacetResult::TermFacet.new(t[:term], t[:count])\n end\n else\n []\n end\n end\n when SearchFacet::SearchFacetDateRange\n SearchFacetResult::DateRangeFacetResult.new do |f|\n f.date_ranges =\n if v[:date_ranges]\n v[:date_ranges].map do |r|\n SearchFacetResult::DateRangeFacetResult::DateRangeFacet.new(r[:name], r[:count], r[:start_time], r[:end_time])\n end\n else\n []\n end\n end\n when SearchFacet::SearchFacetNumericRange\n SearchFacetResult::NumericRangeFacetResult.new do |f|\n f.numeric_ranges =\n if v[:numeric_ranges]\n v[:numeric_ranges].map do |r|\n SearchFacetResult::NumericRangeFacetResult::NumericRangeFacet.new(r[:name], r[:count], r[:min], r[:max])\n end\n else\n []\n end\n end\n else\n next # ignore unknown facet result\n end\n facet.name = v[:name]\n facet.field = v[:field]\n facet.total = v[:total]\n facet.missing = v[:missing]\n facet.other = v[:other]\n o[k] = facet\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d19338a44d4155a39869df4a79425b85",
"score": "0.5407318",
"text": "def run(reify = true)\n @request = build_request_with_options(@options)\n\n log \"searching for #{@options.inspect}\"\n\n perform_action_with_retries do\n @response = @request.query(parsed_query, @options['indexes'])\n log \"search returned #{total_entries}/#{response[:total_found].to_i} in #{time.to_f} seconds.\"\n \n if self.class.client_options['with_subtotals'] \n @subtotals = get_subtotals(@request, parsed_query) \n \n # If the original query has a filter on this class, we will use its more accurate total rather the facet's \n # less accurate total.\n if @options['class_names'].size == 1\n @subtotals[@options['class_names'].first] = response[:total_found]\n end\n \n end\n \n Array(@options['facets']).each do |facet|\n @facets[facet] = get_facets(@request, parsed_query, facet)\n end \n \n @results = convert_sphinx_ids(response[:matches])\n @results = reify_results(@results) if reify\n \n say \"warning; #{response[:warning]}\" if response[:warning]\n raise UsageError, response[:error] if response[:error]\n \n end \n self\n end",
"title": ""
},
{
"docid": "4441810090c2ebd29daac8716f002fe7",
"score": "0.5406435",
"text": "def init_search\n @kat ||= Kat.search\n @kat.query = @args.join(' ')\n @kat.options = @options\n end",
"title": ""
},
{
"docid": "9c3f40e4675de196badf1eb514439fd2",
"score": "0.54043144",
"text": "def search\n\t\t\n\tend",
"title": ""
},
{
"docid": "b3a860ae64ff71905936eddc900ddcfa",
"score": "0.54006",
"text": "def show\n if params[:search]\n @freelancers = Freelancer.search(params[:search]).order(\"created_at DESC\")\n else\n @freelancers = Freelancer.all.order(\"created_at DESC\")\n end\n end",
"title": ""
},
{
"docid": "ab8c88c7092c68e94496b3fb6c230f21",
"score": "0.53999186",
"text": "def index\n # @search = Sunspot.search(Structure) do\n # fulltext params[:q] do\n # #boost_fields :name => 2.0, :description => 1.5\n #\n # #highlight :name, :fragment_size => 255\n # #highlight :description, :fragment_size => 60, :max_snippets => 4, :merge_contiguous_fragments => true\n # end\n # end\n\n @search = Sunspot.search(Structure) do\n params[:per_page] ||= 100\n params[:order] ||= 'score'\n\n fulltext params[:search]\n\n facet_filters = {}\n if params[:f]\n params[:f].each do |facet_field, values|\n case values\n when Array\n facet_filters[facet_field] = with(facet_field, Range.new(*values.first.split('..').map(&:to_i)))\n else\n if facet_field != 'type' || values != ['any']\n facet_filters[facet_field] = with(facet_field).any_of(values)\n end\n end\n end\n end\n\n if params[:r]\n params[:r].each do |facet_field, input_value|\n values = input_value.split(';').map(&:to_i)\n range = values.first..values.last\n with(facet_field).between(range)\n end\n end\n\n # Make sure to return the stats of some objects for the facets\n # facet :building_type\n stats :building_area\n facet :building_area, range: 0..100_000, range_interval: 1000 # , exclude: facet_filters['building_area']\n stats :total_site_eui\n facet :total_site_eui, range: 0..1500, range_interval: 100 # , exclude: facet_filters['total_site_eui']\n\n paginate page: params[:page], per_page: params[:per_page]\n end\n end",
"title": ""
},
{
"docid": "1f945f490a5e6943b430faef2326a0fc",
"score": "0.5397661",
"text": "def search(options = {})\n client.search({ index: index, type: type }.merge(options))\n end",
"title": ""
},
{
"docid": "c0cf99de086b5252f33ef1082e6da887",
"score": "0.53950787",
"text": "def elastic_index(options = {})\n Escargot.register_model(self)\n\n options.symbolize_keys!\n \n self.index_name = options[:index_name] if options[:index_name].present?\n self.elastic_search_type = options[:type] if options[:type].present?\n self.update_index_policy = options[:updates] if options[:updates].present?\n self.index_options = options[:index_options] if options[:index_options].present?\n self.mapping = options[:mapping] if options[:mapping].present? \n \n send :include, InstanceMethods\n \n if update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n\n end",
"title": ""
},
{
"docid": "3ddb8338ae3f18a01ae38a20222c600e",
"score": "0.5391719",
"text": "def to_searchable\n \n end",
"title": ""
},
{
"docid": "403b388d76574b7ca1a1d540c7fa440e",
"score": "0.5386594",
"text": "def search;end",
"title": ""
},
{
"docid": "b97280f48bdd9e37bb4c06c6f8bc3a18",
"score": "0.5385671",
"text": "def initialize(engine = Devcms.search_configuration[:default_search_engine])\n raise \"Search engine unknown: #{engine}\" unless ENGINES.include?(engine)\n raise \"Search engine disabled: #{engine}\" unless Devcms.search_configuration[:enabled_search_engines].include?(engine)\n\n @engine = case engine\n when 'ferret' then Search::FerretSearch\n end\n end",
"title": ""
},
{
"docid": "dfa246bd237534d14f835057a4c0e786",
"score": "0.53757334",
"text": "def search\n \n end",
"title": ""
},
{
"docid": "d8bdd48be62f394b19195fdb27b2b6ae",
"score": "0.53755856",
"text": "def index\n @dinder_searches = DinderSearch.all\n end",
"title": ""
},
{
"docid": "4f3dccc08928bfbddb96fbb4c6b24e1a",
"score": "0.5374869",
"text": "def search\n @foods = Food.search do\n keywords params[:query1]\n keywords params[:query2]\n end.results\n \n if @foods[0] == nil\n @foods = Food.solr_search do\n keywords params[:query1]\n end.results \n \n \n \n \n \n # #1.두부김치\n # @url = 'https://terms.naver.com/entry.nhn?docId=1286417&cid=40942&categoryId=32136'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('div.size_ct_v2 > p')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #2.치즈스틱\n # @url = 'https://terms.naver.com/entry.nhn?docId=1524877&cid=48169&categoryId=48223'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('p.txt')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #3.돼지갈비구이\n # @url = 'https://terms.naver.com/entry.nhn?docId=1084776&cid=40942&categoryId=32136'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('p.txt')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #4.계란말이\n # @url = 'https://terms.naver.com/entry.nhn?docId=3543696&cid=40942&categoryId=32136'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('p.txt')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #5.타코야키\n # @url = 'https://terms.naver.com/entry.nhn?docId=1225586&cid=40942&categoryId=32129'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('p.txt')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #6.제육볶음\n # @url = 'https://terms.naver.com/entry.nhn?docId=1286421&cid=40942&categoryId=32136'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('p.txt')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #7.떡볶이\n # @url = 'https://terms.naver.com/entry.nhn?docId=1086421&cid=40942&categoryId=32136'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('div.size_ct_v2 > p')\n \n # c = Content.new\n # c.content = @info\n # c.save\n \n # #8.돼지곱창구이\n # @url = 'https://terms.naver.com/entry.nhn?docId=1988140&cid=48164&categoryId=48202'\n # @page = RestClient.get(@url)\n # @doc = Nokogiri::HTML(@page)\n # @info = @doc.css('div.size_ct_v2 > p')\n \n # c = Content.new\n # c.content = @info\n # c.save\n\n \n end\n \n respond_to do |format|\n format.html {render :action => \"search\"}\n format.xml {render :xml => @posts }\n end\n end",
"title": ""
},
{
"docid": "b58dfb0022098257063c7bdacb9957dc",
"score": "0.5372499",
"text": "def add_method_search_index(index)\n debug_msg \" generating method search index\"\n \n list = @classes.map { |klass| \n klass.method_list\n }.flatten.sort{ |a, b| a.name == b.name ? a.parent.full_name <=> b.parent.full_name : a.name <=> b.name }.select { |method| \n method.document_self \n }\n unless @options.show_all\n list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }\n end\n \n list.each do |method|\n index[:searchIndex].push( search_string(method.name) + '()' )\n index[:longSearchIndex].push( search_string(method.parent.name) )\n index[:info].push([\n method.name, \n method.parent.full_name, \n method.path, \n method.params, \n snippet(method.comment),\n TYPE_METHOD\n ])\n end\n end",
"title": ""
},
{
"docid": "52cd76aafdddb43e1622e5eb3612ec30",
"score": "0.5363995",
"text": "def add_automatic_search_attributes(options) #:nodoc:\n # define a search attribute for each automatic search attribute\n model.\n search_api_bridge.\n automatic_search_attribute_builders(options).\n each do |builder|\n search_accessor(builder)\n end\n end",
"title": ""
},
{
"docid": "737e4d7a66bb748ab7e65bbaab63c4e7",
"score": "0.536085",
"text": "def initialize(options = {})\n if options[:query]\n # We already have a query here, so go ahead and save the query\n @query = options[:query]\n \n raise ArgumentError unless options[:hits]\n @hits = Integer(options[:hits])\n \n # Basic format: \"field:QUERY\"\n parts = @query.split(':')\n raise ArgumentError unless parts.count == 2\n \n @field = parts[0].to_sym\n @value = parts[1]\n \n # Strip quotes from the value if present\n value_chars = @value.scan(/./mu)\n if value_chars[0] = '\"' && value_chars[-1] == '\"'\n @value = value_chars[1..-2].join\n end\n \n # Format the label according to the field type -- for now, the only\n # argument type is year, so raise an error otherwise\n raise ArgumentError unless @field == :year\n format_year_label\n\n return\n end\n \n # We need to have name, value, and hits\n raise ArgumentError unless options[:name]\n @field = options[:name].to_sym\n \n raise ArgumentError unless options[:value]\n @value = options[:value]\n \n # Strip quotes from the value if present\n value_chars = @value.scan(/./mu)\n if value_chars[0] = '\"' && value_chars[-1] == '\"'\n @value = value_chars[1..-2].join\n end\n \n raise ArgumentError unless options[:hits]\n @hits = Integer(options[:hits])\n \n # Construct the query\n @query = \"#{field.to_s}:\\\"#{value}\\\"\"\n \n # Format the label\n case @field\n when :authors_facet\n @label = @value\n @field_label = I18n.t('search.index.authors_facet_short')\n when :journal_facet\n @label = @value\n @field_label = I18n.t('search.index.journal_facet_short')\n else\n @label = @value\n # Bad fallback, but it will do\n @field_label = @field.to_s\n end\n end",
"title": ""
},
{
"docid": "b1831e27239d97ce8ddeaa803809fdbd",
"score": "0.5358001",
"text": "def field_for_search\n end",
"title": ""
},
{
"docid": "7006a594bdb54da50dda6b1b9875e05d",
"score": "0.5354549",
"text": "def public_settable_search_args\n [:query, :search_field, :semantic_search_field, :sort, :page, :start, :per_page]\n end",
"title": ""
},
{
"docid": "9eaa41a26b589b93adaca052f9a384df",
"score": "0.53488386",
"text": "def add_method_search_index(index)\n debug_msg \"generating method search index\"\n\n list = classes.map { |klass|\n klass.method_list\n }.flatten.sort{ |a, b| a.name == b.name ? a.parent.full_name <=> b.parent.full_name : a.name <=> b.name }.select { |method|\n method.document_self\n }\n unless options.show_all\n list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }\n end\n\n list.each do |method|\n index[:searchIndex].push( search_string(method.name) + '()' )\n index[:longSearchIndex].push( search_string(method.parent.full_name) )\n index[:info].push([\n method.name,\n method.parent.full_name,\n method.path,\n method.params,\n snippet(method.comment),\n TYPE_METHOD\n ])\n end\n end",
"title": ""
},
{
"docid": "adad7336c31fc23e25929e13d08b19aa",
"score": "0.5348482",
"text": "def index\n @forests = Forest.search(params[:search])\n end",
"title": ""
},
{
"docid": "8b3d433d949d91189bd8c909b5edd7d2",
"score": "0.534499",
"text": "def contractor_search_results\n end",
"title": ""
},
{
"docid": "d257734d20db227a3634a98b9295f5c7",
"score": "0.5344941",
"text": "def initialize opts = {} \n\n # Change to normal hashes with String keys for speed\n opts = Hash[HashWithIndifferentAccess.new(opts._deep_dup._coerce_basic_types)]\n unless self.class.query_defaults.instance_of? Hash\n self.class.query_defaults = Hash[self.class.query_defaults]\n self.class.query_defaults['location'] = Hash[self.class.query_defaults['location']]\n \n self.class.client_options = Hash[self.class.client_options]\n self.class.excerpting_options = Hash[self.class.excerpting_options]\n self.class.excerpting_options['content_methods'].map! {|ary| ary.map {|m| m.to_s}}\n end \n\n # We need an annoying deep merge on the :location parameter\n opts['location'].reverse_merge!(self.class.query_defaults['location']) if opts['location']\n\n # Merge the rest of the defaults \n @options = self.class.query_defaults.merge(opts)\n \n @options['query'] = @options['query'].to_s\n @options['class_names'] = Array(@options['class_names'])\n @options['facets'] = Array(@options['facets'])\n @options['indexes'] = Array(@options['indexes']).join(\" \")\n \n raise UsageError, \"Weights must be a Hash\" unless @options['weights'].is_a? Hash\n raise UsageError, \"Filters must be a Hash\" unless @options['filters'].is_a? Hash\n \n @options['parsed_query'] = parse(query)\n \n @results, @subtotals, @facets, @response = [], {}, {}, {}\n \n extra_keys = @options.keys - (self.class.query_defaults.keys + INTERNAL_KEYS)\n log \"discarded invalid keys: #{extra_keys * ', '}\" if extra_keys.any? and RAILS_ENV != \"test\" \n end",
"title": ""
},
{
"docid": "a5ae7e655eb7167a6857f4e6f969db03",
"score": "0.5340155",
"text": "def search\n\n end",
"title": ""
},
{
"docid": "a5ae7e655eb7167a6857f4e6f969db03",
"score": "0.5340155",
"text": "def search\n\n end",
"title": ""
},
{
"docid": "d41484bf894923db9cd9363132f275b9",
"score": "0.53331697",
"text": "def solr_search(options = {}, &block)\n solr_execute_search(options) do\n Sunspot.new_search(self, &block)\n end\n end",
"title": ""
},
{
"docid": "a4162e254484edebca675b7880f7225e",
"score": "0.5325362",
"text": "def def_class_finders\n re_define_class_method :all do |options = {}|\n if options.kind_of? String then\n return self.new options\n end\n\n # change id to name\n if options.has_key? :id then\n options[:name] = options.delete :id\n end\n\n klass.new GMetad.get_data('/?filter=summary', '/'), options\n end\n end",
"title": ""
},
{
"docid": "05df1bf9176c7216e969867dd1448bc3",
"score": "0.5324222",
"text": "def find_fulltext(query, options = {})\n default_options = {:active_record => true}\n options = default_options.merge(options)\n unless options[:page]\n options = {:limit => 10, :offset => 0}.merge(options)\n end\n options[:only] = self.to_s.underscore.to_sym # Only look for object belonging to this class\n # Pass from what class search is invoked.\n options[:search_class] = Kernel.const_get(self.to_s)\n\n FulltextRow.search(query, options)\n end",
"title": ""
},
{
"docid": "391c4d05e04ec9c90a418431a0416a28",
"score": "0.5324072",
"text": "def client_from_options(options = {})\n config = ThinkingSphinx::Configuration.instance\n client = Riddle::Client.new config.address, config.port\n klass = options[:class]\n index_options = klass ? klass.sphinx_index_options : {}\n\n # The Riddle default is per-query max_matches=1000. If we set the\n # per-server max to a smaller value in sphinx.yml, we need to override\n # the Riddle default or else we get search errors like\n # \"per-query max_matches=1000 out of bounds (per-server max_matches=200)\"\n if per_server_max_matches = config.configuration.searchd.max_matches\n options[:max_matches] ||= per_server_max_matches\n end\n\n # Turn :index_weights => { \"foo\" => 2, User => 1 }\n # into :index_weights => { \"foo\" => 2, \"user_core\" => 1, \"user_delta\" => 1 }\n if iw = options[:index_weights]\n options[:index_weights] = iw.inject({}) do |hash, (index,weight)|\n if index.is_a?(Class)\n name = ThinkingSphinx::Index.name(index)\n hash[\"#{name}_core\"] = weight\n hash[\"#{name}_delta\"] = weight\n else\n hash[index] = weight\n end\n hash\n end\n end\n\n [\n :max_matches, :match_mode, :sort_mode, :sort_by, :id_range,\n :group_by, :group_function, :group_clause, :group_distinct, :cut_off,\n :retry_count, :retry_delay, :index_weights, :rank_mode,\n :max_query_time, :field_weights, :filters, :anchor, :limit\n ].each do |key|\n client.send(\n key.to_s.concat(\"=\").to_sym,\n options[key] || index_options[key] || client.send(key)\n )\n end\n\n options[:classes] = [klass] if klass\n\n client.anchor = anchor_conditions(klass, options) || {} if client.anchor.empty?\n\n client.filters << Riddle::Client::Filter.new(\n \"sphinx_deleted\", [0]\n )\n\n # class filters\n client.filters << Riddle::Client::Filter.new(\n \"class_crc\", options[:classes].collect { |k| k.to_crc32s }.flatten\n ) if options[:classes]\n\n # normal attribute filters\n client.filters += options[:with].collect { |attr,val|\n Riddle::Client::Filter.new attr.to_s, filter_value(val)\n } if options[:with]\n\n # exclusive attribute filters\n client.filters += options[:without].collect { |attr,val|\n Riddle::Client::Filter.new attr.to_s, filter_value(val), true\n } if options[:without]\n\n # every-match attribute filters\n client.filters += options[:with_all].collect { |attr,vals|\n Array(vals).collect { |val|\n Riddle::Client::Filter.new attr.to_s, filter_value(val)\n }\n }.flatten if options[:with_all]\n\n # exclusive attribute filter on primary key\n client.filters += Array(options[:without_ids]).collect { |id|\n Riddle::Client::Filter.new 'sphinx_internal_id', filter_value(id), true\n } if options[:without_ids]\n\n client\n end",
"title": ""
},
{
"docid": "83d90b6117b8ca75a49206ae160b8516",
"score": "0.5318099",
"text": "def index\n @franken_beers = FrankenBeer.all.search(params[:search]).order(sort_column + \" \" + sort_direction)\n end",
"title": ""
},
{
"docid": "284dd496248dfbe0a41b54a032e3bc42",
"score": "0.53145903",
"text": "def search_index\n SEARCH_FIELDS.each_with_object({}) do |name, result|\n value = searchable_options[name].call(self)\n key = KEY_MAPPING[name] || name.to_s\n result[key] = value unless value.nil?\n end\n end",
"title": ""
},
{
"docid": "f2b55cd1c0c0cd821db7500ae14e78c2",
"score": "0.5303982",
"text": "def aaf_index\n ActsAsFerret::ferret_indexes[aaf_configuration[:index_dir]] ||= create_index_instance\n end",
"title": ""
},
{
"docid": "9445d126f42709d51083a19874b77179",
"score": "0.52989334",
"text": "def index\n @relevances = Relevance.all\n end",
"title": ""
},
{
"docid": "72d35a7647d99cb80824cbdcd7e9afd3",
"score": "0.5296074",
"text": "def initialize(model_classes, options = {})\n @model_classes = model_classes\n @options = { \n :default_search_field => '*',\n :analyzer => Ferret::Analysis::WhiteSpaceAnalyzer.new\n }.update(options)\n ensure_reader\n end",
"title": ""
},
{
"docid": "886be899c377ba2149b4037b44ea82e0",
"score": "0.5291971",
"text": "def rfq\n end",
"title": ""
},
{
"docid": "c7b471ffe37745ab09336446ae8be962",
"score": "0.5289901",
"text": "def search\n \n end",
"title": ""
},
{
"docid": "e2254a6f83ed6db70cb7328befd6e156",
"score": "0.52879936",
"text": "def search_results\n self.options ||= {}\n search_opts = self.options\n search_text = generate_search_text\n include_facets = self.faceted\n \n response = Bookmark.tire.search(page: search_opts[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE) do\n query do\n boolean do\n must { string search_text, default_operator: \"AND\" } if search_text.present?\n \n must { term :private, 'F' } unless search_opts[:show_private]\n must { term :hidden_by_admin, 'F' }\n must { term :rec, 'T' } if %w(1 true).include?(search_opts[:rec].to_s)\n must { term :with_notes, 'T' } if %w(1 true).include?(search_opts[:with_notes].to_s)\n\n must { term :bookmarkable_posted, 'T' }\n must { term :bookmarkable_hidden, 'F' }\n must { term :bookmarkable_restricted, 'F' } unless search_opts[:show_restricted]\n must { term :bookmarkable_complete, 'T' } if %w(1 true).include?(search_opts[:complete].to_s)\n must { term :bookmarkable_language_id, search_opts[:language_id].to_i } if search_opts[:language_id].present?\n must { term :bookmarkable_type, search_opts[:bookmarkable_type].gsub(\" \", \"\").downcase} if search_opts[:bookmarkable_type].present?\n \n if search_opts[:pseud_ids].present?\n must { terms :pseud_id, search_opts[:pseud_ids] }\n end\n \n [:rating_ids, :warning_ids, :category_ids, :fandom_ids, :character_ids, :relationship_ids, :freeform_ids].each do |id_list|\n if search_opts[id_list].present?\n search_opts[:filter_ids] ||= []\n search_opts[:filter_ids] += search_opts[id_list]\n end\n end\n \n [:filter_ids, :tag_ids, :collection_ids, :bookmarkable_collection_ids].each do |id_list|\n if search_opts[id_list].present?\n search_opts[id_list].each do |id|\n must { term id_list, id }\n end\n end\n end\n end\n end\n \n [:bookmarkable_word_count, :date, :bookmarkable_date].each do |countable|\n if search_opts[countable].present?\n key = (countable == :date) ? :created_at : countable\n filter :range, key => Search.range_to_search(search_opts[countable])\n end\n end\n \n if search_opts[:sort_column].present?\n sort { by search_opts[:sort_column], search_opts[:sort_direction] }\n end\n\n if include_facets\n %w(tag rating warning category fandom character relationship freeform).each do |facet_type|\n facet facet_type do\n terms \"#{facet_type}_ids\".to_sym\n end\n end\n end\n end\n SearchResult.new('Bookmark', response)\n end",
"title": ""
},
{
"docid": "1525979664752d27dea18bddf9c6a115",
"score": "0.5284169",
"text": "def index\n @flower_color_searches = FlowerColorSearch.all\n end",
"title": ""
},
{
"docid": "d5cd20fe789979f917022f87ea3ab3d8",
"score": "0.5283186",
"text": "def query(*args, &block)\n default_options = {:type => document_type, :index => index.name}\n\n if block_given?\n options = args.shift || {}\n else\n query, options = args\n options ||= {}\n end\n\n sort = Array( options[:order] || options[:sort] )\n options = default_options.update(options)\n\n s = Tire::Search::Search.new(options.delete(:index), options)\n options[:per_page] ||= 10\n s.size( options[:per_page].to_i )\n s.from( options[:page].to_i <= 1 ? 0 : (options[:per_page].to_i * (options[:page].to_i-1)) ) if options[:page]\n s.sort do\n sort.each do |t|\n field_name, direction = t.split(' ')\n by field_name, direction\n end\n end unless sort.empty?\n\n if block_given?\n block.arity < 1 ? s.instance_eval(&block) : block.call(s)\n else\n s.query { string query }\n # TODO: Actualy, allow passing all the valid options from\n # <http://www.elasticsearch.org/guide/reference/api/search/uri-request.html>\n s.fields Array(options[:fields]) if options[:fields]\n end\n end",
"title": ""
},
{
"docid": "9e83403a5fec5d00f3a21c3e6a570dd0",
"score": "0.5275993",
"text": "def search_fts\n @query = @query.search(fts)\n end",
"title": ""
},
{
"docid": "321d3c673f811ee2810792ba1100b5e6",
"score": "0.5273399",
"text": "def find_fulltext(query, options = {})\r\n default_options = {:active_record => true}\r\n options = default_options.merge(options)\r\n unless options[:page]\r\n options = {:limit => 10, :offset => 0}.merge(options)\r\n end\r\n options[:only] = self.to_s.underscore.to_sym # Only look for object belonging to this class\r\n\r\n FulltextRow.search(query, options)\r\n end",
"title": ""
}
] |
eccf40171288e1415ee400a451348eb2
|
The number of tracks that the pattern with the greatest number of tracks has. TODO: Is it a problem that an optimized song can have a different total_tracks() value than the original? Or is that actually a good thing? TODO: Investigate replacing this with a method max_sounds_playing_at_once() or something like that. Would look each pattern along with it's incoming overflow.
|
[
{
"docid": "8be963fd52d230221c8c9a9823bfb47d",
"score": "0.8238709",
"text": "def total_tracks\n @patterns.keys.collect {|pattern_name| @patterns[pattern_name].tracks.length }.max || 0\n end",
"title": ""
}
] |
[
{
"docid": "00ee714527ee451dcd85c7ef34bb86cc",
"score": "0.82945156",
"text": "def total_tracks\n @patterns.keys.collect {|pattern_name| @patterns[pattern_name].tracks.length }.max || 0\n end",
"title": ""
},
{
"docid": "d79f8252052a61b7ac0d38cdbed15da3",
"score": "0.82334447",
"text": "def total_tracks()\n @patterns.keys.collect {|pattern_name| @patterns[pattern_name].tracks.length }.max || 0\n end",
"title": ""
},
{
"docid": "be3857ae77e5af3af37c40b7f9fe427f",
"score": "0.6893112",
"text": "def find_most_played_songs\n find_songs_by_value_for_key('play_count', true, false) \n end",
"title": ""
},
{
"docid": "14f8d550307fa7af1fddc70d391a7260",
"score": "0.6831624",
"text": "def num_of_tracks\t# method for checking # of tracks\n\t\t@playlist.length # length of array holding playlist\n\tend",
"title": ""
},
{
"docid": "8e19a64d6a564d623467393f08b90cf0",
"score": "0.67019534",
"text": "def number_of_songs()\n return @songs.length()\n end",
"title": ""
},
{
"docid": "bfb884da5f0f1715fafefb53b5b4132c",
"score": "0.6553906",
"text": "def total_tracks\n track_number_string = @file_metadata.track.to_s\n if (index = track_number_string.index('/'))\n track_number_string[index + 1, track_number_string.length]\n else\n track_number_string\n end\n end",
"title": ""
},
{
"docid": "d0898bcef356a7deda248b9585b71ad9",
"score": "0.6545878",
"text": "def get_most_played_criteria_limit\n most_played_song_count = Song.all.order(plays: :desc).limit(1).first.plays\n return most_played_song_count * 0.95\n end",
"title": ""
},
{
"docid": "0391d332dcb00a97cd1caacd2b8baaa6",
"score": "0.65193194",
"text": "def size\n tracks.size\n end",
"title": ""
},
{
"docid": "c765c926e57d053e221fa7d30c92c595",
"score": "0.6501805",
"text": "def number_of_songs\n\t\treturn @songs.length\n\tend",
"title": ""
},
{
"docid": "d4d1e1e770ffaaa27019859221497781",
"score": "0.64809245",
"text": "def song_count\n songs.size\n end",
"title": ""
},
{
"docid": "4e40b4c4847efbc8c03b60d564485038",
"score": "0.6456461",
"text": "def track_count\n\t\t@result['Tracks'].each do\n\t\t\t@song_count +=1\n\t\tend\n\t\t@song_count\n\tend",
"title": ""
},
{
"docid": "7b0bf2ebb7b3b6a798ebed0b69b3dfe8",
"score": "0.6413954",
"text": "def band_count\n\t\t@music_collection.each {|track|\n\t\t\tentry = /(.*) \\-/.match(track)\n\t\t\tnext unless entry\n\t\t\t@artist_count << entry[1]}\n\t\t\tartists = @artist_count.uniq\n\t\t\tartists.count\n\t\t\t#total = artists.count\n\t\t\t# p \"there are #{total} artists in this queue\"\n\n\tend",
"title": ""
},
{
"docid": "02a23f552ec5ed4d4d98056c8a9de678",
"score": "0.6384178",
"text": "def sample_length(tick_sample_length)\n @tracks.keys.collect {|track_name| @tracks[track_name].sample_length(tick_sample_length) }.max || 0\n end",
"title": ""
},
{
"docid": "c655ebcbc7e34f4d56bf54336289429e",
"score": "0.6337401",
"text": "def songs_count\n\t\tsongs.length\n\tend",
"title": ""
},
{
"docid": "c655ebcbc7e34f4d56bf54336289429e",
"score": "0.6337014",
"text": "def songs_count\n\t\tsongs.length\n\tend",
"title": ""
},
{
"docid": "27ee905e0fa7ab0d8979c383969bbdf9",
"score": "0.6288604",
"text": "def number_of_songs\n\t\t@songs.length\n\tend",
"title": ""
},
{
"docid": "3f08fdda417636e079e7c4493129ad52",
"score": "0.6261618",
"text": "def song_count\n self.songs.length\n end",
"title": ""
},
{
"docid": "fbf5bef6426163060db1c22e7ac1262a",
"score": "0.62562865",
"text": "def get_less_played_criteria_limit\n less_played_song_count = Song.all.order(:plays).limit(1).first.plays\n return less_played_song_count * 1.05\n end",
"title": ""
},
{
"docid": "1d8a42141b51428527551895ab5782de",
"score": "0.62397313",
"text": "def count_tracks(list)\n list.length\nend",
"title": ""
},
{
"docid": "7109dda9fdeb4d145f5bdf24c698d852",
"score": "0.6186978",
"text": "def song_count\n self.songs.count # maybe can replace .count with .size or .length\n end",
"title": ""
},
{
"docid": "28906e7dccbdaed58740e2609b23568d",
"score": "0.61546695",
"text": "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",
"title": ""
},
{
"docid": "6dcb3a3adc28442ec44817776ac5c691",
"score": "0.61388046",
"text": "def total_tracks\n total = 0\n tracking_info[2..-1].chop!.each(',') { |track| total += track.to_i }\n total.to_s\n end",
"title": ""
},
{
"docid": "83d9a78e648f1aaa8ceb313485a99fa3",
"score": "0.61293423",
"text": "def max_count\n ranks.group_by(&:itself).values.max_by(&:size).size\n end",
"title": ""
},
{
"docid": "a2095b8ce0776fc0d2dbcee93d4ea347",
"score": "0.61045825",
"text": "def song_count\n self.songs.size\n end",
"title": ""
},
{
"docid": "7dd9985987425c8405dd11b1fe63e139",
"score": "0.6084583",
"text": "def songs_count\n songs.count\n end",
"title": ""
},
{
"docid": "3c0edda392690e8f3b653768ac4a6caa",
"score": "0.60810536",
"text": "def singles_total_plays\n singles_results.count\n end",
"title": ""
},
{
"docid": "731d7840b3bf051d589405e8fb5723ef",
"score": "0.6068233",
"text": "def songs_count\n self.lib.songs.count\n end",
"title": ""
},
{
"docid": "1ee4366f2ab4eae9cb5f70db98939f25",
"score": "0.604863",
"text": "def track_count\n return @track_count\n end",
"title": ""
},
{
"docid": "12b494882ef17553571e69ef14b8ac84",
"score": "0.60412014",
"text": "def numPlayedPieces()\n return @playedPieces.length()\n end",
"title": ""
},
{
"docid": "ff03e7d787028955461fe811edd2bd6c",
"score": "0.60136443",
"text": "def song_count\n #pluralize could be placed in here.\n self.songs.length\n end",
"title": ""
},
{
"docid": "0791447962c59c12f3fc745011990972",
"score": "0.59862405",
"text": "def master_copies\n if self.unknown_track\n 4\n elsif self.quarter_track\n if stereo and not mono and not unknown_sound_field\n 2\n else\n 4\n end\n elsif self.half_track\n if stereo and not mono and not unknown_sound_field\n 1\n else\n 2\n end\n elsif self.full_track\n 1\n else\n # if no track specification selected, as per Unknown\n 4\n end\n end",
"title": ""
},
{
"docid": "d47dd1d1dc479b65db7caf57601c7dbf",
"score": "0.5933512",
"text": "def frames\n total=0\n toneparts.each {|tp| total+=tp.tone.frames}\n total\n end",
"title": ""
},
{
"docid": "6efe86b7f063686218343bb7a92094bb",
"score": "0.59216917",
"text": "def max_repetitions\n pdu.max_repetitions\n end",
"title": ""
},
{
"docid": "1d0a597c6d00db0ffce4af83402a3eb0",
"score": "0.59176177",
"text": "def numUnplayedPieces()\n return @unplayedPieces.length()\n end",
"title": ""
},
{
"docid": "1aaf94936b87920bc894f8d0a4220f35",
"score": "0.5830529",
"text": "def sample_length\n @flow.inject(0) do |sum, pattern_name|\n sum + @patterns[pattern_name].sample_length(@tick_sample_length)\n end\n end",
"title": ""
},
{
"docid": "650456ff9f78cc95dd2311dd6c0414b9",
"score": "0.58198476",
"text": "def lengths\n frequencies.map { |frequency| (@project.speed_of_sound / (frequency * 2) * 1000).round(0) }\n end",
"title": ""
},
{
"docid": "7139f9d1653edd29bcaa930341ca499c",
"score": "0.57994556",
"text": "def total_songs\n \tself.songs.size\n end",
"title": ""
},
{
"docid": "dfce6b6c7face2eb5c50a4d82253fe61",
"score": "0.5782113",
"text": "def playlist_count\n return @playlist.count\n end",
"title": ""
},
{
"docid": "3f3750309b4e431fd7c0e74a75d47d2e",
"score": "0.57819736",
"text": "def song_count\n @songs.count\n end",
"title": ""
},
{
"docid": "c8464b97cf5eb81a8d09970cc6b1c31d",
"score": "0.57721436",
"text": "def get_total_snpinfo_boxes\n return @snpinfo_tracks.length\n end",
"title": ""
},
{
"docid": "ff1e2e8740b562ca212b98c3ab3da257",
"score": "0.5763202",
"text": "def song_count\n @song_count = 0 if @song_count.nil?\n @song_count\n end",
"title": ""
},
{
"docid": "040807f0f28b861e2ad4f54183ef5571",
"score": "0.5761843",
"text": "def get_popular_criteria_limits\n upper_time = Time.now.midnight + 1.day\n lower_time = upper_time - 5.day\n latest_songs = Song.where({last_played_at: (lower_time..upper_time)}).order(plays: :desc)\n lower_play_count = latest_songs.first.plays * 0-95\n\n return lower_time, upper_time, lower_play_count\n end",
"title": ""
},
{
"docid": "8160eec3cbcb715f773a8de5a97d5bba",
"score": "0.5761468",
"text": "def get_total_games_played\n return games.size\n end",
"title": ""
},
{
"docid": "9ff869435b4fc135b99ddc124844a2e0",
"score": "0.57337415",
"text": "def calculate_num_bytes(track)\n\t\t\tnum_bytes = \"%08X\" % (@track_data[track].length/2) # This is not correct\n\t\tend",
"title": ""
},
{
"docid": "63230c5e00362021c961f95d1f1463eb",
"score": "0.5728561",
"text": "def birthdayCakeCandles(n, ar)\n ar.count(ar.max)\nend",
"title": ""
},
{
"docid": "9cec02d6fd00892b6b9bf3f4b357b562",
"score": "0.57149994",
"text": "def most_popular\n counts = Hash.new 0\n @lyrics.each do |word|\n if word.length > 1\n counts[word] += 1\n end\n end\n return largest_hash_key(counts)\n end",
"title": ""
},
{
"docid": "d63ad92b9dd3c78460d785c140f1593c",
"score": "0.5710441",
"text": "def sample_length()\n @structure.inject(0) {|sum, pattern_name|\n sum + @patterns[pattern_name].sample_length(@tick_sample_length)\n }\n end",
"title": ""
},
{
"docid": "12cd0be80aeeaf1b2dbbf30ff16cc34b",
"score": "0.5684655",
"text": "def song_count\n self.songs.count\n end",
"title": ""
},
{
"docid": "782eee93b8412cc66522e0dc523c2ae4",
"score": "0.5668973",
"text": "def find_track\n\t\tif self.tracks.length >= 1\t\n\t\t\tif self.tracks.unplayed.length > 1\n\t\t return self.tracks.unplayed.shuffle.first\n\t\t else \n\t\t return tracks = self.tracks.sort_by {|x| [x.play_count, -x.skip_count] }.first\n\t\t end\n\t end\n\tend",
"title": ""
},
{
"docid": "36b87b72530fffd28e98a0b3b05e0e83",
"score": "0.5667634",
"text": "def tracks\n @tracks ||= (\n Redlics.redis { |r| r.bitcount(@track_bits || traverse) }\n )\n end",
"title": ""
},
{
"docid": "41a457913e9c479b63818118cc950c87",
"score": "0.5663995",
"text": "def sample_length_with_overflow\n if @flow.length == 0\n return 0\n end\n \n full_sample_length = self.sample_length\n last_pattern_sample_length = @patterns[@flow.last].sample_length(@tick_sample_length)\n last_pattern_overflow_length = @patterns[@flow.last].sample_length_with_overflow(@tick_sample_length)\n overflow = last_pattern_overflow_length - last_pattern_sample_length\n\n return sample_length + overflow\n end",
"title": ""
},
{
"docid": "8be4d3999dd18d3d37807eb470c8419a",
"score": "0.56326437",
"text": "def get_num_sounds\n dict = Sketchup.active_model.attribute_dictionary('MSPhysics Sounds', false)\n dict ? dict.length : 0\n end",
"title": ""
},
{
"docid": "257f98325c410829bddcafd910c0e94c",
"score": "0.5620508",
"text": "def sample_length_with_overflow()\n if(@structure.length == 0)\n return 0\n end\n \n full_sample_length = self.sample_length\n last_pattern_sample_length = @patterns[@structure.last].sample_length(@tick_sample_length)\n last_pattern_overflow_length = @patterns[@structure.last].sample_length_with_overflow(@tick_sample_length)\n overflow = last_pattern_overflow_length - last_pattern_sample_length\n\n return sample_length + overflow\n end",
"title": ""
},
{
"docid": "cfd7fcb439cbb53ff79dcfb2154c4689",
"score": "0.56202465",
"text": "def team_total_plays\n doubles_results.count\n end",
"title": ""
},
{
"docid": "e67fd0752c6ef9093405cbc60f9172fa",
"score": "0.5613523",
"text": "def most_frequent_item_count(collection)\n if collection.empty? # => false, true, false, false\n return 0 # => 0\n else\n most_frequent = collection.group_by{|c| c }.values.max_by(&:size) # => [8], [-3, -3], [0]\n return most_frequent.count # => 1, 2, 1\n end\nend",
"title": ""
},
{
"docid": "dc26a9d7c4b1966cdb321610acbb1daf",
"score": "0.560129",
"text": "def printTracksAndCount\n for variable in @tracks do\n puts \"#{variable.name} which has been played #{variable.count} times\"\n end\n end",
"title": ""
},
{
"docid": "971fa36bbfec1720e5675e7e863b7bf0",
"score": "0.5599202",
"text": "def doubles_total_plays\n total_plays = 0\n get_teams.each {|team| total_plays += team.doubles_results.count}\n total_plays\n end",
"title": ""
},
{
"docid": "4fe962992a29e3545a6a54052479aa33",
"score": "0.559533",
"text": "def birthdayCakeCandles(ar)\n return ar.count(ar.max)\nend",
"title": ""
},
{
"docid": "844a04ddb739568c99d381c57cf78830",
"score": "0.55912566",
"text": "def get_top_decades(tracks)\n decades_hash = Hash.new\n tracks.each do |track|\n release_date = track.album.release_date\n decade = \"#{release_date[0, 3]}0s\"\n\n if decades_hash.key?(decade)\n decades_hash[decade] += 1\n else\n decades_hash[decade] = 1\n end\n end\n\n top_three_decades = decades_hash.sort_by {|k,v| -v}.first(3)\n return top_three_decades\n end",
"title": ""
},
{
"docid": "a5b64af6f0c26824462e594bc1508ec3",
"score": "0.55905354",
"text": "def tracks\n @tracks ||= Redlics.redis { |r| r.bitcount(track_bits) }\n end",
"title": ""
},
{
"docid": "52b5ed59483b5765bded85b341d6d663",
"score": "0.55797225",
"text": "def total_beats\n self.chords.count\n end",
"title": ""
},
{
"docid": "afe73ee1626ba70425cec1e765c21b53",
"score": "0.55790675",
"text": "def calculate_line_with_highest_frequency\n max_analyzer = @analyzers.max_by { |a| a.highest_wf_count}\n @highest_count_across_lines = max_analyzer.highest_wf_count\n @highest_count_words_across_lines = @analyzers.select do |fuck|\n fuck.highest_wf_count == @highest_count_across_lines\n end\n end",
"title": ""
},
{
"docid": "119d51f6def1802b3611079ef95ef3fe",
"score": "0.5569951",
"text": "def songs_in_room()\n return @songs.length()\n end",
"title": ""
},
{
"docid": "94e2ae6d90262f954098d53ebcd7cecc",
"score": "0.5565821",
"text": "def artist_count\n\t\t@music_collection.each do |track|\n\t\t\tentry = /(.*) \\-/.match(track)\n\t\t\tnext unless entry\n\t\t\t@artists << entry[1]\n\t\tend\n\t\t@artists.each do |artist| \n\t\t\t@counts[artist] += 1 \n\t\t\tend\n\t\t@counts\n\tend",
"title": ""
},
{
"docid": "b692d9d2f6154ddc51b639221be80038",
"score": "0.556447",
"text": "def length\n run.spectrum_list.size\n end",
"title": ""
},
{
"docid": "8dc42e1b8f26e1dfd3c7190551326c14",
"score": "0.5528583",
"text": "def get_max_interactions\n max_interaction = 0\n @ld_scores.values.each do |snp_combo_array|\n if snp_combo_array.length > max_interaction\n max_interaction = snp_combo_array.length\n end\n end\n return max_interaction\n end",
"title": ""
},
{
"docid": "770e4172e195404684c49673407c90dc",
"score": "0.552666",
"text": "def birthdayCakeCandles(ar)\n ar.count(ar.max)\nend",
"title": ""
},
{
"docid": "d127a24b91236678ba83288ff415ca6b",
"score": "0.5520487",
"text": "def get_total_count\n return (self.count / MAX)\n end",
"title": ""
},
{
"docid": "0cc5f1d6fb272b9f0019b1509def64a7",
"score": "0.5505273",
"text": "def get_max_haplotype_size\n max_haplotype = 0\n @blocks.values.each do |block|\n if block.haplotypes.length > max_haplotype\n max_haplotype = block.haplotypes.length\n end\n end\n return max_haplotype\n end",
"title": ""
},
{
"docid": "75251ceffe578918e598c6bec39aedc8",
"score": "0.5500746",
"text": "def wins\n self.plays.select {|p| p.play_result == \"Win\"}.length\n end",
"title": ""
},
{
"docid": "bee13dc9169448d2a9226f5271036284",
"score": "0.54995203",
"text": "def most_frequent_item_count(collection)\n collection.group_by { |i| i }.values.map(&:count).max || 0\nend",
"title": ""
},
{
"docid": "8ca385d1653485527100baf6efaffcd8",
"score": "0.5492007",
"text": "def calculate_line_with_highest_frequency()\n temp = 0; @analyzers.each {|a| if a.highest_wf_count > temp then temp = a.highest_wf_count end}\n @highest_count_across_lines = temp\n\n @highest_count_words_across_lines = @analyzers.select {|a| @highest_count_across_lines == a.highest_wf_count}\n end",
"title": ""
},
{
"docid": "0c1217e9b6cae563590d577e036f2039",
"score": "0.5488287",
"text": "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = 0\n @analyzers.each do | analyzer |\n if analyzer.highest_wf_count > @highest_count_across_lines\n @highest_count_across_lines = analyzer.highest_wf_count\n end\n end\n @highest_count_words_across_lines = @analyzers.select { |element| element.highest_wf_count == @highest_count_across_lines }\n end",
"title": ""
},
{
"docid": "435209b5f5fcf349664c8a8aaed221e2",
"score": "0.5479444",
"text": "def calculate_line_with_highest_frequency\n @highest_count_across_lines = analyzers.max { |a, b| a.highest_wf_count - b.highest_wf_count }.highest_wf_count\n @highest_count_words_across_lines = analyzers.select { |a| a.highest_wf_count == highest_count_across_lines }\n end",
"title": ""
},
{
"docid": "739ba222c93ed6771c31e1ae0d5e78fe",
"score": "0.5471882",
"text": "def get_trick_count\n declarer_count, defender_count = 0, 0\n \n (0..self.winners.size-1).each do |i|\n trick = self.get_trick(i)\n winner = self.who_played?(self.winning_card(trick))\n if [self.declarer, self.dummy].include?(winner)\n declarer_count += 1\n else\n defender_count += 1\n end\n end\n \n [declarer_count, defender_count]\n end",
"title": ""
},
{
"docid": "ac31df658b1511467f335e0ad19d7df5",
"score": "0.5463851",
"text": "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = @analyzers.map { |element| element.highest_wf_count }.max\n @highest_count_words_across_lines = @analyzers.select { |element| element.highest_wf_count == @highest_count_across_lines}\n end",
"title": ""
},
{
"docid": "4df3b27499da686ab828dd1e3522e76b",
"score": "0.5462596",
"text": "def most_frequent_item_count(collection)\n if collection.empty?\n puts \"nil\"\n else\n most_frequent = collection.group_by(&:itself).values.max_by(&:size)\n puts most_frequent.count\n end\nend",
"title": ""
},
{
"docid": "b1946cf00e51cc032089cd631f8911d1",
"score": "0.54593146",
"text": "def singleplayer_victories_nb\n self.single_player_games.where(is_finished: true).count\n end",
"title": ""
},
{
"docid": "2961cc772b5b8931d192ad0fc1746044",
"score": "0.54423076",
"text": "def played_count\n if @_itunes_api == :win32ole\n @_itunes_object.playedcount\n elsif @_itunes_api == :appscript\n @_itunes_object.played_count.get\n else\n @_itunes_object.played_count\n end\n end",
"title": ""
},
{
"docid": "7764ad5b5f0b8255f403c9e6230a36e2",
"score": "0.5441491",
"text": "def player_count\n players.length\n end",
"title": ""
},
{
"docid": "5b3279aec7e366c84deb8ac99808e162",
"score": "0.54363674",
"text": "def player_count; end",
"title": ""
},
{
"docid": "2ee856ea315dd9174de483db3186f318",
"score": "0.54309285",
"text": "def guess_count\n @guess_history.length\n end",
"title": ""
},
{
"docid": "50d13b88bda9374f0e168defdb769b3f",
"score": "0.5421741",
"text": "def num_of_guesses\n case @word.length\n when 3..5\n @max_guess = 6\n when 6..7 \n @max_guess = 9\n when 8..11\n @max_guess = 12\n end\n return @max_guess\n end",
"title": ""
},
{
"docid": "bc55018b5b42934196bd63f1cee12c77",
"score": "0.5420872",
"text": "def frame_count\n frames.length\n end",
"title": ""
},
{
"docid": "45cc0a9e088407967e16ff735a550d39",
"score": "0.541428",
"text": "def finished_player_rounds\n player_rounds.finished.count.to_f\n end",
"title": ""
},
{
"docid": "287e8d6a7c254a9390c324b0165c9c56",
"score": "0.5402509",
"text": "def to_playcount\n count = playcount || 0\n \"Played #{count} time#{'s' if count != 1}\"\n end",
"title": ""
},
{
"docid": "e88bc54850b0674300e134fea7102a41",
"score": "0.5399212",
"text": "def numOfPlaylist(n, k, l)\n num = 1\n l.times do |i|\n num *= n - [k, i].min\n end\n num\nend",
"title": ""
},
{
"docid": "9b80a2fa0d35027e93b6e78683223b0c",
"score": "0.53988963",
"text": "def n_rounds\n process\n @rounds.size\n end",
"title": ""
},
{
"docid": "cf046592e34ab08208df513176468f57",
"score": "0.5395535",
"text": "def framecount\n return -1 if demo.nil?\n demos = decode\n return (!demo[0].is_a?(Array) ? demos.size : demos.map(&:size).sum)\n rescue\n -1\n end",
"title": ""
},
{
"docid": "7294da5e7e68d4153d24c9242bda7337",
"score": "0.53947717",
"text": "def games_played\n @games_played ||= games.size\n end",
"title": ""
},
{
"docid": "f006f769f8cccf9467e4360eeb7b7fd6",
"score": "0.5386909",
"text": "def ideal_number_of_werewolves\n if self.players.length < 9\n 1\n elsif self.players.length < APP_CONFIG[:max_players]\n 2\n end\n end",
"title": ""
},
{
"docid": "273a4ea58d3fb9f1fd3d45fbf83c1d35",
"score": "0.5385548",
"text": "def birthdayCakeCandles(arr)\n tallest = arr.max\n count = arr.count(tallest)\nend",
"title": ""
},
{
"docid": "d5c01ec0b0d947f47a6b092be0372853",
"score": "0.53838557",
"text": "def solution(a)\n if a.count >= 3\n peaks = [0] * (a.count + 1)\n (1...a.count - 1).each { |i| \n peaks[i + 1] = peaks[i]\n peaks[i + 1] += 1 if a[i] > a[i - 1] and a[i] > a[i + 1]\n }\n peaks[a.count] = peaks[a.count - 1]\n \n block_sizes = (2..Math.sqrt(a.count).floor).select { |i|\n a.count % i == 0 \n }.flat_map { |i|\n [i, a.count / i]\n }.sort.uniq\n block_sizes << a.count\n \n block_sizes.each { |block_size|\n all_with_a_peak = (0...a.count).step(block_size).all? { |block_start|\n peaks[block_start + block_size] > peaks[block_start]\n } \n return a.count / block_size if all_with_a_peak\n }\n end\n \n return 0\nend",
"title": ""
},
{
"docid": "7ba520ad39c38d283e77cb017bbd356c",
"score": "0.53789824",
"text": "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = 0\n @highest_count_words_across_lines = []\n analyzers.each do |analyzer|\n if analyzer.highest_wf_count > @highest_count_across_lines\n @highest_count_across_lines = analyzer.highest_wf_count\n @highest_count_words_across_lines = [ analyzer ]\n elsif analyzer.highest_wf_count == @highest_count_across_lines\n /analyzer.highest_wf_words.each do |word|/\n @highest_count_words_across_lines.push analyzer\n /end/\n end\n end\n end",
"title": ""
},
{
"docid": "fa0fce1650e67993b5da870843928ba3",
"score": "0.53774935",
"text": "def count(input_arr)\n if(input_arr.length > 4 || input_arr[1] != 'tracks' || input_arr[2] != 'by')\n puts \"Invalid count statement. Please refer Help\"\n else\n artists = warehouse.directory#Retrieve the information from the directory map in warehouse\n initials = input_arr[3]\n if(artists.key?(initials))#Check whether the artist list in ware house has this artist\n puts \"The number of songs from this artist is #{artists[initials].songs.length}\"\n else\n puts \"Invalid id of artist\"\n end\n end\n end",
"title": ""
},
{
"docid": "b797e917e21f950fe50657e30dae4f1d",
"score": "0.5375287",
"text": "def samples_count\n @samples_count ||= sample_table.inject(0)\\\n {|a,v| a += v.sample_length > 1 ? 1 : 0 }\n end",
"title": ""
},
{
"docid": "b46840c4341519eb1528521679c7de7e",
"score": "0.5372457",
"text": "def maxcount \n count.values.max\n end",
"title": ""
},
{
"docid": "fd5545a251e6bfcf915385340b43f452",
"score": "0.53583384",
"text": "def most_frequent_item_count(collection)\n return 0 if collection.empty?\n counts = Hash.new(0)\n collection.each { |n| counts[n] += 1}\n counts.values.max\nend",
"title": ""
},
{
"docid": "3d0dd97c4aa1841cefae393fae52c694",
"score": "0.5357298",
"text": "def calculate_line_with_highest_frequency()\n @highest_count_across_lines = 0\n @highest_count_words_across_lines = []\n count = 0\n @analyzers.each do |line|\n if line.highest_wf_count > @highest_count_across_lines\n @highest_count_across_lines = line.highest_wf_count\n end\n unless line.highest_wf_words == []\n @highest_count_words_across_lines.push(line)\n #puts line.highest_wf_words\n end\n end\n @highest_count_across_lines\nend",
"title": ""
}
] |
35e3dedf8c7a104f5baa21cf6e3b123d
|
helper function to find out which model is our owner returns a project instance if this is owned by a project returns an article instance if this is owned by an article
|
[
{
"docid": "7f2904e5a1e54214f2920a3ffc6b861a",
"score": "0.789801",
"text": "def owner\n self.project or self.article\n end",
"title": ""
}
] |
[
{
"docid": "8163838519170f9d64fec0de9deb888d",
"score": "0.7319768",
"text": "def owner\n self.projects.first or self.jobs.first\n end",
"title": ""
},
{
"docid": "ff49f65b74e7199c168637321339c2ec",
"score": "0.72292614",
"text": "def load_owner\n local_params = params\n if local_params[:article_id]\n @owner = Article.find local_params[:article_id]\n else\n @owner = Project.find local_params[:project_id]\n end\n end",
"title": ""
},
{
"docid": "d0aacafb1e3fabfe038b18408cf0ed62",
"score": "0.70427746",
"text": "def details\n if @project.creator.is_a?(User)\n @project_owner = @project.creator == current_user\n else\n @project_owner = Organization.owned_organizations(current_user.id).include?(@project.creator)\n end\n end",
"title": ""
},
{
"docid": "cd2b54fc88798ea9148c4f272de48439",
"score": "0.6994243",
"text": "def owner\n return Owner.find(self.owner_id)\n end",
"title": ""
},
{
"docid": "bbfedd1dce04eb7a985c22e30515b3ee",
"score": "0.6783546",
"text": "def get_owner()\n Owner.find(1).with(Owner.owner_id == owner_id).entity\n end",
"title": ""
},
{
"docid": "6ab56ab51d2eb709620ed56c73161348",
"score": "0.67649615",
"text": "def owner\n @owner ||= self.owner_type.constantize\n end",
"title": ""
},
{
"docid": "cde017c41320b2f1edb0338c83c5e4fe",
"score": "0.6604994",
"text": "def owner\n owner_group = super\n # trying to pre/eager load on relations other than owner does not work\n # when using this relation accessor override\n # ...and that makes me sad, it does work if you remove this owner override\n # but you lose the ability to return the correct owner resource...\n if owner_group&.identity?\n # ensure that this chained call matches the pre/eager loading setup\n owner_group.identity_membership.user\n else\n owner_group\n end\n end",
"title": ""
},
{
"docid": "9546a1685f51e6090653e9f6c480edcb",
"score": "0.65826917",
"text": "def load_owner\n local_params = params\n if local_params[:post_id]\n @owner = Post.find local_params[:post_id]\n elsif local_params[:project_id]\n @owner = Project.find local_params[:project_id]\n else\n @owner = Job.find local_params[:job_id]\n end\n end",
"title": ""
},
{
"docid": "0a48063340f391a96742293e9e8dd98f",
"score": "0.65820843",
"text": "def get_owner\n if self.has_owner?\n User.find(self.moons.first.user_id)\n end\n end",
"title": ""
},
{
"docid": "ae42369318d923ea767ce2f36163b4b9",
"score": "0.6560266",
"text": "def owner\n self.roles.each do |role|\n if role.permission == 'owner'\n return User.find(role.user_id)\n end\n end\n end",
"title": ""
},
{
"docid": "e4b1d0d7be3ec8e04b410832d78818b2",
"score": "0.65550566",
"text": "def owner\n owners.first\n end",
"title": ""
},
{
"docid": "c225a6346b41ab1b392b5a4bd8239cfa",
"score": "0.653347",
"text": "def owner\n User.find(self.pledges.where(owner: true).first.user_id)\n end",
"title": ""
},
{
"docid": "4dc281da4daed7f9df7da6809330415e",
"score": "0.65191644",
"text": "def owner\n User.find(:first, :conditions => [\"id = ?\", owner_id])\n end",
"title": ""
},
{
"docid": "fe571bd4c38bb5d6d4c49f0e33fc97da",
"score": "0.6515116",
"text": "def get_owner()\n return @owner\n end",
"title": ""
},
{
"docid": "646283d2ca4d732fd2db78f5658fc95a",
"score": "0.64996666",
"text": "def owner\n User.find(owner_id)\n end",
"title": ""
},
{
"docid": "d849219ad76723f2f2f36059c94d785d",
"score": "0.649777",
"text": "def smerf_get_owner_object(object, form) \n if (form.item_index.has_key?(object.parent_id) and\n form.item_index[object.parent_id])\n return form.item_index[object.parent_id]\n else\n raise(RuntimeError, \"Owner object not found or nil\")\n end\n end",
"title": ""
},
{
"docid": "6ee67ff064e11f4593fb35dd07e3802f",
"score": "0.64965177",
"text": "def owner\n self.memberships.find(:first, :conditions => [\"owner = true\"]).user\n end",
"title": ""
},
{
"docid": "f8ebbab3f52086cb02434d79d11f9b62",
"score": "0.6489511",
"text": "def owner\n self.owners[0]\n end",
"title": ""
},
{
"docid": "a9fd86c99e95633a1d7ffde0d5724322",
"score": "0.64832217",
"text": "def owner\n return nil if self.classnameid==0\n _class = Classname.model(Classname.find(self.classnameid).value)\n return nil unless _class\n _class.find self.classpk\n end",
"title": ""
},
{
"docid": "a8cc1d22aaae1c6a80b74f58d37748e0",
"score": "0.6476001",
"text": "def current_owner\n Owner.find(params[:id])\n end",
"title": ""
},
{
"docid": "acfc4a9dd21e9ecc34a7b2122ef9d26a",
"score": "0.6459439",
"text": "def owner\n User.joins(:roles).where('roles.role' => 'owner', 'roles.app_id' => id).first\n end",
"title": ""
},
{
"docid": "9cc87f80f0adcc0b8b7b0030c2362825",
"score": "0.64536124",
"text": "def owner\n @owner ||= User.find(owner_user_id)\n end",
"title": ""
},
{
"docid": "b55dca40632da0ae83bc20051d0cf373",
"score": "0.6415005",
"text": "def owner\n @owner\n end",
"title": ""
},
{
"docid": "89172074b6c99b8a713d84f2a52b1ee7",
"score": "0.64135206",
"text": "def owner_of?(model)\n return false if model.nil?\n if (model.access_restricted?)\n return model.acl.owner?(self)\n end\n return false\n end",
"title": ""
},
{
"docid": "fb491a3d8a9e5afc3fc7885b732f7f81",
"score": "0.6402617",
"text": "def is_owner?(obj)\n obj.user_id == current_user.id\n end",
"title": ""
},
{
"docid": "8a330d49468d0a75cd3879055c5820a2",
"score": "0.6402273",
"text": "def owner\n return @owner\n end",
"title": ""
},
{
"docid": "8a330d49468d0a75cd3879055c5820a2",
"score": "0.64020073",
"text": "def owner\n return @owner\n end",
"title": ""
},
{
"docid": "18db4d5be3cb79accfebf8291b134ef4",
"score": "0.63952386",
"text": "def owner\n result = UserEmote.includes(:user).where(kind: 'Owner', emote_id: self.id).limit(1)\n result.first.user unless result.empty?\n end",
"title": ""
},
{
"docid": "f94bb4b058da88724e0f60240543a690",
"score": "0.6393831",
"text": "def owner\n @owner\n end",
"title": ""
},
{
"docid": "f44a90d5539f1fd01d6f0107e88d96ba",
"score": "0.63853645",
"text": "def owner \n get_users_by_role( :owner ).first\n end",
"title": ""
},
{
"docid": "6c17a8e24c0e5f54d9b257ad544bca3e",
"score": "0.63844496",
"text": "def get_owner\n return self.user\n end",
"title": ""
},
{
"docid": "532ff4ae11f17980b88cc8e77019a9f8",
"score": "0.63842773",
"text": "def owner\n if self.user_id.present?\n self.user\n end\n end",
"title": ""
},
{
"docid": "532ff4ae11f17980b88cc8e77019a9f8",
"score": "0.63842773",
"text": "def owner\n if self.user_id.present?\n self.user\n end\n end",
"title": ""
},
{
"docid": "257de20dadf69afd9427682e06062a86",
"score": "0.6374276",
"text": "def owner\n @owner\n end",
"title": ""
},
{
"docid": "ac91f3f96112d556fa32a219479374ee",
"score": "0.636464",
"text": "def check_if_owner(project, user)\n project.user.id == user.id\n end",
"title": ""
},
{
"docid": "eb8b5d75c3c8c4752d6547cf779db1d0",
"score": "0.63518685",
"text": "def owner? user\n return false if user.nil?\n self.owner_id == user.id\n end",
"title": ""
},
{
"docid": "def6674b470308b22b3bd9f67e516f7c",
"score": "0.6348848",
"text": "def owner\n object.user\n end",
"title": ""
},
{
"docid": "c7aa532b73e66a4d3efd6b5e7c35c521",
"score": "0.6333105",
"text": "def find_owner\n @owner = Owner.find(params[:id])\n end",
"title": ""
},
{
"docid": "535e44d1da567804f1760e82c2433960",
"score": "0.63212687",
"text": "def is_owner?(obj)\n obj.user_id == current_user.id\n end",
"title": ""
},
{
"docid": "f08a214caad128f1eaf79a180cea1b3e",
"score": "0.6319547",
"text": "def owner?\n #TODO\n end",
"title": ""
},
{
"docid": "3b643c3c1befab0a78165a2458e268b4",
"score": "0.6313009",
"text": "def owner\n @owner ||= User.find_by_id(owner_id)\n end",
"title": ""
},
{
"docid": "d8cccbce984cf02b8839d3c973a1e48b",
"score": "0.63115036",
"text": "def owner? user\n self.user == user\n end",
"title": ""
},
{
"docid": "d3b846adfa87c69067ff235d734a3ad6",
"score": "0.6297525",
"text": "def owner\n self.users.find(self.owner_id).name\n end",
"title": ""
},
{
"docid": "2860bddb738e7f18ac32e5c332c72a56",
"score": "0.62970406",
"text": "def project_or_parent\n\t\tparent || project\n\tend",
"title": ""
},
{
"docid": "2860bddb738e7f18ac32e5c332c72a56",
"score": "0.62970406",
"text": "def project_or_parent\n\t\tparent || project\n\tend",
"title": ""
},
{
"docid": "3ea376f1be88ecb6562f9c4989d19ae0",
"score": "0.62784797",
"text": "def find_owner(owner_id)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "13ab5871f056b2b2cb8704d753b1f620",
"score": "0.626337",
"text": "def load_owner\n local_params = params\n if local_params[:project_id]\n @owner = Project.find params[:project_id]\n else\n @owner = Job.find local_params[:job_id]\n end\n end",
"title": ""
},
{
"docid": "0e6366ec80d47555216b3caac536fb43",
"score": "0.6259221",
"text": "def get_object_owner(object)\n User.find_by_id(object.user_id)\n end",
"title": ""
},
{
"docid": "cf86a94928b5380771595a580b3db4c8",
"score": "0.6255954",
"text": "def is_owned_by?(user)\n user.present? && record.project.user == user\n end",
"title": ""
},
{
"docid": "3eaf400d201220a8dbc264ec68ef82d1",
"score": "0.6249276",
"text": "def find_owner\n @owner = Owner.find(params[:owner_id])\n end",
"title": ""
},
{
"docid": "99e7940a980adc7177dad2b925187b9f",
"score": "0.6240572",
"text": "def find_owner(params)\n params = parent_params(params)\n options[:record].call(proxy(params), params)\n end",
"title": ""
},
{
"docid": "2cc79e9d930eb349a43aac2cf5fcc6c3",
"score": "0.6235815",
"text": "def owner? obj\n return false unless obj\n return true if admin?\n\n section_name = obj.class.to_s.tableize\n return true if moderator?(section_name)\n\n # obj is User, simple way to define user_id\n return id == obj.id if obj.is_a?(self.class)\n\n # few ways to define user_id\n return id == obj.user_id if obj.respond_to? :user_id\n return id == obj[:user_id] if obj[:user_id]\n return id == obj[:user][:id] if obj[:user]\n\n false\n end",
"title": ""
},
{
"docid": "ce489cbd524178e75dafe23d233b80a9",
"score": "0.6231465",
"text": "def owner?\n company.owner_id == user_id\n end",
"title": ""
},
{
"docid": "4a280ec1d5be607b8b28a05ba2610fb1",
"score": "0.62290967",
"text": "def current_owner\n \tOwner.where(id: session['owner_id']).first\n end",
"title": ""
},
{
"docid": "4a280ec1d5be607b8b28a05ba2610fb1",
"score": "0.62290967",
"text": "def current_owner\n \tOwner.where(id: session['owner_id']).first\n end",
"title": ""
},
{
"docid": "624f3a7c4ae8e062ed6e103f7cdee684",
"score": "0.62268203",
"text": "def is_owner? (user)\n return user.id == self.owner\n end",
"title": ""
},
{
"docid": "66b3436819ef6979472edf1ebc23a4b9",
"score": "0.6211125",
"text": "def current_owner\n @current_owner ||= Owner.find_by(id: session[:user_id])\n end",
"title": ""
},
{
"docid": "066b2d696c4a6184143046d9c8baf79e",
"score": "0.62053204",
"text": "def owner\n return @owner unless @owner.nil? # memoization\n @owner = parent\n until @owner.nil? || @owner.class.name == config[:owner_class] do\n @owner = @owner.parent\n end\n @owner\n end",
"title": ""
},
{
"docid": "acf22206245d74ccbb7fe43878093bbf",
"score": "0.6196002",
"text": "def is_self_or_owner?(*others)\r\n others.compact.any?{|other| self == other || (other.project? && other.project_founders_include?(self))}\r\n end",
"title": ""
},
{
"docid": "d3881bd76e79264737328698c3f93e0d",
"score": "0.61874634",
"text": "def owner\n imgid unless @owner\n @owner\n end",
"title": ""
},
{
"docid": "b1ea50960d99fa64082c2dcc5b685e47",
"score": "0.61758095",
"text": "def owner\n self.roles.where(name: 'owner').first.users.first\n end",
"title": ""
},
{
"docid": "25da0002a52f9ac7f058b0aa0a5ab076",
"score": "0.61737764",
"text": "def owner\r\n User.select(\"name\").find(object.user_id).name\r\n end",
"title": ""
},
{
"docid": "f5c10166149070cc9f4f065bde29dd54",
"score": "0.6171697",
"text": "def owner_name\n self.owner.name\n end",
"title": ""
},
{
"docid": "b7b7dade89965cd24b1df3743d9f0943",
"score": "0.61707276",
"text": "def owner\n @owner\nend",
"title": ""
},
{
"docid": "a9500f6de4ad7fc11d9f50cbcdc15b5f",
"score": "0.6167973",
"text": "def owner\n\t\t@owner\n\tend",
"title": ""
},
{
"docid": "a9500f6de4ad7fc11d9f50cbcdc15b5f",
"score": "0.6167973",
"text": "def owner\n\t\t@owner\n\tend",
"title": ""
},
{
"docid": "4172d84f69dd04410cd20894f6ea0034",
"score": "0.61590976",
"text": "def owner\n @owner ||= Stacked::User.find(owner_user_id)\n end",
"title": ""
},
{
"docid": "4a260434a71a44b89ccbc684435ac79f",
"score": "0.61429673",
"text": "def owner\n @owner ||= Customer.read_by_id(data[:owner_id])\n end",
"title": ""
},
{
"docid": "677707eae4caccae943f605104e0dabc",
"score": "0.6140052",
"text": "def owner?(record)\n record.user == self\n end",
"title": ""
},
{
"docid": "0ffde780932945bdf8587787cb6acdfd",
"score": "0.6138989",
"text": "def is_owner?\n # The admin should be able to see everything\n if current_user.admin?\n return true\n end\n if @is_owner.nil?\n if current_user != nil && @owner != nil\n if @owner == current_user\n return @is_owner = true\n end\n end\n return @is_owner = false\n else\n return @is_owner\n end\n end",
"title": ""
},
{
"docid": "97cf901e9897bf4702910591df50b00b",
"score": "0.61342305",
"text": "def is_owner?(user)\n user && self.user_id == user.id \n end",
"title": ""
},
{
"docid": "55f6ea10035dc5eade631e431046faa7",
"score": "0.6126542",
"text": "def owner?(obj)\n return false unless obj\n return false unless (obj.class.superclass == ActiveRecord::Base)\n return true if self.has_role?(:system, :administrator)\n return self.id == obj.id if obj.is_a?(User)\n return self.id == obj[:user_id] if obj[:user_id]\n return self.id == obj[:user][:id] if obj[:user]\n false\n end",
"title": ""
},
{
"docid": "c6a04a70136454bea310d2b27dc2b209",
"score": "0.61211056",
"text": "def unique_owner_per_project\n if owner? and ProjectMembership.exists?(:project_id=>project_id, :owner => true)\n errors.add(:project_id, \"#{Project.find_by_id(project_id)} already has an owner\")\n end\n end",
"title": ""
},
{
"docid": "fdd6376b9653bbd6e9d5a8dc5997ab2c",
"score": "0.6119144",
"text": "def owner?(user)\n (self.user == user)\n end",
"title": ""
},
{
"docid": "548d504e2a10bbfde8ed72095503a2f1",
"score": "0.61190623",
"text": "def owner\n fetcher.get(User, owner_id)\n end",
"title": ""
},
{
"docid": "57f5af43af3a18732b7bad7a1ee69388",
"score": "0.611323",
"text": "def owner \n sql = \"SELECT * FROM owners INNER JOIN adoptions\n ON adoptions.owner_id = owners.id\n WHERE owners.id = #{@owner_id}\"\n adoptive_owners = SqlRunner.run(sql)\n return Owner.new(adoptive_owners.first)\nend",
"title": ""
},
{
"docid": "89066c08b410bf7e5827f7bcc791d4c0",
"score": "0.6098343",
"text": "def owner\n property(:owner)\n end",
"title": ""
},
{
"docid": "4ffd6e8affe9cc7e768d8100ea8612ad",
"score": "0.6090223",
"text": "def is_owner\n \"object.user_id == user.id\"\n end",
"title": ""
},
{
"docid": "0b96d90c02a14e4b0716399b36e0b3b6",
"score": "0.60842574",
"text": "def owner\n self.roles.each do |role|\n if role.creator?\n return role.user\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "548a680f7238a42ebe562c0655507a6b",
"score": "0.60797226",
"text": "def owner_inst\n @owner\n end",
"title": ""
},
{
"docid": "4dfe4cc3dd320c1ad356f5c369be087a",
"score": "0.60713756",
"text": "def check_owner\n set_project\n if @project.access_level(current_user.id) != \"owner\"\n redirect_to projects_url\n end\n end",
"title": ""
},
{
"docid": "1ef16bd70a5fc8a3b059658b9b0d6c5f",
"score": "0.6071285",
"text": "def find_discussion_owner\n\t\tfind_answers_discussion\n\t\t@owner = @discussion.user\n\tend",
"title": ""
},
{
"docid": "d965997247bd06af839a7e73b59143ad",
"score": "0.6069861",
"text": "def is_owner?(user)\n user.id == self.user_id\n end",
"title": ""
},
{
"docid": "0d67708c828ca2b77ad2a46d83d93259",
"score": "0.60674673",
"text": "def owner_association\n @owner_association ||= reflect_on_all_associations(:belongs_to).select do |assoc|\n if assoc.options.key? :polymorphic\n false\n else\n assoc.klass <= Configuration.user_class.constantize\n end\n end.try(:first)\n end",
"title": ""
},
{
"docid": "19447000721bd987998a4a1dcda32d47",
"score": "0.6060537",
"text": "def find_project_owner(name) #here name should be a string\n result = @query.build_query(:project,\"Name,Owner,ObjectID\",\"(Name = \\\"#{name}\\\")\",\"\")\n if result && result.length>0\n if nil!=result.first.Owner and nil!=result.first.Owner.Name\n log_info(\"Found project owner username: \" + result.first.Owner.Name)\n return result.first\n end\n else\n log_info(\"did not find that project\")\n end\n return nil\n end",
"title": ""
},
{
"docid": "19447000721bd987998a4a1dcda32d47",
"score": "0.6060537",
"text": "def find_project_owner(name) #here name should be a string\n result = @query.build_query(:project,\"Name,Owner,ObjectID\",\"(Name = \\\"#{name}\\\")\",\"\")\n if result && result.length>0\n if nil!=result.first.Owner and nil!=result.first.Owner.Name\n log_info(\"Found project owner username: \" + result.first.Owner.Name)\n return result.first\n end\n else\n log_info(\"did not find that project\")\n end\n return nil\n end",
"title": ""
},
{
"docid": "26dd96fa6df97a15d06771fb6e3321f9",
"score": "0.60467786",
"text": "def neo_asset_get_owner\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "af0771053e8870f14c9272f238f9030c",
"score": "0.6042774",
"text": "def show_project_to?(user=User.current_user)\n raise ActiveRecord::RecordNotFound if user.nil? and self.private?\n raise ActiveRecord::RecordNotFound if self.homebase.id != Homebase.current_homebase.id\n return self\n end",
"title": ""
},
{
"docid": "6d9700383c69c5218c4a19bcb400b428",
"score": "0.60420895",
"text": "def is_owner? item_in\n\t\titem_in.owner_id == current_user.id\n\tend",
"title": ""
},
{
"docid": "3858d39f8deb570df10a828b60fcc624",
"score": "0.6037408",
"text": "def owner\n defined?(@owners) && @owners.last\n end",
"title": ""
},
{
"docid": "59b49c317054b33f44270503236353f4",
"score": "0.60364467",
"text": "def current_project(only_owner=false)\n return @current_project if @current_project\n base = only_owner ? current_account.projects : Project.accessible(current_account)\n @current_project = base.find(params[:id])\n end",
"title": ""
},
{
"docid": "0e3dae788e40ec1fb73fa7489774de29",
"score": "0.60317796",
"text": "def relation_for_owner(owner)\n type = owner.class.name.split('::').first\n member_relations.where('owner_type LIKE ?', \"#{type}%\").where(owner_id: owner.id).first\n end",
"title": ""
},
{
"docid": "40bfdb752bff6697ddb27dac23cb9a5c",
"score": "0.6031769",
"text": "def get_owner_of_item(item)\n\t\treturn get_owner_of_shop(Shop.find_by_id(item.shop_id))\n\tend",
"title": ""
},
{
"docid": "482b0d19d299598d073d322afffd0701",
"score": "0.60314023",
"text": "def owner\r\n user\r\n end",
"title": ""
},
{
"docid": "37728a7d034da2342ea12a4a7c2e2b3b",
"score": "0.60312015",
"text": "def current_owner?(owner)\n owner == current_owner\n end",
"title": ""
},
{
"docid": "934dd6b2e8eba979f14ade3891b7a24b",
"score": "0.6029427",
"text": "def user_is_owner?\n record.user == user\n\n end",
"title": ""
},
{
"docid": "2f6e87df1c049e72098e1981ddfde283",
"score": "0.6014613",
"text": "def owner\n\t\tself.user\n\tend",
"title": ""
},
{
"docid": "6b2e0cba38322bb34addae0f44541387",
"score": "0.60053957",
"text": "def get_owner\n\treturn @owner_name\nend",
"title": ""
},
{
"docid": "ed4b3f9cdf64a84b9980ecaa8803b989",
"score": "0.6002714",
"text": "def owner?(user)\n user_id == user.id\n # todo can be better use active_record\n end",
"title": ""
}
] |
9e116980532422b93cd6ea05b7a582f1
|
I'm using this to encode things. source://rubyopenid//lib/openid/server.rb1301
|
[
{
"docid": "6f8737871b4d595388dff4c5fca7b1ae",
"score": "0.6789569",
"text": "def encoder; end",
"title": ""
}
] |
[
{
"docid": "39cad6cf03e4622e478f5be0aa1e8a4f",
"score": "0.74977154",
"text": "def encoded; end",
"title": ""
},
{
"docid": "39cad6cf03e4622e478f5be0aa1e8a4f",
"score": "0.74977154",
"text": "def encoded; end",
"title": ""
},
{
"docid": "124998e0c7a9a4201748c093b6268da6",
"score": "0.7320412",
"text": "def encode\n \n end",
"title": ""
},
{
"docid": "b3d932a3bda642555595a172cc87fbba",
"score": "0.71732694",
"text": "def encode(data); end",
"title": ""
},
{
"docid": "b3a898a21a37d38de75092d6116adafa",
"score": "0.7115383",
"text": "def encode\n # Not really sure why we only take part of the defalated saml, but\n # the IdP seems to take it...\n deflated_request = Zlib::Deflate.deflate(saml, 9)[2..-5]\n Base64.encode64(deflated_request)\n end",
"title": ""
},
{
"docid": "d9ae21b5bd26357b88921ede6842ad86",
"score": "0.7102686",
"text": "def encode(params); end",
"title": ""
},
{
"docid": "9fb27a16877d45b379759c5e8909d18a",
"score": "0.7079626",
"text": "def encode(value); end",
"title": ""
},
{
"docid": "9fb27a16877d45b379759c5e8909d18a",
"score": "0.7079626",
"text": "def encode(value); end",
"title": ""
},
{
"docid": "9fb27a16877d45b379759c5e8909d18a",
"score": "0.7079626",
"text": "def encode(value); end",
"title": ""
},
{
"docid": "dec61573472d8daac56b5a4685ccd6f0",
"score": "0.702707",
"text": "def encode(str); end",
"title": ""
},
{
"docid": "59a8871dfff7cd7bf203f4a99fb4c116",
"score": "0.6974323",
"text": "def encode(data)\r\n end",
"title": ""
},
{
"docid": "441fa41ef1f23839aa29146522f3358a",
"score": "0.69690704",
"text": "def can_encode?; end",
"title": ""
},
{
"docid": "5735892218addfdf7e1c58e8d96a7e1d",
"score": "0.68713284",
"text": "def encode_body\n encode_short(@id)\n end",
"title": ""
},
{
"docid": "b05b5710cf695d91d2c49e9edbca4095",
"score": "0.6868272",
"text": "def encode_message(message); end",
"title": ""
},
{
"docid": "ce4c9d12a504f08e8e42359e96d5af12",
"score": "0.6856949",
"text": "def encode(*); self; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.6846097",
"text": "def encoding; end",
"title": ""
},
{
"docid": "eaab13b87c748b1384290af9e9b33aa8",
"score": "0.6845398",
"text": "def encode(*args, &block); end",
"title": ""
},
{
"docid": "2f2c9293089bab50525bba79a0a00677",
"score": "0.68170094",
"text": "def encode\n Base64.encode64(@raw).chop\n end",
"title": ""
},
{
"docid": "495cef204e6a1f043d18172d10b1f0b3",
"score": "0.6813707",
"text": "def encode_with(coder); end",
"title": ""
},
{
"docid": "495cef204e6a1f043d18172d10b1f0b3",
"score": "0.6813707",
"text": "def encode_with(coder); end",
"title": ""
},
{
"docid": "495cef204e6a1f043d18172d10b1f0b3",
"score": "0.6813707",
"text": "def encode_with(coder); end",
"title": ""
},
{
"docid": "495cef204e6a1f043d18172d10b1f0b3",
"score": "0.6813707",
"text": "def encode_with(coder); end",
"title": ""
},
{
"docid": "9a256b1439378911d331418b5df4ebbc",
"score": "0.68053454",
"text": "def encode64(bin); end",
"title": ""
},
{
"docid": "9a256b1439378911d331418b5df4ebbc",
"score": "0.68053454",
"text": "def encode64(bin); end",
"title": ""
},
{
"docid": "03b1d97589780fe992d846e79a581bc1",
"score": "0.67738575",
"text": "def encode\n Base64.encode64 @raw\n end",
"title": ""
},
{
"docid": "8a96a72ad8cfac45da9009ce535ad6b5",
"score": "0.66945446",
"text": "def encoded_value; end",
"title": ""
},
{
"docid": "1333fba0b4f1a588a6576167fff5d802",
"score": "0.66792864",
"text": "def encode_body\n encode_short(@id)\n end",
"title": ""
},
{
"docid": "f653b82bb2052fcf8d6dd1c7491ff4a2",
"score": "0.66712284",
"text": "def charset_encoder; end",
"title": ""
},
{
"docid": "0d59ca7d85155c18817c302f65b9b5c3",
"score": "0.6624693",
"text": "def encode()\n \"#{type}:#{id}:#{endpoint}:#{data}\"\n end",
"title": ""
},
{
"docid": "306881b7ae28eb28afc872fe934adc9f",
"score": "0.6613795",
"text": "def encode(data)\r\n data\r\n end",
"title": ""
},
{
"docid": "f2ac15a9aac349f398cc91dcbf996e21",
"score": "0.6572492",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "fd24655a478cfc45e62417163312af5b",
"score": "0.65720993",
"text": "def encode(s)\n @base64 = Base64.encode64(s)\n end",
"title": ""
},
{
"docid": "261f6d8411f8bbb9cb84354d6ab31e23",
"score": "0.65621585",
"text": "def encode!(*); self; end",
"title": ""
},
{
"docid": "068386eeeaef57562af6a53eb34bc22e",
"score": "0.6561214",
"text": "def encode_extended(buffer); end",
"title": ""
},
{
"docid": "459f9227e51077d332d7c4a224088e6f",
"score": "0.65555584",
"text": "def encode\n raise \"needs to be implemented by sub class\"\n end",
"title": ""
},
{
"docid": "085e2a3053ddc8fd13a9451c16d57edc",
"score": "0.65509325",
"text": "def encode_to_url\n fields = {}\n @fields.each {|k,v| fields['openid.'+k] = v}\n return OpenID::Util.append_args(@request.return_to, fields)\n end",
"title": ""
},
{
"docid": "4e7bf33d1e9f5bd45b5dcfb99e54d402",
"score": "0.6549857",
"text": "def param_encode(str); end",
"title": ""
},
{
"docid": "8fa2f75b0cf593b706870633f27222ad",
"score": "0.6514731",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "604b72cd01bb6a7b4c51ff9be025593a",
"score": "0.6514096",
"text": "def encode_code(eof = nil)\n @code = Rex::Text.encode_base64(Rex::Text.to_unicode(code))\n end",
"title": ""
},
{
"docid": "9a3d5bbf5a219c79e8813e47461c6c7b",
"score": "0.6508628",
"text": "def _encode_parameters\n params = @_parameters.dup\n # The Allopass API expects an array of codes encoded\n # in a slightly different matter than urlencode does\n if params.has_key?('code')\n codes = params.delete('code')\n (0..codes.length-1).each{|i| params[\"code[#{i}]\"] = codes[i]}\n end\n \n URI::encode params.collect { |k,v| \"#{k}=#{v}\" }.join('&') #CGI::escape(v.to_s)\n end",
"title": ""
},
{
"docid": "9a0b4c05140dc5627d67dcd756116021",
"score": "0.6508349",
"text": "def url_encode(key); end",
"title": ""
},
{
"docid": "cc05bf36a8d239e3ec2be7f22b035c76",
"score": "0.6482476",
"text": "def encoder=(_); end",
"title": ""
},
{
"docid": "ad422be035447f679fd4b98a865b33fa",
"score": "0.64799136",
"text": "def encode_parameters(params); end",
"title": ""
},
{
"docid": "0ef7041d25729b9f87a0638063a1acee",
"score": "0.64736336",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0ef7041d25729b9f87a0638063a1acee",
"score": "0.64736336",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0ef7041d25729b9f87a0638063a1acee",
"score": "0.64736336",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "85fd87af2b5c34920fc2ea4144614ec5",
"score": "0.6460005",
"text": "def strict_encode64(bin); end",
"title": ""
},
{
"docid": "85fd87af2b5c34920fc2ea4144614ec5",
"score": "0.6460005",
"text": "def strict_encode64(bin); end",
"title": ""
},
{
"docid": "7667838857114ed58507d87c3bcd20e5",
"score": "0.6459066",
"text": "def encode_to_url(server_url)\n q = {\n 'openid.mode' => @mode,\n 'openid.identity' => @identity,\n 'openid.return_to' => @return_to\n }\n\n q['openid.trust_root'] = @trust_root if @trust_root\n q['openid.assoc_handle'] = @assoc_handle if @assoc_handle\n\n # add other openid stuff into the query (extensions)\n @query.each do |k,v|\n if k.starts_with?('openid.') and not q.has_key?(k)\n q[k] = v\n end\n end\n\n return OpenID::Util.append_args(server_url, q)\n end",
"title": ""
},
{
"docid": "69818657f86ac51f51f7820f70cdcd2c",
"score": "0.644574",
"text": "def encoded(transfer_encoding = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "3a4501fc5308069390c7c838968b3851",
"score": "0.64402646",
"text": "def charset_encoder=(_arg0); end",
"title": ""
},
{
"docid": "9eec829169b4496eb63437a7d377212c",
"score": "0.64292717",
"text": "def encode(id)\n code = \"\"\n code = convert(id, BASE)\n (code.length > KEY_LENGTH) ? \"\" : \"0\" * (KEY_LENGTH - code.length) + code\n end",
"title": ""
},
{
"docid": "ad3d654f7a6a56f11395971429a90531",
"score": "0.6424333",
"text": "def normalize_encode_params(params); end",
"title": ""
},
{
"docid": "b9fa2e737cc44a1b59a0c14cbc929c8a",
"score": "0.6420943",
"text": "def encode(_)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b9fa2e737cc44a1b59a0c14cbc929c8a",
"score": "0.6420943",
"text": "def encode(_)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b9fa2e737cc44a1b59a0c14cbc929c8a",
"score": "0.6420943",
"text": "def encode(_)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "3e70fdbe501df4ea28a7acad529b2000",
"score": "0.6408527",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "94086a40c08b2fcbebc6f5d07cd84cfa",
"score": "0.640664",
"text": "def meta_encode(meta)\n Base64.encode64(Marshal.dump(meta))\n end",
"title": ""
},
{
"docid": "838538a05e140d5c28729327f243625b",
"score": "0.6381306",
"text": "def encoded\n Base64.encode(@str)\n end",
"title": ""
},
{
"docid": "f3b7e2d759fb66c368adc42db4960b68",
"score": "0.6375999",
"text": "def encode(code, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "cdd771dbbc36a5febef17928f517b0b4",
"score": "0.63610494",
"text": "def base64_encoded_request(req)\n Base64.strict_encode64 request_info(req)\n end",
"title": ""
},
{
"docid": "04ad3879a74a90e038100b4e9182f147",
"score": "0.63452095",
"text": "def safe_encoded\n 'uri_' << Base64.encode64(@uri_s).gsub('=', '-_-').gsub('+', '-__-').gsub('/', '-___-').gsub(/\\s/, '')\n end",
"title": ""
},
{
"docid": "930252417796084c73fb7e660b8c76e5",
"score": "0.63260114",
"text": "def encode s\n Base64.urlsafe_encode64 s.to_s\n end",
"title": ""
},
{
"docid": "1fe97bb93cdf27ce1f18922cd156f944",
"score": "0.6317001",
"text": "def enc str\n URI::encode str\nend",
"title": ""
},
{
"docid": "b974ead7a7d78ea3ff12fe76b4db6214",
"score": "0.6316328",
"text": "def encode_code( str, rs )\r\n\t\tstr.gsub( %r{&}, '&' ).\r\n\t\t\tgsub( %r{<}, '<' ).\r\n\t\t\tgsub( %r{>}, '>' ).\r\n\t\t\tgsub( CodeEscapeRegexp ) {|match| EscapeTable[match][:md5]}\r\n\tend",
"title": ""
},
{
"docid": "c746c6599296808ce076d3b1bedba74b",
"score": "0.6315351",
"text": "def encode(text)\n #TODO: Implementa este metodo\nend",
"title": ""
},
{
"docid": "e86f06b6022b9aed49c9571b90c37b26",
"score": "0.6314741",
"text": "def raw_encode(*args)\n JWT.encode(*args)\n end",
"title": ""
},
{
"docid": "3268b2b223aa8d0bea67d30b8b3a9c5c",
"score": "0.6302891",
"text": "def encoder=(_arg0); end",
"title": ""
},
{
"docid": "0f54db563e26bbb108e25bd77907598e",
"score": "0.62998587",
"text": "def encoder\n @encoder ||= ::URI.method(:encode_www_form)\n end",
"title": ""
},
{
"docid": "3d4ad1086f103dbcc9e0c96744888c79",
"score": "0.6298697",
"text": "def encoder\n @encoder ||= WebAuthn::Encoder.new(encoding)\n end",
"title": ""
},
{
"docid": "3d4ad1086f103dbcc9e0c96744888c79",
"score": "0.6298697",
"text": "def encoder\n @encoder ||= WebAuthn::Encoder.new(encoding)\n end",
"title": ""
},
{
"docid": "cf1804258290b3ae268b2c909fabf423",
"score": "0.62934935",
"text": "def rfc4253\n Encoding.encode_fields(\n [:string, algo],\n [:string, pk],\n [:string, application],\n )\n end",
"title": ""
},
{
"docid": "cf1804258290b3ae268b2c909fabf423",
"score": "0.62934935",
"text": "def rfc4253\n Encoding.encode_fields(\n [:string, algo],\n [:string, pk],\n [:string, application],\n )\n end",
"title": ""
},
{
"docid": "c113e8194ac78d7dcee8f2782c478a47",
"score": "0.62927413",
"text": "def encode_body(data); end",
"title": ""
},
{
"docid": "2f35409d2a783324badd571cf516c813",
"score": "0.62861174",
"text": "def encode_auth(username, password)\n base64(\"\\0#{username}\\0#{password}\")\n end",
"title": ""
},
{
"docid": "40251ebfadc98af2d7731eccb72b5824",
"score": "0.6277597",
"text": "def rfc4253\n Encoding.encode_fields(\n [:string, algo],\n [:string, pk],\n )\n end",
"title": ""
},
{
"docid": "0e45110694eebd256394f25d0821e09f",
"score": "0.62733746",
"text": "def encode_payload(opts)\n Rex::Text.encode_base64(@exe)\n end",
"title": ""
},
{
"docid": "534fbaa3729a219fef33a051caf63673",
"score": "0.62637854",
"text": "def internal_encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "02f1500ac1dfa8b9ad3e584a8f5b571d",
"score": "0.6254138",
"text": "def encode_client(session)\n return CGI.escape(Base64.encode64(JSON.unparse(session)))\n end",
"title": ""
},
{
"docid": "eab6e3a85923ead0049f588baaf1b408",
"score": "0.6228171",
"text": "def ident_encode(string)\n string.force_encoding('ISO-8859-1').encode('UTF-8').gsub(\"\\u0000\", '')\n end",
"title": ""
},
{
"docid": "32099150ab3717f1c4c437741a032d6a",
"score": "0.6223338",
"text": "def encode(uri, return_type = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "32099150ab3717f1c4c437741a032d6a",
"score": "0.6223338",
"text": "def encode(uri, return_type = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "aaa8279fd95b55ee7c3a034582dd048e",
"score": "0.62166196",
"text": "def encode(code, lang, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "3f2c427896fea3ed6ee487b2396f2d86",
"score": "0.6216182",
"text": "def encode( value )\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "8750a0870d213101cca93e909b5162ee",
"score": "0.6208655",
"text": "def base64(str); end",
"title": ""
},
{
"docid": "8750a0870d213101cca93e909b5162ee",
"score": "0.6208655",
"text": "def base64(str); end",
"title": ""
},
{
"docid": "8811b54cd68a8eb7634379b9a882704a",
"score": "0.62001795",
"text": "def encode_url(url)\n key = encode(\"#{extract_ids(url)}#{idp_password}\", true)\n url + (url.include?(\"?\") ? \"&\" : \"?\") + \"key=#{key}\"\n end",
"title": ""
},
{
"docid": "ab058fec72472aae7aef2866ae050a86",
"score": "0.6193084",
"text": "def encode(code, lang, format, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "8d853c5900a4641889ffc30ca0e5ab74",
"score": "0.6183297",
"text": "def encode_base64( bin )\n\t[ bin ].pack( \"m\" ).gsub( /\\s/, \"\" )\nend",
"title": ""
},
{
"docid": "b4aaf93424c80740d04d44b7656b6930",
"score": "0.6179959",
"text": "def encode\n Base64.encode64(to_json)\n end",
"title": ""
},
{
"docid": "9b5b36c83f7f4d5f8708087be6a10f5b",
"score": "0.6176097",
"text": "def standard_encode\n encode_entities(:basic).gsub(/'/, ''')\n end",
"title": ""
}
] |
24d4f7ce6ee960591d5e18eecd8eb3f8
|
Sorts a text search by relevance, can only be chained after `fulltext_search()`
|
[
{
"docid": "984df38c3b0b089f4719f7ff27b5927d",
"score": "0.73180884",
"text": "def by_relevance\n self.order(\"search_ranking DESC\")\n end",
"title": ""
}
] |
[
{
"docid": "4062c0be607f0cce1b3d52bbd3aa2cbf",
"score": "0.63799274",
"text": "def handling_fulltext\n options = yield\n add_sort_by_relevance options if fulltext_name_filtering?\n options\n end",
"title": ""
},
{
"docid": "e88c72a9aa06b8980a50a8506bbfa4ff",
"score": "0.6290256",
"text": "def relevance\n BASE_RELEVANCE * @relevance.compact.inject(:*) if @relevance\n end",
"title": ""
},
{
"docid": "54e979c3b37fac641b955058b26f21b2",
"score": "0.6213329",
"text": "def search_and_sort(value, direction)\n if value.blank? && direction.blank?\n Technologist.all.order(\"technologists.name ASC\")\n elsif value.blank? && direction=='asc'\n Technologist.all.order(\"technologists.name ASC\")\n elsif value.blank? && direction=='desc'\n Technologist.all.order(\"technologists.name DESC\")\n elsif value && direction=='asc'\n Technologist.full_text_search(value).reorder(\"technologists.name ASC\").with_pg_search_rank\n elsif value && direction=='desc'\n Technologist.full_text_search(value).reorder(\"technologists.name DESC\").with_pg_search_rank\n else\n Technologist.full_text_search(value).with_pg_search_rank\n end\n end",
"title": ""
},
{
"docid": "fbe7f950b0520ec6dd48a397f465bab8",
"score": "0.6064321",
"text": "def sort\n @sort ||= Vidibus::Words.sort_by_occurrence(list)\n end",
"title": ""
},
{
"docid": "31003dfff16cbc2f76779faf1e1ed359",
"score": "0.60200226",
"text": "def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"title": ""
},
{
"docid": "99a98302a48a837e804aa84cc2ee036d",
"score": "0.59680885",
"text": "def fuzzy_compare(search_words, conservative=false)\n return 0 if search_words.blank?\n \n if conservative\n search_words = Movie::conservative_normalize_rt_title(search_words)\n else\n search_words = Movie::normalize_words(search_words)\n end\n search_trigrams = Movie::trigrams(search_words, true) \n \n title_words = self.normalized_tz_title\n title_trigrams = Movie::trigrams(title_words, true) \n\n #puts \"Original title: #{rt_title}\"\n #puts \"Normalized title: #{title_words}\"\n #puts \"Search words: #{search_words}\"\n \n # Calculate the percentage of search trigrams matched in the movie title\n count = 0.0\n search_trigrams.each do |trigram|\n count += 1 if title_trigrams.include?(trigram)\n end\n percent = search_trigrams.empty? ? 0 : ((count / search_trigrams.length) * 100).to_i\n #puts \"Percent match: #{percent}\"\n percent\n end",
"title": ""
},
{
"docid": "aa482a4448a98f70572e9110e0f6da9c",
"score": "0.5957842",
"text": "def or_text_match(column, search)\n column = \"#{column.to_s}_search_index\".to_sym\n self.or(':column @@ plainto_tsquery(:search)', :column => column, :search => search)\n .order_append(Sequel.function(:ts_rank, column, Sequel.function(:plainto_tsquery, search)).desc)\n end",
"title": ""
},
{
"docid": "9a60ebac3525da0ef767df6109278bea",
"score": "0.58856755",
"text": "def search(\n query, case_sensitive: false, whole_sentence: true, limit: 10, skip: 0\n )\n query = query.to_s.strip\n query.replace('\"' + query + '\"') if whole_sentence\n\n # Sort based on the most search hits (aka \"textScore\").\n # We use the sort_proj hash as both a sort and a projection below.\n sort_proj = { score: { :$meta => 'textScore' } }\n query = { :$text => {\n :$search => query,\n :$caseSensitive => case_sensitive\n } }\n\n results = retrieve(:documents, query,\n sort: sort_proj, projection: sort_proj,\n limit: limit, skip: skip)\n return [] if results.count < 1 # respond_to? :empty? == false\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |mongo_doc| Wgit::Document.new(mongo_doc) }\n results.each { |doc| yield(doc) } if block_given?\n\n results\n end",
"title": ""
},
{
"docid": "33373a4474ef8f83f4aae191a8f69e6c",
"score": "0.5883817",
"text": "def sorted_results(unsorted)\n scores = []\n sorted = []\n\n unsorted.group_by(&:itself).each_pair do |result, results|\n relevance = result_relevance(result, results.length)\n new_index = scores.bsearch_index { |val| val < relevance }\n # if this result has the lowest score, add it to the end\n new_index ||= -1 \n\n scores.insert(new_index, relevance)\n sorted.insert(new_index, result.first)\n end\n sorted\n end",
"title": ""
},
{
"docid": "1662137abd95bf4319607f5cc95d9612",
"score": "0.5844754",
"text": "def text_match(column, search)\n column = \"#{column.to_s}_search_index\".to_sym\n self.where(':column @@ plainto_tsquery(:search)', :column => column, :search => search)\n .order_append(Sequel.function(:ts_rank, column, Sequel.function(:plainto_tsquery, search)).desc)\n end",
"title": ""
},
{
"docid": "b88767bd1e8510fd55b0d627253399ec",
"score": "0.5791668",
"text": "def search_queries_with_frequencies_sorted_descending\n @searches_grouped_by_frequency.to_a.sort{|a,b| b[1] <=> a[1]}\n end",
"title": ""
},
{
"docid": "15c0e850ae935f5a9e6391255f138a63",
"score": "0.5780727",
"text": "def sort_searched_tweets(tweets)\n word_scores = []\n scores = tweets.map do |t|\n score = 0\n score, str = score_for_tweet(t)\n word_scores << str\n score\n end\n tweets = tweets.map.with_index.sort_by { |t, index| -scores[index] }.map(&:first)\n word_scores = word_scores.map.with_index.sort_by { |t, index| -scores[index] }.map(&:first)\n [tweets, word_scores]\n end",
"title": ""
},
{
"docid": "848eb5f518abfda0df2619d79fd501f5",
"score": "0.57130903",
"text": "def sort_sentence(sentence)\r\n words = break_words(sentence)\r\n sort_words(words)\r\nend",
"title": ""
},
{
"docid": "9eef1aa36ab61251b127e2ee29b01934",
"score": "0.5694726",
"text": "def sortwords(words\n return words.sort\nend",
"title": ""
},
{
"docid": "3355ebb667a225029170ecc805bda1d2",
"score": "0.5672745",
"text": "def sort_sentence(sentence)\n words = break_words(sentence)\n sort_words(words)\nend",
"title": ""
},
{
"docid": "176dc9503a903152b508025aa0fa57c9",
"score": "0.56410867",
"text": "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end",
"title": ""
},
{
"docid": "18c29422f08b984d146bff5eb31dc1d0",
"score": "0.5629465",
"text": "def get_articles_by_word_relevance(search_words)\n\n # if the string is empty or null, return nothing.\n if search_words == nil or search_words.empty?\n return [], []\n end\n\n words_list = search_words.split\n @articles_list = []\n begin\n # execute the search from the DAO\n @articles_list = @articles_dao.find_articles_by_relevant_text_fields(words_list)\t\n return @articles_list.uniq, words_list\n rescue Exception => ex\n puts ex\n return Array([]), words_list\n end\n end",
"title": ""
},
{
"docid": "e7aeaf3c745525f589a97ad5485b2925",
"score": "0.5597794",
"text": "def sort_words\n audit\n @_sort_words ||= words.sort { |a, b| b.last <=> a.last }\n end",
"title": ""
},
{
"docid": "525bd7021263d2db1e6dd356ac02745c",
"score": "0.55893326",
"text": "def sort_sentence(sentence)\n words = break_words(sentence)\n return sort_words(words)\nend",
"title": ""
},
{
"docid": "91ee6c783a56fca65a08f47285e84e0b",
"score": "0.55649555",
"text": "def fulltext_search(search_string)\n\n # Strip out !, (), &, and |, because these are search vector control characters\n # Remove extra spaces\n search_string = search_string.to_s.delete(\"()!&|\").squish\n\n tsquery = sanitize_sql_array([\n %{replace(plainto_tsquery('%s')::text,' & ',' | ')::tsquery}, search_string\n ])\n\n relation = self.select(%{\n #{self.table_name}.*,\n ts_rank(#{self.table_name}.search_vector, #{tsquery}) AS search_ranking\n })\n\n return relation.where(\"#{tsquery} @@ #{self.table_name}.search_vector\")\n\n end",
"title": ""
},
{
"docid": "9b5c3656d4ccb6e5d1a94bbf7d23aa1d",
"score": "0.5564709",
"text": "def result_relevance(result, count)\n result_string, score = result\n exact_match = 0\n exact_match = 100_000 if result_string =~ search_regex\n exact_match + (count * 100) + Math.log(score.to_i)\n end",
"title": ""
},
{
"docid": "3db6638ff817dc52c330154ec2e743b9",
"score": "0.5532177",
"text": "def rank(hits)\n\t\thits = Search.fill_meta(hits)\n\t\t\n\t\thits.each do |h|\n\t\t\th[:distance] = distance(query, h[:object].display)\n\t\t\th[:score] = h[:distance] * HIT_WEIGHT_SIMILARITY + \n\t\t\t h[:popularity] * HIT_WEIGHT_POPULARITY\n\t\tend\n\t\t\n\t\thits = hits.sort_by { |h| -1 * h[:score] }\n\tend",
"title": ""
},
{
"docid": "0f6c2dc57a33fa8578d12f42abcce6d2",
"score": "0.5510671",
"text": "def reOrderSuggestions(suggestions, maxDistance = 0.5)\n\t\t\tqueryText = getSearchRequest().getQuerytext()\n\t\t\tgroupNames = ['highlighted-beginning', 'highlighted-not-beginning', 'others']\n\t\t\tgroupValues = Hash.new\n\t\t\tk = 0\n\t\t\tgroupNames.each do |groupName|\n\t\t\t\tgroupValues[k] = Hash.new\n\t\t\t\tif(!suggestions.nil?)\n\t\t\t\t\tsuggestionGroup = Array.new\n\t\t\t\t\tsuggestions.each do |suggestion, suggestionText|\n\t\t\t\t\t\tif (suggestionIsInGroup(groupName, suggestionText))\n\t\t\t\t\t\t\tsuggestionGroup.push(suggestionText)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tgroupValues[k] = suggestionGroup\n\t\t\t\tend\n\t\t\t\tk +=1\n\t\t\tend\n\n\t\t\tfinal = Array.new\n\t\t\tgroupValues.each do |order, values|\n\t\t\t\tif !values.empty? && !values.nil?\n\t\t\t\t\tfinal.push(getRelevanceSuggestion(queryText, values, maxDistance))\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tfinalValues = Array.new\n\t\t\tfinal.each do |elements|\n\t\t\t\tif(elements.length)\n\t\t\t\t\telements.each do |element|\n\t\t\t\t\t\telement.each do |suggestion|\n\t\t\t\t\t\t\tfinalValues.push(suggestion)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn finalValues\n\t\tend",
"title": ""
},
{
"docid": "5724c9f13cc535576994e0086574b5a3",
"score": "0.5501756",
"text": "def search_and_sort(value, direction)\n if value.blank? && direction.blank?\n Servicer.all.order(\"servicers.name ASC\")\n elsif value.blank? && direction=='asc'\n Servicer.all.order(\"servicers.name ASC\")\n elsif value.blank? && direction=='desc'\n Servicer.all.order(\"servicers.name DESC\")\n elsif value && direction=='asc'\n Servicer.full_text_search(value).reorder(\"servicers.name ASC\").with_pg_search_rank\n elsif value && direction=='desc'\n Servicer.full_text_search(value).reorder(\"servicers.name DESC\").with_pg_search_rank\n else\n Servicer.full_text_search(value).with_pg_search_rank\n end\n end",
"title": ""
},
{
"docid": "5f20657c462f5f10842866a0f9cb661a",
"score": "0.5496072",
"text": "def sort_and_search(loans)\n if search_param\n @loans = loans.list_with_loan_type_and_client.order(\"#{sort_column_param} #{sort_order_param}\").simple_search search_param\n else\n @loans = loans.list_with_loan_type_and_client.order(\"#{sort_column_param} #{sort_order_param}\")\n end\n end",
"title": ""
},
{
"docid": "07563554152842c494fd9c3d53083a30",
"score": "0.54958326",
"text": "def sort_sentence(sentence)\r\n words = break_words(sentence)\r\n sort_words(words)\r\n end",
"title": ""
},
{
"docid": "820443100f8c28b9bf7dcaa911a8fc23",
"score": "0.54894304",
"text": "def search(\n query, case_sensitive: false, whole_sentence: true, limit: 10, skip: 0\n )\n query = query.to_s.strip\n query.replace('\"' + query + '\"') if whole_sentence\n\n # Sort based on the most search hits (aka \"textScore\").\n # We use the sort_proj hash as both a sort and a projection below.\n sort_proj = { score: { :$meta => 'textScore' } }\n query = { :$text => {\n :$search => query,\n :$caseSensitive => case_sensitive\n } }\n\n results = retrieve(DOCUMENTS_COLLECTION, query,\n sort: sort_proj, projection: sort_proj,\n limit: limit, skip: skip)\n\n results.map do |mongo_doc|\n doc = Wgit::Document.new(mongo_doc)\n yield(doc) if block_given?\n doc\n end\n end",
"title": ""
},
{
"docid": "242d4bc4ba44fae9799d05743d8a506a",
"score": "0.548205",
"text": "def search\n @user = current_user\n temp_revs = []\n unless params[:search_terms].nil?\n tags = tags_from_string(params[:search_terms])\n temp_revs = filter_reviews(temp_revs, tags)\n end\n @user.friends.each do |friend|\n temp_revs += friend.reviews\n end\n tags = tags_from_string(params[:search_terms])\n temp_revs = filter_reviews(temp_revs, tags)\n @reviews = temp_revs.sort_by(&:post_date).reverse\n end",
"title": ""
},
{
"docid": "6d8fa7c518a89263673223a42ed25ba6",
"score": "0.5458593",
"text": "def similar_to(main, opts={})\n opts.merge!(default_options)\n \n cleaned = @collection.remove(main)\n\n results = order_by_similarity_score(main, cleaned)\n\n sort_results(results,opts[:size])\n end",
"title": ""
},
{
"docid": "2b22f2d18174fb69ed48ef19b67153fa",
"score": "0.5449764",
"text": "def sort_hits!\n @array.sort! do |a, b|\n code = a.hit[:code] <=> b.hit[:code]\n next code unless code.zero?\n\n b.hit[:release_date] <=> a.hit[:release_date]\n end\n self\n end",
"title": ""
},
{
"docid": "1446d7f05da5b02c659a2b03c110f12b",
"score": "0.5435666",
"text": "def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end",
"title": ""
},
{
"docid": "b5e030e4daa1fb5da09004eb46c1331e",
"score": "0.54213345",
"text": "def search\n @query = params[:q]\n @ads = Ad.within(@city, 30)\n @ads = @ads.fulltext_search(@query).group_by { |x| x.created_at.to_date }\n end",
"title": ""
},
{
"docid": "d870abca54847c9542ed449bc34105b8",
"score": "0.540698",
"text": "def search(search, distance: nil, negate: false, case_type: nil)\n prefs = Doing.setting('search', {})\n matching = prefs.fetch('matching', 'pattern').normalize_matching\n distance ||= prefs.fetch('distance', 3).to_i\n case_type ||= prefs.fetch('case', 'smart').normalize_case\n\n if search.rx? || matching == :fuzzy\n matches = @title + @note.to_s =~ search.to_rx(distance: distance, case_type: case_type)\n else\n query = search.strip.to_phrase_query\n\n if query[:must].nil? && query[:must_not].nil?\n query[:must] = query[:should]\n query[:should] = []\n end\n matches = no_searches?(query[:must_not], case_type: case_type)\n matches &&= all_searches?(query[:must], case_type: case_type)\n matches &&= any_searches?(query[:should], case_type: case_type)\n end\n # if search =~ /(?<=\\A| )[+-]\\S/\n # else\n # text = @title + @note.to_s\n # matches = text =~ search.to_rx(distance: distance, case_type: case_type)\n # end\n\n # if search.rx? || !fuzzy\n # matches = text =~ search.to_rx(distance: distance, case_type: case_type)\n # else\n # distance = 0.25 if distance > 1\n # score = if (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore\n # text.downcase.pair_distance_similar(search.downcase)\n # else\n # score = text.pair_distance_similar(search)\n # end\n\n # if score >= distance\n # matches = true\n # Doing.logger.debug('Fuzzy Match:', %(#{@title}, \"#{search}\" #{score}))\n # end\n # end\n\n negate ? !matches : matches\n end",
"title": ""
},
{
"docid": "633862ca1825a105d3fa07b258dcb3b9",
"score": "0.5387106",
"text": "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end",
"title": ""
},
{
"docid": "832fb1ad6e11fbd78b08922e2a2b9f08",
"score": "0.53694147",
"text": "def get_results search_term, max_recipes=25, desired_results=10\n ids = DBUtils.execute([\"\n SELECT recipe_id,\n MATCH (text) AGAINST (?) AS relevance \n FROM search_data \n WHERE MATCH(text) AGAINST (? IN BOOLEAN MODE) \n HAVING relevance > 0 \n ORDER by relevance desc\n LIMIT ?\n \", search_term, search_term, max_recipes]).to_a.map(&:first)\n\n results = []\n\n ids.each do |id|\n recipe = Recipe.includes([{:inclusions => :ingredient}, :source]).find id\n result = yield(recipe)\n\n unless result.nil?\n results.push result\n break if results.length >= desired_results\n end\n end\n\n return results.each_with_index.sort_by do |(result, score), idx| \n # add the index to the score to ensure a stable sort --\n # if the scores are tied, keep the relevancy ordering\n [score, idx]\n end.map do |(result, score), idx|\n # map it to just the result\n result\n end\n end",
"title": ""
},
{
"docid": "21286d18bc5bab868254589ea83b5960",
"score": "0.5344223",
"text": "def search_search_text\n query\n .where(localized_search_text_in(:title), text: \"%#{search_text}%\")\n .or(query.where(localized_search_text_in(:description), text: \"%#{search_text}%\"))\n end",
"title": ""
},
{
"docid": "f0bc3d92445a7d6e9ed5daaea5e6eb42",
"score": "0.53136617",
"text": "def sort array\n\tcount = -2\n\t\t# count number of words in first list\n\t\tarray.each do |word|\n\t\tcount = count + 1\n\tend\n\trecursive_sort(array, [ ], [ ], count)\nend",
"title": ""
},
{
"docid": "5c1f6629c409d67455429d68f629ebeb",
"score": "0.5307318",
"text": "def sort array\n\tcount = -2\n\t\t# count number of words in first list\n\t\tarray.each do |word|\n\t\tcount = count + 1\n\t\tend\n\trecursive_sort(array, [ ], [ ], count)\nend",
"title": ""
},
{
"docid": "024be7cabbfd7a85fc136b294f9f7c38",
"score": "0.52856404",
"text": "def full_text_search(options, ar_options ={})\n klass = use_invitation(options) ? Invitation : Meeting\n ar_options[:include] ||= DEFAULT_INCLUDES\n\t\t build_query_string(options)\n\n\t\t options[:sort] = @sort_options unless @sort_options.nil?\n\t\t options[:page] ||= 1\n logger.debug \"SEARCH STRING: #{@query_string} OPTIONS: #{options.to_yaml}\"\n\n\t\t begin\n\t\t results = klass.paginate_search(@query_string, options, ar_options) \n\t\t rescue\n\t\t logger.error(\"Error while searching with search string: #{@query_string}\")\n\t\t logger.error(\"Error was: #{$!}.\")\n\t\t logger.error($!.backtrace.join(\"\\n\"))\n\t\t return WillPaginate::Collection.new(0, 20, 0) # This is wrong actually. We need to return an empty paginator... Might be somethign like this WillPaginate::Collection.new(page, per_page, total_hits) ?? \n\t\t end\n results.each do |result|\n result.extend(TTB::CoerceInvitation)\n result.filtered_date = self.start_date\n end\n \n \n #~ real_results = results.sort_by{|inv| inv.start_time_local }\n #~ real_results.extend(TTB::CoerceResults)\n #~ real_results.real_results = results\n\t\t return results\n\t\tend",
"title": ""
},
{
"docid": "492a8b091c52fdfe16640e077b9dae6e",
"score": "0.52834445",
"text": "def my_search\n keywords = params[:search].downcase.split(',')\n\n tags = Article.tagged_with(keywords, any: true).uniq\n titles = Article.all.select { |a| keywords.include?(a.title.downcase) }.uniq\n begin\n summarys = Article.all.select { |a| keywords.include?(a.summary.downcase) }.uniq\n rescue NoMethodError\n summarys = []\n end\n sources = Article.all.select { |a| keywords.include?(a.source.name.downcase) }.uniq\n\n weight_dictionary = []\n\n tags.each do |article|\n if weight_dictionary.map { |row| row[0] }.include?(article)\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)] =\n [\n article,\n TAGS_WEIGHT,\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)][2] + 1\n ]\n else\n weight_dictionary << [article, TAGS_WEIGHT, 1]\n end\n end\n titles.each do |article|\n if weight_dictionary.map { |row| row[0] }.include?(article)\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)] =\n [\n article,\n TITLES_WEIGHT,\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)][2] + 1\n ]\n else\n weight_dictionary << [article, TITLES_WEIGHT, 1]\n end\n end\n summarys.each do |article|\n if weight_dictionary.map { |row| row[0] }.include?(article)\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)] =\n [\n article,\n SUMMARYS_WEIGHT,\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)][2] + 1\n ]\n else\n weight_dictionary << [article, SUMMARYS_WEIGHT, 1]\n end\n end\n sources.each do |article|\n if weight_dictionary.map { |row| row[0] }.include?(article)\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)] =\n [\n article,\n SOURCES_WEIGHT,\n weight_dictionary[weight_dictionary.map { |row| row[0] }.index(article)][2] + 1\n ]\n else\n weight_dictionary << [article, SOURCES_WEIGHT, 1]\n end\n end\n\n unless !weight_dictionary.nil? || !weight_dictionary.empty?\n @articles = [].paginate(page: params[:page], per_page: 10)\n @page_title = 'No results found for: \"' + params[:search] + '\"'\n render 'index'\n else\n weight_dictionary.each do |row|\n # Only keep searches where ALL keywords have been accounted for\n weight_dictionary.delete(row) if row[2] != keywords.length\n end\n @articles = weight_dictionary.sort_by { |article, _weight, _keyword| article.date_time }.sort_by { |_article, weight, _keyword| weight }.reverse.map { |row| row[0] }\n @articles = @articles.paginate(page: params[:page], per_page: 10)\n @page_title = 'Results for search: \"' + params[:search] + '\"'\n render 'index'\n end\n end",
"title": ""
},
{
"docid": "d66299706f60288df73d8a6f1b59c7b7",
"score": "0.5274295",
"text": "def get_keywords(input_text, relevance)\n\tkeywords = Keyword.extract(input_text)\n\trelevant_words = keywords.select {|w| w[\"text\"] if w[\"relevance\"].to_f > relevance }\n\treturn relevant_words.map{|w| w[\"text\"]}\nend",
"title": ""
},
{
"docid": "ba063f5fd8e3bd776e8c924d3af8d49c",
"score": "0.5251641",
"text": "def score(search_term:, item_name:)\n return 99 unless search_term.present? && item_name.present?\n\n Text::Levenshtein.distance(search_term.downcase, item_name.downcase)\n end",
"title": ""
},
{
"docid": "e43b1d5da7a5fcc67c59abb2bd4237dd",
"score": "0.52509016",
"text": "def or_similar(column, search, threshold = 0.3)\n similarity = Sequel.function(:similarity, column, search)\n self.or(similarity > threshold).order_append(similarity.desc)\n end",
"title": ""
},
{
"docid": "4177fc1638f56abaa036e040629a9cdb",
"score": "0.52499086",
"text": "def sort_by_title(solr_parameters)\n return if solr_parameters[:q]\n solr_parameters[:sort] ||= \"#{sort_field} asc\"\n end",
"title": ""
},
{
"docid": "4177fc1638f56abaa036e040629a9cdb",
"score": "0.52499086",
"text": "def sort_by_title(solr_parameters)\n return if solr_parameters[:q]\n solr_parameters[:sort] ||= \"#{sort_field} asc\"\n end",
"title": ""
},
{
"docid": "400c498de898b6231ddec9312399b802",
"score": "0.52473307",
"text": "def relevance_score(result)\n @term_keys.find_all { |key| result.title =~ /\\b#{Regexp.quote(key)}\\b/i }.size\n end",
"title": ""
},
{
"docid": "4777d4d111dde7b7c25cfbec0c09082c",
"score": "0.5245398",
"text": "def fulltextsearch(query, text, words=2)\n result = \"\"\n if text =~ /.*#{query}.*/i\n text_words = text.scan(/\\w*/)\n indexes = []\n text_words.each_with_index do |word,index|\n if word =~ /.*#{query}.*/i\n i = []\n i << index - words unless words == 0 || index - words < 0\n i << index\n i << index + words unless words == 0 || index + words > text_words.length\n indexes << i\n end\n end\n indexes.each do |i|\n result += \"... \" unless i.length == 1\n i.each {|j| result += \"#{text_words[j]} \"}\n result += \" ...\" unless i.length == 1\n end\n end\n result\n end",
"title": ""
},
{
"docid": "fbe2211b34dcf7027df590f6785400de",
"score": "0.5239543",
"text": "def index\n if params[:search]\n @tutorials = Tutorial.search(params[:search]).order(\"created_at DESC\")\n else\n @tutorials = Tutorial.all.order('created_at DESC')\n end\n=begin\n #for sunspot\n @search = Tutorial.search do\n fulltext params[:search]\n end\n @tutorials = @search.results\n=end\n end",
"title": ""
},
{
"docid": "29b4468d959d2846f524a2c051a71b39",
"score": "0.5238886",
"text": "def sort_results(results)\n case @metadata[:sort]\n when \"new\"\n results.sort_by do |c|\n [c.set.regular? ? 0 : 1, -c.release_date_i, c.default_sort_index]\n end\n when \"old\"\n results.sort_by do |c|\n [c.set.regular? ? 0 : 1, c.release_date_i, c.default_sort_index]\n end\n when \"newall\"\n results.sort_by do |c|\n [-c.release_date_i, c.default_sort_index]\n end\n when \"oldall\"\n results.sort_by do |c|\n [c.release_date_i, c.default_sort_index]\n end\n when \"cmc\"\n results.sort_by do |c|\n [c.cmc ? 0 : 1, -c.cmc.to_i, c.default_sort_index]\n end\n when \"pow\"\n results.sort_by do |c|\n [c.power ? 0 : 1, -c.power.to_i, c.default_sort_index]\n end\n when \"tou\"\n results.sort_by do |c|\n [c.toughness ? 0 : 1, -c.toughness.to_i, c.default_sort_index]\n end\n when \"rand\"\n results.sort_by do |c|\n [Digest::MD5.hexdigest(@query_string + c.name), c.default_sort_index]\n end\n when \"number\"\n results.sort_by do |c|\n [c.set.name, c.number.to_i, c.number, c.default_sort_index]\n end\n when \"color\"\n results.sort_by do |c|\n [COLOR_ORDER.fetch(c.colors), c.default_sort_index]\n end\n when \"ci\"\n results.sort_by do |c|\n [COLOR_ORDER.fetch(c.color_identity), c.default_sort_index]\n end\n when \"rarity\"\n results.sort_by do |c|\n [-c.rarity_code, c.default_sort_index]\n end\n else # \"name\" or unknown key\n results.sort_by(&:default_sort_index)\n end\n end",
"title": ""
},
{
"docid": "5e5bf32ad2530a7228c359371099c825",
"score": "0.5232988",
"text": "def heuristic( args={} )\n opts = {:threshold => 0.6, :authors => []}.merge(args)\n result = Result.new\n \n # use only authors surnames\n args_dup = opts.dup\n args_dup[:authors].map!{|a| a =~ /([^,]+)/; $1 ? $1 : a}\n args_dup[:authors].map!{|a| a =~ /([^ ]+) \\S+/; $1 ? $1 : a}\n args_dup[:nwords] = 2\n sites = article(args_dup)\n\n # query article has to contain full names\n query_article = Article.new( {:title => args[:title].to_s, :authors => args[:authors], :year => args[:year]} )\n sites.each do |site|\n site[:result].to_a.each do |article|\n next if article[:title].to_s.empty?\n article[:similarity] = query_article.similarity(article)\n end\n site[:result].to_a.delete_if{|a| a[:similarity].to_f < opts[:threshold].to_f}\n if site[:result].to_a.size > 0\n site[:result].sort!{|a,b| a[:similarity]<=>b[:similarity]}\n site[:result].reverse!\n site[:result] = [site[:result].to_a.first]\n end\n end\n\n sites\n end",
"title": ""
},
{
"docid": "280d6d268d26f7b8b64f9872beb34d11",
"score": "0.522811",
"text": "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end",
"title": ""
},
{
"docid": "280d6d268d26f7b8b64f9872beb34d11",
"score": "0.522811",
"text": "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end",
"title": ""
},
{
"docid": "d6afed5bca8e608f4c89e1b8e9e1813c",
"score": "0.52271795",
"text": "def weight_heading_relevance(data)\n # Get list of unique words in headings\n title_words = %i(title h1 h2 h3 h4 h5 h6)\n .select { |title| data.key?(title) }\n .map { |title| data[title].to_s.split(/\\W+/) }\n .flatten\n .compact\n .map(&:downcase)\n .uniq\n # Intersect words in headings with words in test\n text_words = data[:text].downcase.split(/\\W+/)\n (title_words & text_words).size\n end",
"title": ""
},
{
"docid": "21bef9e1cbdf16b2b1aacc1f0ba01afa",
"score": "0.5220174",
"text": "def wordsorting (sentence)\n\t# removing punctuation and splitting sentence\n\twordlist = sentence.gsub(/\\W/, ' ').split(\" \")\n\t#sorting alpahbetically + upcase\n\tputs wordlist.sort_by { |word| word.upcase }\nend",
"title": ""
},
{
"docid": "cacac3823bd28a44ddad0eb8c85ce177",
"score": "0.5204079",
"text": "def sorts_with_links\n [\n [search_merge(sort: 'best_match', order: 'desc', page: '1'), 'Relevancy'],\n\n [search_merge(sort: 'date', order: 'asc', page: '1'), 'Published Earliest'],\n [search_merge(sort: 'date', order: 'desc', page: '1'), 'Published Latest'],\n\n [search_merge(sort: 'title', order: 'asc', page: '1'), 'Title A-Z'],\n [search_merge(sort: 'title', order: 'desc', page: '1'), 'Title Z-A']\n ]\n end",
"title": ""
},
{
"docid": "5b47790c7600d0129a29e6ebae908b8c",
"score": "0.5184135",
"text": "def search_by_keyword(query, o={})\n #debugger\n #debug \"[search_by_keyword] query = #{query}\"\n result = Sunspot.search(Item) do\n keywords query\n if o[:doc_only]\n without :itype_str, Item::ITYPE_CONCEPT#['query','concept','tag']\n end\n #debugger\n o.find_all{|k,v|k.to_s =~ /^facet\\_/}.each do |e|\n #debugger\n with (e[0].to_s.split('_')[1..-1].join('_')).to_sym, e[1] if [e[1]].flatten.first != '-1'\n end\n #debugger\n order_by(:basetime, :desc) if o[:order] == \"recency\" || query == TEXT_DUMMY\n paginate(:page => o[:page], :per_page => o[:per_page]) if o[:page]\n facet(o[:facet]) if o[:facet]\n without :hidden_flag, '1'\n end\n #debugger\n if o[:facet]\n result.facet(o[:facet]).rows\n elsif o[:raw]\n result\n else\n result_items = result.hits.map_with_index{|e,i|{:id=>e.instance.id, :rank=>(i+1), :score=>e.score}}\n @cv.add(:type=>'kwd', :query=>query, :created_at=>(o[:created_at] || Time.now), :history_id=>o[:history_id], :result=>result_items) if o[:add_context]\n result_items\n end\n end",
"title": ""
},
{
"docid": "35f6435220b04f42ac06a3ad65974edd",
"score": "0.518271",
"text": "def do_search(params)\n\n # This first section sets up basic search parameters based on what was requested.\n\n format = params[:format].present? ? params[:format] : 'none'\n\n order = params[:order].present? ? {field: params[:order].split[0], direction: params[:order].split[1]} : {}\n limit = params[:limit].present? ? params[:limit].to_i : 50\n page = params[:limit] ? (params[:offset].to_i / params[:limit].to_i) + 1 : 1\n s_op = params[:op].present? ? params[:op] : 'AND'\n role = params[:role].present? ? params[:role] : 'guest'\n\n linking_tool = params[:linking_tool].present?\n\n options = options_for_search(params)\n\n reviewed = params[:reviewed] && params[:reviewed] == \"1\" ? false : nil\n\n # Each model has a custom version of these functions (and a list of valid fields) to permit only the\n # appropriate search fields for each model. \n\n # \"Params\" are any fulltext fields\n # \"Filters\" are all non-fulltext fields (numbers, booleans, exact string matches)\n # \"Dates\" are specifically for fields that need to allow date comparison\n\n filters = filters_for_search(params)\n dates = dates_for_search(params)\n params = params_for_search(params)\n \n s = self.search do\n \n # Fulltext search is defined as a lambda function, since it needs to be able to be combined with non-fulltext\n # search options as the user decides.\n\n fulltext_search = lambda { |p, o| \n if params.present?\n p.each do |field, value|\n\n # Since there are unlimited rows for the advanced search, the user can submit multiple values for the same field\n # i.e. \"Title\" for an Entry could be \"Bible\" and \"Book\" separately. So, they are iterated over:\n\n value = Array(value)\n if value.kind_of? Array\n value.each do |v|\n\n # Each search field can also be qualified in various ways\n\n op = Array(options[field + \"_option\"]).shift\n \n # If searching for this 'without' the term, right now just add a '-' to the beginning of query to negate it\n \n if op && op == 'does not contain'\n fulltext \"-\" + v.gsub(' ', '+'), :fields => [field]\n elsif op && op == 'blank'\n with field.gsub('_search', ''), nil\n elsif op && op == 'not blank'\n without field.gsub('_search', ''), nil\n elsif op && op == 'before'\n with(field).less_than v\n elsif op && op == 'after'\n with(field).greater_than v\n else\n fulltext v, :fields => [field]\n end\n end\n end\n end\n end\n }\n\n if not reviewed.nil?\n with :reviewed, false\n end\n\n # The same process for exact-match fields, but this time the search is being run and narrowed (i.e. it is not\n # using a lambda function)\n\n if filters.present?\n filters.each do |field, value|\n value = Array(value)\n value.each do |v|\n op = Array(options[field + \"_option\"]).shift\n if op && op == 'blank'\n with field, nil\n elsif op && op == 'not blank'\n without field, nil\n elsif v.blank? # ignore blank\n elsif op && op == 'less than'\n with(field).less_than v\n elsif op && op == 'greater than'\n with(field).greater_than v\n elsif op && op == 'without'\n without field, v\n elsif v.kind_of?(Array) && v.all? { |v2| v2.blank? } # make sure it's not an array of blanks \n else\n if ['true', 'false'].include? v\n v = (v == 'true')\n end\n with field, v\n end\n end\n end\n end\n\n # The same process for Dates, but with different interpretations of the search field options to correspond\n # with date-based searching\n\n if dates.present?\n dates.each do |field, value|\n value = Array(value)\n value.each do |v|\n v = v.split(/[-\\/]/).join(\"\").ljust(8, '01')\n op = Array(options[field + \"_option\"]).shift\n begin\n if op && op == 'before'\n with(field).between(Date.new(0,1,1)..Date.parse(v))\n elsif op && op == 'after'\n with(field).between(Date.parse(v)..Date.today)\n elsif op && op == 'near'\n d = Date.parse(v)\n with(field).between((d - 1.month)..(d + 1.month))\n elsif op && op == 'exact'\n with(field, v)\n end\n rescue ArgumentError\n @error = \"Error in Date Search - please use format YYYY/MM/DD or similar\"\n end\n end\n end\n end\n\n # In order to use SUNSPOT'S 'and'/'or' options together with non-fulltext fields,\n # we create a lambda function for fulltext searching (above)\n\n # ( This may be an idiosycracy of Sunspot only, but that is the reason for this roundabout approach ) \n\n if s_op == 'OR'\n any do\n fulltext_search.call(params, options)\n end\n else\n all do\n fulltext_search.call(params, options)\n end\n end\n\n # Unfortunately, sunspot does not natively support MIXING fulltext and exact searches using the \"OR\" operator \n # - so we do that manually\n # \n # params[:fq] refer to 'filter queries', or queries that refer to a fixed set of objects (exact strings, numbers, etc.)\n # params[:q] refers to fulltext queries\n\n # What this block of code does is check whether the 'OR' operator is used, and if it has been added by sunspot correctly\n # to the Solr query - if not, it is added in the proper place\n\n adjust_solr_params do |params|\n new_q = []\n p_fq = []\n params[:fq].each do |fq|\n if not fq.include? \"type\"\n new_q.push('_query_:\"{!edismax} ' + fq + '\"')\n else\n p_fq.push(fq)\n end\n end\n params[:fq] = p_fq\n if params[:q].blank?\n # nothing here...\n elsif not params[:q].include? s_op\n params[:q] = '(_query_:\"{!edismax qf=\\'' + params[:qf] + '\\'}' + params[:q].gsub('\"', '\\\"') + '\")'\n params.delete(:qf)\n end\n if params[:q].blank?\n if new_q.length > 0\n params[:q] = new_q.join(\" #{s_op} \")\n else\n params[:q] = \"*\"\n end\n else\n params[:q] = ([params[:q]] + new_q).join(\" #{s_op} \")\n end\n if linking_tool\n # NOTE: remove 'approved' thing here to make unapproved records show up in linking tool...\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'deprecated\\'}false\") AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n elsif role != \"admin\" && self.model_name.to_s == 'Entry'\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n end\n end\n\n # Finally, page number, count and order_by field are accounted for, and the search results are returned\n\n paginate :per_page => limit, :page => page\n\n order.present? ? order_by(order[:field], order[:direction]) : order_by(:score, :desc)\n\n end\n\n return s\n end",
"title": ""
},
{
"docid": "4a55aa84ed391e955ae114716c28c46d",
"score": "0.5181153",
"text": "def search_groups(search_text,options={})\r\n options = {:direct_query => false }.merge options\r\n search_text = prep_text_for_match_query(search_text,true,!options.delete(:direct_query))\r\n\r\n if (search_text.index('\"'))\r\n mysql_match_term = 'match (gti.name_text, gti.description_text, gti.tags_text) against (? IN BOOLEAN MODE)'\r\n else\r\n mysql_match_term = 'match (gti.name_text, gti.description_text, gti.tags_text) against (?)'\r\n end\r\n ModelUtil.add_joins!(options,'join group_text_indices gti on gti.group_id=groups.id')\r\n ModelUtil.add_conditions!(options,[\"#{mysql_match_term}\",search_text])\r\n \r\n # MM2: This allows the rank to come through with the results. The search should be sanitized and therefore ok to use like this\r\n options = options_with_rank(options, mysql_match_term, search_text, [\"groups.*\"])\r\n \r\n Group.find(:all, options)\r\n end",
"title": ""
},
{
"docid": "cb8d1abf6d77cbbee7765b3a774fc49f",
"score": "0.5176329",
"text": "def score_words\n @scores = @results.map do |word|\n { :word => word, :score => score_word(word) }\n end.sort { |a, b| a[:score] <=> b[:score] }.reverse\n end",
"title": ""
},
{
"docid": "56c809d29f8accc0e62228ae0485c9b9",
"score": "0.51742965",
"text": "def similar_related_to(main, opts={})\n opts.merge!(default_options)\n\n inverted_collection = @collection.invert\n suggestor = self.class.new(inverted_collection)\n \n suggestor.similar_to(main,opts)\n end",
"title": ""
},
{
"docid": "11ce13e20510d01629fc0044e9c0f5dc",
"score": "0.51715225",
"text": "def sortby_title_when_browsing solr_parameters, user_parameters\n # if no search term is submitted and user hasn't specified a sort\n # assume browsing and use the browsing sort field\n if user_parameters[:q].blank? and user_parameters[:sort].blank?\n browsing_sortby = blacklight_config.sort_fields.values.select { |field| field.browse_default == true }.first\n solr_parameters[:sort] = browsing_sortby.field\n end\n end",
"title": ""
},
{
"docid": "5a11b91822afa00d54fba5a010304153",
"score": "0.5167371",
"text": "def search( query, page=nil )\n \n # Reset all of our stored variables\n @ordered_results = []\n @current_results = {}\n @grouped_terms = {}\n @current_results_total = 0\n @current_page = 1\n \n # Calculate the start page\n start_doc = 0\n if page and ( Integer(page) > 1 )\n start_doc = ( Integer(page) - 1 ) * @docs_per_page\n end\n \n data = index_request(\n {\n \"q\" => query,\n \"sort\" => @sort_results_by,\n \"start\" => start_doc,\n \"rows\" => @docs_per_page,\n \"hl\" => true,\n \"hl.fl\" => '*',\n \"hl.usePhraseHighlighter\" => true\n }\n )\n \n if start_doc === 0\n @current_page = 1\n else\n @current_page = ( start_doc / @docs_per_page ) + 1\n end\n \n @current_results_total = data[\"response\"][\"numFound\"]\n \n data[\"response\"][\"docs\"].each do |doc|\n @current_results[ doc[ @primary_field ] ] = {\n \"index\" => doc,\n \"search_explaination\" => data[\"highlighting\"][ doc[ @primary_field ] ]\n }\n @ordered_results.push( doc[ @primary_field ] )\n end\n \n # Process and cache these results ready for searching the marts\n @grouped_terms = grouped_query_terms( @current_results )\n \n return @current_results\n end",
"title": ""
},
{
"docid": "bc1b243f7211f95566dc80aea7ea9ec7",
"score": "0.5165704",
"text": "def index name = nil, dictionary = 'english', &block\n search_name = ['search', name].compact.join('_')\n\n class_eval do\n named_scope search_name.to_sym, lambda { |term|\n # Let's extract the individual terms to allow for quoted terms.\n term = term.scan(/\"([^\"]+)\"|(\\S+)/).flatten.compact.map {|lex| \"'#{lex}'\"}.join(' & ')\n {\n :select => \"#{table_name}.*, ts_rank_cd((#{full_text_indexes.first.to_s}),\n to_tsquery(#{connection.quote(term)})) as rank\",\n :conditions =>\n [\"#{full_text_indexes.first.to_s} @@ to_tsquery(?)\", term],\n :order => 'rank DESC'\n }\n }\n end\n index_name = [table_name, name, 'fts_idx'].compact.join('_')\n (self.full_text_indexes ||= []) <<\n FullTextIndex.new(index_name, dictionary, self, &block)\n end",
"title": ""
},
{
"docid": "b964b70149d77ad655928d4c37a83fd5",
"score": "0.51633686",
"text": "def search query, sort_by=nil, relevance=nil, offset=nil, count=nil, language=nil\n function = 'search/'\n\n params = {}\n params[:q] = query\n params[:s] = sort_by if sort_by\n params[:relevance] = relevance if relevance\n params[:offset] = offset if offset\n params[:count] = count if count\n params[:language] = language if language\n\n request(@resource, function, params)\n end",
"title": ""
},
{
"docid": "1b3fac706fd779142c668bd25236d6b8",
"score": "0.5161917",
"text": "def fulltext(keywords, options = {}, &block)\n return if not keywords or keywords.to_s =~ /^\\s*$/\n\n field_names = Util.Array(options.delete(:fields)).compact\n\n add_fulltext(keywords, field_names) do |query, fields|\n query.minimum_match = options.delete(:minimum_match).to_i if options.key?(:minimum_match)\n query.tie = options.delete(:tie).to_f if options.key?(:tie)\n query.query_phrase_slop = options.delete(:query_phrase_slop).to_i if options.key?(:query_phrase_slop)\n\n if highlight_field_names = options.delete(:highlight)\n if highlight_field_names == true\n query.add_highlight\n else\n highlight_fields = []\n Util.Array(highlight_field_names).each do |field_name|\n highlight_fields.concat(@setup.text_fields(field_name))\n end\n query.add_highlight(highlight_fields)\n end\n end\n\n if block && query\n fulltext_dsl = Fulltext.new(query, @setup)\n Util.instance_eval_or_call(fulltext_dsl, &block)\n else\n fulltext_dsl = nil\n end\n\n if fields.empty? && (!fulltext_dsl || !fulltext_dsl.fields_added?)\n @setup.all_text_fields.each do |field|\n unless query.has_fulltext_field?(field)\n unless fulltext_dsl && fulltext_dsl.exclude_fields.include?(field.name)\n query.add_fulltext_field(field, field.default_boost)\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a819b929bf553fd264ad0d01bff1363e",
"score": "0.51598275",
"text": "def search_TF(query)\n terms = query.split(' ')\n puts terms\n articles_bool = search_bool(query) # first get a simple boolean search of articles\n\n\n # create the corpus of articles \n corpus = []\n articles_bool.each do |article|\n summary = article.summary\n split_summary = summary.split(' ')\n corpus << split_summary\n end\n\n analyzed = nil\n\n # make a hash of TF for each of the articles \n score_map = {}\n articles_bool.each do |article|\n summary = article.summary\n split_summary = summary.split(' ')\n article_tf = TfIdf.new([split_summary])\n score_map[article] = score(article_tf.tf[0],terms,analyzed)\n end\n\n # rank this hash by TF and return the articles\n\n @articles = articles_bool.sort_by { |article|\n -score_map[article]\n }\n\n return @articles\n \n end",
"title": ""
},
{
"docid": "1bd12761f5bd992ea3c1264c39f00fbe",
"score": "0.51553035",
"text": "def search\n @array = from_json\n @array = from_ga unless @array.any?\n sort_hits!\n end",
"title": ""
},
{
"docid": "f8a3c403fe05844f543139788dc315c7",
"score": "0.51521826",
"text": "def query(query, print=false)\n rows, word_ids = get_match_rows(query)\n scores = get_scored_list(rows, word_ids)\n scores.to_a.sort_by { |score| score[1] }.reverse\n end",
"title": ""
},
{
"docid": "b0911ec655f3052e6c00d71711b223c3",
"score": "0.5144908",
"text": "def perform_search\n terms = { vehicle_year: 2006,\n vehicle_brand: \"Yamaha\",\n vehicle_model: \"Yz250\",\n vehicle_submodel: \"-- Base\",\n category_name: \"Complete Wheel Assembly\" }\n perform_search(terms)\n end",
"title": ""
},
{
"docid": "36dc0cd46054381d1ea9098002ba89ae",
"score": "0.5141581",
"text": "def advancedSort\n @sortField = params[:sortField]#field to search on \n @searchField =params[:searchField]# value to search for\n @sortField2 = params[:sortField2]\n @searchField2 =params[:searchField2]\n @graphField = params[:graphField] #datapoint to build graph around\n \n if @sortField2 == \" \"#check if default second value was changed\n @records = Record.where(@sortField => @searchField) #if not only use the first search field\n else#otherwise use both seach fields\n @records = Record.where(@sortField => @searchField, @sortField2 => @searchField2 )\n end\n @sortedSet = @records.order(@graphField)\n end",
"title": ""
},
{
"docid": "cacb682164ea21618624164cbfbe5d5d",
"score": "0.5139109",
"text": "def calculate_keyword_score(terms = nil, **opt)\n search = opt.extract!(:q, *SCORE_TYPES)\n terms = search[:q] || search[:keyword] || terms\n count = 0\n types = { title: 100, creator: 0, publisher: 0 }\n scores =\n types.map { |type, weight|\n next if weight.zero?\n score = send(\"search_#{type}_score\").to_f\n score = send(\"calculate_#{type}_score\", terms, **opt) if score.zero?\n if score.nonzero?\n count += weight\n score *= weight\n end\n [type, score]\n }.compact.to_h\n Float(scores.values.sum) / Float(types.values.sum)\n end",
"title": ""
},
{
"docid": "ccbd01f93ad672487764dacd4a3aa49d",
"score": "0.5134024",
"text": "def search!(\n query, case_sensitive: false, whole_sentence: true,\n limit: 10, skip: 0, sentence_limit: 80\n )\n results = search(\n query,\n case_sensitive: case_sensitive,\n whole_sentence: whole_sentence,\n limit: limit,\n skip: skip\n )\n\n results.each do |doc|\n doc.search!(\n query,\n case_sensitive: case_sensitive,\n whole_sentence: whole_sentence,\n sentence_limit: sentence_limit\n )\n yield(doc) if block_given?\n end\n\n results\n end",
"title": ""
},
{
"docid": "ba422072b7a7c22d33885ac8a0e6974b",
"score": "0.513147",
"text": "def relevance_score\n to_nil _response_entity.fetch(\"relevanceScore\", nil)\n end",
"title": ""
},
{
"docid": "7fa953ffe7a2931fd31bf2bc62c2f9d7",
"score": "0.51300615",
"text": "def search_text(\n query, case_sensitive: false, whole_sentence: true,\n limit: 10, skip: 0, sentence_limit: 80, top_result_only: false\n )\n results = search(\n query,\n case_sensitive: case_sensitive,\n whole_sentence: whole_sentence,\n limit: limit,\n skip: skip\n )\n\n results\n .map do |doc|\n yield(doc) if block_given?\n\n results = doc.search(\n query,\n case_sensitive: case_sensitive,\n whole_sentence: whole_sentence,\n sentence_limit: sentence_limit\n )\n\n # Only return result if its text has a match - compact is called below.\n next nil if results.empty?\n\n [doc.url, (top_result_only ? results.first : results)]\n end\n .compact\n .to_h\n end",
"title": ""
},
{
"docid": "2d7a258ecc214625de290cf093835b15",
"score": "0.51152045",
"text": "def matching(*terms, sort: nil, **opt)\n # noinspection RubyMismatchedReturnType\n where(sql_match(*terms, **opt)).tap do |relation|\n relation.order!(sort) if sort\n end\n end",
"title": ""
},
{
"docid": "9a138a92e0c5a6df0c4dc9f940b88e31",
"score": "0.51141715",
"text": "def search(ref)\n upcase_ref = ref.upcase\n @index.select do |i|\n RelatonBib.array(i[:pubid]).detect { |r| r.include? upcase_ref }\n end.sort_by { |r| r[:pubid].is_a?(Array) ? r[:pubid].min : r[:pubid] }\n end",
"title": ""
},
{
"docid": "294cffca1264c266b9e8d0b361432d23",
"score": "0.5112849",
"text": "def index\n @search = Restaurant.search do\n fulltext params[:search]\n end\n \n # @restaurants = Restaurant.all\n @restaurants = @search.results\n #@restaurants = Restaurant.order('id desc').limit(5)\n end",
"title": ""
},
{
"docid": "226c1c1cff082c524399305d38063ee0",
"score": "0.5096049",
"text": "def sort_matched_arrays\n matched_arrays = [@matched_names, @matched_queries, @matched_tags,\n @matched_creator, @matched_modifier]\n matched_arrays.each do |array|\n array.joins(\"left join asq_statuses on asq_statuses.status_enum = \\\n asqs.status\")\n .order(\"disabled ASC, query_type ASC, \\\n asq_statuses.sort_priority ASC\")\n end\n end",
"title": ""
},
{
"docid": "63575f9206e6fd8844c6ee4770ed4e55",
"score": "0.5091847",
"text": "def apply_search(results:)\n return results unless search_params.present?\n\n terms = search_params[:search_words] || ''\n return results unless terms.present?\n\n results.search(term: terms)\n end",
"title": ""
},
{
"docid": "ee6d3a4d7f787560c35447c44850eb1e",
"score": "0.5091648",
"text": "def index\n @texts = Text.all.sort_by {|obj| (((obj.get_upvotes.size - obj.get_downvotes.size) * 10000000000000000000) / (Time.now.to_i - obj.created_at.to_i)) }.reverse\n end",
"title": ""
},
{
"docid": "303b5ea429df85d84f597161ee1a6523",
"score": "0.50885105",
"text": "def text_search(search_text, limit, offset)\n query_strategy.text_search(search_text, limit, offset)\n end",
"title": ""
},
{
"docid": "aaa81286f26dd546c2581164cd66a6fd",
"score": "0.5087113",
"text": "def sorted_word_count\n\n\t counts = text_nodes.inject(Hash.new(0)) do |word_counts, node|\n\t\tnode.text().scan(WORD_REGEX).each {|match| word_counts[match.first.upcase] += 1}\n\t\tword_counts\n\t end\n\t counts.sort{|a,b| b[1] <=> a[1]}\n\n end",
"title": ""
},
{
"docid": "9a3cab78182c16150871585ce7b2756a",
"score": "0.5069764",
"text": "def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "00457cd9ec7d5c6b5bcc11a8d2fb2857",
"score": "0.5069115",
"text": "def sort_with!(field, direction)\n return self if 'usefulness' == field && 'desc' == direction\n return self.reverse! if 'usefulness' == field && 'asc' == direction\n if 'asc' == direction\n self.sort! { |review1, review2| review1[field] <=> review2[field]}\n elsif 'desc' == direction\n self.sort! { |review1, review2| review2[field] <=> review1[field]}\n end\n end",
"title": ""
},
{
"docid": "f5238c9ea20989a0a17dec12e469693b",
"score": "0.5068656",
"text": "def search\n terms = params[:query].split\n query = terms.map { |term| \"title like '%#{term}%' OR body like '%#{term}%' OR tags like '%#{term}%'\" }.join(\" OR \")\n \n @posts = Post.where(query).order(\"created_at DESC\").first(10)\n end",
"title": ""
},
{
"docid": "d3baa2cd96c88261cbcbae020ee40645",
"score": "0.5056162",
"text": "def search_TFIDF_pagerank(query)\n terms = query.split(' ')\n puts terms\n articles_bool = search_bool(query) # get boolean articles first\n\n corpus = []\n\n # make the corpus \n\n articles_bool.each do |article|\n summary = article.summary\n split_summary = summary.split(' ')\n corpus << split_summary\n end\n\n # get TFIDF article hash\n\n analysis = TfIdf.new(corpus)\n analyzed = analysis.idf\n\n score_map = {}\n articles_bool.each do |article|\n summary = article.summary\n split_summary = summary.split(' ')\n article_tf = TfIdf.new([split_summary])\n score_map[article] = score(article_tf.tf[0],terms,analyzed)\n end\n\n # get pankrank values and sort on the sum of TfIdf and pagerank\n @articles = articles_bool.sort_by { |article|\n pagerank = article.pagerank\n puts pagerank\n -(score_map[article]+pagerank)\n }\n\n return @articles\n \n end",
"title": ""
},
{
"docid": "a33d734ca62dd3239e76b9c2596f2e4d",
"score": "0.50551635",
"text": "def optimize_search(relation, post_count, small_search_threshold)\n return relation unless small_search_threshold.present?\n\n order_values = relation.order_values.map { |order| order.try(:to_sql) || order.to_s }.map(&:downcase)\n return relation unless order_values.in?([[\"posts.id desc\"], [\"posts.id asc\"]])\n\n if post_count.nil?\n # If post_count is nil, then the search took too long to count and we don't\n # know whether it's large or small. First we try it normally assuming it's\n # large, then if that times out we try again assuming it's small.\n posts = Post.with_timeout(1000) { relation.load }\n posts = small_search(relation) if posts.nil?\n elsif post_count <= small_search_threshold\n # Otherwise if we know the search is small, then treat it as a small search.\n posts = small_search(relation)\n elsif post_query.tags.any?(&:is_deprecated?)\n # If the search contains a deprecated tag, then assume the tag is small, even if it's over the threshold. Most\n # deprecated tags are small enough that a bitmap scan is faster than a sequential scan.\n posts = small_search(relation)\n else\n # Otherwise if we know it's large, treat it normally\n posts = relation\n end\n\n posts\n end",
"title": ""
},
{
"docid": "377f82208c7c91abea9cac1db7ae5016",
"score": "0.5052678",
"text": "def git_grep\n # grep on the root object implies searching on HEAD\n grep = @repo.grep(query, nil, ignore_case: true)\n grep.map do |treeish, matches|\n _sha, filename = treeish.split(':', 2)\n SearchResult.new(filename, @score, *matches)\n end.sort\n end",
"title": ""
},
{
"docid": "414804b44a2bb5927053b24c821a74bd",
"score": "0.5051001",
"text": "def sort sentence\n sentence = sentence.gsub(/[^A-Za-z\\s]/, '').split(' ')\n left = sentence.select {|x| x[0] == x[0].downcase}\n right = sentence.select {|x| x[0] == x[0].upcase}\n sentence = (left.sort {|x, y| x <=> y} + right.sort {|x, y| y <=> x}).join(' ')\nend",
"title": ""
},
{
"docid": "6d76525eaaf0b0291b11eb1ae5eee3af",
"score": "0.50479794",
"text": "def sort_results(results, weights)\n results.sort_by {|item| weights[item.name] }.reverse\n end",
"title": ""
},
{
"docid": "ea30f51b6de06f20addb373c6040b4d1",
"score": "0.50458926",
"text": "def sort(*sorts)\n query('sort' => sorts)\n end",
"title": ""
},
{
"docid": "363d7ac7d08c0e80b3280cdbb4f4ebb6",
"score": "0.5044145",
"text": "def search\n @search ||= exhibit.searches.first\n # @searches ||= exhibit.searches.published.where(slug: item_ids).sort do |a, b|\n # order.index(a.slug) <=> order.index(b.slug)\n # end\n end",
"title": ""
},
{
"docid": "7c6c9d8f9152b07753c129ea7f84f447",
"score": "0.50393057",
"text": "def full_text_search(integer)\n select_size integer\n hit_enter\n end",
"title": ""
},
{
"docid": "7c6c9d8f9152b07753c129ea7f84f447",
"score": "0.50393057",
"text": "def full_text_search(integer)\n select_size integer\n hit_enter\n end",
"title": ""
},
{
"docid": "32696a9967a85477d93d4409e9a88c8c",
"score": "0.50376457",
"text": "def find_fulltext(query, options={}, with_mdate_desc_order=true)\n fulltext_option = {}\n fulltext_option[:order] = :updated_at if with_mdate_desc_order\n ids = matched_ids(query, fulltext_option)\n find_by_ids_scope(ids, options)\n end",
"title": ""
},
{
"docid": "aca139bde88f9b4dd2e3a8a8ebb1a702",
"score": "0.5033115",
"text": "def sorted_results\n results.sort\n end",
"title": ""
},
{
"docid": "82eeda2995d546349e3b9020c43655f5",
"score": "0.50329393",
"text": "def suggest_other_query(items, query)\n query = query.gsub(/_/,\" \").downcase\n\n distance_levenshtein = 100\n longest_subseq = 0\n word = \"\"\n\n matcher1 = Amatch::Levenshtein.new(query)\n matcher2 = Amatch::LongestSubsequence.new(query)\n\n items.each{ |item|\n name_array = item.name.downcase.split\n name_array.push(item.name.downcase)\n\n new_distance_array_levenshtein = matcher1.match(name_array).sort\n new_longest_subseq_array = matcher2.match(name_array).sort.reverse\n\n if new_distance_array_levenshtein[0] < distance_levenshtein and new_longest_subseq_array[0] >= longest_subseq\n word = item.name\n distance_levenshtein = new_distance_array_levenshtein[0]\n longest_subseq = new_longest_subseq_array[0]\n end\n\n }\n\n if distance_levenshtein <= 3 and longest_subseq >=2\n self.closest_string = word\n end\n\n end",
"title": ""
},
{
"docid": "17bf18296bcd4de3ad07c3a319a3bbee",
"score": "0.5030025",
"text": "def sort_sentence(sentence)\n words = break_words(sentence)\n sort_words(words) # took out 'return'\nend",
"title": ""
},
{
"docid": "742aac5338ba35746c469d92e930c5da",
"score": "0.501644",
"text": "def full_text_search(cols, terms, opts = OPTS)\n lang = Sequel.cast(opts[:language] || 'simple', :regconfig)\n\n unless opts[:tsvector]\n phrase_cols = full_text_string_join(cols)\n cols = Sequel.function(:to_tsvector, lang, phrase_cols)\n end\n\n unless opts[:tsquery]\n phrase_terms = terms.is_a?(Array) ? terms.join(' | ') : terms\n\n query_func = case to_tsquery = opts[:to_tsquery]\n when :phrase, :plain\n :\"#{to_tsquery}to_tsquery\"\n else\n (opts[:phrase] || opts[:plain]) ? :plainto_tsquery : :to_tsquery\n end\n\n terms = Sequel.function(query_func, lang, phrase_terms)\n end\n\n ds = where(Sequel.lit([\"\", \" @@ \", \"\"], cols, terms))\n\n if opts[:phrase]\n raise Error, \"can't use :phrase with either :tsvector or :tsquery arguments to full_text_search together\" if opts[:tsvector] || opts[:tsquery]\n ds = ds.grep(phrase_cols, \"%#{escape_like(phrase_terms)}%\", :case_insensitive=>true)\n end\n\n if opts[:rank]\n ds = ds.reverse{ts_rank_cd(cols, terms)}\n end\n\n if opts[:headline]\n ds = ds.select_append{ts_headline(lang, phrase_cols, terms).as(:headline)}\n end\n\n ds\n end",
"title": ""
},
{
"docid": "5f7daa04a0e6a6c76d726491b77d6ebb",
"score": "0.5016156",
"text": "def search_search_text\n query\n .where(\"decidim_opinions_opinions.title ILIKE ?\", \"%#{search_text}%\")\n .or(query.where(\"decidim_opinions_opinions.body ILIKE ?\", \"%#{search_text}%\"))\n end",
"title": ""
}
] |
dc736e9eddaa1048a86321078892f114
|
codecite index codecite create POST /posts//comments POST /posts//comments.xml
|
[
{
"docid": "3bb8bab5bf2f8e430eb7d8796bea7718",
"score": "0.6009759",
"text": "def create\n # codecite create\n\n # codecite two models\n @post = Post.find(params[:post_id])\n @comment = @post.comment(params[:comment][:body], current_user)\n # codecite two models\n\n respond_to do |format|\n # codecite valid\n if @comment.valid?\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to post_comments_url(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n format.js { render :nothing => true}\n else\n # codecite valid\n # codecite invalid\n @comments = @post.comments\n format.html { render :action => \"index\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n # codecite invalid\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "668554c50d0198da5b8f3204d1da9b3b",
"score": "0.6892517",
"text": "def create\n hash = params[:comment].dup\n hash.delete('parent_id') unless hash['parent_id'].presence\n response = RestClient.post(([Share.config.endpoint, 'sources', params[:post_id], 'comments.json'].join('/') + \"?api_key=\" + Share.config.api_key), {\n :comment => hash.merge(:source_id => params[:post_id]), \n :category_keys => params[:app_id],\n :user_key => current_user.id\n })\n #Rails.logger.debug(response.inspect)\n render :text => response.body\n \n end",
"title": ""
},
{
"docid": "9e9c41c6c59232060e00cdfeab37e939",
"score": "0.6768808",
"text": "def test_post_comment\n filename = 'test_multi_pages.docx'\n remote_name = 'TestPostComment.docx'\n comment_index = 0\n node_link = NodeLink.new({:NodeId => '0.0.3'})\n document_position = DocumentPosition.new({:Node => node_link, :Offset => 0})\n body = Comment.new({:RangeStart => document_position, :RangeEnd => document_position, :Initial => 'YE', :Author => 'Yaroslav Ekimov', :Text => 'A new comment'})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_common_folder + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = PostCommentRequest.new remote_name, comment_index, body, remote_test_folder + test_folder\n result = @words_api.post_comment request\n assert_equal 200, result.code\n end",
"title": ""
},
{
"docid": "f61343527a3ac5629bb712c871cd6d6c",
"score": "0.6728387",
"text": "def create_comments\n end",
"title": ""
},
{
"docid": "f61343527a3ac5629bb712c871cd6d6c",
"score": "0.6728387",
"text": "def create_comments\n end",
"title": ""
},
{
"docid": "f61343527a3ac5629bb712c871cd6d6c",
"score": "0.6728387",
"text": "def create_comments\n end",
"title": ""
},
{
"docid": "f61343527a3ac5629bb712c871cd6d6c",
"score": "0.6728387",
"text": "def create_comments\n end",
"title": ""
},
{
"docid": "f05ed1182ba31b8f9b8fde499589b235",
"score": "0.64675164",
"text": "def create\n if is_amf?\n @comment = @post.comments.push(params[:comment])\n else\n @comment = @post.comments.build(params[:comment])\n end\n\n respond_to do |format|\n if @post.save\n notice = \"Comment was successfully #{request.action}d.\"\n format.amf {render :amf => CallResult.new(@comment, notice) }\n format.html { redirect_to(@comment, :notice => notice) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.amf {render :amf => FaultObject.new( \"Comment was not #{request.action}d.\\n\" + @comments.full_messages.join(\".\\n\") ) }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "73bed4a1cd0a193412a50f17083c2594",
"score": "0.62183756",
"text": "def create\n @comment = @commentable.comments.build(params[:comment])\n @comment.env = request.env if SITE_SETTINGS[:use_defensio]\n respond_to do |format|\n if @comment.save\n cookies[:notice] = 'Your comment was successfully created.'\n format.html { redirect_to(\"#{url_for(@commentable)}#comments\") }\n format.xml { render :xml => @comment, :status => :created, :location => @commentable }\n else\n cookies[:error] = 'Your comment was unable to be created.'\n flash[:comment] = @comment\n format.html { redirect_to(@commentable) }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8dd4920f4880c5e42eb73f5106f0cb0c",
"score": "0.61872035",
"text": "def create\n post =Post.find(params[:post_id])\n comment = post.comments.create()\n if comment.save\n redirect_to root_path\n end \n end",
"title": ""
},
{
"docid": "6c51a97912f988810db293a177b7d3cd",
"score": "0.6179082",
"text": "def create\n \t@post = Post.where(id: params[:post_id]).first\n @comment = @post.comments.create(comment_params)\n end",
"title": ""
},
{
"docid": "05f879dbd1424e4ff129ecc2831a741d",
"score": "0.6174109",
"text": "def create\n unless params[:test] =~ /^no$/i\n #Merb.logger.error \"spam comment: #{params.inspect}\"\n raise NotHuman\n end\n\n @post= Post[params[:postid]]\n raise NotFound unless @post\n\n @comment = Comment.new(params[:comment])\n begin\n @post.add_comment(@comment)\n flush_cache\n redirect permalink(@post, {:fragment => 'comments'})\n rescue\n # #err= @comment.errors.full_messages\n redirect(permalink(@post), :message => {:error => \"Failed to post comment\"})\n end\n end",
"title": ""
},
{
"docid": "bc30ff9ababdb262c5f205364aae03c0",
"score": "0.61656535",
"text": "def create\n #@post = Post.where(:id => params[:post_id]).first\n @post = Post.find(params[:post_id])\n @comment = @post.comments.build(params[:comment])\n \n respond_to do |format|\n if @comment.save\n format.html { \n flash[:notice] = 'Thank you for your comment. All comments are checked for spam, once this check has been completed your comment will be published.' \n redirect_to post_path(params[:post_id])\n }\n # format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :controller => \"posts\", action => \"index\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6af2478fea0b297cdf5c6cdf8414ebc7",
"score": "0.61404294",
"text": "def create\n # require a referer and user\n return if head_if_true(:forbidden, post_params.blank?)\n return if head_if_true :unauthorized, !logged_in?, 'you must be logged in to comment'\n\n return request_aes_key if decrypt_sym!(:comment).nil?\n decrypt_sym! :post\n\n # Get the post from the params\n pp = post_params\n post = Post.cat_and_path_to_post pp[:category], pp[:file_path]\n return if head_if_true(:forbidden, post.nil?)\n\n # Set the additional comment fields\n cp = comment_params\n cp[:body].strip!\n cp[:post] = post\n cp[:user] = current_user\n parent_comment_id = cp.delete :parent_comment_id\n get_all_comments = cp.delete :all\n @parent_comment = nil\n unless parent_comment_id.nil?\n results = Comment.where id: parent_comment_id\n @parent_comment = results[0] if results.exists?\n end\n @comment = Comment.new(cp)\n\n respond_to do |format|\n if !current_user.email_confirmed\n format.html do\n flash[:notice] = \"you must confirm your email before you can comment\"\n redirect_to return_point_if_none root_path\n end\n format.json do\n msg = { error: \"you must confirm your email before you can comment\" }\n render json: msg, status: :unauthorized\n end\n elsif @comment.valid?\n @parent_comment.comments << @comment if @parent_comment\n @comment.save\n com = \"\"\n if !get_all_comments\n com = render_to_string layout: false\n else\n @comment_list = PostsHelper.tree_comments post\n @post = post\n com = render_to_string 'post_comments', layout: false\n end\n\n msg = { html: com, id: @comment.id.to_s }\n format.json { render json: msg, status: :ok }\n else\n format.html do\n flash[:notice] = \"Comment failed to save\"\n redirect_to return_point_if_none root_path\n end\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b0a68ee4df9cfc8f7cc619d01d2577d",
"score": "0.61349875",
"text": "def create\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end",
"title": ""
},
{
"docid": "ff3cf263f085f64ee5dc5597db7bc12c",
"score": "0.6134587",
"text": "def add_comment(xid, text,title=nil,url=nil,publish_to_stream=false)\n @session.post('facebook.comments.add',{:xid=>xid,:text=>text,:title=>title,:url=>url,:publish_to_stream=>publish_to_stream})\n end",
"title": ""
},
{
"docid": "171911dbed990647667ee7af9f7a2306",
"score": "0.6118221",
"text": "def create\n @ccomment = Ccomment.new(params[:ccomment])\n\n respond_to do |format|\n if @ccomment.save\n format.html { redirect_to(@ccomment, :notice => 'Ccomment was successfully created.') }\n format.xml { render :xml => @ccomment, :status => :created, :location => @ccomment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ccomment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1bb8d66479e70e010c5894996e81e91b",
"score": "0.6088348",
"text": "def create\n @user = current_user\n\n @post = Post.find_by_id(params[:comment][:post_id_value])\n\n @comment = @post.comments.build(:content => params[:comment][:content])\n @comment.user = current_user\n \n if @comment.save\n flash[:success] = \"Comment created!\"\n respond_with(@comment) \n else\n flash[:error] = \"Comment not created :(\"\n end\n end",
"title": ""
},
{
"docid": "0dc72690eb92f29ad3ec1a472e8f0402",
"score": "0.60793245",
"text": "def create\n @comment = @@record.comments.new(comment_params)\n @@record = 0\n path = path_name(@comment)\n respond_to do |format|\n if @comment.save\n format.html { redirect_to path, notice: \"Comment was successfully created.\" }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8dec869556d5106be04ce521149de0af",
"score": "0.6075837",
"text": "def create\n resource, id = request.path.sqlit('/')[1, 2]\n @commentable = resource.singularize.classify.constantize.find(id)\n @comment = @commentable.comments.new params.require(:comment).permit(:body).merge(user: current_user)\n if @comment.save\n Resque.enqueue(ConmmentNotificationJob, @comment.id)\n end\n end",
"title": ""
},
{
"docid": "25f03aa5c0152e55a31f09e0bf89b2ab",
"score": "0.60683304",
"text": "def post_comment tag, comment\n tag_params = (tag.is_a? String) ? { :the_tag => tag } : {:tag_id => (tag.is_a? Tag) ? tag.id : tag }\n tag_params.merge! :the_comment => comment\n path = \"/comment/create.xml\"\n doc = http_post path, tag_params\n Comment.new(:xml => doc)\n end",
"title": ""
},
{
"docid": "e8f2c584d4c4642b4b1435b81f64afda",
"score": "0.60512",
"text": "def create\n content = create_params[ :content ]\n comment = Comment.create( content: content, user_id: @current_user.id, collection_id: @collection.id )\n\n # save user activity\n save_activity :commented_on_collection, { comment_id: comment.id, collection_id: @collection.id }\n render json: comment\n end",
"title": ""
},
{
"docid": "c07ab2a9a1a4a4e14dc7d2d31f0ca0bf",
"score": "0.604634",
"text": "def test_put_comment\n filename = 'test_multi_pages.docx'\n remote_name = 'TestPutComment.docx'\n node_link = NodeLink.new({:NodeId => '0.0.3'})\n document_position = DocumentPosition.new({:Node => node_link, :Offset => 0})\n body = Comment.new({:RangeStart => document_position, :RangeEnd => document_position, :Initial => 'YE', :Author => 'Yaroslav Ekimov', :Text => 'A new comment'})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_common_folder + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = PutCommentRequest.new remote_name, body, remote_test_folder + test_folder\n result = @words_api.put_comment request\n assert_equal 200, result.code\n end",
"title": ""
},
{
"docid": "b1476a4f9e3c6618e9fd52a789ae2635",
"score": "0.60426897",
"text": "def new_comment(commenter, post, content)\n db = SQLite3::Database.new(DB_PATH)\n db.execute(\"INSERT INTO comments (owner, post, content) VALUES (?, ?, ?)\", commenter, post, content)\n end",
"title": ""
},
{
"docid": "15ac461f19f9b511adf53a8a30bd360e",
"score": "0.60358393",
"text": "def create\n @post = Post.find(params[:comment][:post])\n @comment = Comment.create(:text => params[:comment][:text], :post => @post)\n \n respond_to do |format|\n if @comment.save\n #format.html { redirect_to @comment, :notice => 'Comment was successfully created.' }\n format.json { render :json => { :comment => @comment.as_json }, :status => :created, :location => @comment }\n else\n #format.html { render :action => \"new\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8cfca40fa8d0a629064e6f16630d049",
"score": "0.6034676",
"text": "def create\n @post = Post.find(params[:post_id])\n @comments = @post.comments.create(comment_params)\n redirect_to post_path(@post)\n end",
"title": ""
},
{
"docid": "c5aa51923714afd6e054a56d2c22f797",
"score": "0.6000825",
"text": "def create_comment(contents)\n Resource.client.create_comment(self, contents)\n end",
"title": ""
},
{
"docid": "28b09e7e96064ac43128281758238613",
"score": "0.5999752",
"text": "def create_comment(contents)\n Dropio::Client.instance.create_comment(self, contents)\n end",
"title": ""
},
{
"docid": "a8f6674924d928ae430def76244f21d4",
"score": "0.59819996",
"text": "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to invoice_items_url }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a4298febc12eb1c92f709d3d0ad62f05",
"score": "0.5968037",
"text": "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(params[:comment].permit(:name, :body))\n\n redirect_to post_path(@post)\n end",
"title": ""
},
{
"docid": "91324e3eda56515c5980a60991200a28",
"score": "0.5960676",
"text": "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to(@comment, :notice => 'Comment was successfully created.') }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d665367f3f8db54d4d78714500556194",
"score": "0.5950651",
"text": "def create\n @comment = @post.comments.new(params[:comment])\n @comment.user = current_user\n @comment.ip_address = request.remote_ip\n @comment.user_agent = request.user_agent\n @comment.referrer = request.referrer\n @comment.akismet_api_key = @preferences[:akismet_api_key] unless @preferences[:akismet_api_key].blank?\n respond_to do |format|\n if @comment.save\n if @preferences[:akismet_api_key].blank? || @comment.approved?\n flash[:notice] = \"Thanks for the comment.\"\n else\n flash[:error] = \"This comment appears to be spam. It will show up once it has been reviewed.\"\n end\n format.html { redirect_to(@post) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n flash[:error] = 'There was an error creating your comment.'\n format.html { redirect_to(@post ) }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ccba5bb62c5436a15e0c772d8af87dd9",
"score": "0.5938736",
"text": "def create\n @comment = Comment.new(comment_params)\n @comment.save\n redirect_to action: 'index'\n end",
"title": ""
},
{
"docid": "f1767ca86f744402effb378002fb1d11",
"score": "0.5932037",
"text": "def create_comment(attributes={})\n c = build_comment(attributes)\n c.save\n end",
"title": ""
},
{
"docid": "0fae27997a3002b7ee3a078a5bc65dbc",
"score": "0.5924656",
"text": "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create!(params[:comment])\n redirect_to @post\n end",
"title": ""
},
{
"docid": "c05215e92a9ef45ea2c0ea7a4d53c330",
"score": "0.59224373",
"text": "def add_comment(params = {})\n if self.comments.length > 0\n thread = self.comments.last.next_thread\n else\n thread = \"01/\"\n end\n c = DrupalComment.new({\n :pid => 0,\n :nid => self.nid,\n :uid => params[:uid],\n :subject => \"\",\n :hostname => \"\",\n :comment => params[:body],\n :status => 0,\n :format => 1,\n :thread => thread,\n :timestamp => DateTime.now.to_i\n })\n c.save\n c\n end",
"title": ""
},
{
"docid": "7da3dc4a0cc5ed80039d439d72153e25",
"score": "0.5914076",
"text": "def create\n comment = Comment.new(:content => params[:content], :post_id => params[:post_id], :user_id => current_user.id)\n if comment.save\n render :json => comment, :status => :created\n else\n render :json => {:ok => false, :message => comment.errors}, :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "16bd1d480fd97b658c69cc68c8d69129",
"score": "0.59050757",
"text": "def create\n # comment = @post.comments.new(user_id: current_user.id, body: params[:body])\n # comment.save\n # redirect_to post_path(@post)\n @comment = @post.comments.create(user_id: current_user.id, body: params[:body])\n redirect_to post_path(@post)\n end",
"title": ""
},
{
"docid": "ac278584bc61a9e0096038862b4cbec5",
"score": "0.58956087",
"text": "def create\n\n unless params[:comment][:url].blank?\n # this is spam if it is filled out\n add_to_blacklist(request)\n redirect_to root_path\n return \n end\n\n if params[:no] != '1' || params[:yes]\n #logger.error \"spam comment: #{params.inspect}\"\n #redirect_to root_path\n render :text => \"SpamBots are not welcome\", :status => 401\n return\n end\n\n \n @post= Post[params[:postid]]\n if @post.nil?\n logger.error \"post #{params[:postid]} not found for comment\"\n redirect_to root_path\n return\n end\n\n @comment = Comment.new\n begin\n @comment.set_only(params[:comment], :body, :name, :email, :url)\n @post.add_comment(@comment)\n flush_cache\n rescue\n logger.error \"failed to add comment reason: #{@comment.errors.full_messages} - #{@post.errors.full_messages}, error: #{$!}\"\n end\n redirect_to postbyid_path(@post, :anchor => 'comments')\n end",
"title": ""
},
{
"docid": "16134177f4cef3794f38280ba8cbe526",
"score": "0.5894236",
"text": "def create\n @blog = Blog.find(params[:blog_id])\n @blog.comments.create(comment_params)\n @blog.save\n redirect_to blog_path(@blog.id)\n end",
"title": ""
},
{
"docid": "f6254c8985776495c13f581b236af279",
"score": "0.5869067",
"text": "def create\n\t\t@comment = @parent.comments.build(comment_params)\n\t\tunless @parent.save\n\t\t\trender json: @parent.errors, status: :unprocessable_entity\n\t\t\treturn\n\t\tend\n\n\t\tif @comment.save\n\t\t\trender json: @comment, status: :created\n\t\telse\n\t\t\trender json: @comment.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"title": ""
},
{
"docid": "82e4ead8f1e5583eb10c8154f371d195",
"score": "0.5864573",
"text": "def create\n @post = Post.friendly.find(params[:post_id])\n @comment = @post.comments.create(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to post_comment_path(@post, @comment), notice: 'Question Asked' }\n format.json { render action: 'show', status: :created, location: @comment }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "822daa1da3a93c8a8e2308f5cf8908c0",
"score": "0.5864508",
"text": "def create\n\n @user=User.find(params[:user_id])\n @post = @user.posts.find(params[:post_id])\n @comment = @post.comments.create(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "156b689110e2aabc522359cebca277a9",
"score": "0.58593345",
"text": "def create!(content, comments)\n # Set up a backend object to fill in.\n dir = Giraffe.wiki.object_for @dir.join(\"/\")\n name = Giraffe.to_filename.call @name\n\n path = if dir.path.empty? then name else File.join(dir.path, name) end\n\n @object = Git::Blob.new dir.repo, name,\n path, dir, \"no sha1\", 0\n\n # Then normal commit.\n message = \"Giraffe created #{@object.path}.\"\n\n if comments and not comments.empty?\n message = comments + \"\\n\\n\" + message\n end\n\n content.gsub! /\\r\\n/, \"\\n\"\n\n @object.data = content + \"\\n\"\n @object.add!\n @object.commit! message\n end",
"title": ""
},
{
"docid": "628fbccdfb3bd2b6dd171f9a93f3cfc3",
"score": "0.5859279",
"text": "def comment_create\n\t\tcomment = Comment.find(params[:id])\n\t\tnew_comment = comment.comments.create(params[:comment].permit(:body))\n\t\tcurrent_user.comments << new_comment\n\n\t\tredirect_to \"/posts/#{params[:post_id]}/comments/#{comment.id}\"\n\tend",
"title": ""
},
{
"docid": "bc22e95d171f7ccff1d4de52c2abb419",
"score": "0.5858664",
"text": "def create\n # get the post\n @post = Post.find_by_id(params[:post_id])\n # create post to comment\n @post_comment = @post.comments.create(comment_params[:attributes])\n # associate comment before save(comment cannot be saved without user_id)\n @post_comment.user_id = @current_user.id\n # save comment\n @post_comment.save\n render json: response_params(@post.comments.last), status: 201\n end",
"title": ""
},
{
"docid": "560dc4edabc30c58a20c90aae62785fb",
"score": "0.58469486",
"text": "def create\n json_create(innerComment_params, InnerComment)\n end",
"title": ""
},
{
"docid": "102c1d4814f3a7aa9e00a8a3b6532094",
"score": "0.58446115",
"text": "def create\n\t\t@comment = @post.comments.create(params[:comment].permit(:body))\n\t\t@comment.save\n\n\t\tif @comment.save\n\t\t\tredirect_to post_path(@post)\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9e32fa422a697131833e3bcb2017907e",
"score": "0.584248",
"text": "def create_comments(project_id, key_id, req_params)\n name = 'KeyComments'\n params = { query: [project_id, key_id], req: req_params.to_array_obj(:comments) }\n\n data = endpoint(name: name, params: params).do_post\n\n collection name, data\n end",
"title": ""
},
{
"docid": "f5804f0934d006abd1eb6c349b4aa485",
"score": "0.58417493",
"text": "def create\n respond_to do |format|\n @comment.author = current_user\n @comment.post = @post\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5cfaba16f4c8bb1b4709d4a783cc01e4",
"score": "0.5837902",
"text": "def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to admins_comment_path(@comment, :notice => 'Comment was successfully created.') }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7d51158eb9b04b448b9e08ff4d348064",
"score": "0.58355707",
"text": "def create\n @comment = @post.comments.new(comment_params)\n @comment.user = current_user\n\n if @comment.save\n render json: @comment, status: :created, location: api_v1_post_comments_path(@post, @comment), serializer: Api::V1::CommentSerializer\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "04bcc521d250e682c4309968681fc507",
"score": "0.5835445",
"text": "def create\n create! do |success, failure|\n success.html do\n redirect_back fallback_location: active_admin_root\n end\n failure.html do\n flash[:error] = I18n.t \"active_admin.comments.errors.empty_text\"\n redirect_back fallback_location: active_admin_root\n end\n end\n end",
"title": ""
},
{
"docid": "c066e4da32460d46125ecd56df92abe7",
"score": "0.5833972",
"text": "def create\n\t \t@current_user.comments.create(body: params[:body], post_id: params[:post_id])\n\tend",
"title": ""
},
{
"docid": "9cc0dab1a09cc389fcac090719f47795",
"score": "0.5831669",
"text": "def create_comment(thread_id, author_name, author_email, author_url, message, ip_address, created_at, parent_post = nil)\n self.class.post('/create_post/', :body => { :thread_id => thread_id,\n :author_name => author_name,\n :author_email => author_email,\n :author_url => author_url,\n :message => message,\n :forum_api_key => @forum_api_key,\n :state => 'approved',\n :ip_address => ip_address,\n :created_at => created_at }).parsed_response\n end",
"title": ""
},
{
"docid": "17d1533b123c37a32faea9f0163f8ca7",
"score": "0.5819173",
"text": "def create\n @newcomment = Newcomment.new(params[:newcomment])\n\n respond_to do |format|\n if @newcomment.save\n format.html { redirect_to(@newcomment, :notice => 'Newcomment was successfully created.') }\n format.xml { render :xml => @newcomment, :status => :created, :location => @newcomment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @newcomment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20d2a99c248be007e55227de25bcb5e0",
"score": "0.5814803",
"text": "def post\n unless request.post?\n flash[:error] = \"No comment to post!\"\n redirect_to MainController.r\n end\n \n # Check for robots\n unless request[:captcha].blank? and\n request[:comment].blank?\n # Robot!?\n flash[:error] = \"Cortex Reaver is immune to your drivel, spambot.\"\n redirect MainController.r\n end \n\n begin\n # Create comment\n CortexReaver.db.transaction do\n @comment = Comment.new\n\n @comment.body = request[:body]\n @comment.comment_id = request[:comment_id]\n @comment.journal_id = request[:journal_id]\n @comment.photograph_id = request[:photograph_id]\n @comment.page_id = request[:page_id]\n\n if session[:user]\n # A user is logged in. Use their account.\n @comment.creator = session[:user]\n else\n # Use anonymous info, if it won't conflict.\n if User.filter(:email => request[:email]).count > 0\n # Conflicts!\n flash[:error] = \"Sorry, that email address belongs to a registered user. Would you like to <a href=\\\"/user/login\\\">log in</a>? Your comment will still be here when you get back.\"\n \n # Save comment and go back to the parent.\n session[:pending_comment] = @comment\n redirect @comment.parent.url\n else\n # Okay, set anonymous info\n @comment.name = request[:name] unless request[:name].blank?\n @comment.email = request[:email] unless request[:email].blank?\n @comment.http = request[:http] unless request[:http].blank?\n end\n end\n\n # Save\n raise unless @comment.save\n\n # Clear action cache\n Ramaze::Cache.action.clear\n\n flash[:notice] = \"<a href=\\\"##{@comment.url.gsub(/.*#/, '')}\\\">Your comment</a> has been posted.\"\n redirect @comment.parent.url\n end\n rescue => e\n # An error occurred\n Ramaze::Log.error e.inspect + e.backtrace.join(\"\\n\")\n flash[:error] = \"We couldn't post your comment.\"\n\n if @comment.parent\n session[:pending_comment] = @comment\n redirect @comment.parent.url + '#post-comment'\n else\n redirect MainController.r\n end\n end\n end",
"title": ""
},
{
"docid": "32255f246e3edaa995fca5198df0cf86",
"score": "0.5813753",
"text": "def comments\n @comment = Comment.new(comment: params[:comments][:comment], commentable: @article)\n if @comment.save\n else\n end\n end",
"title": ""
},
{
"docid": "72a98e103205acb03ba100b118a8ea99",
"score": "0.5810467",
"text": "def create\n @commentable = find_commentable\n @commentable.comments.create(comment_params)\n @comments = @commentable.comments.order('created_at ASC')\n end",
"title": ""
},
{
"docid": "4df17896f3967f8fe8739e7658ff2f17",
"score": "0.58095753",
"text": "def create\n @comment\n if params[:comment][:reply] == \"true\"\n parent = Comment.find(params[:comment][:parent_id])\n @comment = parent.children.build(comment_params)\n @comment.user_id = current_user.id\n else\n @comment = current_user.comments.build(comment_params)\n end\n\n byebug\n if @comment.save\n render json: @comment\n else\n render json: {error: t('Unabel to save comment')}, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0e7c9cca9ac9732976cf2f8e951f0bb8",
"score": "0.5809567",
"text": "def create\n @comment = Comment.new(comment_params)\n @comment.user_id = @user.id\n respond_to do |format|\n if @comment.save\n format.json { render json: @comment }\n format.xml { render xml: @comment }\n else\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n format.xml { render xml: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "25a63d5ce3c1fee1d90771aed6ebdfcc",
"score": "0.5805646",
"text": "def create\n post = Post.find(params[:post_id])\n @comment = post.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n render_create_success(format)\n else\n render_create_fail(format)\n end\n end\n end",
"title": ""
},
{
"docid": "6b2a489ba9e3f9a1beddd3343628a57b",
"score": "0.5804053",
"text": "def comment\n if request.post?\n begin\n @node = Node.find(params[:id])\n @comment = Comment.new(params[:comment])\n @comment.user_id = session[:user]\n \n @node.comments<< @comment\n @comment.save!\n\n redirect_to :action => 'read', :id => @node\n rescue ActiveRecord::RecordInvalid\n STDERR.puts @comment.errors.inspect\n render_error(@comment)\n end\n end\n end",
"title": ""
},
{
"docid": "58cf5fd158876624bcdbf81268fbcc58",
"score": "0.5799203",
"text": "def create\n #1st you retrieve the post thanks to params[:post_id]\n @post = Post.find(params[:post_id])\n #2nd you create the comment with arguments in params[:comment]\n @comment = @post.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.'}\n format.json { render :show, status: :created, location: [@comment.post,@comment]}\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "924285ed85d41b008a43c483afdba361",
"score": "0.5798469",
"text": "def create_comment_for u\n Comment.new(:post=> Post.all[0], :user=>u,:body=>\"something\").save!\n end",
"title": ""
},
{
"docid": "74b6c82559a44646cb60c96c8929ac4b",
"score": "0.5797921",
"text": "def create\n @comment = Xmt::Press::Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html {redirect_to xmt_press_comments_url, notice: '评论添加成功.'}\n format.json {render :show, status: :created, location: @comment}\n else\n format.html {render :new}\n format.json {render json: @comment.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "582ece585cb32cbc0fba94ec10fa0234",
"score": "0.5794017",
"text": "def index\n @create_comments = CreateComment.all\n end",
"title": ""
},
{
"docid": "a880ed7daa92c311cb104e1f46a33bd4",
"score": "0.5788721",
"text": "def create\n @comment = @blogger.comments.build(comment_params)\n\n if @comment.save\n redirect_to([@comment.blogger, @comment], notice: 'Comment was successfully created.')\n else\n render action: 'new'\n end\n end",
"title": ""
},
{
"docid": "00e4e557e6056e853b7e5f85607178a6",
"score": "0.5784473",
"text": "def create\n @note = Note.new(params[:note])\n\n=begin\n $ curl -H 'Content-Type: application/xml' -X POST -d '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <content>note from api 2</content>\n <course_id>2</course_id>\n <tag>api</tag>\n</note> http://notility.herokuapp.com/notes\n=end\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n format.xml { render :xml => @note }\n else\n format.html { render action: \"new\" }\n format.xml { render :xml => \"Failed\"}\n flash[:notice] = \"Failed to save.\"\n end\n end\n end",
"title": ""
},
{
"docid": "b3a97ae2dc3ed5ef7a0dcf71a1a46fbf",
"score": "0.5778487",
"text": "def create\n post = Post.find(params[:post_id])\n @post = Post.find(params[:post_id])\n @comment = post.comments.create(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to post_comments_path }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26ec6dbf58e7d6e9e6639a235b35efb5",
"score": "0.5777333",
"text": "def create\n @api_v1_comment = @post.comments.new(params[:comment])\n if @api_v1_comment.save\n render :json => @api_v1_comment.to_json(:methods => [:votes_count, :user_vote, :user_flag, :flags_count])\n else\n render :json => @api_v1_comment.errors.to_json, :status => 400\n end\n end",
"title": ""
},
{
"docid": "b90e1ecd589eabbf53d2300d6e026c49",
"score": "0.57722765",
"text": "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to admin_post_path(@comment.post), notice: t('comments.create.success') }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "61ba81eedeb3b868bfbddf3c7cbbc898",
"score": "0.57693136",
"text": "def add(comment, key)\n issueKey_test(key)\n fetch({:method => :post, :body => comment, :parent => parent_name, :parent_key => key})\n end",
"title": ""
},
{
"docid": "fe8bd9a30e3f2b76095f7012690508e0",
"score": "0.57667416",
"text": "def index\n prepare_index\n @comment = Comment.new\n end",
"title": ""
},
{
"docid": "0e041466ebfae20b7403b3e17934a453",
"score": "0.576376",
"text": "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.build(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to([@comment.post, @comment], :notice => 'Comment was successfully created.') }\n format.json { render :json => @comment, :status => :created, :location => [@comment.post, @comment] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4ad3aed525e3631731ff42665808d9e8",
"score": "0.57621616",
"text": "def create\n @comment = @post.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4ad3aed525e3631731ff42665808d9e8",
"score": "0.57621616",
"text": "def create\n @comment = @post.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @post, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f611cd010d534028860dfd5c1db7d238",
"score": "0.5761637",
"text": "def create\n\t\t@comment = Comment.new()\n\t\t@comment.comment = params[:message] \n\t\t@comment.user = current_user\n\t\t#@comment.save\n\t\t\n\t\t@repository = Repository.find(params[:repo_id])\n\t\t@repository.comments << @comment\n\t\t@repository.save\n\t\t\n\t\trespond_with(@comment)\n end",
"title": ""
},
{
"docid": "db954f81674a3e425b764acbe8689de6",
"score": "0.57611793",
"text": "def comment_create\n @comment = Comment.new(content: params[:content], user_id: current_user.id, post_id: @post.id)\n if @comment.save\n render json: @comment, status: 201\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end",
"title": ""
},
{
"docid": "3b534441a5f98448a3e8a3727823deef",
"score": "0.57472485",
"text": "def create\n # Validar, enviar mensaje!!\n #@post = Post.find_by_id(params[:post_id])\n @post.comments.create(params[:comment])\n redirect_to @post, :notice => \"Comment was perfectly done\"\n end",
"title": ""
},
{
"docid": "0ecefb04e5e203e12c9cfaa559470bba",
"score": "0.5746939",
"text": "def create\n\t\tpost = Post.find(params[:post_id])\n\t\tcomment = post.comments.create(params[:comment].permit(:body))\n\t\tcurrent_user.comments << comment\n\t\tredirect_to post_path(post)\n\tend",
"title": ""
},
{
"docid": "f67b240bb74977877d3bc36310ace082",
"score": "0.574525",
"text": "def post_comment text, options={}\n request_str = \"/gallery/appliances/#{id.to_i}/comments\"\n request_str = Util.add_options request_str, options\n response = GenericRequest.new(self.class.studio_connection).post request_str, :__raw => text\n tree = XmlSimple.xml_in response, \"ForceArray\" => [\"comment\"]\n tree[\"appliance\"][\"comments\"][\"comment\"].collect do |c|\n Comment.parse(self,c)\n end\n end",
"title": ""
},
{
"docid": "0b029b14e0061f9e09313719b1bdc2fd",
"score": "0.5735213",
"text": "def create_comment(attrs)\n attrs.merge! :project_id => id\n COMMENT_API.new attrs\n end",
"title": ""
},
{
"docid": "69ea2390d7088b0ee5a3057006ca5911",
"score": "0.57334584",
"text": "def create\n begin\n topic = find_or_create_topic\n if topic\n if params[:id].to_i > 0\n p = topic.comments.find(params[:id])\n @comment = topic.comments.build(:created_by => params[:n], \n :email => params[:e], :website => params[:w], \n :content => params[:c], :ip => request.remote_ip,\n :user_id => self.current_user ? self.current_user.id : nil\n )\n Lun::Comment.transaction do\n topic.increment(:comment_count)\n topic.save \n @comment.save_as_reply!(p)\n end\n else\n @comment = topic.comments.build(:created_by => params[:n], \n :email => params[:e], :website => params[:w], \n :content => params[:c], :ip => request.remote_ip,\n :user_id => self.current_user ? self.current_user.id : nil\n )\n Lun::Comment.transaction do\n topic.site.save if topic.new_site? || topic.site.changed?\n topic.increment(:comment_count)\n topic.save \n @comment.save!\n end\n flash[:notice] = 'comment posted'\n end\n end\n rescue Exception => ex\n flash[:error] = ex.message\n end\n\n @errors = @comment.errors\n\n respond_to do |format|\n format.html {render :action => 'new'}\n format.js { \n render_json({\n :flash => flash,\n :errors => @errors, \n :created => @comment\n }, :except => Lun::Comment.json_except) \n }\n end\n end",
"title": ""
},
{
"docid": "2baf40e204656cc2de6894544a0f3602",
"score": "0.57263476",
"text": "def create\n @article_comments = Admin::ArticleComments.new(params[:article_comments])\n\n respond_to do |format|\n if @article_comments.save\n flash[:notice] = 'Admin::ArticleComments was successfully created.'\n format.html { redirect_to(@article_comments) }\n format.xml { render :xml => @article_comments, :status => :created, :location => @article_comments }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article_comments.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f7327649882a23cd58a059591234783e",
"score": "0.5723162",
"text": "def post_comment\n summary = parse_string(:summary, 100)\n content = parse_string(:content)\n\n target = nil\n target ||= parse_object(:location, Location)\n target ||= parse_object(:name, Name)\n target ||= parse_object(:observation, Observation)\n\n summary ||= '.'\n content ||= ''\n\n raise error(102, 'missing content') if !content\n raise error(102, 'missing object') if !target\n\n comment = Comment.new(\n :created => time,\n :modified => time,\n :user => user,\n :summary => summary,\n :comment => content,\n :target => target\n )\n save_new_object(comment)\n\n if result.respond_to?(:log)\n result.log(:log_comment_added, :summary => summary)\n end\n return comment\n end",
"title": ""
},
{
"docid": "87305703fc47248243182aa23d05d6cc",
"score": "0.5719805",
"text": "def create\n\t\t@post = post\n\t\t@comment = @post.comments.create(comment_params)\n\t\t@comment.user = current_user\n\t\trespond_to do |format|\n\t\t\tif @comment.save\n\t\t\t\tformat.html { redirect_to post_url(post), notice: 'Ha agregado un comentario' }\n\t\t\t\tformat.json { render :show, status: :created, location: @comment }\n\t\t\telse\n\t\t\t\tformat.html { redirect_to post_url(post), alert: 'Recuerde que el comentario debe tener entre 10 y 150 caracteres.' }\n\t\t\t\tformat.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6b337be4b129c73ee16ce50e2012688b",
"score": "0.5719383",
"text": "def comment_post(post_id, user_id, content, username)\n db = SQLite3::Database.new(\"db/reddit.db\")\n time = Time.now.asctime\n db.execute(\"INSERT INTO comments (post_id, user_id, content, timestamp, upvote_count, username) VALUES (?,?,?,?,?,?)\", post_id, user_id, content, time, 0, username)\n end",
"title": ""
},
{
"docid": "d3d994331f5b58f5b9f2e143e052cd5f",
"score": "0.57177037",
"text": "def create\n\t\t@post = Post.find(params[:post_id])\n\t\t@comment = @post.comments.create(comment_params)\n\n\t\tredirect_to post_path(@post)\n\tend",
"title": ""
},
{
"docid": "8779b943e1ff9679aa183d3524b3f5cd",
"score": "0.5715382",
"text": "def comment\n return unless load_course( params[:course] )\n return unless allowed_to_see_course( @course, @user )\n return unless course_open( @course, :action => 'post', :id => params[:id] )\n @post = Post.find( params[:id] )\n return unless post_in_course( @course, @post ) \n return unless check_comments_enabled( @course, @post ) \n\n begin\n @comment = Comment.new(params[:comment])\n @comment.user = session[:user]\n @comment.ip = session[:ip]\n @comment.course_id = @course.id\n \n item = @post.add_comment(@comment)\n\n link = url_for(:controller => '/post', :action => 'view', :id => item, :course => nil, :only_path => false)\n Bj.submit \"./script/runner ./jobs/comment_notify.rb #{item.id} #{@user.id} \\\"#{link}\\\"\"\n\n flash[:notice] = 'Your comment has been saved.'\n redirect_to :action => 'post', :course => @course, :id => @post\n rescue\n set_title()\n @breadcrumb.post = @post\n @breadcrumb.text = nil\n flash[:expand] = true\n render :action => 'post'\n end\n end",
"title": ""
},
{
"docid": "9fbf8709267014597b1655580fc1b0d0",
"score": "0.57058764",
"text": "def create\n @comment = @network.comments.build(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to(:back) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n flash[:notice] = 'Comment was not created.'\n # TODO errors to form and AJAX update if comments div\n format.html { redirect_to(:back) }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6ff89474f67dc8bfd495b15a189cb067",
"score": "0.5705225",
"text": "def create\n\t\t#@post = Post.find(params[:post_id])\n\t\t@comment = Comment.new(params[:comment])\n\t\t@comment.post_id = params[:comment][:post_id]\n\t\t@comment.user_id = current_user.id\n\t\tif @comment.save\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to admin_comment_path(@comment) }\n\t\t\tend\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to admin_comments_path, alert: 'Μή έγκυρο σχόλιο' }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5d7932fc60924c39544cdea594efb418",
"score": "0.57039315",
"text": "def create_comment(options={})\n comment = comments.create!(options)\n touch\n notification_manager.notifyChanged(id.to_i, comment.user.login.to_java, to_java_map, to_java_map(\"comment\" => comment.text))\n end",
"title": ""
},
{
"docid": "b7a9aeef626fe1b4df13e6e90cb8fb06",
"score": "0.57027954",
"text": "def create\n @comment = Comment.new(params[:comment])\n content = @comment.build_content(params[:content])\n\n @comment.user = current_user\n @comment.content.user = current_user\n\n @comment.content.published = true\n\n if !params[:post_id].nil?\n post = Post.find(params[:post_id])\n post.comments << @comment\n elsif !params[:page_id].nil?\n page = Page.find(params[:page_id]) \n page.comments << @comment\n\t elsif !params[:card_id].nil?\n card = Card.find(params[:card_id]) \n card.comments << @comment\n end\n\n respond_to do |format|\n if @comment.save #post.save && comment.save && content.save\n notify :notice, 'Comment was successfully created.'\n \n format.html { redirect_to polymorphic_path(@comment.commentable) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n format.js\n else\n format.html { redirect_to polymorphic_path(@comment.commentable) }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "5e11d87160a22943cbcf8fe2a7feb69f",
"score": "0.57027936",
"text": "def test_create_chapter_comment\n create_comments\n # FIXME Called id for nil comments_controller.rb:64\n# assert_difference('Comment.count') do\n# post :create, :locale => 'en',\n# :chapter_id => @chapter1.id,\n# :comment => { :content => 'foo',\n# :name => 'Someone',\n# :email => 'someone@someplace.org' }\n# end\n# assert_redirected_to work_path(:locale => 'en', :id => @work.id)\n end",
"title": ""
},
{
"docid": "1ac9ba557024b5578cd8e4d5483f9d1e",
"score": "0.5698437",
"text": "def create\n @post = Post.find(params[:post_id])\n @comment = Comment.new(\n content: params[:comment][:content],\n date: params[:comment][:date],\n post_id: @post.id,\n user_id: session[:user_id]\n )\n\n @comment.save\n # @post.comments << new_comment\n\n redirect_to post_path(@post)\n end",
"title": ""
},
{
"docid": "487024397da917bd5d6030b400b18a25",
"score": "0.5695049",
"text": "def create\n @comment = Comment.new(comment_params)\n\n if @comment.save\n render json: @comment, status: :created, location: [:api, @comment]\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2f7f8e25fa0f44613bbfb508a5c992b6",
"score": "0.5691711",
"text": "def make_comment(params = {})\n merged_params = default_params.merge(params)\n uri = Osmek::Uri.new('make_comment')\n request = Osmek::Request.new(uri, merged_params)\n request.perform\n end",
"title": ""
},
{
"docid": "b0ca19a04192ab14fb1f4cc0297ef2e7",
"score": "0.5689364",
"text": "def create\n @recipe = Recipe.find(params[:recipe_id])\n @comment = Comment.new(params[:comment])\n @comment.user_id = @current_user.id\n\n respond_to do |format|\n if @recipe.comments << @comment\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to recipe_url(@recipe) }\n format.xml { head :created, :location => comment_url(@comment) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "202fdf074e2b6772bda2ca527f76c0e0",
"score": "0.5687435",
"text": "def create\n comment.post_id=post.id\n comment.user_id=current_user.id\n if comment.save\n render action: :index\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "f044e4be1e506c2621f2867a448188ed",
"score": "0.5680845",
"text": "def index \n\t\t@comment = Comment.new\n\tend",
"title": ""
}
] |
ee0a20d0d08d3abf53cfebb76d75fa90
|
Return the provided metatags
|
[
{
"docid": "64428b3bb61d7ea7bd33a53babfa23f9",
"score": "0.6101481",
"text": "def show_metatags( tags = @@default_tags, format = @@outputformat, show_filename = @@show_filename )\n\n # Build the output hash from the tags matching the values in @@default_tags\n metadataOutputHash = Hash.new\n tags.each do |tagname|\n if @@metadata.has_key?(tagname)\n metadataOutputHash[tagname] = @@metadata[tagname]\n elsif tagname.downcase == 'all' # Exception when for keyword 'all'\n metadataOutputHash = @@metadata\n end\n end\n\n metadataOutputHash = show_corrected_date_format(metadataOutputHash)\n\n if show_filename\n metadataOutputHash['filename'] = @filename\n end\n\n # Return output well formatted\n case format\n when /hash/i\n Pdfmdmethods.log('info',\"Showing metatags for '#{@filename}' in format 'hash'.\")\n metadataOutputHash\n when /csv/i\n csvData = Hash.new\n metadataOutputHash.keys.each do |tagname|\n csvData[tagname] = '\"' + metadataOutputHash[tagname.downcase].to_s.gsub(/\"/,'\"\"') + '\"'\n end\n Pdfmdmethods.log('info',\"Showing metatags for '#{@filename}' in format 'csv'.\")\n csvData.values.join(',')\n when /json/i\n require 'json'\n Pdfmdmethods.log('info',\"Showing metatags for '#{@filename}' in format 'json'.\")\n metadataOutputHash.to_json\n else \n require 'yaml'\n Pdfmdmethods.log('info',\"Showing metatags for '#{@filename}' in format 'yaml'.\")\n metadataOutputHash.to_yaml\n end\n\n end",
"title": ""
}
] |
[
{
"docid": "762583aa16afbf5193c3aa8369c0efe2",
"score": "0.75395125",
"text": "def metatags\n self.tags.split(',').map do |tag|\n Metatag.find_by(tag: tag)\n end.compact\n end",
"title": ""
},
{
"docid": "079db8d43a89a1ef4bf9a3e7ee6321b2",
"score": "0.7175424",
"text": "def og_metatags\n end",
"title": ""
},
{
"docid": "ce38c63c34d48adfc128bb05794f56f4",
"score": "0.7124274",
"text": "def metatags\n tags = fields.map do |name,value|\n attrs = {\n name: ::Middleman::TwitterCards::Tags.map_name(name),\n content: value\n }\n Render.tag :meta, attrs\n end.join('')\n\n return tags\n end",
"title": ""
},
{
"docid": "a76149a9bddc6355817493b9e2e3b229",
"score": "0.7048757",
"text": "def meta\n meta = {}\n metadata.each do |m|\n meta[m.key] = m\n end\n return meta\n end",
"title": ""
},
{
"docid": "dca28d930a6a3af0c26fd030082b872f",
"score": "0.6868388",
"text": "def metacontent\n @sitemap.app.data.metacontent\n end",
"title": ""
},
{
"docid": "e43e783bfbbd3adbc3f1fc32081adf22",
"score": "0.68396914",
"text": "def metas\n Metas.new(self)\n end",
"title": ""
},
{
"docid": "b5f94b3597af6f17b611b8794bbd373d",
"score": "0.68329656",
"text": "def get_meta_tags\n if @content_package.present?\n\n if @content_package.meta_image_uid\n image = \"http://#{Settings.site_url}#{@content_package.meta_image.thumb('1024x1024#').url}\"\n elsif @content_package.respond_to?(:hero_image) && @content_package.hero_image.present?\n image = \"http://#{Settings.site_url}#{@content_package.hero_image.thumb('1024x1024#').url}\"\n end\n\n meta_title = @content_package.meta_title.presence || Settings.default_meta_title\n meta_description = @content_package.meta_description.presence || Settings.default_meta_description\n meta_keywords = @content_package.meta_keywords.presence || Settings.default_meta_keywords\n if @content_package.hide_from_robots?\n meta_hide_from_robots = \"<meta name='robots' content='noindex, nofollow' />\\n\"\n end\n\n else\n meta_title = Settings.default_meta_title\n meta_description = Settings.default_meta_description\n meta_keywords = Settings.default_meta_keywords\n meta_hide_from_robots = nil\n\n end\n\n meta_image = image || \"http://#{Settings.site_url}#{asset_path(Settings.default_fb_meta_image)}\"\n\n meta_values = [meta_title, meta_description, meta_image, meta_keywords, meta_hide_from_robots]\n\n pig_meta_tags(meta_values)\n end",
"title": ""
},
{
"docid": "5738d734d4cfd6b5bc3ee70d12e8d33e",
"score": "0.6548726",
"text": "def meta(tags = nil)\n @meta_tags ||={}\n \n if tags.is_a? Hash\n @meta_tags.merge!(tags) \n elsif tags.is_a? Symbol\n return @meta_tags[tags]\n end\n\n @meta_tags\n end",
"title": ""
},
{
"docid": "3bfddd2f86ad939b14bb4efd31b950b6",
"score": "0.65400124",
"text": "def get_metadata(metadata={})\n case universe\n when :ebi, :ncbi\n # Get taxonomy\n metadata[:tax] = get_ncbi_taxonomy\n end\n metadata\n end",
"title": ""
},
{
"docid": "e9762e9684a42f6944b486c3575d3edf",
"score": "0.6523195",
"text": "def build_meta_values\n page_slug = request.path.match(/^\\/(.+)$/) { $1 }\n if @content_package.present?\n # cache content_package_meta_tags_cache_key(@content_package) do\n\n meta_title = @content_package.meta_title.presence || Settings.default_meta_title\n meta_description = @content_package.meta_description.presence || Settings.default_meta_description\n meta_image = @content_package.meta_image_uid ? \"#{Settings.site_url}#{@content_package.meta_image.thumb('300x300#').url}\" : \"#{Settings.site_url}#{image_path(Settings.default_fb_meta_image)}\"\n meta_keywords = @content_package.meta_keywords.presence || Settings.default_meta_keywords\n\n if @content_package.hide_from_robots?\n meta_hide_from_robots = \"<meta name='robots' content='noindex, nofollow' />\\n\"\n end\n [meta_title, meta_description, meta_image, meta_keywords, meta_hide_from_robots]\n # end\n elsif meta_data = Pig::MetaDatum.where(page_slug: page_slug).first\n meta_title = meta_data.title || Settings.default_meta_title\n meta_description = meta_data.description || Settings.default_meta_description\n meta_image = meta_data.image_uid ? \"#{Settings.site_url}#{meta_data.image.thumb('300x300#').url}\" : \"#{Settings.site_url}#{image_path(Settings.default_fb_meta_image)}\"\n meta_keywords = meta_data.keywords || Settings.default_meta_keywords\n [meta_title, meta_description, meta_image, meta_keywords, nil]\n end\n end",
"title": ""
},
{
"docid": "b72bf535b20480968d01c8b2e5364cbd",
"score": "0.6487841",
"text": "def meta\n end",
"title": ""
},
{
"docid": "ae30020d9aaac0aae98bf68b4f9dcdb8",
"score": "0.6479572",
"text": "def meta\n @meta || load_meta\n end",
"title": ""
},
{
"docid": "e766550975c1b744c02e92186be7f513",
"score": "0.6414694",
"text": "def metadata m\n\t\tm\n\tend",
"title": ""
},
{
"docid": "bc95d104bbaf4151b13f8f7d836324d3",
"score": "0.64138454",
"text": "def missing_meta; end",
"title": ""
},
{
"docid": "f0777d36d46bde2e5eb8e2b0dea34955",
"score": "0.6400649",
"text": "def meta_tags\n @meta_tags ||= {}\n return @meta_tags\n end",
"title": ""
},
{
"docid": "74d83c138ab7a57c5352a81b104c61c3",
"score": "0.63830316",
"text": "def meta\n @metadata\n end",
"title": ""
},
{
"docid": "8fb1239b5c8cf998e39eff24c7efe5e3",
"score": "0.6369527",
"text": "def meta_values\n @meta_values ||= {}\n end",
"title": ""
},
{
"docid": "114a005302275a557e9d52166538b5d1",
"score": "0.63649666",
"text": "def meta\n Meta.constants.each_with_object(Set.new) do |meta_name, meta|\n meta_class = Meta.const_get(meta_name)\n meta.merge(meta_class.new(self).to_a)\n end.to_a\n end",
"title": ""
},
{
"docid": "065bf3cbdad8e482de8b92d4d027681c",
"score": "0.63616747",
"text": "def meta; end",
"title": ""
},
{
"docid": "065bf3cbdad8e482de8b92d4d027681c",
"score": "0.63616747",
"text": "def meta; end",
"title": ""
},
{
"docid": "065bf3cbdad8e482de8b92d4d027681c",
"score": "0.63616747",
"text": "def meta; end",
"title": ""
},
{
"docid": "065bf3cbdad8e482de8b92d4d027681c",
"score": "0.63616747",
"text": "def meta; end",
"title": ""
},
{
"docid": "065bf3cbdad8e482de8b92d4d027681c",
"score": "0.63616747",
"text": "def meta; end",
"title": ""
},
{
"docid": "154ff9e3b1a3297a750caa3031a7baa1",
"score": "0.63440657",
"text": "def collect_metadates\n meta = []\n meta = @page.css('meta') if @page\n meta\n end",
"title": ""
},
{
"docid": "8a8c05b1167e8f40b5f69446bb1b52f1",
"score": "0.6313628",
"text": "def meta(tags = nil)\n @meta_tags ||= self.class.meta.clone\n\n if tags.is_a? Hash\n @meta_tags.merge!(tags)\n @meta_tags\n elsif tags.is_a? Symbol\n return @meta_tags[tags]\n else\n output_meta_tags @meta_tags\n end\n end",
"title": ""
},
{
"docid": "991a4feaaf7cff3292d56b6f6f3ec19b",
"score": "0.6292096",
"text": "def meta_attrs\n { }\n end",
"title": ""
},
{
"docid": "811ac0e4f57e4c620b9a444f186c391e",
"score": "0.6291475",
"text": "def plugin_meta(slice=nil)\n # see http://www.tiddlywiki.com/#ExamplePlugin\n if not @plugin_meta\n meta = %w[Name Description Version Date Source Author License CoreVersion Browser]\n @plugin_meta = get_slices.reject{|k,v| not meta.include?(k)}\n end\n if slice\n @plugin_meta[slice]\n else\n @plugin_meta\n end\n end",
"title": ""
},
{
"docid": "1339dab4d63f19fbf4835dc08e055283",
"score": "0.6283456",
"text": "def get_meta_data\n @functional_areas = Hash[Vger::Resources::FunctionalArea.where(:query_options => {:active=>true},:order => \"name ASC\")\\\n .all.to_a.collect{|x| [x.id,x]}]\n @industries = Hash[Vger::Resources::Industry.where(:query_options => {:active=>true},:order => \"name ASC\")\\\n .all.to_a.collect{|x| [x.id,x]}]\n @job_experiences = Hash[Vger::Resources::JobExperience.active.all.to_a.collect{|x| [x.id,x]}]\n end",
"title": ""
},
{
"docid": "a1315484e10444d75caa140cad6453a7",
"score": "0.62825453",
"text": "def metadata(*_args)\n {}\n end",
"title": ""
},
{
"docid": "1d7180d31d52e66740fe264d2e0e12ac",
"score": "0.6276826",
"text": "def metadata\n end",
"title": ""
},
{
"docid": "7904c4c02c6f516839faab2660da100c",
"score": "0.62759656",
"text": "def meta\n @meta\n end",
"title": ""
},
{
"docid": "422129bc19102e888e37741f257aa1b5",
"score": "0.6273014",
"text": "def metadata\n @meta_data\n end",
"title": ""
},
{
"docid": "78eb98db9a5aac47b56a598764ef746e",
"score": "0.62700725",
"text": "def default_meta_tags\n {\n title: full_title,\n description: 'Chegilonは、知恵やノウハウを共有し議論するためのサービスです。',\n keywords: '知恵, 議論, 共有, ノウハウ',\n twitter: {\n card: 'product',\n site: '@Chegilon',\n description: :description,\n image: ENV[\"APPLI_URL\"] + asset_path(\"card_logo.png\")\n },\n og: {\n title: :title,\n type: 'website',\n url: request.url,\n image: ENV[\"APPLI_URL\"] + asset_path(\"card_logo.png\"),\n description: :description\n }\n }\n end",
"title": ""
},
{
"docid": "ffa0c3a48b1a11eae2e07053bb829606",
"score": "0.6259794",
"text": "def meta\n tags = driver.all(:css, 'meta[name]')\n tags.inject(Hash.new) do |vals, tag|\n vals[tag.attribute(:name)] = tag.attribute(:content) if tag.attribute(:name)\n vals\n end\n end",
"title": ""
},
{
"docid": "fa0f2d4751971b19a20b4b603e4e6e3e",
"score": "0.62440646",
"text": "def get_meta(name)\n result = nil\n @_meta.each do |m|\n if m[:name] == name.to_s \n result = m\n break\n end\n end\n return result\n end",
"title": ""
},
{
"docid": "d230b73233ac9774a0f6ea671ce4b998",
"score": "0.6231927",
"text": "def meta_vars\n end",
"title": ""
},
{
"docid": "ec64d5e16f5b7bb5646332c08f1946b5",
"score": "0.6222",
"text": "def get_meta(matcher)\n val = get_meta_name(matcher)\n val = get_meta_property(matcher) if val.blank?\n val = get_meta_itemprop(matcher) if val.blank?\n val\n end",
"title": ""
},
{
"docid": "cb33c5a9da5150b68e33cf1319a92ffc",
"score": "0.620702",
"text": "def get_metadata(metadata_def = {})\n metadata_def.each { |k, v| @metadata[k] = v }\n case universe\n when :ebi, :ncbi, :web\n # Get taxonomy\n @metadata[:tax] = get_ncbi_taxonomy\n end\n @metadata = get_type_status(metadata)\n end",
"title": ""
},
{
"docid": "dde3d12d703fa24a89f37511b1b46bfa",
"score": "0.6206517",
"text": "def meta\n get_meta(@meta_id)\n end",
"title": ""
},
{
"docid": "4167c7ee5dd5082d8af2efc672895ab8",
"score": "0.62037677",
"text": "def metadata\n {}\n end",
"title": ""
},
{
"docid": "7d2ad39574b7babe7db73f267b1f4d9d",
"score": "0.62027794",
"text": "def met\n subset(select { |g| g.met? })\n end",
"title": ""
},
{
"docid": "ac2e00441f23999dc2eff26f89f66c3d",
"score": "0.6197198",
"text": "def metadata \n\n end",
"title": ""
},
{
"docid": "52055761fcade2b90af2e9297cbe8cb6",
"score": "0.6185597",
"text": "def metadata\n return @metadata if @metadata\n\n metadata_array = []\n return metadata_array unless attributes[:metadata]\n\n attributes[:metadata].each do |a|\n metadata_array << render(a) unless a.nil? || a.strip.empty?\n end\n\n @metadata = metadata_array unless loading\n metadata_array\n end",
"title": ""
},
{
"docid": "13154d84f9f94722193ac99a3727b032",
"score": "0.6181204",
"text": "def metadata\n # @metadata ||= \n get_raw_metadata\n end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "45a6a5f5f02a4a2dbf1941f532a11450",
"score": "0.6165867",
"text": "def metadata; end",
"title": ""
},
{
"docid": "e4ca2e0df2bde0400913fefc0f3d1da3",
"score": "0.6162283",
"text": "def meta_options\n meta_opts = {}\n\n meta_tags.each do |meta|\n tag_name = meta['name'] && meta['name'][/#{Ernie.configuration.meta_tag_prefix}([a-z_-]+)/, 1]\n next unless tag_name\n\n Utils.deep_assign meta_opts, tag_name.split('-'), meta['content']\n end\n\n meta_opts\n end",
"title": ""
},
{
"docid": "71b5a3ea8887e9c2a5e6c6ba021fa330",
"score": "0.6151082",
"text": "def getMeta(meta)\n\n @media.getMeta(meta)\n\n end",
"title": ""
},
{
"docid": "465051f2b566a87025198d79f29007b5",
"score": "0.6150045",
"text": "def global_meta_tags(default = {})\n open_meta_tags = (default || {}).merge(@open_meta_tags || {})\n\n result = []\n\n ##### metadata options\n \n description = normalize_description(open_meta_tags[:description])\n result << tag(:meta, :property => 'og:description', :content => description) unless description.blank?\n \n admins = normalize_admins(open_meta_tags[:admins])\n result << tag(:meta, :property => 'fb:admins', :content => admins) unless admins.blank?\n \n app_id = open_meta_tags[:app_id]\n result << tag(:meta, :property => 'fb:app_id', :content => app_id) unless app_id.blank?\n \n street_address = open_meta_tags[:street_address]\n result << tag(:meta, :property => 'og:street-address', :content => street_address) unless street_address.blank?\n \n postal_code = open_meta_tags[:postal_code]\n result << tag(:meta, :property => 'og:postal-code', :content => postal_code) unless postal_code.blank?\n\n country_name = open_meta_tags[:country_name]\n result << tag(:meta, :property => 'og:country-name', :content => country_name) unless country_name.blank?\n \n # metaprogramming\n [:title, :type, :url, :image, :site_name, :latitude, :longitude, :locality, :region, :email, :phone_number, :fax_number, :upc, :isbn, :video].each do |attr|\n result << tag(:meta, :property => \"og:#{attr}\", :content => open_meta_tags[attr]) unless open_meta_tags[attr].blank?\n end\n\n result = result.join(\"\\n\")\n result.respond_to?(:html_safe) ? result.html_safe : result\n end",
"title": ""
},
{
"docid": "d2c8637cf3d0c6f6a273f03c1ce78f84",
"score": "0.61404824",
"text": "def meta\n return @meta if @meta\n\n meta_option = options[:meta]\n @meta = meta_option.nil? ? {} : meta_option.to_hash\n end",
"title": ""
},
{
"docid": "8bad86cdd5a37efb8fcc2f0c695286a9",
"score": "0.6136166",
"text": "def get_metros( params )\n LastFM.get( \"geo.getMetros\", params )\n end",
"title": ""
},
{
"docid": "c98759dc195c734e2889d85266a0293f",
"score": "0.61246455",
"text": "def manifest_metadata\n metadata = []\n ::Hyrax.config.iiif_metadata_fields.each do |field|\n next unless methods.include?(field.to_sym)\n value = Array.wrap(send(field))\n if field.to_sym.in? HTML_RENDERED_FIELDS\n value.map! { |v| unrender_value(v) }\n end\n \n data = send(field)\n next if data.blank?\n \n metadata << {\n 'label' => I18n.t(\"simple_form.labels.defaults.#{field}\", default: field.to_s.humanize),\n 'value' => value\n }\n end\n metadata\n end",
"title": ""
},
{
"docid": "055747d335df39877eaa0b997684c312",
"score": "0.611927",
"text": "def list_by_meta\n API::request(:get, 'meta')\n end",
"title": ""
},
{
"docid": "8b86dd0bde3a2ddf15785be531f921d3",
"score": "0.61097753",
"text": "def meta_defaults\n @meta_title = \"Sublime Sydney | Luxury & Boutique Hotels | Travel Guide\"\n @meta_keywords = \"Sydney luxury hotel, Sydney boutique hotel, Sydney luxury accommodation, Sydney boutique accommodation, Sydney luxury travel, Sydney boutique travel, Sydney travel guide\"\n @meta_description = \"Sublime Sydney is Sydney's ultimate travel guide for luxury hotels, boutique hotels, fine dining & more. Sydney luxury hotels, Sydney boutique hotels, Sydney luxury travel, Sydney boutique travel.\"\n\t end",
"title": ""
},
{
"docid": "dd41c2a1cb3a16a0fdaef845d5425707",
"score": "0.6107655",
"text": "def metadata\n metadata = {}\n other_chunks.each do |chunk|\n metadata[chunk.keyword] = chunk.value if chunk.respond_to?(:keyword) && chunk.respond_to?(:value)\n end\n metadata\n end",
"title": ""
},
{
"docid": "113e1ae220608a3ccf286537abe32134",
"score": "0.61074674",
"text": "def option_metas\n meta_or ['options', 'opts', 'vars'], []\n end",
"title": ""
},
{
"docid": "a9c758703b0965f1fca23b56020d6b8b",
"score": "0.60973674",
"text": "def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end",
"title": ""
},
{
"docid": "1f78daf70eb6fe5cf177fd518bebe446",
"score": "0.60911894",
"text": "def meta(file)\n ret = meta_default folder_categories file \n \n yamls = meta_files(file) + meta_file(file)\n yamls.flatten.each do |y| \n data = YAML.load_file(\"#{@dir}/images/#{y}\")\n ret = meta_merge ret, data unless data == false\n end\n \n ret\n end",
"title": ""
},
{
"docid": "7a6e682bf8232a43490b18cddaf2fb80",
"score": "0.6085471",
"text": "def metros\n return @nodes\n end",
"title": ""
},
{
"docid": "8cdc7350115bc92985bdb5bc8d011e5d",
"score": "0.60823876",
"text": "def missing_meta\n data[:missing_meta]\n end",
"title": ""
},
{
"docid": "a1957028402871507a610bb35cc469d3",
"score": "0.6053684",
"text": "def product_meta_data\n end",
"title": ""
},
{
"docid": "8417a371ed79b1abe3d3c4acc0e6b8ff",
"score": "0.6051003",
"text": "def meta\n @meta ||= parsed_response[:meta]\n end",
"title": ""
},
{
"docid": "47b719b56febbf771702ca70652e26d2",
"score": "0.60335165",
"text": "def metadata\n (groups + [step]).compact.inject({}) { |merged, part| merged.merge(part.metadata) }\n end",
"title": ""
},
{
"docid": "05077150caeb4944eb15f5788468aa7d",
"score": "0.60282254",
"text": "def meta_tags\n @meta_tags ||= {}\n end",
"title": ""
},
{
"docid": "bdd634269bd8ef04667bfbd5cc1ed92a",
"score": "0.60264844",
"text": "def metadata\n [\"--url\", @meta[:url], \"--description\", @meta[:description], \"--license\", @meta[:license],\n \"--maintainer\", @meta[:author], \"--vendor\", @vendor]\n end",
"title": ""
},
{
"docid": "50992bd567f20530ffeedce6b49d491d",
"score": "0.60219955",
"text": "def get_metadata; end",
"title": ""
},
{
"docid": "73d1704252eb368bb282f2def8f7186c",
"score": "0.6019248",
"text": "def metadata\n {}\n end",
"title": ""
},
{
"docid": "62372606b6ed45d1dc36c2cc8daebcea",
"score": "0.6016799",
"text": "def meta_options; end",
"title": ""
},
{
"docid": "e97739847f6d70fa37246776e9f8197d",
"score": "0.6013232",
"text": "def prepare_meta_tags(options={})\n site_name = 'TrekHub'\n title = options[:title] || action_name.capitalize\n description = 'Organizing trekking tours, adventures tours. We hold expertise in offering you India trekking tours at best prices. Get complete information about famous treks for Trekking in India.'\n image = options[:image] || 'http://www.trekhub.in/imgs/logo.png'\n current_url = request.url\n\n defaults = {\n site: site_name,\n title: title,\n reverse: true,\n icon: 'favicon.ico',\n image: image,\n description: description,\n keywords: %w[trekhub adventure tourism trekking India paraglide scuba diving skydiving team outings campsites corporate tours],\n category: 'Tourist Guide, Adventure Guide India, Trekking Tour Guide, Hiking Tour Guide',\n classification: 'Tours, Travel, Tourism, Tour Guide, Tourism Guide, Tourist Guide, Adventure Guide, Trekking Tour Guide, Hiking Tour Guide',\n DC: {\n title: 'Trekhub – Adventure Trekking Tours Guide in India | Adventure Tourism'\n },\n geo: {\n region: 'IN-KA',\n placename: 'Bengaluru',\n position: '12.898622;77.570897'\n },\n ICBM: '12.898622;77.570897',\n googlebot: 'index, follow',\n msnbot: 'index, follow',\n YahooSeeker: 'index, follow',\n twitter: {\n site_name: site_name,\n title: title,\n site: '@TrekHubIN',\n card: 'summary',\n description: description,\n image: image\n },\n og: {\n url: current_url,\n site_name: site_name,\n title: title,\n image: image,\n description: description,\n type: 'website'\n },\n author: 'humans.txt',\n publisher: 'https://plus.google.com/+TrekhubInindia'\n }\n\n options.reverse_merge!(defaults)\n\n set_meta_tags options\n end",
"title": ""
},
{
"docid": "d862c09e7ee5c829d0c5a630b37d10b2",
"score": "0.60115266",
"text": "def meta_tags(*args)\n options = args.extract_options!\n \n if args.first.is_a?(Symbol) && args.last.is_a?(String)\n send :\"#{args.first}_tag\", (args.last if args.last.present?)\n else # Hash\n returning '' do |html|\n options.slice(:title, :description, :keywords).each do |type|\n html << send(:\"#{type}_tag\", (options[type] if options[type].present?))\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ec9f6093fd1c4333609e8a401007e03e",
"score": "0.59961486",
"text": "def meta_options\n meta_opts = {}\n\n meta_tags.each do |meta|\n tag_name = meta['name'] && meta['name'][/#{Grover.configuration.meta_tag_prefix}([a-z_-]+)/, 1]\n next unless tag_name\n\n Utils.deep_assign meta_opts, tag_name.split('-'), meta['content']\n end\n\n meta_opts\n end",
"title": ""
},
{
"docid": "3f52a1b8ed50a9625560067331d502f9",
"score": "0.5988788",
"text": "def metadata\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "3f52a1b8ed50a9625560067331d502f9",
"score": "0.5988788",
"text": "def metadata\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "79ed9dae0e82f9fa6d33ece19a5ca53b",
"score": "0.59496325",
"text": "def metadata\n @metadata.map { |key, value| {:name => key, :content => value } } rescue nil\n end",
"title": ""
},
{
"docid": "8f3d0ba5c6a1b2c1364e46dc4f8c6897",
"score": "0.5946779",
"text": "def metadata\n yield self\n end",
"title": ""
},
{
"docid": "c522e19bb35be54a3a0afdb097fa1df0",
"score": "0.594524",
"text": "def metadata\n attributes[:metadata] || {}\n end",
"title": ""
},
{
"docid": "08604c91b9972b0e68aac51ed17d28b6",
"score": "0.59451073",
"text": "def metadata\n @metadata ||= {}\n end",
"title": ""
},
{
"docid": "08604c91b9972b0e68aac51ed17d28b6",
"score": "0.59451073",
"text": "def metadata\n @metadata ||= {}\n end",
"title": ""
},
{
"docid": "509e449cd54b99303d2f01c2de2f080c",
"score": "0.5931849",
"text": "def meta_attributes(attributes = {})\n meta_data = {}\n\n meta_data[:pagination] = {\n currentPage: attributes[:pagination].current_page,\n totalPages: attributes[:pagination].total_pages,\n totalCount: attributes[:pagination].total_count\n } if attributes[:pagination]\n\n meta_data[:metaTags] = meta_tags.meta_tags if meta_tags&.meta_tags.present?\n\n return meta_data\n end",
"title": ""
},
{
"docid": "f0e2f565f3d360501173b8db4e5bbcdc",
"score": "0.5915089",
"text": "def manifest_metadata\n metadata_fields = [:ark, :date_created, :creator_label, :rights_statement]\n metadata = []\n metadata_fields.each do |field|\n values = Array.wrap(send(field))\n next if values.blank?\n metadata << {\n 'label' => I18n.t(\"simple_form.labels.defaults.#{field}\"),\n 'value' => values\n }\n end\n metadata\n end",
"title": ""
}
] |
5a8893f9e47acceb9cc86e5aad1341eb
|
GET /activity_refs/new GET /activity_refs/new.json
|
[
{
"docid": "0fde5d518bfb374746c22b63e3d47795",
"score": "0.7849113",
"text": "def new\n @activity_ref = ActivityRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_ref }\n end\n end",
"title": ""
}
] |
[
{
"docid": "a5110da580d5b7870feebc4d25e8c3f2",
"score": "0.73859644",
"text": "def create\n @activity_ref = ActivityRef.new(params[:activity_ref])\n\n respond_to do |format|\n if @activity_ref.save\n format.html { redirect_to @activity_ref, notice: 'Activity ref was successfully created.' }\n format.json { render json: @activity_ref, status: :created, location: @activity_ref }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "87e721a0c7a79942b262c658d22598a0",
"score": "0.65033996",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "12f37c0e081863d5d33da5f7c73015cd",
"score": "0.650317",
"text": "def new\n @rebalance_ref = RebalanceRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rebalance_ref }\n end\n end",
"title": ""
},
{
"docid": "57dfd9cc44b9c2941cd1ef68a94d5036",
"score": "0.64901054",
"text": "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"title": ""
},
{
"docid": "57dfd9cc44b9c2941cd1ef68a94d5036",
"score": "0.64901054",
"text": "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"title": ""
},
{
"docid": "5371387d199dfb1e82527ec95e4b4634",
"score": "0.64750576",
"text": "def new\n @ref_datum = RefDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_datum }\n end\n end",
"title": ""
},
{
"docid": "9697eae9fae89ce9f034d5f1aa0af9bb",
"score": "0.6465824",
"text": "def new\n @refer = Refer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @refer }\n end\n end",
"title": ""
},
{
"docid": "da6a39d6db8b3522ed9670a11874e602",
"score": "0.6420136",
"text": "def new\n @activity = get_user.activities.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "e478d9d89c668b67b5d882a16818786a",
"score": "0.636512",
"text": "def new\n if params[:master].present?\n master = Reference.find(params[:master])\n @reference = master.dup\n else\n @reference = Reference.new\n end\n\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"title": ""
},
{
"docid": "df87f498b2f75447ccb7be573893292e",
"score": "0.6354052",
"text": "def new\n @activity = Activity.new\n @orgs = Org.all\n @activity.user_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "4a4938dc624e4719ba0e1758f7393da1",
"score": "0.6327184",
"text": "def new\n @ref_entity = RefEntity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref_entity }\n end\n end",
"title": ""
},
{
"docid": "dcc9f7fc0ddaaed5b23a35135600c5df",
"score": "0.63044864",
"text": "def new\n @task_activity = TaskActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_activity }\n end\n end",
"title": ""
},
{
"docid": "4606ca315d9b74b740f5634d938c7751",
"score": "0.62900704",
"text": "def new\n @tags = Tag.all\n @activity = Activity.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "970fcfd1c8c06d579c17dae35c9311fb",
"score": "0.6228813",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @achieved_activity }\n end\n end",
"title": ""
},
{
"docid": "d3ce8ea5943bfc3c2992b9e8a05dc1c3",
"score": "0.6221364",
"text": "def new\n @resource_history = Resource::History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_history }\n end\n end",
"title": ""
},
{
"docid": "efde9eeba956ddb8712b39187c5f7794",
"score": "0.6215752",
"text": "def new\n @activity_type = ActivityType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_type }\n end\n end",
"title": ""
},
{
"docid": "9e34c167c335613f052dafbaeddf9107",
"score": "0.6190386",
"text": "def new\n @topic = Topic.find params[:topic_id] \n @reference = @topic.references.new\n end",
"title": ""
},
{
"docid": "b85ab62426b82d329b36c8db29685e70",
"score": "0.6182478",
"text": "def new\n @activity = Activity.new\n end",
"title": ""
},
{
"docid": "8a68885e5104238eb38eb8f4b772e161",
"score": "0.6177014",
"text": "def new\n @activity = Activity.new(destination_id: params[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "164f1f64efda00c20ed61374ce37868a",
"score": "0.6173654",
"text": "def new\n @activity_types = ActivityType.find(:all)\n\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "40ffd0451ea5cbe97c65d212717c8e27",
"score": "0.61615956",
"text": "def new\n @history_resource = HistoryResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history_resource }\n end\n end",
"title": ""
},
{
"docid": "6b07a21ac74d74325ddad92a0bbe41e1",
"score": "0.6154246",
"text": "def new\n @ref_palm = RefPalm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_palm }\n end\n end",
"title": ""
},
{
"docid": "4bee35a132ce4fc736e9f4609bf0e278",
"score": "0.6147146",
"text": "def new\n @my_referral = MyReferral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_referral }\n end\n end",
"title": ""
},
{
"docid": "2d1e270b7737085f34e3583bca511a5d",
"score": "0.6136149",
"text": "def new\n @activity = Activity.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "c44085ac63e24f65a73bc0c5d35484f8",
"score": "0.61253774",
"text": "def new\n @lookup_ref = LookupRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ref }\n end\n end",
"title": ""
},
{
"docid": "c44085ac63e24f65a73bc0c5d35484f8",
"score": "0.61253774",
"text": "def new\n @lookup_ref = LookupRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ref }\n end\n end",
"title": ""
},
{
"docid": "4305e61ed267357e99fb71089a72efc6",
"score": "0.610757",
"text": "def new\n @change = Change.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @change }\n end\n end",
"title": ""
},
{
"docid": "968f6656853b0ccfe664c20e1f35d99e",
"score": "0.6101629",
"text": "def new\n @produit = Produit.new\n @produit.references = []\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produit }\n end\n end",
"title": ""
},
{
"docid": "0eb79498ee4456297b41a4ff58e7cd23",
"score": "0.60927653",
"text": "def new\n @user_activity = UserActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_activity }\n end\n end",
"title": ""
},
{
"docid": "8089fd22d8519ae54ea4d4353805da1f",
"score": "0.6087848",
"text": "def new\n @reference_datum = ReferenceDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_datum }\n end\n end",
"title": ""
},
{
"docid": "e5c3fbf14b16193b6e00217750d2f431",
"score": "0.6084382",
"text": "def new\n @fcol = Fcol.find(params[:fcol_id])\n @link = @fcol.links.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
},
{
"docid": "5edb685b38166f67efe2570af8d897a4",
"score": "0.60836077",
"text": "def new\n @exercise = Exercise.find(params[:exercise_id])\n @activity = current_user.activities.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "e0fd4dbc4696deffefd98d1ae8450e77",
"score": "0.6079749",
"text": "def new\n @activity_comment = ActivityComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_comment }\n end\n end",
"title": ""
},
{
"docid": "0ff234e6ba873e53ff696f23d9a29b20",
"score": "0.607936",
"text": "def new\n @georef = Georef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @georef }\n end\n end",
"title": ""
},
{
"docid": "f6e59c34e00f8cd78f8ab1e897e945ab",
"score": "0.6076824",
"text": "def new\n @primary_activity = PrimaryActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @primary_activity }\n end\n end",
"title": ""
},
{
"docid": "e92eac1982b30b54511899833983f19e",
"score": "0.6075229",
"text": "def new\n @activity = Activity.find(params[:activity_id]) if params.has_key?(:activity_id)\n @budgets = @current_user.budgets\n @activities = @current_user.activities\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"title": ""
},
{
"docid": "20bb6be8edd219d7be4016a1a1dbe474",
"score": "0.6074539",
"text": "def new\n @recruitment_activity = RecruitmentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recruitment_activity }\n end\n end",
"title": ""
},
{
"docid": "6f036b96a6d5350752cc3ba80a3067c8",
"score": "0.6074047",
"text": "def new\n @activity = current_user.activities.new\n @categories = current_user.categories\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "81a7020bd6d6727c12ec28f800a53fd6",
"score": "0.60711604",
"text": "def new\n @activity = @klass.new(:person_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "bd381758928b397a61696ec3d19310f6",
"score": "0.60684395",
"text": "def new\n @referrer = Referrer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referrer }\n end\n end",
"title": ""
},
{
"docid": "85eed13336482eba14bdcda157922b44",
"score": "0.6057471",
"text": "def new\n @activity = Activity.new({:start_date => Time.now, :end_date => Time.now})\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "ed1a6b51abc18aafe383a233926d8411",
"score": "0.60531276",
"text": "def new\n\t\t@activity = Activity.new\n\tend",
"title": ""
},
{
"docid": "ed1a6b51abc18aafe383a233926d8411",
"score": "0.60531276",
"text": "def new\n\t\t@activity = Activity.new\n\tend",
"title": ""
},
{
"docid": "dec6e9fb49454044ffeb271fc2c3863f",
"score": "0.60499805",
"text": "def new\n @activity = Activity.new\n respond_with(@activity)\n end",
"title": ""
},
{
"docid": "ab5fc114c92d6663316c3025461e2f6d",
"score": "0.6048016",
"text": "def new\n @detailed_activity = DetailedActivity.new\n @detailed_activity.activity_id = params[:activity_id] unless params[:activity_id].nil?\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detailed_activity }\n end\n end",
"title": ""
},
{
"docid": "0989355f9f777bf35a2188e72c839e47",
"score": "0.6043541",
"text": "def new\n @resource_activity_id = params[:resource_activity_id]\n @activity_id = params[:activity_id]\n @tree_id = params[:tree_id]\n @resource_activities_tree = ResourceActivitiesTree.new\n end",
"title": ""
},
{
"docid": "ca3abcc00365956c1cf0949de65e7bcb",
"score": "0.6036642",
"text": "def new\n @member = Member.find(params[:member_id])\n @completed_activity = CompletedActivity.new\n @activities = Activity.find(:all, :order => \"accreditation_type, reference_number\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"title": ""
},
{
"docid": "356944abd9cb4eee7b13be3bf1aba416",
"score": "0.60338384",
"text": "def new\n return unless force_group(\"root\")\n @referat = Referat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referat }\n end\n end",
"title": ""
},
{
"docid": "7419ceae2788c7c44329dd9f592b0982",
"score": "0.6031449",
"text": "def new\n @pbreferral = Pbreferral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pbreferral }\n end\n end",
"title": ""
},
{
"docid": "5bd96fc0420a7bef6ff894335e6f2fa0",
"score": "0.60260314",
"text": "def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recent_activity }\n end\n end",
"title": ""
},
{
"docid": "35ee4c8744a62049fd2dc7ad0ed9e31e",
"score": "0.60233706",
"text": "def create\n @lookup_refs_change_log = LookupRefsChangeLog.new(lookup_refs_change_log_params)\n\n respond_to do |format|\n if @lookup_refs_change_log.save\n format.html { redirect_to @lookup_refs_change_log, notice: 'Lookup refs change log was successfully created.' }\n format.json { render :show, status: :created, location: @lookup_refs_change_log }\n else\n format.html { render :new }\n format.json { render json: @lookup_refs_change_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fd732d7ba5a806dbc96d8700d79a1426",
"score": "0.6022126",
"text": "def new\n @refagency = Refagency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @refagency }\n end\n end",
"title": ""
},
{
"docid": "b74a5450b81096a939c9fb1fdeba2a07",
"score": "0.60191596",
"text": "def new\n @coaching_history = CoachingHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coaching_history }\n end\n end",
"title": ""
},
{
"docid": "a6afe4c27b64fa4666e5666870d5cdb8",
"score": "0.6013514",
"text": "def new\n @changelist = Changelist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @changelist }\n end\n end",
"title": ""
},
{
"docid": "50fb4a00e92b35271a78cb18120851d2",
"score": "0.600245",
"text": "def new\n @allocated_link = AllocatedLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @allocated_link }\n end\n end",
"title": ""
},
{
"docid": "714d9e06b52ecd29d2c36d451d9639c5",
"score": "0.60011023",
"text": "def new\n @fk_reference = FkReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fk_reference }\n end\n end",
"title": ""
},
{
"docid": "a54e10610aa24c842e69389d5e610b0e",
"score": "0.5992021",
"text": "def new\n @routes_history = RoutesHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routes_history }\n end\n end",
"title": ""
},
{
"docid": "a79a11ca1c3f84e6e855ce557dd8bf22",
"score": "0.59885424",
"text": "def new\n @referral = Referral.new\n @referral.build_note\n lead_params\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referral }\n end\n end",
"title": ""
},
{
"docid": "782209a9d636691841785080b3a71f91",
"score": "0.5980122",
"text": "def new\n @activity_tracking = ActivityTracking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity_tracking }\n end\n end",
"title": ""
},
{
"docid": "2cda7d3da1cd2d702f82b5c6f4c7dc6c",
"score": "0.59787565",
"text": "def create\n @reference = Reference.new(params[:reference])\n @reference.projects << current_aspect\n\n respond_to do |format|\n if @reference.save\n track_activity @reference\n format.html { redirect_to @reference, notice: 'Reference was successfully created.' }\n format.json { render json: @reference, status: :created, location: @reference }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "49bf6135bfc3c137135e3c8cbebe037c",
"score": "0.5977813",
"text": "def new\n @link = task.links.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
},
{
"docid": "3fa572836ffe146e7b1f23ceee28bef3",
"score": "0.59745896",
"text": "def new\n @relative = Relative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relative }\n end\n end",
"title": ""
},
{
"docid": "73ad2d34196f1cfab51cf92d0d9adb38",
"score": "0.5974368",
"text": "def new\n @event = Event.find(params[:event_id])\n @program = Program.find(params[:program_id])\n @activity = @program.activities.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "7089f15792051e018f64d71afd3efc36",
"score": "0.59660673",
"text": "def new\n\n @repo = Repo.new\n 1.times { @repo.issues.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repo }\n end\n end",
"title": ""
},
{
"docid": "5e045ad3a3ecd710d7d73ec38ea1624b",
"score": "0.59610254",
"text": "def new\n @activity = nil\n @trip_activity = @trip.trip_activities.new\n @trip_activity.trip_id = params[:trip_id]\n @latlong = find_location_latlong @trip\n @trip_activities = @trip.trip_activities.all.sort_by {|e| e[:activity_sequence_number]}\n\n #if we have less than one activity, set the activity_sequence_number to 1\n if @trip_activities.size < 1\n @trip_activity.activity_sequence_number = 1\n else\n #if we have more than one activity, get last activity sequence\n #and set this new activity's position (in the form field), to n+1\n @trip_activity.activity_sequence_number = @trip_activities.last.activity_sequence_number+1\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_activity }\n end\n end",
"title": ""
},
{
"docid": "22281977069753861451bec372649f53",
"score": "0.5959152",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "22281977069753861451bec372649f53",
"score": "0.5958791",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "9ca42a45393c1e020ff776546ec82ff2",
"score": "0.595148",
"text": "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "a695227d4762f82bb08b4fa10c3d1c4c",
"score": "0.5950171",
"text": "def new\n @activitygoal = Activitygoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activitygoal }\n end\n end",
"title": ""
},
{
"docid": "c35a1d9f6f1851282538cedf1289e7e2",
"score": "0.5949782",
"text": "def new\n @questions = Question.find(:all, :order => :id, :conditions => { :question_type => 1 } )\n @activity = @response.activities.build\n # was @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"title": ""
},
{
"docid": "ddf761cdb4f4b162c59da7bf2b4f601c",
"score": "0.59465754",
"text": "def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reference }\n end\n end",
"title": ""
},
{
"docid": "210cb52f966601b0392e441c71f82390",
"score": "0.59445184",
"text": "def new\n @activity_log = ActivityLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_log }\n end\n end",
"title": ""
},
{
"docid": "f2df1a2fcbee6d68ac43106ab661d850",
"score": "0.5941048",
"text": "def new\n @contact_note = current_user.contacts.find(params[:contact_id]).contact_notes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_note }\n end\n end",
"title": ""
},
{
"docid": "a2cfeba4b3705559e150934bf2c4ea4f",
"score": "0.5940227",
"text": "def new\n @activity = Activity.new\n @user = User.where(:id => params[:uid]).first\n @activity.images.build if @activity.images.blank?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"title": ""
},
{
"docid": "a73329b0426887f3666260aaad02d2f2",
"score": "0.59391445",
"text": "def new\n if current_user != nil \n @edition_mode=true;\n @current_tab = \"activities\"\n #@activity_template = Activity.find(params[:template_id])\n @activity_template = Activity.find(15)\n @activity = Activity.new()\n @activity_template.boxes.each do |box|\n box_clone = box.clone\n @activity.boxes << box_clone\n end\n @functionalities = Functionality.all\n @person_categories = PersonCategory.all\n @person_roles = PersonRole.all\n @event_types = EventType.all\n @event_places = EventPlace.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n else\n redirect_to activities_path\n end\n end",
"title": ""
},
{
"docid": "2320e84e6916e15fa84c1d8774cdb5a4",
"score": "0.59337986",
"text": "def new\n @cms_reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cms_reference }\n end\n end",
"title": ""
},
{
"docid": "166128c5df4d992606269b11e0624cb8",
"score": "0.59331656",
"text": "def new\n @patternlink = Patternlink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patternlink }\n end\n end",
"title": ""
},
{
"docid": "0cebe688633e5a61ad1070b5ba9af09a",
"score": "0.59288234",
"text": "def new\n @go_relation = GoRelation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_relation }\n end\n end",
"title": ""
},
{
"docid": "2a6a337dd70d79ad5795ca1a7e189669",
"score": "0.592545",
"text": "def create\n\n @ref_metum = RefMetum.new(ref_metum_params)\n\n respond_to do |format|\n if @ref_metum.save\n format.html { redirect_to '/refs/'+@ref_metum.ref.slug, notice: 'Viitteeseen lisätty tieto onnistuneesti.' }\n format.json { render :show, status: :created, location: @ref_metum }\n else\n @refs = Ref.all\n @attrs = RefAttribute.all\n format.html { render :new }\n format.json { render json: @ref_metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c95001594a4c3afbc66acdf59c889d6",
"score": "0.5923385",
"text": "def new_with_references(params)\n self.id = (params[:_id] || params[:id])\n self.update_with_references(params)\n end",
"title": ""
},
{
"docid": "0b55bb943d8712833279e398eddc613b",
"score": "0.59126186",
"text": "def new\n @history = History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history }\n end\n end",
"title": ""
},
{
"docid": "0b55bb943d8712833279e398eddc613b",
"score": "0.59113014",
"text": "def new\n @history = History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history }\n end\n end",
"title": ""
},
{
"docid": "0b55bb943d8712833279e398eddc613b",
"score": "0.59113014",
"text": "def new\n @history = History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history }\n end\n end",
"title": ""
},
{
"docid": "0b55bb943d8712833279e398eddc613b",
"score": "0.59113014",
"text": "def new\n @history = History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history }\n end\n end",
"title": ""
},
{
"docid": "0b55bb943d8712833279e398eddc613b",
"score": "0.59113014",
"text": "def new\n @history = History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history }\n end\n end",
"title": ""
},
{
"docid": "cf8ba412aaad4be46f8d76835d454fe8",
"score": "0.5906638",
"text": "def new\n @participation_type = ParticipationType.new(ParticipationType::RDF_PARTICIPATION_TYPE_NEW_URI, \"\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participation_type }\n end\n end",
"title": ""
},
{
"docid": "939eb9194b7c224df34b3f94cf4effce",
"score": "0.59048736",
"text": "def new\n @reference_check = ReferenceCheck.new\n @reference_check.candidate_id = params[:candidate_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_check }\n end\n end",
"title": ""
},
{
"docid": "48e016a4f50f164efc3e0512f0ebb45a",
"score": "0.59012955",
"text": "def set_ref_item_for_new\n ref_params = params[:references]\n if ref_params.present?\n ref_record_type = ref_params[:record_type]\n ref_record_id = ref_params[:record_id]\n end\n unless ref_record_type.present? && ref_record_id.present? && object_instance.respond_to?(:set_referring_record)\n return\n end\n\n # The reference will actually get created when the object instance is saved\n object_instance.set_referring_record(ref_record_type, ref_record_id, current_user)\n end",
"title": ""
},
{
"docid": "bd800da9d0fdb28e45beb88b3adb01a0",
"score": "0.5898022",
"text": "def create\n new_referent = Referent.new(referent_params)\n\n if new_referent.save\n json_response(new_referent)\n else\n render json: { errors: new_referent.errors}, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "9c5195a59ccf4ce0b6d0823e43bb5b0a",
"score": "0.5896042",
"text": "def new\n @activity_set = ActivitySet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_set }\n end\n end",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.