query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
DELETE /user_accounts_groups/1 DELETE /user_accounts_groups/1.json
def destroy @user_accounts_group.destroy respond_to do |format| format.html { redirect_to user_accounts_groups_url, notice: 'User accounts group was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end", "def destroy\n @groups = Group.find(params[:id])\n @groups.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to user_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n u1 = User.where(:login=>@group.name).select(:id)\n @u2 = User.find(u1)\n @u2.destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end", "def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @add_group_to_user = AddGroupToUser.find(params[:id])\n @add_group_to_user.destroy\n\n respond_to do |format|\n format.html { redirect_to add_group_to_users_url }\n format.json { head :no_content }\n end\n end", "def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end", "def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end", "def remove_user_from_group(user_id, group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users/#{user_id}\"\n puts \"@url is #{@url}\"\n\n @deleteResponse = HTTParty.delete(@url, :headers => $header)\n puts(\" DELETE to remove user from group has Response.code #{@deleteResponse.code} and getResponse is #{@deleteResponse}\")\nend", "def destroy\n @current_user.quit_group(@group)\n respond_to do |format|\n format.html { redirect_to groups_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @user_id = @group.user_id\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url(:user_id=>@user_id) }\n # format.html { redirect_to groups_sidebartab_url(:user_id=>@user_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @usergroup.destroy\n respond_to do |format|\n format.html { redirect_to usergroups_url, notice: 'User group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n return\nend", "def destroy\n @usergroup.destroy\n respond_to do |format|\n format.html { redirect_to usergroups_url, notice: 'Usergroup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_group_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_updates_url, notice: 'Group update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n\n mbs = Membership.where \"group_id = ?\", @group.id\n\n mbs.each do |m|\n m.destroy\n end\n\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n authorize! :destroy, @group\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @access_group = AccessGroup.find(params[:id])\n @access_group.destroy\n\n respond_to do |format|\n format.html { redirect_to access_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_user.destroy\n respond_to do |format|\n format.html { redirect_to group_users_url, notice: 'group_user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Group.delete_groups_and_acls([id])\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n begin\n group = Group.find(params[:id])\n group.destroy\n render json: { \"notice\"=>\"group deleted successfully\" }\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record deleted.\" }\n end\n end", "def delete(group_id)\n if expired?(@begin_time)\n @auth = get_auth(@api_key)\n end\n Log.debug(\"#{@base_url}#{@get_post_delete_url}#{group_id}\")\n user_group = RestClient.delete \"#{@base_url}#{@get_post_delete_url}#{group_id}\", header\n end", "def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @request_group.destroy\n respond_to do |format|\n format.html { redirect_to request_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_user_group = UserGroup.find_by(id: current_user.id)\n @user_group = UserGroup.find_by(id: params[:id])\n if @user_group.user_id == current_user || (current_user.admin == true && @current_user_group.group_id == @user_group.group_id)\n @user_group.destroy\n render json: {message: \"this user group has been successfully deleted\"}\n else\n render json: {:errors => @user_group.errors.full_messages}, Status: :Unauthorized\n end\n end", "def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end", "def destroy\n @groupc_user = GroupcUser.find(params[:id])\n @groupc_user.destroy\n\n respond_to do |format|\n format.html { redirect_to groupc_users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group = @authorized_group\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to group_users_path(@group) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @user_group = UserGroup.find(params[:id])\n @user_group.destroy\n\n respond_to do |format|\n format.html do\n if request.env['HTTP_REFERER']\n redirect_to :back\n else\n redirect_to :controller => :user_groups, :action => :index\n end\n end\n format.xml do\n head :ok\n end\n end\n end", "def destroy\n @customers_group.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customers_group.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group_key.destroy\n respond_to do |format|\n format.html { redirect_to group_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n redirect_to :action => :index and return unless is_owner?\n for member in @group.members\n member.destroy\n end\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact_group.destroy\n\n render json: @contact_group, status: :ok\n end", "def destroy\n @client.resource_groups.delete(@resource_group)\n end", "def destroy\n @item_group = ItemGroup.find(params[:id])\n redirect_to root_path unless @item_group.user == request.user\n @item_group.destroy\n\n respond_to do |format|\n format.html { redirect_to item_groups_path }\n format.json { head :ok }\n end\n end", "def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n audit(@group, \"destroy\", @group.name )\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_group_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_fields_url, notice: 'Group field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n end\n end", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end", "def destroy\n @reagent_group = ReagentGroup.find(params[:id])\n @reagent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n users = @group.users \n users.each do |user|\n if user.groups.length == 1\n events = Event.where(:organizer => user.id)\n events.each do |event|\n event.destroy\n end\n user.destroy\n end\n end \n \n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n\n head :no_content\n end", "def destroy\n UserGroup.find_by(user_id: @user.id).destroy if UserGroup.find_by(user_id: @user.id).present?\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: t('flash.notice.users.successfully_destroyed') }\n format.json { head :no_content }\n end\n end", "def delete_group \n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html {redirect_to dashboard_path}\n end\n end", "def destroy\n @member_group.destroy\n respond_to do |format|\n format.html { redirect_to member_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent_group = AgentGroup.find(params[:id])\n @agent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @yeargroup = Yeargroup.find(params[:id])\n @yeargroup.destroy\n\n respond_to do |format|\n format.html { redirect_to yeargroups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = Group.find(params[:id])\n authorize @group, :destroy?\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(browse_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @register_group = RegisterGroup.find(params[:id])\n @register_group.destroy\n\n respond_to do |format|\n format.html { redirect_to register_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_user_request.destroy\n respond_to do |format|\n format.html { redirect_to group_user_requests_url, notice: 'Group user request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @esol_group = EsolGroup.find(params[:id])\n @esol_group.destroy\n\n respond_to do |format|\n format.html { redirect_to esol_groups_url }\n format.json { head :no_content }\n end\n end", "def delete_from_group\n @user = User.find(params[:user_id], :select => \"id\")\n @group.delete_from_group(@user)\n\n respond_to do |format|\n format.js\n end\n end", "def destroy\n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \t# we can destroy group only if current user is owner or current user is admin\n \tif @group.owner_id = current_user.id || is_admin?(current_user)\n\t @group.destroy\n\t respond_to do |format|\n\t format.html { redirect_back_or mygroups_path }\n\t format.json { head :no_content }\n\t end\n\t end\n end", "def destroy\n @usernetworkgroup.destroy\n respond_to do |format|\n format.html { redirect_to usernetworkgroups_url, notice: 'Usernetworkgroup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_group.destroy\n respond_to do |format|\n format.html { redirect_to resource_groups_url, notice: 'Resource group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: t('flash.notice.groups.successfully_destroyed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group = @course.groups.find(params[:id])\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_related_groups\n \n end" ]
[ "0.77438855", "0.77144307", "0.7708459", "0.76923585", "0.7511899", "0.74640507", "0.7452043", "0.7434376", "0.7433611", "0.7415008", "0.74116623", "0.7407413", "0.7373673", "0.73659796", "0.736591", "0.734441", "0.7338477", "0.7337965", "0.7326458", "0.73036504", "0.73036504", "0.72879386", "0.72879386", "0.7274132", "0.7274132", "0.7274132", "0.7274132", "0.7274132", "0.72671425", "0.72671425", "0.72671425", "0.72671425", "0.72671425", "0.72671425", "0.7258051", "0.7251277", "0.7243133", "0.72349346", "0.7227874", "0.7211385", "0.71877086", "0.7173359", "0.71657383", "0.7153252", "0.71501243", "0.7133636", "0.71277606", "0.7127195", "0.71051735", "0.7103821", "0.70897144", "0.70897144", "0.70890266", "0.7088454", "0.70820856", "0.7060294", "0.7058645", "0.7051415", "0.70510936", "0.7049345", "0.7040823", "0.7038151", "0.7035951", "0.7030564", "0.7019088", "0.7014009", "0.7012415", "0.70074815", "0.70034564", "0.700258", "0.7001543", "0.7000057", "0.6999818", "0.699953", "0.69945467", "0.69931483", "0.69925153", "0.69915366", "0.6990117", "0.6988276", "0.69829655", "0.69764036", "0.6975747", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6975094", "0.6974689", "0.69712234" ]
0.757578
4
Use callbacks to share common setup or constraints between actions.
def set_user_accounts_group @user_accounts_group = UserAccountsGroup.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_accounts_group_params params.require(:user_accounts_group).permit(:account_id, :group_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_marketplace_bid_no_bid_question @marketplace_bid_no_bid_question = ::Marketplace::BidNoBidQuestion.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def marketplace_bid_no_bid_question_params params.permit(:question_text, :position, :tender_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def parameters\n nil\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7120904", "0.70538116", "0.69469863", "0.6901261", "0.67348766", "0.6717708", "0.66874576", "0.6676195", "0.66601187", "0.65563625", "0.6525127", "0.64565873", "0.64494514", "0.644928", "0.64452374", "0.6433947", "0.6412815", "0.6412815", "0.6391939", "0.63792473", "0.63792473", "0.63738", "0.6360176", "0.6354222", "0.6284756", "0.6277987", "0.6245304", "0.62259704", "0.62243503", "0.6223834", "0.62104595", "0.62081766", "0.61759263", "0.61721593", "0.6168236", "0.61587787", "0.6143901", "0.6135065", "0.61204714", "0.61065775", "0.60983306", "0.6073666", "0.6051939", "0.6040974", "0.6036216", "0.60291374", "0.6020614", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.60180086", "0.6017416", "0.60161096", "0.6006702", "0.6002367", "0.600212", "0.5996321", "0.59943277", "0.59942585", "0.59858114", "0.5982845", "0.59766084", "0.5973769", "0.5968758", "0.59653395", "0.5964966", "0.5964966", "0.5957481", "0.59511584", "0.5951042", "0.5948871", "0.59427315", "0.5930573", "0.5930121", "0.5926885", "0.5923959", "0.59182686", "0.5916637", "0.5913613", "0.5912174", "0.5906678", "0.59059656", "0.5904252", "0.5901623", "0.58983696", "0.58962476", "0.589576", "0.5893608" ]
0.0
-1
give the links for the semi_index partial
def edit_link(obj) case obj.class.to_s when "Tenant" edit_tenant_path(obj) when "Semester" edit_semester_path(obj) when "Department" edit_department_path(obj) when "Subject" edit_subject_path(obj) when "Faculty" edit_faculty_path(obj) when "Exam" edit_exam_path(obj) when "Batch" edit_batch_path(obj) when "SchoolType" edit_school_type_path(obj) when "Student" edit_student_path(obj) when "Section" edit_section_path(obj) when "BloodGroup" edit_blood_group_path(obj) when "Resource" edit_resource_path(obj) when "Role" edit_role_path(obj) when "UserProfile" edit_user_profile_path(obj) when "Grade" edit_grade_path(obj) when nil nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_for_index; end", "def url_for_index; end", "def define_index_links(query)\n @links ||= []\n\n # Add some extra links to the index user is sent to if they click on an\n # undefined location.\n if query.flavor == :at_where\n @links << [:list_observations_location_define.l,\n { controller: :location, action: :create_location,\n where: query.params[:user_where] }]\n @links << [:list_observations_location_merge.l,\n { controller: :location, action: :list_merge_options,\n where: query.params[:user_where] }]\n @links << [:list_observations_location_all.l,\n { controller: :location, action: :list_locations }]\n end\n\n @links << [\n :show_object.t(type: :map),\n add_query_param(\n { controller: :observations, action: :map },\n query\n )\n ]\n\n @links << coerced_query_link(query, Location)\n @links << coerced_query_link(query, Name)\n @links << coerced_query_link(query, Image)\n\n @links << [\n :list_observations_add_to_list.t,\n add_query_param(\n { controller: :species_list, action: :add_remove_observations },\n query\n )\n ]\n\n @links << [\n :list_observations_download_as_csv.t,\n add_query_param(\n { controller: :observations, action: :download },\n query\n )\n ]\n @links\n end", "def show_super_search_links_on_index\n false \n end", "def index\n @urls = ['index', 'fade_replace', 'simple_blind_ror', 'javascript']\n @descriptions = {'index' => \"listing of all demos/methods. This page\",\n \n 'fade_replace' => \"link triggers central page replacement. This will be used in the final project. Uses ror/rjs\",\n 'simple_blind_ror' => \"simplistic scriptaculous effects using ror. demo only.\",\n 'javascript' => \"uses javascript directly. demo only. straight from Scriptaculous site.\"\n }\n end", "def index\n \t#display text and links \n end", "def get_all_index_links_to_each_vland_show\n \t\t# index link for shows\n \t\tresp = get_resp(self.url)\n \t\tshow_index_link = self.url + resp.match(/\"\\/([^\"]*\\/shows)/)[1]\n \t\t#should probbly store this on something but yolo\n \t\tresp_shows = get_resp(show_index_link)\n \t\t# create shows by urls\n \t\tresp_shows.scan(/href=\"([^\"]*show\\/[^\"]*)/).uniq.each do |show_url|\n \t\t\tshow=Show.find_or_initialize_by(url: \"https:\" + show_url.to_s.gsub(/[\"\\[\\]]/,\"\"))\n \t\t\tif show.new_record?\n \t\t\t\tshow.content_provider_id = self.id\n \t\t\t\tshow.save!\n \t\t\tend\n \t\tend\n \tend", "def sitemap_index_links\n each_sitemap_index_link.to_a\n end", "def index ; @index ; end", "def index\n # display text and links\n end", "def navigation\n [IndexHtmlUnit.new.link] + ModelHtmlUnitCollection.links_by_make(make)\n end", "def generate_indexes\n @first_page = first_page\n generate_index('index')\n generate_index('indexes')\n end", "def process_index\n bindings = {\n :url => @definition.get_url,\n :name => @definition.get_name,\n :resources => @definition.resources,\n :description => @definition.get_description,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:index)\n page.save_template('index.html', bindings)\n end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def route_index; end", "def to_index\n\t\tbegin\n\t\t\tplaylist=Playlist.instance\n\t\t\t@artistas=playlist.artistas\n\t\t\t@artistaSel=params['artista']\n\t\t\t@discoSel=params['disco']\n\t\t\thaml :index\n\t\trescue Exception => ex\n\t\t LOG.error(\"ERROR: #{ex}\\n\"){ \n\t\t\t\tex.backtrace.join(\"\\n\")\n\t\t\t}\n\n\t\t\tshow_error('error.jpg','Auch! Hubo un error!')\n\t\tend\n\tend", "def index_template\n :index\n end", "def index_template\n :index\n end", "def index_table(klass, objects)\n # get links from class' helper\n links = send(\"#{klass.table_name}_index_links\", objects).compact\n\n # if there are any batch links, insert the 'select all' link\n batch_ops = !links.reject{|l| !l.match(/class=\"batch_op_link\"/)}.empty?\n links.insert(0, select_all_link) if batch_ops\n \n # render, getting fields and checking if there are no objects at all\n render(\"layouts/index_table\",\n :klass => klass,\n :objects => objects,\n :paginated => objects.respond_to?(:total_entries),\n :links => links.flatten.join.html_safe,\n :fields => send(\"#{klass.table_name}_index_fields\"),\n :batch_ops => batch_ops\n )\n end", "def preview_index(urls, path: request.path)\n render(path: __dir__ + \"/index.erb\", locals: { urls: Array(urls), path: path })\n end", "def links; end", "def links; end", "def render_index(posts, prev_page, next_page)\n # Get the HTML of each Post and combine them\n posts.collect! { |p| p.html(File.join('/', @post_location, p[:id].to_s)) }\n data = { \"body\" => posts.join(\"\\n\\n\") }\n\n # Append next/previous links if necessary\n if !prev_page.nil?\n data[\"body\"] += \"<a class=\\\"nav\\\" id=\\\"future\\\" href=\\\"#{prev_page}\\\">Newer Posts</a>\\n\"\n end\n\n if !next_page.nil?\n data[\"body\"] += \"<a class=\\\"nav\\\" id=\\\"past\\\" href=\\\"#{next_page}\\\">Older Posts</a>\\n\"\n end\n\n # Return the rendered index\n populate(data)\n end", "def anchors_index\n ANCHORS_INDEX_PLACEHOLDER\n end", "def index?; end", "def construct_index\n end", "def index\n\t\trelators\n\tend", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n @sites = Site.where(:reference => false, :page_rank.gt => -1).sort(:name).all\n @reference_sites = Site.where(:reference => true).sort(:name).all\n respond_with(@sites)\n end", "def index\n @global_links = GlobalLink.all\n @tier_two_links = TierTwoLink.all\n end", "def gen_main_index\n template = RDoc::TemplatePage.new @template::INDEX\n\n open 'index.html', 'w' do |f|\n classes = @classes.sort.map { |klass| klass.value_hash }\n\n values = {\n 'main_page' => @main_page,\n 'initial_page' => main_url,\n 'style_url' => style_url('', @options.css),\n 'title' => CGI.escapeHTML(@options.title),\n 'charset' => @options.charset,\n 'classes' => classes,\n }\n\n values['inline_source'] = @options.inline_source\n\n template.write_html_on f, values\n end\n end", "def index; @index; end", "def index\n render template: 'links/index.html.erb', locals: {\n links: Link.includes(:comments, :board).group(:id).order(\"SUM(upvotes_count - downvotes_count) DESC\").page(params[:page]),\n board: Board.group(:id).joins(:links).find_by(\"boards.id = links.board_id\")\n }\n end", "def navigation\n [IndexHtmlUnit.new.link, MakeHtmlUnitCollection.link_by_make(make)]\n end", "def default_index_subaction\n list_all\n end", "def index\n\t\t\n\tend", "def index\n\t\t\n\tend", "def index\n\t\t\n\tend", "def index\n\t\t\n\tend", "def index\n\t\t\n\tend", "def index\n \n if current_user.admin\n @links = Link.all\n else\n @links = Link.where(:content_code_matcher => current_user.content_code)\n end\n end", "def index\n set_current_query(@study)\n\n @entities = @study.sites.descend_by_created_at.search(get_current_search(Site)).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entities }\n format.js {\n if params[@template.dom_id_nested(:commit, @study)].blank? && params[:page].blank?\n render :file => 'admin/study_sites/index.html.erb'\n else\n render(:update) {|page| page[dom_id(@study, :sites_index)].replace :file => \"admin/study_sites/index\" }\n end\n }\n end\n end", "def index\n render_index\n end", "def default_index_subaction\n list_locations\n end", "def show\n set_index_options\n end", "def link_with_local_index(text, path)\n resource = sitemap.find_resource_by_path(path)\n # \"<li> #{path} </li>\"\n output = link_to(text, resource)\n if resource && current_page.url.include?(resource.url)\n index = local_index(current_page.url)\n %(<li class=\"list-group-item\"><h5>#{output}</h5>#{index}</li>)\n else\n \"<li class='list-group-item'><h5>#{output}</h5></li>\"\n end\n end", "def index\n \n end", "def lttfindex\n end", "def generate_indexes\n @posts = DB[:posts].all\n index_layout = File.read \"#{root}/_layouts/index.html\"\n @output = Liquid::Template.parse(index_layout).render('site'=>self)\n path = \"#{root}/_site/index.html\"\n File.open(path, 'w'){ |f| f.write(@output) }\n end", "def build_index_helper(resource)\n helper_name = \"index_#{resource.name_prefix}#{resource.plural}#{@@link_helpers_suffix}\"\n return if already_defined?(helper_name)\n @module.module_eval <<-end_eval\n def #{helper_name}(*args)\n opts = args.extract_options!\n label = opts.delete(:label) || 'Index'\n custom_classes = opts.delete(:class) || ''\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.plural}', 'index', *custom_classes.split)\n opts[:sending] = opts.delete(:parameters) and ResourcefulViews.deprecation_warning('Please use :sending instead of :parameters') if opts[:parameters]\n args << opts.delete(:sending) if opts[:sending]\n link_to(label, #{resource.name_prefix}#{resource.plural}_path(*args), opts)\n end\n end_eval\n end", "def index(options = {}, &block)\n options[:as] ||= :table\n config.set_page_presenter :index, ActiveAdmin::PagePresenter.new(options, &block)\n end", "def index\n render \"opt10081s/index\",:layout=>false\n end", "def render_additional_index_buttons\n template = self.additional_index_buttons\n if !template.nil?\n result = render_to_string :partial => template\n result.html_safe\n else\n \"\"\n end\n end", "def test_index\n # make sure public can access\n get(:index)\n\n assert_response(:success)\n assert_head_title(:glossary_term_index_title.l)\n\n GlossaryTerm.find_each do |term|\n assert_select(\n \"a[href *= '#{glossary_term_path(term.id)}']\", true,\n \"Glossary Index missing link to #{term.unique_text_name})\"\n )\n end\n end", "def markdown_filter_link_index(markdown)\n return markdown if index.nil? || index.empty?\n\n markdown << \"\\n\\n\"\n index.each { |ref| markdown << \"[#{ref.name}]: #{ref.url}\\n\" }\n markdown\n end", "def render_simple_index(aggregation, options = {})\n return \"<p>No Records Found.</p>\" if aggregation[0].class.name == 'NilClass'\n options.symbolize_keys!\n options[:exclude] ||= []\n options[:ignored_foreign_keys] ||= []\n if options[:prefix]\n options[:prefix] += '_'\n else\n options[:prefix] = ''\n end\n linkcols = 0\n [options[:display_show], options[:display_edit], options[:display_destroy]].each do |opt|\n opt = true if opt.nil?\n linkcols += 1 if opt == true\n end\n options[:display_show] = true if options[:display_show].nil?\n options[:display_edit] = true if options[:display_edit].nil?\n options[:display_destroy] = true if options[:display_destroy].nil?\n haml_tag :table do\n haml_tag :thead do\n aggregation[0].class.columns.each do |c|\n next if options[:exclude].include? c.name.to_sym\n haml_tag :th do\n haml_concat h(c.name.humanize)\n end\n end\n linkcols > 0 ? haml_tag(:th, \"Options\", {:colspan => linkcols}) : nil\n end\n\n haml_tag :tbody do\n aggregation.each do |instance|\n haml_tag :tr do\n instance.class.columns.each do |c|\n haml_tag :td do\n if ((c.name.split('_')[-1] == 'id' && c.name != 'id') && (!options[:ignored_foreign_keys].include?(c.name.to_sym)))\n # handle foreign key fields\n foreign_model = (options[:prefix].to_s + c.name.gsub(/_id$/, '')).camelize.constantize\n if foreign_model.column_names.include?('name')\n haml_concat h(instance.__send__(foreign_model.to_s.underscore).name)\n elsif foreign_model.column_names.include?('description')\n haml_concat h(instance.__send__(foreign_model.to_s.underscore).description)\n else\n haml_concat h(instance.__send__(c.name))\n end\n else\n haml_concat h(instance.__send__(c.name))\n end # big if\n end #td\n end #columns.each\n if options[:display_show]\n haml_tag :td do\n haml_concat link_to('Show', url_for(instance))\n end\n end\n if options[:display_edit]\n haml_tag :td do\n haml_concat link_to('Edit', url_for(instance) + \"/edit\")\n end\n end\n if options[:display_destroy]\n haml_tag :td do\n haml_concat link_to('Destroy', url_for(instance), :confirm => \"Are You Sure?\", :method => :delete)\n end\n end\n end #tr\n end #aggregation\n end #tbody\n end #table\n end", "def index\n respond_with(@navlinks = Navlink.all_main_links.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 10))\n end", "def index\n return not_found unless request.format.to_sym.in?(%i[html md]) || !request.path.include?('.')\n\n redirect_to help_page_path(library: library,\n section: index_section,\n subsection: index_subsection,\n display_as: display_as)\n end", "def index_portal\n index\n end", "def index\n\t\tprepare_variable_for_index_template\n\tend", "def index\n @library_location = 2\n super\n end", "def create_ref_link(index)\n %Q([<a href=\"##{NOTE}-#{index}\">#{index}</a>])\n end", "def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end", "def index\n render \"opt10059s/index\",:layout=>false\n end", "def set_relleno_and_index_url\n @relleno = Relleno.find(params[:id])\n set_index_url\n logger.debug \"@relleno = #{@relleno}, @index_url = #{@index_url}\"\n end", "def index\n @notes = collection_based_on_path(request.path_parameters)\n @notes = custom_index_sort if params[:sort]\n render(:index)\n end", "def document_show_link_field\n Blacklight.config[:index][:show_link].to_sym\n end" ]
[ "0.67462087", "0.67462087", "0.6709865", "0.6501287", "0.6362406", "0.63517994", "0.62613326", "0.62010217", "0.61797297", "0.6147147", "0.61405456", "0.6132732", "0.6124785", "0.6122753", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.612188", "0.61189926", "0.6096177", "0.6067634", "0.6067634", "0.605212", "0.6042939", "0.5986626", "0.5986626", "0.5977642", "0.5966985", "0.5955552", "0.5953905", "0.59468144", "0.59158856", "0.59158856", "0.59158856", "0.590085", "0.58730924", "0.58711165", "0.58702356", "0.58699566", "0.5862297", "0.585563", "0.58537614", "0.58537614", "0.58537614", "0.58537614", "0.58537614", "0.5849856", "0.5845042", "0.5843789", "0.5841183", "0.58322847", "0.5828306", "0.58258384", "0.5803765", "0.57986355", "0.5791001", "0.57753414", "0.57700956", "0.57576066", "0.5756494", "0.57558745", "0.5755044", "0.5725839", "0.5718026", "0.57162744", "0.5715544", "0.57113576", "0.5711149", "0.5710441", "0.57089955", "0.5699943", "0.5696288", "0.5695732" ]
0.0
-1
If extra local variables have to passed to the partial, they will passed in to params If no extra variables are required, a blank hash will be used as a default value.
def link_to_add_fields(name, f, association, params={}) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| #merge the params hash with the form builder being sent as a local variable to the partial render(association.to_s.singularize + "_fields", {:f => builder}.merge(params)) end link_to_function(name, "add_fields(this, '#{association}', '#{escape_javascript(fields)}')") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_params defaults = {}\n defaults.merge layout: layout\n end", "def params\n @params.blank? ? default_hash : @params\n end", "def params\n {}\n .merge!(base_params)\n .merge!(tracker_default_params)\n .merge!(global_options_params)\n .merge!(hit_params)\n .merge!(custom_dimensions)\n .merge!(custom_metrics)\n .merge!(measurement_params)\n .reject {|_,v| v.nil?}\n end", "def params\n base_params.\n merge(tracker_default_params).\n merge(global_options_params).\n merge(hit_params).\n merge(custom_dimensions).\n merge(custom_metrics).\n merge(custom_params).\n reject {|_,v| v.nil?}\n end", "def defaulted_populated_params\n default_params = { \"secret\" => Authsig.house_secret }.merge(defaults.params)\n default_params.merge(populated_params)\n end", "def start_with_default_params!\n default_params = upper(:@@default_params) || {}\n @params.reverse_merge!(default_params)\n end", "def optional_params\n return {}\n end", "def full_params\n full_credentials.merge(\n additional_params\n ).merge(\n basic_variables\n )\n end", "def junk_params\n params.fetch(:junk, {})\n end", "def render_partial(*ignore_args); end", "def my_foo_params\n params.fetch(:my_foo, {})\n end", "def render_function_hash(input_pair_array)\n hash = {};\n hash[:partial] = input_pair_array[0].to_s;\n if(!input_pair_array.empty?) #if this partial has inputs\n hash[:locals] = input_pair_array[1]; #put in hash\n end\n return hash;\n end", "def default_params\n {}\n end", "def overwritten_params\n result = {}\n %i[email mobile_phone].each do |param|\n result[param] = nil if person_params.key?(param) && !person_params[param].present?\n end\n result\n end", "def params\n default_params.merge @params\n end", "def partial; end", "def partial; end", "def partial; end", "def partial; end", "def _setFinalParams(additionalParams)\n finalParams = Marshal.load(Marshal.dump(@renderParameters))\n if additionalParams.is_a?(Hash)\n additionalParams.each do |k, v|\n if v\n finalParams[k] = v\n end\n end\n end\n finalParams['workflow'] = @workflowId\n finalParams\n end", "def prep_variables\n end", "def partial?; end", "def default_locals\n {}\n end", "def outside_params\n params.fetch(:outside, {})\n end", "def set_shared_layout_vars(model, required, optional = {})\n @twitter_username = model.twitter_username\n @location = model.location\n @description = model.description\n @website = website_url(model.website)\n @website_clean = @website ? @website.gsub(/https?:\\/\\//, \"\") : \"\"\n @name = required.fetch(:name)\n @avatar_url = required.fetch(:avatar_url)\n @email = optional.fetch(:email, nil)\n @available_for_hire = optional.fetch(:available_for_hire, false)\n @user = optional.fetch(:user, nil)\n @is_org = model.is_a? Carto::Organization\n @tables_num = (@is_org ? org_datasets_public_builder(model) : user_datasets_public_builder(model)).count\n @maps_count = (@is_org ? org_maps_public_builder(model) : user_maps_public_builder(model)).count\n\n @needs_gmaps_lib = @most_viewed_vis_map.try(:map).try(:provider) == 'googlemaps'\n @needs_gmaps_lib ||= @default_fallback_basemap['className'] == 'googlemaps'\n\n gmaps_user = @most_viewed_vis_map.try(:user) || @viewed_user\n @gmaps_query_string = gmaps_user ? gmaps_user.google_maps_query_string : @viewed_org.google_maps_key\n end", "def additional_parameters\n @additional_parameters ||= {}\n end", "def missing_data_params\n default_params\n end", "def special(*names)\n # Ensure special param are also a valid param (see ParameterMerger#param)\n names_hash = names.map { |n| [n, nil] }.to_h\n\n # this just Hash#reverse_merge! as implemented in activesupport-4.2\n default_params.merge!(names_hash) { |_key, left, _right| left }\n special_params.concat(names)\n end", "def params\n @opts[:params] || {}\n end", "def explanatory_params\n params.fetch(:explanatory, {})\n end", "def mountain_params\n params.fetch(:mountain, {})\n end", "def update_partial_input(partial_file, key=nil, value=nil)\n @partials ||= {};\n @partials[partial_file.to_sym] ||= {} #hash for inputs\n if(!key.nil?) #don't save input if there was none\n @partials[partial_file.to_sym][key.to_sym] = value;\n end\n return;\n end", "def partial=(_arg0); end", "def prepare_params(options)\n params = options[:required] || []\n params = params.map {|p| p.to_s.snakecase}\n params.push 'locals = {}' if options[:locals].nil? || options[:locals]\n params\n end", "def show\n setup_variables(params)\n\n end", "def mandatory_params\n return {}\n end", "def partial (template, options = {})\n options = { :layout => false }.merge options\n if template.is_a? Hash\n options[:locals] = template[:locals] || {}\n template.delete(:locals) if template[:locals] \n options[:locals].merge! template\n template = template.reject{ |key, value| [:locals].include? key }.keys.first.to_s\n end \n haml(\"_#{template}\".to_sym, options)\n end", "def unnovel_params\n params.fetch(:unnovel, {})\n end", "def default_values\n h = {}\n template.parameters.each do |p|\n h[p.name] = h.default\n end\n h\n end", "def hash_to_embed\n if not self.initial?\n self.params_hash\n else\n \"\"\n end\n end", "def params\n default_options.merge(@params)\n end", "def empty!\n super\n @params = ActiveSupport::OrderedHash.new\n end", "def hold_request_params\n params.fetch(:hold_request, {})\n end", "def hold_request_params\n params.fetch(:hold_request, {})\n end", "def params\n {}\n end", "def static_game_datum_params\n params.fetch(:static_game_datum, {})\n end", "def params= param_hash\n @params = default_params.merge(param_hash)\n\n if @format == :html\n @params.delete(:format)\n else\n @params.merge!(:format => format.to_s)\n end\n end", "def default_parameters\n {}\n end", "def default_params(h={})\n raise ArgumentError, 'Default params must be a hash' unless h.is_a?(Hash)\n @default_params ||= {}\n return @default_params if h.blank?\n @default_params.merge!(h)\n end", "def validate_params\n template_param.merge(options)\n end", "def validate_params\n template_param.merge(options)\n end", "def setupNewParam(_varied)\n _param = {} ;\n @scatterPolicy.each{|_paramName, _policy|\n _param[_paramName] = ( _varied.key?(_paramName) ?\n _varied[_paramName] :\n getValueByPolicy(_policy) ) ;\n }\n return _param ;\n end", "def partial(file=nil, locals={})\n # self.instance_variables.each { | k | \n # locals[k.gsub(/@/,'').to_s] = eval(k)\n # }\n # p locals.inspect\n locals[:request] = @request\n Doozer::Partial.partial(file, locals, route=@route)\n end", "def render_partial(context, options, &block); end", "def setup_params(parms, for_download=false)\n report_state_hash = YAML.load(self.view_state)\n\n parms[:parameter_field] = {:excel_only => '0' }\n report_state_hash[:parameter_fields_values].each do |parm_set|\n parms[:parameter_field][parm_set[:field_name]] = parm_set[:field_value]\n parms[:parameter_field][\"#{parm_set[:field_name]}-sign\"] = report_state_hash[:operator_signs][parm_set[:field_value]]\n end\n parms[:parameter_field]['excel_only'] = for_download ? '0' : '1'\n parms['apply_functions_hidden_field'] = report_state_hash[:functions]\n parms['group_by_hidden_field'] = report_state_hash[:search_engine_group_by_columns]\n parms['order_by_hidden_field'] = report_state_hash[:search_engine_order_by_columns]\n end", "def setup_form_locals(params, bib_record, current_user)\n locals = {\n bib_record: bib_record,\n feedback_options: FEEDBACK\n }\n locals\n end", "def filter_params\n if not @params_filtered\n # these values are automatically persisted\n # via the session\n @current_map = select_param :map, :symbol => true\n @current_language = select_param :lang\n @current_scope = select_param :scope\n @current_id = select_param :id\n # update the view state with values that must be communicated down-stream\n properties = PropertySet.new()\n properties[:language] = @current_language\n properties[:scope] = @current_scope\n properties[:map] = @current_map\n properties[:home] = Globals::DEFAULT[:id]\n @view_state[:properties] = properties\n @view_state[:languages] = Globals::LANGUAGES\n @view_state[:scopes] = Globals::SCOPES\n @view_state[:maps] = Globals::MAPS\n @view_state[:notice] = PropertySet.new()\n @view_state[:error] = PropertySet.new()\n @view_state[:success] = PropertySet.new()\n @params_filtered = true\n end\n end", "def params_for_user\n {}\n end", "def params_for_user\n {}\n end", "def default_params\n @default_params ||= {}\n end", "def member_params\n # params.require(:member).permit(:name, :email, :variables, :company_id)\n params.require(:member).permit(:name, :email, :company_id, variables: params[:member][:variables].try(:keys))\n end", "def template_params\n params.require(:cms_template).permit(:title, :section_id, :layout_id, :path,\n :content_type, :tag_list, :system_name, :liquid_enabled, :handler, :draft).tap do |params|\n\n section_id = params.delete(:section_id).presence\n layout_id = params.delete(:layout_id).presence\n\n params[:section] = current_account.sections.find(section_id) if section_id\n # We need to handle the case when the layout_id is purposely nil\n params[:layout] = layout_id && current_account.layouts.find(layout_id)\n end\n end", "def params=(_); end", "def params\n {}\n end", "def partial(*args); end", "def actionator_params_with_unpopulated_values\n @actionator_params_with_unpopulated_values ||=\n actionators_from_api.map{ |actionator|\n actionator[:variables_attributes] = actionator[:params].present? ? actionator[:params].values : []\n actionator.delete :params\n actionator\n }\n end", "def load_data_with_partials(hash=nil)\n if(@partials != nil) #if a partial has actually been submitted\n hash ||= {}; #if nil, make a hash. (return value)\n hash[:htmlElts] = {}; #hash for each elementID<=>newHTML pair\n \n @partials.each { |p| #for each partial submitted\n partial_id = find_partial_name(p[0].to_s);\n\n #build the html from embedded ruby files in views and relevant inputs\n hash[:htmlElts][partial_id] = ERB.new(render_to_string(render_function_hash(p))).result;\n }\n end\n return hash;\n end", "def fry_params\n params.fetch(:fry, {})\n end", "def partial?; @unbound_fields.any?; end", "def shared_params(extra_vars:)\n {:cmdline => \"--extra-vars '#{JSON.dump(extra_vars)}'\"}\n end", "def fitness_third_params\n params.fetch(:fitness_third, {})\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def form_partial_locals(args)\n output = super\n output[:date_options] = { \n :start_year => Time.now.year - 70,\n :default => get_date_or_today(args[:value])\n }\n return output\n end", "def set_partial_path\n @partial_path = params[:partial_path]\n end", "def default_params\n case @action.to_s\n when /(show|edit|update|destroy)/\n {:id => \"some_id\"}\n else\n {}\n end\n end", "def default_params\n @default_params ||= {\n id: nil,\n class: name.gsub(/.*::/, '').downcase,\n width: nil,\n height: nil,\n border: nil,\n borders: nil,\n border_style: nil\n }\n end", "def need_params\n params.\n require(:need).\n permit(:location,\n :city,\n :start_time,\n :end_time,\n :category,\n :volunteers_needed,\n :user_id).\n merge(user_id: current_user.id)\n end", "def original_params\n @original_params || params\n end", "def block_params\n params.require(required_params).permit(default_permitted_attributes)\n end", "def pagemaster_params\n #params.require(:pagemaster).permit(:\n params.fetch(:pagemaster, {})\n end", "def merge_overrided_params!\n overrided_params = upper(:@@overrided_params) || {}\n @params.merge!(overrided_params)\n end", "def template_detail_params\n params.fetch(:template_detail, {}).permit(:task_description, :template_id, :stage_id)\n end", "def presenter_params\n params.require(:participant).permit(:name, :email, :bio).to_h.each_with_object({}) do |(k, v), h|\n h[k] = v.blank? ? nil : v\n end\n end", "def params=(hash); end", "def params=(hash); end", "def main_screen_params\n params.fetch(:main_screen, {})\n end", "def method_missing(sym, *args, &blk)\n if @_merb_partial_locals.key?(sym)\n @_merb_partial_locals[sym]\n else\n @web_controller.send(sym, *args, &blk)\n end\n end", "def assign(params, args)\n params.update(get_default_params())\n end", "def global_params\n [:publication_type_id, :is_draft, :is_deleted, :created_at, :created_by, :updated_by, :biblreviewed_at, :biblreviewed_by, :bibl_review_postponed_until, :bibl_review_postpone_comment, :content_type, :xml, :datasource, :sourceid, :ref_value]\n end", "def params(user_login:, user_password:, user_ip:, order_id:, amount:, **optional)\n {\n VWID: config.merchant_id,\n DATA: encoded_data(\n SessionType: 'Block',\n VWUserLgn: user_login,\n VWUserPsw: user_password,\n IP: user_ip,\n PhoneNumber: optional[:user_phone],\n CardId: optional[:card_id],\n OrderId: order_id,\n Amount: amount.cents,\n TemplateTag: optional[:template],\n Language: optional[:language],\n Url: optional[:return_url],\n Cheque: encoded_cheque(optional[:cheque]),\n Product: optional[:product],\n Total: optional[:total],\n ),\n }\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def additional_params\n params.to_unsafe_hash.delete_if do |key, _|\n SHOW_PAGE_PARAMS_KEYS.include?(key)\n end\n end", "def load_params\r\n vars = ['article', 'article_submission']\r\n vars.each { |v| load_param(v) }\r\n end", "def default_params(default_params=nil)\n default_params and @default_params = default_params or @default_params or {}\n end", "def params_with_values names, local_params = params\n local_params.select {|k,v| names.include?(k) && !v.blank?}\n end", "def defaults(hash)\n default_params.update(hash)\n end", "def variables\n {}\n end", "def define_variables\n @favori = session[:favori] ||= Favori.new\n @theme = User.find_theme(session)\n @language = PlmServices.get_property(:LOCAL_DEFAULT)\n\t @urlbase = \"http://\"+request.env[\"HTTP_HOST\"]\n @themes = get_themes(@theme)\n @languages = get_languages\n ###########TODO inutile @notification=PlmServices.get_property(:NOTIFICATION_DEFAULT)\n ###########TODO inutile @time_zone=PlmServices.get_property(:TIME_ZONE_DEFAULT)\n # mise en forme d'une tache (workitem)\n @payload_partial = 'shared/ruote_forms'\n WillPaginate::ViewHelpers.pagination_options[:previous_label] = t('label_previous')\n WillPaginate::ViewHelpers.pagination_options[:next_label] = t('label_next')\n WillPaginate::ViewHelpers.pagination_options[:page_links ] = true # when false, only previous/next links are rendered (default: true)\n WillPaginate::ViewHelpers.pagination_options[:inner_window] = 10 # how many links are shown around the current page (default: 4)\n WillPaginate::ViewHelpers.pagination_options[:page_links ] = true # when false, only previous/next links are rendered (default: true)\n WillPaginate::ViewHelpers.pagination_options[:inner_window] = 10 # how many links are shown around the current page (default: 4)\n WillPaginate::ViewHelpers.pagination_options[:outer_window] = 3 # how many links are around the first and the last page (default: 1)\n WillPaginate::ViewHelpers.pagination_options[:separator ] = ' - ' # string separator for page HTML elements (default: single space)\n \t@myparams = params\n \t#puts \"fin de define_variables\"\n end", "def prepare_params\n\n filtered_params = song_params\n\n # if no value specified, store a null\n filtered_params[:OrigBand] = nil if filtered_params[:OrigBand].strip.empty?\n filtered_params[:Author] = nil if filtered_params[:Author].strip.empty?\n filtered_params[:Lyrics] = nil if filtered_params[:Lyrics].strip.empty?\n filtered_params[:lyrics_ref] = nil if filtered_params[:lyrics_ref].strip.empty?\n filtered_params[:Comments] = nil if filtered_params[:Comments].strip.empty?\n\n filtered_params\n\n end" ]
[ "0.6370954", "0.6258175", "0.6215388", "0.6100431", "0.60393727", "0.5934502", "0.58746696", "0.58297503", "0.5802294", "0.5799748", "0.5788642", "0.57760745", "0.57755774", "0.5772103", "0.57194006", "0.57156736", "0.57156736", "0.57156736", "0.57156736", "0.5683473", "0.56645167", "0.56511986", "0.56154567", "0.56040424", "0.5595287", "0.5551304", "0.5538842", "0.5526241", "0.5515766", "0.54982936", "0.5483751", "0.5468139", "0.5462799", "0.54563105", "0.5454073", "0.5452369", "0.54361886", "0.54358137", "0.54338825", "0.54198724", "0.5415215", "0.54017866", "0.5399028", "0.5399028", "0.5397673", "0.53954625", "0.53829366", "0.5380968", "0.5372742", "0.53698546", "0.53698546", "0.53682375", "0.536769", "0.53576493", "0.5347323", "0.5345111", "0.5341805", "0.53390026", "0.53390026", "0.53190637", "0.5315607", "0.53109133", "0.53091395", "0.53089297", "0.5288021", "0.5283385", "0.5280325", "0.5279337", "0.5262283", "0.52618504", "0.525976", "0.525337", "0.525337", "0.52377665", "0.5234882", "0.52345365", "0.5232568", "0.523101", "0.5223454", "0.52154905", "0.5207111", "0.52041936", "0.52039605", "0.52031076", "0.52028924", "0.52028924", "0.5202037", "0.5200905", "0.519413", "0.51929593", "0.51919264", "0.51885045", "0.51885045", "0.51844394", "0.51823014", "0.51780987", "0.51717734", "0.5166978", "0.51577544", "0.5155144", "0.51456004" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def todo_params params.require(:todo).permit(:description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
simple calculation for promotions
def calculate_dicsount(index) ((index + 1) * 9) / 100.0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pmt(pv, n, r)\n (pv*r)/(1.0 - 1/(1.0+r)**n)\nend", "def promedios\n promedio = (@nota1.to_f + @nota2.to_f + @nota3.to_f) / 3\n promedio\n end", "def pmt(i, n, pv)\n return pv / ((1 - (1 / (1 + i) ** n )) / i)\n end", "def percentage_of_promoters\n calculator.percentage_of_promoters\n end", "def promotions\n @promotions ||= order.promotions\n end", "def ponderado(pesos)\n @promedio = @p.zip(pesos).inject(0) do |suma, coordenada, peso| {suma+coordenada*peso }\n end\nend", "def calculate_promotional_adjustments\n @promotion_adjustment = 0\n\n # An assumption is made here that the promotions are ordered correctly. A global 10% discount must be applied last\n @promotions.each do |promotion|\n if promotion.triggered?(self)\n @promotion_adjustment += promotion.calculate_adjustment(self)\n end\n end\n end", "def masterwork_prob_bonus; 0; end", "def porcentaje_proteinas\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_prot = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n porcentaje_prot += (auxNodo1.value.proteinas * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return porcentaje_prot.round(1)\n end", "def get_cout_ha_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_ha_parcelle(self)\n end\n end\n sum\n end", "def inverter_mppt_Calculate\n inverter_watt = ((@panels_no*@panel_wt)/0.7).ceil(3)\n @sys_circuits = 1\n if inverter_watt > 2500\n @sys_circuits = (((inverter_watt/2500)+0.4).ceil(1)).round()\n @sys_circuits += 1 if @sys_circuits.odd?\n inverter_watt = (inverter_watt/@sys_circuits).ceil(3)\n end\n inverter_watt = 1000 if inverter_watt < 1000\n mppt_amp = ((@panels_no*@panel_wt*1.25)/(@battery_voltage*2)).ceil()\n mppt_amp = mppt_amp / @sys_circuits if @sys_circuits > 1\n \n {\"inverter_watt\" => inverter_watt.ceil(-2), \"inverters_num\" => @sys_circuits, \"mppt_amp\" => mppt_amp.ceil(-1), \"mppts_num\" => @sys_circuits}\n end", "def check_promotions\n line_items.each do |item|\n Spree::ItemAdjustments.new(item).calculate_promo_total\n end\n end", "def pmt(rate,nper,pv,fv =0,type = 0)\n #- pv/((1 - (1 / (1 + rate)**nper )) / rate)\n pv = -pv\n\n k = [1,1+rate][type]\n\n -(pv + (pv - fv)/((1+rate) ** nper - 1))* -rate/k #added some extra neg signs to get it to work\n end", "def proton_mass\r\n mass(HYDROGEN) - mass(ELECTRON)\r\n end", "def por_prote\n\t\t\t(@proteinas/suma_gramos)*100\n\t\tend", "def calc_pv()\n i = @i / 100.0\n #Initial contribution\n pvf = @fv / ((1 + i) ** @n)\n #Present value of annuity\n pva = (@pmt/i) * (1-(1/((1+i)**@n)))\n @pv = (pvf + pva) * (-1)\n #Round\n @pv = (@pv*100).round / 100.0\n end", "def calculation\n end", "def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend", "def transmogrifier(num1,num2,num3)\n\tp (num1*num2)**num3\nend", "def get_cout_total_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_total_parcelle(self)\n end\n end\n sum\n end", "def ppmt\n pmt - ipmt\n end", "def calculate_ponderated_values\n 1.upto(12) do |i|\n c = @code[i - 1]\n if c\n c *= 3 if i.even?\n @ponderated.push c\n end\n end\n end", "def imc \n\t\t@peso/(@talla*@talla)\n\tend", "def preco_total\n produto.preco * quantidade\n end", "def phat\n @phat ||= 1.0 * positive/total\n end", "def pmt (interest_rate, nper, pv)\n\t#monthly_payment = 1.00\n\tmonthly_payment = (pv*interest_rate*((1+interest_rate)**nper))/(((1+interest_rate)**nper)-1)\n\treturn monthly_payment\nend", "def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end", "def pmt(rate,n,amount)\n\n\ttop = 0.0\n\ttop = rate*(1+rate)**n\n\tbot = 0.0\n\tbot = (1+rate)**n-1\n\tresult = 0.0\n\tresult =amount*top/bot\n\treturn result \n\nend", "def goods_produced\n (0.2 * base_production + trade_goods_bonus).round(6)\n end", "def totalProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn prot.round(2)\n\tend", "def compute_total_value\n @value= @net_price * @count\n end", "def numerator() end", "def calculated; end", "def consumo_promedio\n medidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n estado_medidor_id = MedidorEstadoMedidor.where(medidor_id: medidor_id).map(&:estado_medidor_id)\n periodo = \"#{self.fecha_medicion.month}/#{self.fecha_medicion.year}\"\n estados = EstadoMedidor.where(id: estado_medidor_id).where.not(periodo: periodo)\n aux = 0\n estados.each do |estado|\n aux = aux + estado.consumo\n end\n aux = aux + self.estado_actual\n promedio = aux / (estados.count + 1)\n end", "def CalculatePentagonal (input)\n\treturn (input * (3*input - 1) / 2)\nend", "def pProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\ttotal += (alimento.proteinas + alimento.lipidos + alimento.carbohidratos)\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn ((prot/total)*100).round\t\n\tend", "def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend", "def compute(object=nil)\n if preferred_units.nil? or preferred_units <= 0\n units = 2\n else\n units = preferred_units\n end\n\n promotional_units = object.quantity / units\n\n (object.price * promotional_units * preferred_percent) / 100\n end", "def pmt(interest_rate,payments,principal)\n numerator =interest_rate*principal*(1 + interest_rate)**payments\n denominator= (1+ interest_rate)**payments - 1\n return numerator/denominator.to_f\nend", "def promo_price\n price*0.75\n end", "def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end", "def porcentaje_lipidos\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_lip = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n porcentaje_lip += (auxNodo1.value.lipidos * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return porcentaje_lip.round(1)\n end", "def total\n conv_price_single * conv_quantity\n end", "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend", "def to_peta\n big_self / PETA\n end", "def transmogrifier(a, b, c)\n p (a * b) ** c\nend", "def net_present_value\n lambda do |x|\n relative_payments.reduce(0) do |sum, relative_payment|\n sum + relative_payment.amount * (1 + x)**-relative_payment.offset\n end\n end\n end", "def prod_nar\n\t\t@edad * 2\n\tend", "def promotion\r\n\r\n end", "def pi_product\n self.inject{|a,b| a*b}\n end", "def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend", "def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend", "def product_cost\n product_with_unit_cost + product_without_unit_cost\n end", "def pmt(rate, nper, pv)\n\n # =========================================================\n #the required output already accounts for monthly nature by dividing the 0.0404 by 12. it also already puts the percentage in decimal form so no need to adjust for rate on the back end\n part1 = (pv * rate)\n part2 = 1 - (1 + rate)**-nper\n\n monthly_payment = part1 / part2\n\n # Your code to implement the method goes here.\n # You shouldn't have to write or change code anywhere else.\n # =========================================================\nend", "def total\n total_amount = 0\n @order.each do |product, quantity|\n prod_price = PRODUCTS[product]\n if @pricing_rules.key?(product)\n rule = @pricing_rules[product]\n n = rule[1]\n type = rule[0]\n case type\n when \"Nx1\"\n total_amount += prod_price*( quantity/n + quantity%n )\n when \"BULK\"\n disccount_price = rule[2]\n total_amount += quantity * (quantity < n ? prod_price : disccount_price) #disccount price\n end\n else\n total_amount += prod_price * quantity\n end\n end\n total_amount\n end", "def ir_proteina\n @ir_proteina = (@proteinas/50.to_f)*100\n @ir_proteina.round(1)\n end", "def proteinas\n food = @ingredientes.head\n protein = 0.0\n while food != nil do\n protein += food[:value].proteinas * (food[:value].gramos / 1000.0)\n food = food[:next]\n end\n protein * (100.0 / @total_nutricional)\n end", "def compute\n p1, p2 = self.support\n return [[:vector, p1, (p2-p1) * 1.0 / 3.0, p2, (p1 - p2) * 1.0 / 3.0]]\n end", "def profitability\n # based on \n # @pools.map { |p| }.sum\n end", "def sum_produits_stock\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * p.stock }\n sum\n end", "def transmogrifier(num1, num2, num3)\n return (num1*num2)**num3\nend", "def promo_total\n 0.0\n end", "def calc_mp_cost(skill)\n cost = 0\n cost += skill.mp_cost\n cost += maxmp * skill.mp_cost_per / 100\n cost += (base_spi + @spi_plus) * skill.base_spi_mp_cost\n cost += (base_atk + @atk_plus) * skill.base_atk_mp_cost\n cost /= 2 if half_mp_cost\n cost.to_i\n end", "def transmogrifier (num1,num2,num3)\n (num1 * num2)**num3\nend", "def valorproteinasp\n\t\tvag=(proteinas * 70) / 100\n vag.round(2)\n\tend", "def compute_fullcnpswage\n ( full_caissebase + full_process_bonuses ).ceil\n end", "def volume_calculations ops\n ops.each do |op|\n p = op.input(INPUT).item.get :passage\n op.temporary[:passage] = p + 1 if p\n op.temporary[:passage] ||= 1\n op.temporary[:req_cells] = op.required_cells\n op.temporary[:cell_vol] = (op.temporary[:req_cells] / op.input(INPUT).item.cell_density)\n op.temporary[:media_vol] = working_volume_of(op.output(OUTPUT).object_type) - op.temporary[:cell_vol] || 0.0\n op.temporary[:media_vol] = 0 if op.temporary[:media_vol] < 0\n op.temporary[:volume] = op.temporary[:cell_vol] + op.temporary[:media_vol]\n\n in_plate = op.input(INPUT).item\n from_plate_id = in_plate.get :from\n\n op.error :from_plate_id_not_defined, \":from not defined\" if from_plate_id.nil?\n from_plate = Item.find_by_id(from_plate_id)\n op.error :cannot_find_original_plate, \"Could not find original plate with id #{from_plate_id}.\" if from_plate.nil?\n op.temporary[:from_plate] = from_plate if from_plate\n end\n end", "def promo_code_multiplier\n return 1.0 unless promo_code.present?\n\n (100 - promo_code.discount) / 100.0\n end", "def pmt rate, nper, pv\n\n\tpay = 0.0\n\tnumerator = 0.0\n\tdenominator = 0.0\n\n\tnumerator = pv * rate * (1 + rate) ** nper\n\n\tdenominator = ((1 + rate) ** nper) - 1\n\n\tpay = numerator / denominator\n\n\treturn pay.round(2)\n\nend", "def voting_power_for_proposition(proposition)\n delegators = delegators_for_category(proposition.category)\n delegators = delegators.reject { |delegator| delegator.voted_for?(proposition) }\n 1 + delegators.sum { |delegator| delegator.voting_power_for_proposition(proposition) }\n end", "def obtener_promedio(hash)\n hash.values.inject(0) { |sum, n| sum + n }.to_f / hash.length\nend", "def proteinas\n\t\treturn @proteinas*@cantidad\n\tend", "def prot\n\t\tgrtotal = 0\n\t\tsum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las\n\t\t#proteinas dependiendo de la cantidad y tambien suma\n\t\t#todas las cantidades para poder calcular el porcentaje\n\t\t#despues\n\t\t@lista.zip(@listagr).each do |normal, gr|\n\t\t\tgrtotal += gr\n\t\t\tcant = gr/1000.0\n\t\t\tsum += normal.prot*cant \n\t\tend\n\t\t(sum*100)/grtotal\n\tend", "def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end", "def get_val()\n val = (@proteinas * 4) + (@lipidos * 9) + (@glucidos * 4)\n end", "def amount_calc\n quantity * price\n end", "def promedio(h)\n suma = h.values.inject(0) {|sum, x| sum + x}\n p suma\n suma / h.count.to_f\nend", "def transmogrifier(num1, num2, num3)\n transmogrified = ((num1*num2) * num3)\n return transmogrified \nend", "def calculate(policy, mrg)\n case policy\n when 'Flexible'\n base_price * mrg\n when 'Fixed'\n base_price + mrg\n when 'Prestige'\n base_price + mrg\n end\n end", "def prom_weight\n if pet_histories.length > 0\n promw= pet_histories.sum(:weight)\n promw/pet_histories.length\n else\n \"0\"\n end\n end", "def product_price_inc_vat\n price_calculator.inc_vat\n end", "def productrevenue\n vat_rate = TaxRate.find_by_name(\"VAT\")\n shipping_rate = TaxRate.find_by_name(\"Shipping Reverse for PPO\")\n \n totalrevenue = 0\n totalrevenue += (self.subtotal * (self.pieces ||= 1) * vat_rate.reverse_rate.to_f) || 0\n totalrevenue += (self.shipping * (self.pieces ||= 1) * shipping_rate.reverse_rate.to_f) || 0\n return totalrevenue\nend", "def precio_total_compras\n compras.sum(:precio_total)\n #p = 0\n #compras.each do |compra|\n #p += (compra.precio_total || 0)\n #end\n #return p\n end", "def price_per_piece\n self.unit_price / (self.pieces || 1) if self.unit_price\n end", "def positive_adjustment_commission(event)\n additional_charges = event.additional_charges.nil? ? 0 : event.additional_charges\n comm = ((additional_charges + ((event.amount_of_guests - event.minimum_guarantee) * event.base_price)) * COMMISSION_RATE) / BREAKAGE_RATE\n comm.round(2)\n end", "def transmogrifier (num1, num2, num3)\n result = (num1 * num2) **num3\n p result\nend", "def compute(object)\n return 0, [] if self.preferred_buy_number_of_items_x.blank? or \n self.preferred_buy_number_of_items_x == 0 or\n self.preferred_get_number_of_items_y.blank? or \n self.preferred_get_number_of_items_y == 0 or\n self.preferred_at_z_percent_off.blank? or\n self.preferred_at_z_percent_off == 0\n \n #puts \"Buy #{self.preferred_buy_number_of_items_x} Get #{self.preferred_get_number_of_items_y} at #{self.preferred_at_z_percent_off}% Off\"\n \n save_test = lambda do |calculator, options={}|\n #puts \" save test: #{options[:count] % (self.preferred_buy_number_of_items_x + self.preferred_get_number_of_items_y) >= self.preferred_buy_number_of_items_x}\"\n options[:count] % (self.preferred_buy_number_of_items_x + self.preferred_get_number_of_items_y) >= self.preferred_buy_number_of_items_x\n end\n \n save_value = lambda do |calculator, line_item|\n #puts \" save value: #{calculator.preferred_at_z_percent_off / 100.0 * line_item.price}\"\n calculator.preferred_at_z_percent_off / 100.0 * line_item.price\n end\n \n add_false_items_to_current = lambda do |calculator, line_item|\n true\n end\n \n compute_line_items(object, save_value, linked_object: LineItemPromotionCredit, save_test: save_test, add_false_items_to_current: add_false_items_to_current)\n end", "def compute\n perimeter = 1000\n (1..(perimeter+ 1)).each do |a|\n ((a + 1)..(perimeter + 1)).each do |b|\n c = perimeter - a - b\n return (a * b * c).to_s if (a * a + b * b == c * c)\n end\n end\nend", "def ppptotal\n pppquantity + pppquality + pppontime + pppeffective + \n pppknowledge + ppprules + pppcommunication +\n pppleader + pppmanage + pppdiscipline + pppproactive + ppprelate + \n pppparttwo\n end", "def ppptotal\n pppquantity + pppquality + pppontime + pppeffective + \n pppknowledge + ppprules + pppcommunication +\n pppleader + pppmanage + pppdiscipline + pppproactive + ppprelate + \n pppparttwo\n end", "def prot\n\t\tsuma = 0\n\t\tx = 0\n\t\tcantidad = 0\n\n\t\t@alimentos.each do |i|\n\t\t\tcantidad = @gramos[x].valor / (i.proteinas + i.lipidos + i.carbohidratos)\n\t\t\tsuma += i.proteinas * cantidad\n\t\t\tx += 1\n\t\tend\t\n\n\t\treturn ((suma * 100) / gramos_total).round(2)\n\tend", "def get_valor_energetico\n \n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n \n \n end", "def calc_obp\n obp = (hits.to_f + walks.to_f + hbp.to_f) / (bats.to_f + walks.to_f + hbp.to_f+ sf.to_f)\n self.obp = obp\n end", "def por_lip\n\t\t\t(@lipidos/suma_gramos)*100\n\t\tend", "def transmogrifier (a,b,c)\n (a*b)^c\n end", "def calculation(operant)\n\tnum1 = rand(10)\n\tnum2 = rand(10)\n\t if operant == '*'\n\t prob = \"#{num1} * #{num2}\"\n\t ans = num1 * num2\n\t correct_chk(ans,prob)\n\t elsif operant == '-'\n\t prob = \"#{num1} - #{num2}\"\n\t ans = num1 - num2\n\t correct_chk(ans,prob)\n\t else operant == '+'\n\t prob = \"#{num1} + #{num2}\"\n\t ans = num1 + num2\n\t correct_chk(ans,prob)\n\t end\n end", "def target_value\n items.reduce(0) do |sum, item|\n sum + item.target * item.price\n end\n end", "def product_weight\n price_calculator.weight\n end", "def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend", "def promedio(arreglo)\n\ttotal = 0.0\n\tfor i in 0...arreglo.size\n\t\ttotal = total + arreglo[i]\n\tend \n\n\treturn (total / arreglo.size).round(2)\nend" ]
[ "0.66387093", "0.64373314", "0.6347403", "0.6314204", "0.6223738", "0.6124138", "0.6120193", "0.6104821", "0.6081337", "0.60716367", "0.60439485", "0.60142493", "0.59794176", "0.59785956", "0.5960817", "0.59428555", "0.5922606", "0.5921299", "0.5875557", "0.5871444", "0.5866473", "0.5841601", "0.58358866", "0.5822836", "0.5821899", "0.582042", "0.58154815", "0.5808929", "0.5754101", "0.5739815", "0.57348704", "0.57079834", "0.5704895", "0.56930226", "0.567456", "0.5670606", "0.56574875", "0.5645797", "0.564491", "0.56435287", "0.56430626", "0.56397414", "0.56290036", "0.5622696", "0.5621939", "0.56194043", "0.56139636", "0.5607243", "0.5606727", "0.56059855", "0.5600891", "0.55947715", "0.55947715", "0.55914724", "0.55865973", "0.558414", "0.5583179", "0.55808747", "0.55796856", "0.5576347", "0.55734336", "0.55687755", "0.5559938", "0.5554288", "0.5550162", "0.55450106", "0.5543327", "0.55299366", "0.5528158", "0.5525635", "0.5524447", "0.5522479", "0.5519094", "0.55125874", "0.5504781", "0.55017555", "0.55016017", "0.54954004", "0.54865927", "0.54856336", "0.54850155", "0.5484807", "0.5483186", "0.54821974", "0.5480751", "0.54796314", "0.54794604", "0.5479458", "0.54768234", "0.5472441", "0.5472441", "0.5465543", "0.5459656", "0.5459647", "0.54585683", "0.54570353", "0.5456211", "0.5447708", "0.5443392", "0.54427713", "0.5442345" ]
0.0
-1
Takes a name and returns the string "Howdy Howdy, NAME!" Additionally must remove white spaces around the name and use standard english capitalization for example " bOB " => "Bob"
def greetings_interpolation(name) # code goes here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_name(name)\n properly_formatted_name = name.split(\" \").map { |n| n.capitalize }\n properly_formatted_name.join(' ')\n end", "def format_name(name)\n name.split.map(&:capitalize)\n .join(' ')\nend", "def format_name(name)\n names = name.split(\" \")\n formatted_names = []\n names.each do |singleName|\n singleName = singleName.downcase\n singleName[0] = singleName[0].upcase\n formatted_names << singleName\n end\n return formatted_names.join(\" \")\nend", "def capitalize_name(name)\n name_array = name.split\n formatted_user_name = name_array.map(&:capitalize)\n formatted_user_name.join(' ')\nend", "def formate_name(name)\n # name.split.map{|p| p.split(\"-\").map{|m| m.split(\"'\").map{|n| (n.length > 1 ? n.capitalize : n) }.join(\"'\")}.join(\"-\")}.join(\" \")\n name.gsub(/[^\\s\\-']{02,}/, &:capitalize)\n\n end", "def formate_name(name)\n # name.split.map{|p| p.split(\"-\").map{|m| m.split(\"'\").map{|n| (n.length > 1 ? n.capitalize : n) }.join(\"'\")}.join(\"-\")}.join(\" \")\n name.gsub(/[^\\s\\-']{02,}/, &:capitalize)\n\n end", "def cleanup_surname(name)\n if name.length > 4\n name.gsub!(/^Mc(\\w+)/) { |s| \"Mc#{$1.capitalize}\" }\n name.gsub!(/^Mac(\\w+)/) { |s| \"Mac#{$1.capitalize}\" }\n name.gsub!(/^Mac(\\w+)/) { |s| \"Mac#{$1.capitalize}\" }\n name.gsub!(/^Osh(\\w+)/) { |s| \"O'sh#{$1}\" }\n name.gsub!(/^Van(\\w+)/) { |s| \"Van#{$1.capitalize}\" }\n name.gsub!(/^Von(\\w+)/) { |s| \"Von#{$1.capitalize}\" } \n# name.gsub!(/^Dev(\\w+)/) { |s| \"DeV#{$1}\" } \n end\n name\n end", "def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end \n\n new_name = new_parts.join(\" \")\n return new_name\nend", "def format_name(str)\n str = str.downcase\n name = []\n str.split(\" \").each do |ele| \n ele[0] = ele[0].upcase\n name << ele\n end\n return name.join(\" \")\nend", "def undercover_name(name)\n name.downcase.split(' ').map!{|name| name.split('').map! {|letter| next_letter(letter)}.join('').capitalize}.reverse.join(\" \")\nend", "def capitalize_name\n self.name = self.name.split.collect(&:capitalize).join(' ') if self.name && !self.name.blank?\n end", "def format_name(str)\n names = str.split (\" \")\n new_name = []\n\n names.each do |name|\n new_name << name[0].upcase + name[1..-1].downcase\n # 2nd character to end (-1 last character of string)\n end\n\n return new_name.join(\" \")\nend", "def format_name(str)\n parts = str.split(' ')\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end\n\n return new_parts.join(' ')\nend", "def format_name(str)\n parts = str.split(\" \") # A space separates each word\n new_parts = []\n\n parts.each do |part| # Iterate over each part using .each. Note: each part is a single element from the array, which is a string.\n\n # We need to target the first element of the string.\n new_parts << part[0].upcase + part[1..-1].downcase\n # give you upper case version of index 0. + concatenation\n # when you slice a string, you use square brackets, but you don't put a single number. You'll use a range and go all the way to the end, which is index -1 (note: -2 is the second to last element of a string)\n end\n\n return new_name = new_parts.join(\" \") # first we split on a space, now we join on a space\nend", "def format_name(str)\n\twords = str.split(\" \")\n \tnewWord = \"\"\n \n \twords.each do |word|\n newWord += word[0].upcase + word[1..-1].downcase + \" \"\n end\n return newWord\nend", "def clean_name(name)\n cleaned_name = I18n.transliterate(name)\n cleaned_name = cleaned_name.upcase\n # remove 'da, do, de' do nome (nao servem para nada em termos de citacoes)\n cleaned_name = cleaned_name.sub(/ \\b[\\w]{1,2}\\b /, ' ')\n # to make a trim: .gsub!(/\\s+/, \"\" )\n return cleaned_name\n end", "def format_name(str)\n names = str.split(\" \")\n formatted_names = []\n \n names.each do |name|\n formatted_names << name[0].upcase + name[1..-1].downcase\n end\n\n return formatted_names.join(\" \")\nend", "def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend", "def capitalize(name)\n secret_name = name.split(\" \").map do |word|\n word.capitalize\n end\n secret_name.join(\" \")\nend", "def full_name\n new_name = first_name.capitalize + \" \" + last_name.capitalize\n final_name = new_name.split(' ').each(&:capitalize!).join(' ')\n end", "def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\t\tif char == ' '\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend", "def capitalize_name name\n names = []\n unless name.blank?\n name.split.each do |n|\n names << n.split('-').map(&:capitalize).join('-')\n end\n end\n names.join(' ')\n end", "def format_name(str)\n\tnames = str.split(\" \")\n \tnames.each_with_index do |name, i|\n names[i] = name[0].upcase + name[1..-1].downcase\n end\n \treturn names.join(\" \")\nend", "def name(entered_name)\n split_name = entered_name.split\n @first_name = split_name[0].capitalize\n @last_name = split_name[1].capitalize\n end", "def namify\n self.name.split(\" \").map{|x| x.first.capitalize}[0..1].join(\"\")\n end", "def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n \n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end\n \n return new_parts.join(\" \")\n end", "def format_name(str)\n norm_arr = []\n str_arr = str.split(\" \")\n\n str_arr.each do |word|\n word = word.downcase\n word[0] = word[0].upcase\n norm_arr << word\n end\n\n return norm_arr.join(\" \")\nend", "def uncapitalize(name)\n raise if name.blank?\n name.downcase.titleize.gsub(/\\sAnd\\s/, ' and ')\n end", "def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end \n\n return new_parts\nend", "def format_name(str)\n\tnames = str.split(\" \")\n proper = []\n names.each do |name|\n proper << name[0].upcase + name[1..-1].downcase\n end\n return proper.join(\" \")\nend", "def capitalize_name\n self.name = name.sub(/\\S/, &:upcase) unless name.nil?\n end", "def format_name(str)\n str.split.map{|val| val[0].upcase + val[1..-1].downcase}.join(\" \")\n end", "def normalize_name\n @normalize_name ||= begin\n return '' if name.empty?\n\n exclude = %w[corporation institute organization university\n all and of the].join('|')\n tmp = name.dup\n tmp.gsub!(/#{exclude}/i, '')\n tmp.gsub!(/\\s+/, ' ')\n tmp.strip!\n tmp.downcase # it's not case sensitive\n end\n end", "def format_name(str)\n \n formatted_name = []\n \n str.split.each do |word|\n formatted_word = word.downcase\n formatted_word[0] = formatted_word[0].upcase\n formatted_name.push(formatted_word)\n end\n return formatted_name.join(\" \")\nend", "def full_name\n \"#{first_name} #{last_name}\".gsub(/\\b('?[a-z])/) { $1.capitalize }.strip\n end", "def normalize_name(name)\n CapitalizeNames.capitalize(name)\n end", "def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end", "def titleize_wow(name)\n lowercase_words = %w{a an the and but or for nor of}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "def full_name\n \"#{first_name} #{last_name}\".strip.squeeze(' ').titleize\n end", "def abbrev_name(name)\r\n # name.split.map { |s| s[0]}.join('.').upcase\r\n # name.upcase.split.map(&:chr).join\".\"\r\n \r\n newname = name.split(' ')\r\n newname[0][0].capitalize + '.' + newname[1][0].capitalize\r\nend", "def titleize(name)\n lowercase_words = %w{a an the and but or for nor of over}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "def prepare_name(name)\n name.to_s.upcase\n end", "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end", "def to_s\n return self.name.split.map(&:capitalize)*' '\n end", "def name\n [first_name || '', last_name || ''].map(&:capitalize).join(\" \")\n end", "def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend", "def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend", "def short_country_name(name)\n if name.include? ' '\n temp = name.split(' ')\n temp[0][0] + temp[1][0]\n else\n name[0..2].upcase\n end\nend", "def short_country_name(name)\n if name.include? ' '\n temp = name.split(' ')\n temp[0][0] + temp[1][0]\n else\n name[0..2].upcase\n end\nend", "def format_city_name\n # Capitalize first letter of each word\n # Convert remaining letters of each word to lower case\n # Remove leading and trailing white space\n # Reduce internal string of multiple white spaces to single white space\n # Preserve non-whitespace, non-word characters as-is (e.g. dashes)\n\n self.city = city.strip.gsub(/\\s\\s+/, ' ').gsub(/(\\w|å|ä|ö|Å|Ä|Ö)+/) do |word|\n word.mb_chars.capitalize.to_s\n end\n end", "def capitalize_name(first_name, last_name)\n \"#{first_name.capitalize} #{last_name.capitalize}\"\nend", "def fullname\n name = firstname + ' ' + lastname\n name.split.map(&:capitalize).join(' ')\n end", "def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name =~ (/^[A-Z]/)\n name.capitalize\n else\n name\n end\n end\nend", "def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.strip}\" if !mother_last_name.nil?\n\n # capitalize each word and return the capitalized version\n name.split.map(&:capitalize).join(' ')\n end", "def name\n [last_name.upcase, first_name].delete_if { |n| n.blank? }.join(\", \")\n end", "def format_name(str)\n\tnames = str.split(\" \")\n\tformatted = \"\"\n\n\tnames.each do |name|\n\t\tformatted += name[0].upcase + name[1..-1].downcase + \" \"\n\tend\n\n\treturn formatted\n\n\t# name.each do |word|\n\t# \tword.each_char.with_index do |char, idx|\n\t# \t\tif idx == 0\n\t# \t\t\tupLetter = char.upcase\n\t# \t\t\tformatted << upLetter\n\t# \t\telse\n\t# \t\t\tdownLetter = char.downcase\n\t# \t\t\tformatted << downLetter\t\n\t# \t\tend\n\t# \tend\n\t# end\n\t# return formatted.join(\"\")\n\t# print formatted\nend", "def full_name(first_name, last_name)\n name = first_name.capitalize + \" \" + last_name.capitalize\n return name\nend", "def surnameize\n s = slice(0, 2).upcase\n if s == 'MC' || s == \"O'\"\n s.titleize + slice(2..-1).titleize\n else\n titleize\n end\n end", "def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\t# Swap characters - change all vowels to next vowel,\n\t# and all consonants to next consonant\n\n\t# Initialize fake_name & index (counter) variables \n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\n\t\t# For each character\n\t\tif char == ' '\n\t\t\t# If space, add space\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\t# Handle lower & uppercase properly\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend", "def capitalize_name!\n @fullname = @fullname.upcase\n return @fullname.upcase\n end", "def cleanup_firstname(name)\n name.gsub(/^Dean(\\w+)/) { |s| \"DeAn#{$1}\" }\n end", "def capitalize_full_name(first_name, last_name)\n return \"#{first_name.capitalize} #{last_name.capitalize}\"\nend", "def format_name(name)\n name[2..-2].humanize.downcase.gsub ' | ', ': '\n end", "def format_name(first, last)\n if first.empty? || last.empty?\n nil\n else\n formatted_first = first.delete(' ')\n formatted_last = last.delete(' ')\n return (formatted_first[0] + formatted_last).downcase\n end\nend", "def swap_name(full_name)\n first_name, last_name = full_name.split(' ')\n\n altered_name = \"#{last_name}, #{first_name}\"\nend", "def full_name(name)\n return '' if name.nil?\n [name.first, name.middle, name.last].compact.join(' ')\n end", "def flip_first_last_name(name)\n fixed_name = name.split(\", \")\n if fixed_name[1] \n fixed_name[1] + ' ' + fixed_name[0]\n else\n name\n end\n end", "def titleize(str)\n str.capitalize!\n dont_capitalize = [\"and\", \"over\", \"the\", \"from\"]\n str.split(\" \").collect {|word| dont_capitalize.include?(word) ? word : word.capitalize}.join(\" \")\nend", "def format_name(name)\n name.match(/\\,/).nil? ? name : \"#{name.split(\", \").reverse.join(\" \")}\"\n end", "def format_name(str)\r\n \tformat = []\r\n\twords = str.split(\" \")\r\n \twords.each do |word|\r\n word = word[0].upcase + word[1..-1].downcase\r\n format << word\r\n end\r\n \treturn format.join(\" \")\r\nend", "def change_name(original)\n original.gsub!(' ','_')\n INVALID_CHARS.split('').each do |char|\n original.gsub!(char,'')\n end\n original.downcase\n end", "def to_name(name)\n name.to_s.downcase\n end", "def to_initials(name)\n str = \"\"\n name.split(\" \").each { |ele| str += ele[0] }\n return str\nend", "def last_name_first_name(name)\n last = last_name(name)\n first = name.gsub(last, '').strip \n \"#{last}, #{first}\"\n end", "def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end", "def capitalize_name(first_name, last_name)\n first_name.capitalize + \" \" + last_name.capitalize # concatenation\n \"#{first_name.capitalize} #{last_name.capitalize}\" # interpolation\nend", "def format_name(first, last)\n\treturn nil if first.empty? || last.empty?\n (first.gsub(/[\\W0-9_]/, \"\")[0] + last.gsub(/[\\W0-9_]/, \"\")).downcase\nend", "def abbrev_name(name)\n \"#{name[0]}.#{name.split[1][0]}\".upcase\nend", "def band_name(name)\n return name.to_s.capitalize << name.to_s[1..-1] if name[0] == name[-1]\n\n article = 'The'\n article << ' ' << name.to_s.capitalize\nend", "def normal_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tfirstname = firstpart.gsub(/[[:upper:]]\\./, '').strip\n\t\t\tfirstname + ' ' + lastname\n\t\tend", "def format_name(first, last)\n first.empty? || last.empty? ? nil :\n (first.gsub(/[^A-z]/, \"\")[0] + last.gsub(/[^A-z]/, \"\")).downcase\nend", "def to_initials(name)\n name = name.split(\" \").join\n initials = \"\"\n i = 0\n while i < name.length\n char = name[i]\n if char == char.capitalize()\n initials << char\n end\n i += 1\n end\n return initials\nend", "def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend", "def initials\n name.split.collect{|a| a[0]}.join(\" \")\n end", "def mixed_case(name)\n\tname.downcase.gsub(/\\b\\w/) {|first| first.upcase}\nend", "def as_english_word\n self.name.gsub(/\\W/,\" \").gsub(/([a-z])([A-Z])/,\"\\\\1 \\\\2\").\n squeeze(\" \").strip.downcase\n end", "def spy_name(realname)\n\tvowels = ['a','e','i','o','u']\n\tconsonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n\treverseName = realname.downcase.split(\" \").reverse!\n\tfullName = reverseName[0] + \" \" + reverseName[1]\n\tletteredName = fullName.split('')\n \tletteredName.map! do |letter|\n \t if vowels.include?(letter)\n \t vowels.rotate(1)[vowels.index(letter)]\n \t elsif consonants.include?(letter)\n \t consonants.rotate(1)[consonants.index(letter)]\n \t end\n \tend\nfullName = letteredName.join('').insert(reverseName[0].length,' ')\nfullName.capitalize!\ntwoNames = fullName.split(\" \")\ntwoNames[1].capitalize!\nfullName = twoNames[0] + \" \" + twoNames[1]\np fullName\nend", "def format_name(first, last)\nif first.length<1 || last.length<1\n\tnil\nelse\n first = first.split.join\n last = last.split.join\n str = (first[0]+last).downcase.gsub(/[^0-9a-z]/i, '')\nend\nend", "def names(first_name, last_name)\n\t\"#{last_name.upcase}, #{first_name.capitalize}\"\nend", "def capitalized\n name.titleize.capitalize\n end", "def name\n \"#{first_name.strip} #{last_name.strip}\".strip\n end", "def sanitize_name(name)\n name.gsub!(' ', '_')\n name.downcase!\n name.gsub!('-', '_')\n name.gsub!('\\'', '_')\n name\n end", "def localizeSkillName(name)\n #Remove 'effect' from translated\n effectPattern = /(?<=\\s)((?:E|e)ffect)/\n name = name.gsub(effectPattern, '')\n\n #Remove space between arrow symbol\n arrowPattern = /(\\s+)(#{CommonFields::BUFF_SYMBOL})/\n if (arrowPattern.match(name))\n lastMatch = Regexp.last_match\n spaceIdxB = lastMatch.begin(1)\n spaceIdxE = lastMatch.end(1)\n name = \"#{name[0..(spaceIdxB-1)]}#{name[lastMatch.begin(2)]}\"\n end\n\n #Replacement for localization (lightning, blast)\n name = name.gsub( /(?:L|l)ightning/, 'Thunder')\n name = name.gsub(/(?:E|e)xplosion/, 'Blast')\n\n #Capitalize every word inside parenthesis\n nameArray = name.split(/\\s+/)\n (nameArray.map do |v| \n if v.length > 2 \n v.capitalize\n else\n v \n end\n end).join(' ').gsub(/\\r|\\R|\\n/, '').strip\n end", "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def titlify(s)\n s.split(/[ _]/).map(&:capitalize).join(' ')\nend", "def strip_and_downcase_name\n if name.present?\n name.strip!\n name.downcase!\n end\n end", "def swap_names(name)\n real_names = name.downcase.split(\" \")\n real_names[0], real_names[-1] = real_names[-1], real_names[0]\n real_names.join(\" \")\nend", "def full_name\n (first_name + ' ' + last_name).titleize\n # another way to do this vv\n # (first_name, last_name).join(' ')\n end", "def fix_team_name(team)\n team.split.map {|w| w.capitalize}.join(' ').\n gsub('.', '').\n match(/[A-z &']+/)[0].\n gsub(/((Af|F)c|Rmi)/) {|w| w.upcase}.\n strip\nend", "def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @subtitle = StringUtils.mixed_case(@subtitle)\n @genre = StringUtils.mixed_case(@genre)\n @mixer = StringUtils.mixed_case(@mixer)\n @version_name = StringUtils.mixed_case(@version_name)\n @version_name.gsub!(/(\\A|\\s)(Version|Release)\\b/) {|string| string.downcase} if @version_name\n end", "def determine_name_parts(name)\n @first_name = name[0..name.index(\" \")].strip.downcase\n @last_name = name[name.index(\" \")..name.length].strip.downcase\n end" ]
[ "0.80306464", "0.8022016", "0.7878082", "0.78776765", "0.75745225", "0.75745225", "0.75538975", "0.7522513", "0.74876785", "0.7463529", "0.7458455", "0.7448558", "0.74368626", "0.740528", "0.74034667", "0.7399498", "0.7397133", "0.7343997", "0.73284775", "0.7326327", "0.7317408", "0.7315476", "0.729475", "0.7280934", "0.7276778", "0.72622055", "0.72390646", "0.7216707", "0.72079945", "0.7207727", "0.7190477", "0.71830136", "0.7160453", "0.71352464", "0.7122068", "0.70964235", "0.70932686", "0.7072859", "0.7040879", "0.7029663", "0.70211476", "0.70054334", "0.70005727", "0.699407", "0.69884294", "0.69876695", "0.69876695", "0.6987334", "0.6987334", "0.697018", "0.6961816", "0.693395", "0.6926318", "0.69233596", "0.6913289", "0.6893406", "0.68931603", "0.688668", "0.6872366", "0.6854875", "0.6851711", "0.68476075", "0.6835423", "0.68317074", "0.682605", "0.6824408", "0.6824186", "0.68225724", "0.6820987", "0.67970484", "0.6796668", "0.6774057", "0.67618334", "0.67544025", "0.67472625", "0.6745849", "0.6737537", "0.6737481", "0.6737283", "0.67241806", "0.67120063", "0.66965306", "0.669437", "0.66912276", "0.6688722", "0.6686966", "0.66813284", "0.66570526", "0.6656257", "0.66462463", "0.66383874", "0.6638308", "0.6637517", "0.66370654", "0.6631466", "0.6625481", "0.66243196", "0.6622531", "0.6619581", "0.6609879", "0.6594503" ]
0.0
-1
Takes a string sentence of 0 or more words and reverses them and changes capitalization to fit standard English "This is AN example" => "Example an is this" No punctuation will be included in examples
def a_turn_of_phrase(sentence) # code goes here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalized string\n little_words = [\"a\", \"an\", \"the\", \"and\", \"in\", \"of\"]\n string = string.downcase\n string = string.split(\" \")\n if string.length > 1\n string.each_index do |i|\n if i == 0 || !little_words.include?(string[i])\n string[i] = string[i].capitalize\n end\n end\n else\n string[0] = string[0].capitalize\n end\n string.join(\" \").strip\n end", "def reverse_each_word(sentence)\n sentence.split.collect { |word| word.reverse }.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split(\" \").collect do |word|\n word.reverse\n end\n .join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split(\" \").collect{|x| x.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\n end", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(\" \")\n end", "def reverse_each_word(sentence)\n sentence.split(\" \").collect do |word|\n word.reverse\n end\n .join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|x| x.reverse}.join(\" \")\nend", "def reverse_words sentence\n sentence.split(\" \").map{ |x| x.reverse }.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence_array = sentence.split(/ /) \n final_sentence = sentence_array.collect {|word| word.reverse}\n final_sentence.join(\" \")\nend", "def reverse_words(sentence)\n if sentence != \"\"\n sent_array = sentence.split\n sent_array.each do |word|\n word.reverse!\n end\n sentence = sent_array.join(\" \")\n end\n sentence\nend", "def capitalize_words(string)\n array_sentence = string.split(\" \")\n idx = 0\n while idx < array_sentence.length\n current = array_sentence[idx]\n current[0] = current[0].upcase\n idx += 1\n end\n return array_sentence.join(\" \")\nend", "def reverse_sentence(sentence)\n return '' if sentence == ''\n list = sentence.split(' ').reverse\n str = '' \n list.each{|word| str << word + \" \"}\n str.strip!\nend", "def reverse_each_word(sentence)\n sentence.split.collect(&:reverse).join(' ')\nend", "def reverse_each_word(sentence) # will use #collect\n sentence.split(\" \").collect {|word| word.reverse}.join(\" \")\nend", "def reverse_each_word(sentence)\n\tsentence.split.collect { |el| el.reverse }.join(\" \")\nend", "def word_reverse(sentence)\n sentence.split(\" \").reverse.join(\" \")\nend", "def reverse_each_word(sentence)\n array = sentence.split\n array = array.collect {|word| word.reverse}\n array.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.split.map! do |word|\n word.reverse\n end\n .join(\" \")\nend", "def reverse_sentence(str)\n str.scan(/\\w+/).reverse.join(' ')\nend", "def reverse_each_word(sentence2)\n sentence2.split.collect {|word| word.reverse}.join(\" \")\nend", "def reverse_sentence(my_sentence)\n if my_sentence == nil\n return nil \n else \n my_arr = my_sentence.split(/(\\s+)(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/) #regex expression from https://stackoverflow.com/questions/8162444/ruby-regex-extracting-words\n p my_arr\n joined = []\n my_arr.each do |word|\n joined.prepend word\n end\n p joined\n string = joined.join\n my_sentence.replace string\nend\nend", "def reverse_sentence(string)\n string.split(\" \").reverse.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\n \nend", "def reverse_sentence(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split(' ').reverse.join(' ')\nend", "def reverse sentence\n\twords = sentence.split\n\treversedString = \"\"\n\t\n\twords.each do |current| \n\n\t\tif current.include? \".\" || \",\" || \"!\" || \"?\"\n\t\t\tcurrentPuncuation = current.slice!(\".\")\n\t\telsif current.include? \",\"\n\t\t\tcurrentPuncuation = current.slice!(\",\")\n\t\telsif current.include? \"!\"\n\t\t\tcurrentPuncuation = current.slice!(\"!\")\n\t\telsif current.include? \"?\"\n\t\t\tcurrentPuncuation = current.slice!(\"?\")\n\t\tend\n\n\t\treversedString = reversedString + current.reverse + currentPuncuation.to_s + \" \"\n\tend\n\n\treversedString\nend", "def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend", "def reverse_each_word(sentence1)\n sentence1.split.collect{ |e| e }\n sentence1.reverse!\n sentence1.split.reverse.join(' ')\nend", "def reverse_sentence str \n str.split.reverse.join' '\nend", "def titleize_a_string(string)\nsentence = string.capitalize!.split(' ')\n words_not_to_capitalize = ['a', 'and', 'the']\n\n sentence.each do |word|\n word.capitalize! unless words_not_to_capitalize.include?(word)\n end.join(' ')\n\nend", "def reverse_each_word(sentence)\n sentence.split.collect {|word| word.reverse}.join(' ')\n # new_sentence = []\n # new_sentence = sentence.split(' ')\n # new_sentence.collect {|word| word.reverse}\n # new_sentence.join(' ')\n end", "def reverse_sentence(sentence)\n reverse_string = reverse_string(sentence)\n \n reverse_words = reverse_string.split\n \n new_words = []\n \n reverse_words.each do |word|\n new_words << reverse_string(word)\n end\n \n return new_words.join(\" \")\nend", "def reverse_words(sentence)\n\twords = sentence.split(' ')\n\twords.each do |word|\n\t\tword.reverse!\n\tend\n\treversed_sentence = words.join(\" \")\nend", "def reverse_each_word(sentence2)\n sentence2.split(' ').collect do |word|\n word.reverse\nend.join(\" \")\nend", "def reverse_sentence(str)\n str.split(' ').reverse.join(' ')\nend", "def letterReverse (string_of_words)\n new_sentence = ''\n new_word = ''\n word_array = string_of_words.split(' ')\n word_array.each do |elem|\n new_word = elem.split('').reverse().join('')\n puts new_word\n new_sentence.concat(new_word + ' ')\n puts new_sentence.to_s\n end\n new_sentence\nend", "def reverse_sentence(string)\n \n string.split.reverse.join(' ')\n \nend", "def reverse_sentence(string)\n string = string.split(' ')\n new_sentence = []\n while string.length > 0\n new_sentence << string.pop\n end\n string = ''\n new_sentence.each do |value|\n string = string + ' ' + value\n end\n string.strip\nend", "def reverse_words(sentence)\n\tsentence.split.map! { |word| word.reverse }.join(\" \")\nend", "def titleize(s)\n my_words = s.split(\" \")\n cap_sentence = \"\"\n my_words.each {|w| cap_sentence << w.capitalize << \" \"} \n cap_sentence.chop\n\nend", "def reverse_each_word(sentence)\n new_array = sentence.split(\" \").collect do |word|\n word.reverse!\n end\n new_array.join(\" \")\nend", "def capitalizer (string)\n new_name = string.downcase.split\n new_name.map! do | words |\n words.capitalize\n end\n new_name.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n string.split.reverse.join(' ')\nend", "def reverse_each_word(sentence)\n\tsplit_up = sentence.split(\" \")\n\tsplit_up.collect do |word|\n\t\tword.reverse!\n\tend\n\tsplit_up.join(' ')\nend", "def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n\n array = my_sentence.split(/(\\S+)|(\\W)/)\n\n first_index = 0\n last_index = (array.length) - 1\n \n while first_index < last_index\n temp = array[first_index]\n array[first_index] = array[last_index]\n array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n\n array = array.join(\"\")\n\n array.length.times do |n|\n my_sentence[n] = array[n]\n end\n return my_sentence \nend", "def change_me(string)\n result = []\n words = string.split\n iterator = 0\n loop do\n break if iterator == words.size\n word = words[iterator]\n if word.reverse == word\n result << word.upcase\n else\n result << word\n end\n iterator += 1\n end\n result.join(' ')\nend", "def reverse_each_word(sentence)\n backwards = []\n sentence_array = sentence.split(/ /)\n sentence_array.collect do |word|\n backwards << word.reverse\n end\n backwards.join(\" \")\nend", "def reverse_words(sentence)\n # sentence_array = sentence.split\n sentence.split.map(&:reverse)\n .join(' ')\n\nend", "def reverse_each_word(sentence)\r\n new_sentence = sentence.split\r\n new_sentence.collect do |x|\r\n x.reverse!\r\n end\r\n new_sentence.join(\" \")\r\nend", "def reverse_sentence(a_string)\n a_string.split.reverse.join(' ')\nend", "def reverse_each_word(sentence)\n array = sentence.split()\n reversed_words = array.collect do |word|\n word.reverse\n end\n reversed_words.join(\" \")\nend", "def reverse_sentence(words)\n words.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n=begin\n p string.reverse # ex. \"dlroW olleH\" --- reverses whole string\n p string.split(' ') # ex. [\"Hello\", \"World\"] --- returns array of strings split by the space\n p string.split(' ').reverse # ex. [\"World\", \"Hello\"] --- returns array in reverse order\n p string.split(' ').reverse.join # ex. \"WorldHello\" --- returns string from reversed array\n p string.split(' ').reverse.join(' ') # ex. \"World Hello\" --- solution\n=end\n if string != ''\n string.split(' ').reverse.join(' ')\n else\n string\n end\nend", "def reverse_words(sentence)\n new_sentence = []\n reversed_sentence = []\n new_sentence = sentence.split(\" \")\n new_sentence.each do |word|\n new_word = word.reverse\n reversed_sentence << new_word\n end\n reversed_sentence.join(\" \")\nend", "def reverse_each_word(sentence)\n sentence = sentence.split(' ')\n sentence.collect do |word|\n word.reverse!\n end\n sentence = sentence.join(' ')\nend", "def reverse_each_word (sentence)\n array_sentence = sentence.split()\n array_reversed = array_sentence.collect do |word|\n word.reverse\n end\n array_reversed.join(\" \")\nend", "def reverse_it(sentence)\n sentence.split(' ').reverse.join(' ')\nend", "def reverse_sentence(str)\n str.split.reverse.join(' ')\nend", "def reverseWords(s)\n s.split(\" \").reverse.join(\" \")\nend", "def letter_reverse(sentence)\n # sentence.split(\" \").map(&:reverse).join(\" \")\n # sentence.gsub(/\\w+/) { |word| word.reverse }\n sentence.gsub(/\\w+/, &:reverse)\nend", "def reverse_sentence(string)\r\n string.split.reverse.join(\" \")\r\nend", "def reverse_sentence(str)\n str.split.reverse.join(\" \")\nend", "def reverse_sentence(str)\n str.split.reverse.join(\" \")\nend", "def reverse_each_word (sentence)\r\n arr = sentence.split\r\n new_sentence = []\r\n arr.collect do |word|\r\n new_sentence << word.reverse\r\n end\r\n new_sentence.join(\" \")\r\nend", "def reverse_sentence_old(str)\n str.split.reverse.join(' ')\nend", "def reverse_sentence(string)\n array = string.split\n array.reverse!\n array.join(\" \")\nend", "def reverse_each_word(string)\n sentence_array = string.split(\" \")\n reversed_sentence = []\n sentence_array.collect do |word|\n reversed_sentence << word.reverse\n end\n reversed_sentence.join(\" \")\nend", "def reverse_sentence(string)\n \n arr = string.split\n arr = arr.reverse\n arr.join(' ')\nend", "def word_cap(sentence)\n words = sentence.split(' ')\n capitalized_words = []\n words.each do |word|\n capitalized_words << word.capitalize\n end\n capitalized_words.join(' ')\nend", "def reverse_each_word(string)\n s = string.split(\" \")\n backward_sentence = s.collect do |word|\n word.reverse\n end\n backward_sentence.join(\" \")\nend", "def capital str \n cap_arr = str.split(' ')\n cap_arr.map! { |word|\n word[0].upcase + word[1..-1]\n }\n cap_arr.join(' ')\nend", "def reverse_sentence(sentence)\n reverse = sentence.split(' ').reverse.join(' ')\nend", "def reverse_sentence(str)\n\n str.split.reverse.join(\" \")\n \nend", "def reverse_each_word(sentence)\n reversed = []\n array = sentence.split(/ /)\n array.collect do |word|\n reversed << word.reverse\n end\n reversed.join(\" \")\nend", "def reverse_sentence(sentence)\n sentence.split.reverse.join(' ')\nend", "def reverse_sentence(my_sentence)\n if my_sentence != nil\n # Creates array of words and spaces\n words_array = words(my_sentence)\n\n # Revereses the order of the words\n length = words_array.length\n i = 0\n j = length - 1\n (length / 2).times do\n # selects word at smallest index that has not been swapped\n word_1 = words_array[i]\n # selects words at largest index that has not been swapped\n word_2 = words_array[j]\n \n words_array[i] = word_2\n words_array[j] = word_1\n \n i += 1\n j -= 1\n end\n \n reverse = words_array.join\n\n # Overrides original string with order of characters in reverse\n i = 0\n my_sentence.length.times do\n my_sentence[i] = reverse[i]\n i += 1\n end\n end\n\n return my_sentence\nend", "def reverse_each_word(string)\n sentence = string.split()\n sentence.collect do |word|\n word.reverse!\n end\n sentence.join(\" \")\nend", "def reverse_each_word(sentence)\n words = sentence.split(\" \")\n\n new_words = words.collect do |word|\n word.reverse()\n end\n\n new_words.join(\" \")\nend", "def reverse_each_word(phrase)\n phrase.split.collect {|word| word.reverse}.join(\" \")\n \n end", "def reverse_each_word(sentence1)\n ## sentence1.split turns the string into an array, where each word is an element of the array. No spaces.\n sentence_array = sentence1.split\n sentence_array.collect { |word|\n \n ## .reverse! reverses each word \"in place\", not creating new\n word.reverse!\n }\n ## .join(\" \") takes the elements of the array, joins them as a string with a space between each \n sentence_array.join(\" \")\nend", "def reverse_words(sentence)\n\t# improved readability by making this code into two separate lines.\n\tnew_sentence = sentence.split.map! do |word| \n\t\tword.reverse!\n\tend\n\t# removed an unnecessary \"return\"\n\tnew_sentence.join(\" \")\nend", "def reverse_each_word(sentence)\narrayed = sentence.split (\" \")\nreversed = arrayed.collect {|i| i.reverse}\nreversed.join (\" \")\nend", "def reverse_each_word(sentence)\n\tarray_of_words = sentence.split(' ')\n\tarray_of_words.collect do |word|\n word.reverse!\n\tend\n\tarray_of_words.join(\" \")\nend", "def reverse_sentence2(sentence)\n words = sentence.split\n reversed = []\n words.each { |word| reversed.unshift(word) }\n reversed.join(' ')\nend", "def reverse_words(string)\n string.gsub(/\\w+/) { |word| word.reverse! } \n end", "def reverse_sentence(str)\n new_str = []\n str.split.reverse_each {|x| new_str.push(x)}\n new_str.join(' ')\nend", "def reverse_each_word(sentence)\n\treversed = Array.new\n\tsentence.split(\" \").map do |word|\n\t\treversed << word.reverse.to_s\n\tend\n\treversed.join(\" \")\nend", "def reverse_each_word(string)\n sentence = string.split(\" \")\n sentence.collect do |word|\nword.reverse\nend.join(\" \")\nend", "def reverse_sentence(my_sentence)\n # raise NotImplementedError\n return my_sentence if my_sentence.nil? || my_sentence.empty?\n\n array = my_sentence.split(/\\s(\\s$)?/)\n\n reverse_array = []\n i = array.length - 1\n\n while i >= 0\n reverse_array << array[i]\n i -= 1\n end\n\n joined_sentence = reverse_array.join(\" \")\n j = 0\n while j < joined_sentence.length\n my_sentence[j] = joined_sentence[j]\n j += 1\n end\n\nend", "def reverse_each_word(str)\n words=str.split(' ')\n sentence = []\n words.collect do |word|\n sentence << word.reverse\n end\n sentence.join(' ')\nend" ]
[ "0.774764", "0.7665982", "0.76456", "0.76456", "0.76456", "0.76456", "0.763883", "0.7622648", "0.76161605", "0.76161605", "0.7593086", "0.7580194", "0.7555982", "0.7552808", "0.75448716", "0.75360644", "0.75198585", "0.75164944", "0.7498448", "0.7487729", "0.7481702", "0.7475937", "0.7474842", "0.7470783", "0.7454638", "0.7444374", "0.74338734", "0.74323565", "0.74286884", "0.74286884", "0.74286884", "0.7427805", "0.74100363", "0.74100363", "0.7395768", "0.7393749", "0.7387533", "0.7380271", "0.7379988", "0.73760766", "0.7374345", "0.7373044", "0.7372278", "0.73660284", "0.7364265", "0.7354208", "0.73479813", "0.7346837", "0.7341657", "0.7338719", "0.7338719", "0.7338719", "0.7338719", "0.7338719", "0.73363024", "0.7333188", "0.7327731", "0.7327639", "0.7325268", "0.7312361", "0.7310676", "0.73065877", "0.73036647", "0.7302209", "0.72902983", "0.72865087", "0.7282319", "0.72819036", "0.728082", "0.7279607", "0.7276502", "0.7276211", "0.7270535", "0.7270535", "0.72688186", "0.7261307", "0.725491", "0.72522646", "0.7251896", "0.7247052", "0.72436565", "0.72436357", "0.7241551", "0.7237164", "0.7236455", "0.72324145", "0.7231822", "0.72313184", "0.722204", "0.72131735", "0.72098386", "0.7209002", "0.7208343", "0.7202803", "0.72003937", "0.7190904", "0.71908844", "0.7190815", "0.71841514", "0.71676457", "0.7166448" ]
0.0
-1
Takes a single positive integer and returns that integer reversed 24521 => 12542
def dyslexic_accounting(number) # code goes here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reversed_number(int)\n int.to_s.reverse.to_i\nend", "def reversed_number(int)\n int.to_s.reverse.to_i\nend", "def reversed_number(int)\n int.to_s.reverse.to_i\nend", "def reversed_number(integer)\n integer.to_s.reverse.to_i\nend", "def reversed_number(integer)\n integer.to_s.reverse.to_i\nend", "def reversed_number(integer)\n integer.to_s.reverse.to_i\nend", "def reversed_number(int)\r\n int.digits.join.to_i\r\nend", "def reversed_number(integer)\n p integer.digits.join.to_i # .to_i automatically omit the leading 0s\n end", "def reversed_number(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(num)\n reversed_num = num.to_s.reverse\n reversed_num.to_i # convert back to integer (and drop leading zeroes)\nend", "def reversed_number(n)\n n.to_s.reverse.to_i\nend", "def reversed_number(n)\n n.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.reverse.to_i \nend", "def reversed_number(number)\n number.to_s.chars.reverse.join.to_i\nend", "def reversed_number(num)\n\tnum.to_s.reverse.to_i\nend", "def reversed_number_re(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(number)\n number.to_s.chars.reverse.join('').to_i\nend", "def reversed_number(pos_int)\n pos_int.to_s.reverse.to_i\nend", "def reversed_number2(num)\n num.to_s.reverse.to_i\nend", "def reverse_int(int)\nend", "def reverse(int)\n int.to_s.chars.reverse.delete_if{|num| num.to_i <= 0}.join.to_i\nend", "def reversed_number(num)\n num.to_s.chars.reverse.join.to_i\nend", "def reverse(x)\n int_str = x.to_s\n res_str = String.new\n if int_str[0] == '-'\n res_str << int_str[0]\n int_str.slice!(0)\n end\n i = int_str.size - 1\n int_str.size.times do\n res_str << int_str[i]\n i -= 1\n end\n res = res_str.to_i\n res.between?(-2**31, 2**31 - 1) ? res : 0\nend", "def reverse(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.chars.reverse.join('').to_i\nend", "def reversed_number(number)\n \n reversed_num = number.to_s.reverse\n reversed_num.to_i\nend", "def reversed_number(num)\n num.to_s.split('').reverse.join('').to_i\nend", "def reversed_number(num)\n num.to_s.split(//).reverse.join.to_i\nend", "def number_reverser(integer)\n string = integer.to_s.reverse!\n string.to_i\nend", "def reverse_integer(given)\n split_given = given.to_s.split('')\n reversed = []\n split_given.length.times { reversed << split_given.pop }\n reversed.join.to_i\nend", "def integer_reverse (i)\n y = 0\n #reversed = []\n\n while i > 0 do\n y = y*10\n y += (i%10)\n i /= 10\n #reversed << y\n end\n\n #return reversed[-1]\n return y\nend", "def reverse_number\n number = 12345\n tmp = 0\n while number != 0 do\n tmp = tmp * 10 + (number % 10)\n number = number / 10\n end\n puts tmp\nend", "def reversed_number(num)\n num.digits.join.to_i\nend", "def reversed_number(int)\n final = []\n until int <= 0\n int, to_push = int.divmod(10)\n final << to_push\n end\n final.join.to_i\nend", "def reversed_number(num)\n\nend", "def reversed_number(num)\n num_as_str = num.to_s\n num_as_str.reverse.to_i\nend", "def rev(n)\n n.to_s.chars.reverse.join('').to_i\nend", "def reversed_number(integer)\n result = []\n until integer.zero?\n integer, remainder = integer.divmod(10)\n result.push(remainder)\n end \n p result.inject { |number, digit| number * 10 + digit }\nend", "def reversed_number(number)\n list_reversed = []\n number.to_s.split('').each {|num| list_reversed.unshift(num) }\n list_reversed.join.to_i\nend", "def reversed_number(number)\n reversed = []\n leading = true\n\n number.digits.each do |digit|\n unless leading && digit == 0\n leading = false\n reversed.push(digit)\n end\n end\n\n reversed.join.to_i\nend", "def reversed_number(integer)\n integer_array = integer.to_s.chars\n\n reversed_string = integer_array.reverse.join\n\n result = ''\n reversed_string.each_char do |int|\n result << Integer(int, 10).to_s\n end\n result.to_i\nend", "def reverse(x)\n if x >= 0\n return arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\n else\n arr = x.to_s.chars.map(&:to_i)\n return arr.shift\n end\nend", "def reverse(x)\n negative = false\n negative = true if x < 0 \n result = 0\n divisor = 10\n x = x.abs\n while(x > 0)\n result = (result * 10) + x % divisor\n x = x / divisor \n end\n result = result * -1 if negative\n return 0 if (result > 2147483648 || result < -2147483647)\n result\nend", "def reverse(number)\n digits = number.to_s.chars\n reversed = []\n if digits.length <= 1\n number\n else\n reversed << digits.pop\n reversed << reverse(digits.join.to_i)\n reversed.join.to_i\n end\nend", "def reverse(x)\n return 0 if x == 0\n ans = x.to_s.reverse.to_i\n return 0 if ans > 2147483647 #(2^32) \n x > 0 ? ans : ans * -1\nend", "def reverse(number)\n digits = number.to_s.split(\"\")\n digits.reverse!\n return digits.to_s.to_i\nend", "def reverse(number)\n \n digits = number.to_s.split(\"\").dup\n return number if digits.length == 1\n last = digits.pop\n p \"last == #{last.inspect}\"\n new_num = Integer(digits.to_s)\n Integer(last << reverse(new_num).to_s)\nend", "def reverse(n)\n reversed = 0\n while n > 0\n reversed = 10 * reversed + n % 10\n n = n / 10\n end\n reversed\nend", "def reverse_digits(int)\n \nend", "def reverse(z)\n\tx = z\n\ty = 0\n\twhile x!=0 do\n\t\ty *= 10\n\t\ty += x%10\n\t\tx /= 10\n\tend\n\treturn y\nend", "def reversed_number(int)\n # output = 0\n # reversed_array = int.to_s.chars.reverse\n # p reversed_array\n int.to_s.reverse.to_i\nend", "def reverse(number)\n return number if number < 10\n array = number.to_s.split(//)\n\n test_number = array.first.to_i\n new_array = array.drop(1)\n\n new_number = reverse(new_array.join.to_i)\n new_number * 10 + test_number\nend", "def reverseNumber(n)\n n.to_s[0] == '-' ? -(n.to_s.reverse.to_i) : n.to_s.reverse.to_i\n # if n.to_s[0] == '-'\n # -(n.to_s.reverse.to_i)\n # else\n # n.to_s.reverse.to_i\n # end\nend", "def reverse(x)\n if x >= 0\n arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\n puts(arr)\n else\n arr = x.to_s.chars.map(&:to_i)\n arr.shift\n arr = -(arr.reverse.join.to_i)\n puts(arr)\n end\nend", "def invertirNumero(numero)\n @numero = numero.to_s\n return (@numero.reverse).to_i\nend", "def reverse(number)\n if number < 10\n return number\n end\n \n multiplier = 10\n \n until multiplier > number / 10\n multiplier *= 10\n end\n \n return ((number % 10) * multiplier) + reverse(number / 10) \n \nend", "def reversed_number(number)\n number_string = number.to_s # convert to string\n number_chars = number_string.chars # chars to split string to individual characters in an array\n reversed_string = number_chars.reverse # 'reverse' the array\n numbers = reversed_string.join('') # join the array\n numbers.to_i # convert array to integers\nend", "def reverse(num)\n reverse = 0\n while num > 0\n last_num = num % 10\n reverse = (reverse * 10) + last_num\n num = num / 10\n end\n return reverse\nend", "def reverse_ruby(x)\n x_rev_signed = x.positive? ? '' : '-'\n x_rev = (x_rev_signed + x.to_s.split('-').last.reverse).to_i\n x_rev.bit_length > 31 ? 0 : x_rev\nend", "def reverse_digits(int)\n # return int.to_s.reverse.to_i\n\n digs = int.to_s\n rev_digs = \"\" \n\n i = digs.length - 1\n while i >= 0\n rev_digs << digs[i]\n i -= 1\n end\n return rev_digs\nend", "def reversed_number(number)\n result = ''\n numbers = number.to_s\n numbers.each_char do |num|\n result.prepend(num) # prepend to take the end of the array and add it to the 'result' array.\n end\n result.to_i # convert to integer\nend", "def reverse_digit(original)\n reverse = 0\n # check if there is any numbers left\n while original > 0\n # adding the lass digit to reverse\n reverse = (reverse*10) + (original%10)\n # removing the lass digit from the original\n original=original/10\n end\n return reverse\nend", "def reverse(number)\n return number if number.to_s.length == 1 #1 is the last number to go\n number_array = number.to_s.split(\"\")\n first_element = number_array.pop #ie 2 (from base)\n new_number = number_array.join(\"\").to_i\n recursive_call = first_element.to_s + reverse(new_number).to_s #take advantage of string concat\n\n output_string = \"\"\n number = output_string + recursive_call\n number.to_i\nend", "def solution(x)\n reverse = 0\n sign = x < 0 ? -1 : 1\n number = x.abs\n while(number > 0) do\n last_digit = number % 10\n reverse = (reverse * 10) + last_digit\n number = number / 10\n end\n reverse * sign\nend", "def reverse(x)\n if x == 0\n return 0\n end\n array = x.to_s.split(\"\")\n answer = []\n array.each_with_index do |num, ind|\n answer.insert(-(ind+1), num)\n end\n p answer\n if answer.last == \"-\"\n return -(answer.join(\"\").to_i)\n end\n answer.join(\"\").to_i\nend", "def number_reverser(number)\n result = 0\n while number != 0\n digit = number % 10\n result = (result * 10) + digit\n number = number / 10\n end\n result\nend", "def reverse(x)\n x = x.to_s\n x = x.reverse\n zeros = 0\n \n if x[x.length-1] == \"-\"\n x.delete \"-\"\n x.prepend(\"-\")\n end\n \n if x[0] == \"0\"\n x.split('').each do |str|\n if str != \"0\"\n break\n else\n zeros += 1\n end\n end\n x = x[zeros..x.length-1]\n end\n \n if x.to_i > 2147483647 || x.to_i < -2147483648\n return 0\n else\n return x.to_i\n end\n \nend", "def reverse_digits(num)\n num_array = num.to_s.chars\n return num_array[0] if num_array.length == 1\n\n \"#{num_array.pop} \" + reverse_digits(num_array.join.to_i)\nend", "def rotate_rightmost_digits(int, r)\n arr = int.to_s.chars\n remove = arr.delete_at(-r)\n arr << remove\n arr.join.to_i\nend", "def rotate_rightmost_digits(number, n)\n arr = number.digits.reverse\n e = arr.delete_at(-n)\n arr << e\n arr.join.to_i\nend", "def rotate_rightmost_digits(int, position)\n int_arr = int.digits.reverse\n shifting = int_arr.pop(position)\n int_arr.concat(rotate_array(shifting)).join.to_i\nend", "def rotate_rightmost_digits(integer, n)\n ary = integer.digits.reverse\n new_ary = Array.new(ary) # avoid mutating the original argument\n new_ary << new_ary.delete_at(-n)\n new_ary.join('').to_i\nend", "def reverse_bits(num)\n num.to_s(2).rjust(32, '0').reverse.to_i(2)\nend", "def rotate_rightmost_digits(num, n)\n arr = num.digits.reverse\n number = arr.delete_at(-n)\n arr.append(number).join.to_i\nend", "def rotate_rightmost_digits(num, n)\n arr = num.digits.reverse\n number = arr.delete_at(-n)\n arr.append(number).join.to_i\nend", "def fliplr\n reverse(1)\n end", "def reverse(x)\n return arr = x.to_s.chars.map(&:to_i).reverse.join.to_i\nend", "def rotate_rightmost_digits(num, n)\n digits = num.to_s.chars\n digits << digits.delete_at(-n)\n digits.join.to_i\nend", "def rotate_rightmost_digits(number, n)\n array = number.to_s.split(//)\n removed_element = array[-n]\n array.slice!(-n)\n [array, removed_element].flatten.join.to_i\nend", "def rotate_rightmost_digits_alt(number, n)\n digits = number.digits.reverse\n digits[-n..-1] = rotate_array_alt(digits[-n..-1])\n digits.join.to_i\nend", "def rotate_rightmost_digits(number, n)\n number_array = number.to_s.chars\n number_array[-n..-1] = rotate_array(number_array[-n..-1])\n number_array.join.to_i\nend", "def rotate_rightmost_digits(integer, n)\n num_arr = integer.digits.reverse\n new_arr = num_arr[0...-n] << rotate_array(num_arr[-n..-1])\n new_arr.flatten.join.to_i\nend", "def digit_list(positive_integer)\n positive_integer.digits.reverse!\nend", "def digit_list(integer)\n integer.digits.reverse\nend", "def reverse_digits(number)\n numberArray = number.to_s.split('')\n numberArray = numberArray.reverse\n \n newInt = \"\"\n numberArray.each do |element|\n newInt += element\n end\n return newInt.to_i\n \n \nend", "def digit_list(int)\n int.digits.reverse\nend", "def digit_list(int)\n int.digits.reverse\nend", "def rotate_integer(int)\r\n ans = int.to_s[1..-1] << int.to_s[0]\r\n ans.to_i\r\nend", "def rotate_rightmost_digits(number, num)\n digits = number.to_s.chars.map(&:to_i)\n index_to_rotate = digits.size - num\n digits << digits.delete_at(index_to_rotate)\n p digits.join.to_i\nend", "def reverse_sign(an_integer)\n return 0 - an_integer\nend", "def reverse_sign(an_integer)\n return 0 - an_integer\nend", "def rotate_rightmost_digits(number, n)\n all_digits = number.to_s.chars\n all_digits[-n..-1] = rotate_array(all_digits[-n..-1])\n all_digits.join.to_i\nend", "def rotate_rightmost_digits(number, n)\nall_digits = number.to_s.chars\nall_digits[-n..-1] = rotate_array(all_digits[-n..-1])\nall_digits.join.to_i\nend" ]
[ "0.84845674", "0.84845674", "0.84845674", "0.84505075", "0.84505075", "0.84505075", "0.8344419", "0.8334538", "0.833096", "0.833096", "0.833096", "0.83074206", "0.830725", "0.830725", "0.82453936", "0.82453936", "0.82453936", "0.82453936", "0.82453936", "0.82453936", "0.8236024", "0.822353", "0.82128197", "0.82123905", "0.81973594", "0.8186491", "0.81730473", "0.8170716", "0.81284916", "0.81153756", "0.8112693", "0.8095907", "0.8094611", "0.80490863", "0.80426705", "0.8025764", "0.8009115", "0.80031407", "0.79597175", "0.79500526", "0.7920835", "0.7916574", "0.7870989", "0.78668433", "0.7864408", "0.7818856", "0.77850056", "0.77821416", "0.7765493", "0.77649176", "0.7761772", "0.77523905", "0.7744705", "0.77197397", "0.7712892", "0.7700649", "0.76862764", "0.76527315", "0.76497674", "0.76409554", "0.7640276", "0.76229024", "0.7586548", "0.7497973", "0.7493824", "0.746039", "0.7459561", "0.7431242", "0.73960364", "0.73940533", "0.73212373", "0.73039395", "0.7254443", "0.72086215", "0.72027445", "0.71104443", "0.7106609", "0.7106338", "0.70782995", "0.70638394", "0.69973075", "0.698928", "0.698928", "0.6971353", "0.69595", "0.6958779", "0.69111395", "0.6910008", "0.690938", "0.6880893", "0.68803704", "0.6877934", "0.68767613", "0.6869272", "0.6869272", "0.6854748", "0.68448436", "0.6831278", "0.6831278", "0.6822979", "0.6798925" ]
0.0
-1
helper to export the complete nested attributes.
def export_attributes attributes.to_nested_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_attrs\n self.class.export_attrs || []\n end", "def exportable_attributes\n attributes.clone\n end", "def dump_data\n create_attr_hash\n end", "def nested_attributes\n []\n end", "def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend", "def full_attributes \n self.class.attributes\n end", "def to_rest\n return attributes\n end", "def attributes\n full_attributes.to_hash(self)\n end", "def to_rest\n return attributes\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def dump_attributes!\n self.class.fields.each_pair do |name, field|\n send(\"set_#{name}\", field.dump(attributes[name])) if respond_to? \"set_#{name}\"\n end\n self\n end", "def export_attributes(*attributes)\n self.export_attrs = attributes.freeze\n end", "def attributes\n @build['attributes']\n end", "def to_json\n JSON.dump _attributes\n end", "def attributes(out_mode)\n (out_mode == :full ? self::FIELDS_FULL : self::FIELDS_SUMMARY).map(&:to_s)\n end", "def attributes\n @attributes ||= @internal_struct[:attributes] || {}\n end", "def fattr_inspect\n to_hash.inspect\n end", "def data_attributes\n end", "def to_data\n data = {}\n @keys.each do |k|\n attr = select_child_attr(send(k))\n ext_key = @attr_table.ext_of(k)\n data[ext_key] = attr\n end\n data['_diff_state_'] = @diff_state.to_data unless @diff_state.empty?\n data\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes\n data[:attributes]\n end", "def _dump(lvl = -1)\n if !@exported_fields\n super\n else\n marshalled_members = @exported_fields.map do |name|\n value = @members[name]\n [name, Marshal.dump(value)] rescue nil\n end\n marshalled_members.compact!\n Marshal.dump([marshalled_members, @aliases])\n end\n end", "def all_attributes\n @@all_attributes ||= \n begin\n to_return = {}\n @fields.each do |key, field|\n to_return[key] = field.human_name\n end\n to_return\n end\n end", "def to_hash\n Attributes.disable_nest_hash(attrs)\n end", "def imported_attributes\n @imported_attributes ||= ImportedAttributes.new(subject: self, keys: self.class.displayed_attributes).to_h\n end", "def imported_attributes\n @imported_attributes ||= ImportedAttributes.new(subject: self, keys: self.class.displayed_attributes).to_h\n end", "def attributes\n @attributes ||= @internal_struct[:attributes]\n end", "def attributes\n @attributes ||= {}\n @attributes\n end", "def attributes\n @attributes\n end", "def attributes\n @_attributes\n end", "def attributes\n @attributes\n end", "def attribs\n\t\t@attributes\n\tend", "def to_json\n attrs.to_json\nend", "def attributes\n end", "def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end", "def structure_dump() end", "def export_personal_information\n return unless persisted?\n\n descendants = ApplicationRecord.descendants.select(&:has_personal_information?)\n {}.tap do |result|\n descendants.each do |descendant|\n result[descendant.name] = descendant.export_personal_information(id)\n end\n end.to_json\n end", "def attributes\n attrs = sort_members(@context.attributes).find_all{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n attrs.collect{|a| {:name=>a.name, :visibility=>a.visibility, :rw=>a.rw, :description=>markup(a.comment, true)}}\n end", "def iiif_manifest_attributes\n super.merge imported_attributes\n end", "def iiif_manifest_attributes\n super.merge imported_attributes\n end", "def public_attributes\n attributes\n end", "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:key] = self.key\n\t\tattrs[:value] = self.value\n\t\tattrs[:description] = self.description\n\t\tattrs[:reference_id] = self.id\n\t\tattrs[:rider_id] = self.rider_id\n\t\tattrs[:tag_list] = self.tag_list\n\n\t\tattrs\n\tend", "def full_export_as_json\n struct = self.as_json\n struct[:assessment_question_responses] =\n self.assessment_question_responses.map { |r| r.as_json }\n struct[:resources] = self.resources.\n where(parent_id: nil).map { |res| res.full_export_as_json }\n struct\n end", "def get_attributes\n\t\t\t@@attributes\n\t\tend", "def collect_writable_attributes\n #\n # Find the attributes for the class and collect them into an array\n # that will be placed into a Hash structure\n #\n attributes = self.class.attributes.filter_map do |attribute|\n #\n # If an attribute is marked as read_only then we want to ignore the attribute\n # when it comes to saving the xml document; so we will not go into any of\n # the below process\n #\n next if attribute.options[:read_only]\n\n value = send(attribute.method_name)\n value = nil if value == attribute.default\n\n #\n # Apply any on_save lambda/proc or value defined on the attribute.\n #\n value = apply_on_save_action(attribute, value)\n\n #\n # Attributes that have a nil value should be ignored unless they explicitly\n # state that they should be expressed in the output.\n #\n next if value.nil? && !attribute.options[:state_when_nil]\n\n attribute_namespace = attribute.options[:namespace]\n [\"#{attribute_namespace ? \"#{attribute_namespace}:\" : \"\"}#{attribute.tag}\", value]\n end\n\n attributes.to_h\n end", "def flex_attributes; nil end", "def flatten!\n self.class.attributes.keys.select { |k| k.end_with?('_data') }.each do |data_attr|\n reference_attr = data_attr[/(.+?)_data$/, 1]\n value = send(data_attr)\n next if value.nil?\n\n send(\"#{data_attr}=\", value)\n send(\"#{reference_attr})\", nil)\n end\n\n self\n end", "def attributes\n serializable = {}\n\n @attrs.each do |key|\n serializable[key.to_s] = nil\n end\n\n serializable\n end", "def recursive\n attributes.fetch(:recursive)\n end", "def as_json\n attributes\n end", "def as_json\n attributes\n end", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def detail_attributes\n @detail_attributes ||= {}\n end", "def attributes\n @attributes\n end", "def attributes\n @attributes\n end", "def attributes\n @attributes\n end", "def to_yaml\n @attributes.to_yaml\n end", "def flattened_fields\n metadata_string = String.from_java_bytes @reader.getMetadata\n description_text = self.class.description_from_metadata_xml(metadata_string)\n begin\n metadata = JSON(description_text)\n flattened_fields = metadata.key?('jpdfer_flattened_fields') ? metadata['jpdfer_flattened_fields'] : {}\n rescue JSON::ParserError\n flattened_fields = {}\n end\n flattened_fields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = value\n end\n end", "def dump(depth = 0)\n attr = ''\n @attr.each do |a| ## self.attributes do |a|\n attr += a.to_s + \", \"\n end if @attr\n attr.chop!\n attr.chop!\n print ' ' * depth * 2\n print \"#{@name}(#{attr})\\n\"\n @children.each do |child|\n child.dump(depth + 1)\n end if @children\n end", "def export_attributes(hash = nil, options = {})\n attribute_map.assign_context = self\n\n hash ||= attributes\n attribute_map.map_attributes(hash, options)\n end", "def attrs\r\n @attrs ||= Utils.deep_merge(@attributes, _package_.env)\r\n end", "def exposed_attributes\n [:id, :first_name, :last_name, :email, :phone, :role_id, :school_id]\n end", "def _attributes\n @_attributes = superclass.try(:_attributes)&.dup || {} unless defined?(@_attributes)\n @_attributes\n end", "def final_serialize_attrs \n if being_included?\n self.class.include_attrs | serialize_attrs\n else\n self.class.default_attrs | serialize_attrs\n end\n end", "def serializable_attributes\n #attribute_names = @record.attributes.keys # This includes all attributes including associations\n attribute_names = @record.class.keys.keys # This includes just keys\n idex = attribute_names.index(\"_id\")\n attribute_names[idex] = \"id\" if idex\n\n if options[:only]\n options.delete(:except)\n attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }\n else\n options[:except] = Array(options[:except]) \n attribute_names = attribute_names - options[:except].collect { |n| n.to_s }\n end\n\n attribute_names.collect { |name| Attribute.new(name, @record) }\n end", "def attributes\n @_attributes\n end", "def serializable_attributes\n attributes = %w[id name created_at]\n attributes << \"uid\" unless confidential?\n attributes\n end", "def attributes\n self.class.fields.inject({}) do |attribute_hash, field|\n attribute_hash[field] = send(field)\n attribute_hash\n end\n end", "def serialize_attrs\n @serialize_attrs ||= []\n end", "def global_attributes\n @root_group.attributes\n end", "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:year] = self.year\n\t\tattrs[:age] = self.age\n\t\tattrs[:amount] = self.amount\n\t\tattrs[:rate] = self.rate\n\n\t\tattrs\n\tend", "def attributes\n @attributes = @attributes || {}\n end", "def print_attribute(*) end", "def attributes\n data.require(:attributes)\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def attributes\n @attributes ||= {}\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def to_h\n @attributes\n end", "def json_attributes\n attributes.merge(\n node_from_id: from_character_id, \n node_to_id: to_character_id,\n strengh: force.abs,\n label: title)\n end", "def copyable_attributes; end" ]
[ "0.7145824", "0.71221995", "0.68197215", "0.6781049", "0.65717417", "0.64945203", "0.6494318", "0.64807415", "0.6474723", "0.64334774", "0.64063007", "0.63334435", "0.6228887", "0.61896086", "0.6130107", "0.60799575", "0.6058245", "0.59941417", "0.5993633", "0.59816456", "0.59816456", "0.59816456", "0.59816456", "0.59816456", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5979144", "0.5976823", "0.5976151", "0.59740597", "0.59704715", "0.5968047", "0.5968047", "0.5962521", "0.5937798", "0.5928198", "0.5919417", "0.59088665", "0.590455", "0.59008676", "0.58931184", "0.5886799", "0.5886515", "0.58855957", "0.58849", "0.58801466", "0.58801466", "0.587963", "0.586378", "0.5863215", "0.5863186", "0.5859337", "0.58589405", "0.58488387", "0.5839413", "0.582801", "0.5826858", "0.5826858", "0.5801787", "0.5789282", "0.578696", "0.578696", "0.578696", "0.5783688", "0.57799673", "0.57797813", "0.57788384", "0.5778004", "0.5770847", "0.57694507", "0.57658756", "0.57655805", "0.5758009", "0.57506657", "0.57477975", "0.57444626", "0.57437575", "0.57433236", "0.5732058", "0.57136756", "0.5695106", "0.5692893", "0.5692893", "0.5692893", "0.5692893", "0.5692893", "0.5690994", "0.5688231", "0.56759113", "0.5675146" ]
0.81389475
2
Use callbacks to share common setup or constraints between actions.
def set_app_record @app_record = AppRecord.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def app_record_params params.fetch(:app_record, {}).permit( :company_name, :position, :description, :salary, :city, :interest_level, :app_link, :notes, :user_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
Create a way for the username to become encrypted
def encrypt(val) #Usage self.encrypt(val) return Digest::SHA1.hexdigest(val.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_credentials(username, password)\n \"\\0#{username}\\0#{password}\"\n end", "def username_format\n return if self.username.nil?\n self.username.gsub!(/[^0-9a-z\\- ]/i, '_')\n self.username.gsub!(/\\s+/, '-')\n self.username = self.username.downcase\n self.username = self.username.byteslice(0, 24) #substring 24\n end", "def encrypt_username(key = @key)\n # TODO: add different sql statements for different DBs.\n sql = \"UPDATE login_details\n SET encrypted_username =\n AES_ENCRYPT(#{quote_value(self.decrypted_username)}, #{quote_value(key)})\n WHERE id = #{self.id}\"\n # Run this update manually.\n self.connection.execute sql\n end", "def hash_username\n charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n Digest::SHA1.hexdigest(email + created_at.usec.to_s)\n .chars\n .each_slice(2)\n .map(&:join)\n .map { |hex| hex.to_i(16) }\n .map { |i| charset[i % charset.length] }\n .join\n .slice(0, 6)\n end", "def create_username() #t\n email_username = self.email.gsub(/(\\A([\\w\\.\\-\\+]+))@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i, \"\\\\1\")\n email_username = email_username.gsub(/\\W/, \"\")\n username_try = email_username\n \n i = 1\n found_unique_username = false\n while(!found_unique_username)\n if User.unique_username?(nil, username_try)\n found_unique_username = true\n else\n username_try = email_username + i.to_s\n end\n i += 1\n end\n \n self.username = username_try\n end", "def encode_credentials(username, password)\n \"\"\n end", "def ensure_username\n if self.username != \"\"\n self.username \n else\n self.username = \"user#{((self.email).hash).to_s[0,6]}\"\n end\n end", "def encode_pass_word val\n Sequel.lit \"\\ncrypt(\\n?\\n, gen_salt('bf', 13))\", val\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\") \n\tend", "def encrypt(string)\n\t#store passwords with the timestamp first, then password (encrpyted)\n secure_hash(\"#{salt}--#{string}\")\n\t#Since weíre inside the User class, Ruby knows that salt refers to the userís salt attribute.\n end", "def generate_username2 (fir, las)\n\tfir.gsub(/[\\W\\d]/, \"\").downcase[0] + las.gsub(/[\\W\\d]/, \"\").downcase unless\n\tfir === \"\" || las === \"\"\nend", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def secret_username\n return nil if gml_uniquekey_hash.blank?\n \"anon-\"+gml_uniquekey_hash[-5..-1]\n end", "def fake_name(real_name)\n #call swap name to swap first and last names\n swapped_name = swap_name( real_name)\n last_name = swapped_name[0]\n first_name = swapped_name[1]\n\n #call encrypting method\n fake_last_name = encrypt_word(last_name)\n fake_first_name = encrypt_word(first_name)\n\n #concatenate name\n fake_last_name + \" \" + fake_first_name\nend", "def encrypt; end", "def encrypt_password\n salt = Digest::SHA1.hexdigest(username)[0..4]\n hash = Digest::SHA1.hexdigest(salt + password)\n self.password_digest = \"sha1$#{salt}$#{hash}\"\n end", "def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end", "def encrypt string\n string\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def generate_username\n\t\tself.username = \"guest_#{Time.now.to_i}#{rand(100)}\" if username.blank?\n\tend", "def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend", "def encrypt_password\n self.password = Digest::MD5.hexdigest(self.password).encode('UTF-8')\n end", "def encrypt_password\n return if self.password.blank?\n \n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{self.username}--\") if self.new_record?\n self.crypted_password = self.encrypt(self.password)\n end", "def encrypt(password)\n self.class.encrypt(password, Time.now.to_s)\n end", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def encrypt(string, preserve_case=false)\n string.downcase! if !preserve_case && User.case_insensitive_passwords?\n generate_hash(\"--#{salt}--#{string}--\")\n end", "def username=(value)\n if value\n value.downcase!\n value.squish!\n end\n super(value)\n end", "def encrypt(password)\n Digest::SHA1.hexdigest(\"--#{self.salt}--#{password}--\")\n end", "def encrypt_name(name)\n\n\t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\t\talias_name = \"\"\n\t\t\t\n\t\t\tname.each_char do |letter|\n\t\t\t# if the letter is inside the array called vowels\n\t\t\t\tif vowels.include?(letter)\n\t\t\t\t\t# replace the letter with the next vowel in the array\n\t\t\t\t\t# put it into alias_name\n\t\t\t\t\talias_name << vowels[vowels.index(letter)+1]\n\t\t\t\t# replace the letter with the next consonant in the array\n\t\t\t\t# put it into alias_name\n\t\t\t\telsif consonants.include?(letter)\n\t\t\t\t\talias_name << consonants[consonants.index(letter)+1]\n\t\t\t\t# put letter into alias_name\n\t\t\t\t# this is for the spaces\t\n\t\t\t\telse\n\t\t\t\t\talias_name << letter\t\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\talias_name.split.reverse.map(&:capitalize)*' '\n\nend", "def set_username\n return if username?\n return unless email?\n\n base = email.partition('@').first.tr('.', '_')\n\n self.username = generate_username(base)\n end", "def wsse_username_token\n if digest?\n security_hash :wsse, \"UsernameToken\",\n \"wsse:Username\" => username,\n \"wsse:Nonce\" => nonce,\n \"wsu:Created\" => timestamp,\n \"wsse:Password\" => digest_password,\n :attributes! => { \"wsse:Password\" => { \"Type\" => PasswordDigestURI } }\n else\n security_hash :wsse, \"UsernameToken\",\n \"wsse:Username\" => username,\n \"wsse:Password\" => password,\n :attributes! => { \"wsse:Password\" => { \"Type\" => PasswordTextURI } }\n end\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end", "def standard_password\n \"!@Cd5678\"\n end", "def encode(plain_pass)\n md5 salt + plain_pass + salt\n end", "def encrypt(plain_password)\n self.class.encrypt(plain_password)\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def format_username\n \t_email_base = self.email[/[^@]+/]\n \tself.username ||= _email_base.camelize.underscore.gsub(/\\./,\"_\") unless _email_base.nil?\n\n end", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def encrypt(password)\n\tcounter = 0\n\twhile counter < password.length\n\tif password[counter] == \" \"\n\t\tpassword[counter] = \" \"\n\t\tcounter += 1\n\telse\n\t\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\t\talphabet.reverse!\n\t\tinstance_in_alphabet = alphabet[alphabet.index(password[counter])]\n\t\tpassword[counter] = alphabet[(alphabet.index(instance_in_alphabet)) - 1] \n\t\tcounter += 1 \n\tend\n\tend\nreturn password \nend", "def to_s\n \"#{username}\"\n end", "def username\n params[:username].downcase\n end", "def encrypt_password\n \tself.password = Digest::MD5.hexdigest(self.password)\n end", "def string_username\n CaseInsensitiveString.str(current_user.getUsername())\n end", "def authenticatable_salt; end", "def to_param; username end", "def to_param; username end", "def username=(value)\n write_attribute :username, value.downcase\n end", "def lets_encrypt\n render plain: ACME_SECRET\n end", "def lets_encrypt\n render plain: ACME_SECRET\n end", "def preprocess_username\n @username = @options[:ldap][:username_prefix] + @username if @options[:ldap][:username_prefix]\n end", "def name_encryption(full_name)\n\nfull_name = full_name.split(' ').rotate.join(' ')\n# .split(' ') splits full_name into array [\"first\", \"last\"]\n# .rotate rotates the first and last name within the array. (Ex. [\"last\", \"first\"])\n# .join(' ') combines array into a string. (Ex. \"last first\")\n\ncode_name = full_name.split('').map{ |x| x = next_letter(x)}\n# .split('') splits the string \"last first\" into individual characters.\n# .map{ |x| x = next_letter(x)} uses the next_letter method on each character and saves the changes.\n\ncode_name = code_name.join('')\n# .join('') combines individual characters into a\n\nend", "def encrypted(password)\n\t\tDigest::SHA2.hexdigest(\"#{self.salt} -- #{pass}\")\n\tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt_password\n\t\treturn if password.blank?\n\t\tif new_record?\n\t\t\tself.salt = Digest::SHA1.hexdigest(\"--#{Time.now}--#{name}--\")\n\t\tend\n\t\tself.encrypted_password = User.encrypt(password, salt)\n\tend", "def encrypt_code(e=nil)\n\t\tUser.encrypt((e || self.email), self.activation_code)\n\tend", "def encode_credentials(username, password)\n \"Basic #{ActiveSupport::Base64.encode64(\"#{username}:#{password}\")}\"\n end", "def store_issuer\n user = User.find_or_create_by(slack_id: @params[:user_id])\n user.update(username: @params[:user_name]) # in case they have changed their username\n end", "def crypt_password\r\n write_attribute \"password\", self.class.sha1(password)\r\n end", "def encryptor(user_pass)\n counter = 0\n output = \"\"\n while counter < user_pass.length\n\n if user_pass[counter] == \" \"\n output += \" \"\n elsif user_pass[counter] == \"z\"\n # conditional for \"z\"\n output += \"a\"\n else\n output += user_pass[counter].next\n end\n\n counter += 1\n\n end\n\n return output\nend", "def to_s\n username\n end", "def to_s\n username\n end", "def to_s\n username \n end", "def authenticatable_salt\n end", "def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end", "def encrypt_password\n return if password.blank?\n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{login}--\") if new_record?\n self.crypted_password = User.encrypt(password,self.salt)\n end", "def username\n username = self.name + \" \" + self.email\n\t end", "def encrypt_string(string)\n\n return string.tr(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\", \"9nopqrs8tuvwxy7zabcde6fghijk5lmNOPQ4RSTUVW3XYZABC2DEFGHI1JKLM0\")\n\nend", "def encrypt (password)\n output = ''\n for i in 0.. ( password.length - 1) do\n if password[i] == ' '\n output += ' '\n elsif password[i] == 'z'\n output += 'a'\n else\n output += password[i].to_s.next\n end\n end\n output\nend", "def encrypt_string(string)\n\n return string.tr(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\", \"9nopqrs8tuvwxy7zabcde6fghijk5lmNOPQ4RSTUVW3XYZABC2DEFGHI1JKLM0\")\n\nend", "def to_s\n username.to_s\n end", "def username\n params[:username].downcase\n end", "def set_username\n self.username = \"#{self.email.split('@').first}#{Faker::Number.number(3)}\"\n end", "def encrypt_password\n self.salt = make_salt if new_record?\n\t self.encrypted_password = encrypt(password)\n end", "def cypher(name)\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n\tnew_name = split_reverse(name).map! { |name| \n\t\tname.chars.map! { |char| \n\t\t\tif consonants.include?(char)\n\t\t\t \tconsonant(char)\n\t\t\telsif vowels.include?(char) \n\t\t\t\tvowel(char)\n\t\t\telsif consonants.upcase.include?(char) || vowels.upcase.include?(char) \n\t\t\t\tupcase(char)\n\t\t\telse\n\t\t\t\tspecial_char(char)\n\t\t\tend\n\t\t}\n\t}\n\tjoin(new_name)\nend", "def downcase_username\n self.username = username.downcase\n end", "def username=(value)\n\t write_attribute(:username, value.downcase)\n\tend", "def set_key!\n self.new_user_key = [*('a'..'z'),*('0'..'9')].shuffle[0,8].join\n end", "def encrypt_password(password, password_seed)\n\t\t\tpass_to_hash=password + \"Securasaurus\" + password_seed\n\t\t\t\n\t\t\tcase AUTHENTASAURUS[:hashing] \n when \"SHA2\"\n Digest::SHA2.hexdigest(pass_to_hash)\n when \"SHA1\"\n Digest::SHA1.hexdigest(pass_to_hash)\n when \"MD5\"\n Digest::MD5.hexdigest(pass_to_hash)\n else\n Digest::SHA2.hexdigest(pass_to_hash)\n end\n\t\t\t\n\t\tend", "def to_s\n username || sanitized_email || 'Anonymous'\n end", "def username=(username)\n write_attribute(:username, username.downcase)\n end", "def username=(username)\n write_attribute(:username, username.downcase)\n end", "def downcase_username()\n self.username = username.downcase\n end", "def encrypt(password)\n self.class.encrypt(password) #, salt)\n end", "def username=(val)\n write_attribute(:username, val.downcase.split(\" \").join)\n end", "def downcase_username\n self.username = self.username.downcase if self.username?\n end", "def encrypted\n \tself.encrypted_password = BCrypt::Password.create(self.password)\n end", "def username=(_arg0); end", "def username=(_arg0); end", "def username=(_arg0); end", "def digest_encrypt_password\n if password_changed? || username_changed?\n self.password = encrypt_password(username, DIGEST_REALM, password)\n end\n end", "def encrypted_password\n nil\n end" ]
[ "0.71242034", "0.68715996", "0.6871418", "0.6718811", "0.6634123", "0.66153085", "0.65640754", "0.64792585", "0.64270586", "0.64196855", "0.64130986", "0.63812107", "0.6350863", "0.6347924", "0.63435805", "0.63087523", "0.6295951", "0.629466", "0.62798417", "0.62551326", "0.62542105", "0.6239745", "0.622978", "0.6223325", "0.6201393", "0.6186776", "0.6174903", "0.61739653", "0.6171122", "0.61700326", "0.6168308", "0.61663955", "0.61534786", "0.61534786", "0.61534786", "0.61519563", "0.61488116", "0.61476386", "0.6145802", "0.61390287", "0.6135807", "0.6135807", "0.61345786", "0.6131095", "0.6128551", "0.612077", "0.61108816", "0.6099458", "0.6091869", "0.60915554", "0.60910237", "0.60910237", "0.60901165", "0.6084113", "0.6084113", "0.60713434", "0.6064877", "0.6055922", "0.6053291", "0.6053291", "0.6053291", "0.6053291", "0.6053291", "0.60473716", "0.60435337", "0.60390925", "0.60361063", "0.6035211", "0.60335743", "0.60286695", "0.60286695", "0.6027296", "0.6023938", "0.60216016", "0.6007043", "0.5998205", "0.5994797", "0.59944195", "0.5994231", "0.5991729", "0.5982677", "0.5978695", "0.5976801", "0.596798", "0.59649813", "0.59606713", "0.59573746", "0.59537506", "0.595078", "0.59494776", "0.59494776", "0.5949407", "0.5944678", "0.5943325", "0.5940701", "0.59397155", "0.5930845", "0.5930845", "0.5930845", "0.5927424", "0.592677" ]
0.0
-1
NOTE: there are also `copy_to` and `copy_from` methods, but that would have exceeded my timebox
def download(path, &block) resource = Aws::S3::Resource.new(client: @client).bucket(@bucket).object(path) local = Tempfile.new resource.download_file local.path local.rewind block.call local ensure local&.close local&.unlink # deletes the temp file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(from, to)\n \n end", "def copy_to(other); end", "def copy\n \n end", "def copy\n move(:copy)\n end", "def copy\n dup\n end", "def copy(from, to)\n @ctx.cp(@path + from, @path + to)\n end", "def copy(dest)\n raise NotImplementedError\n end", "def cache_copy(from,to)\n return unless @cache_base\n\n copy(@cache_base + from, @cache_base + to)\n end", "def copy_from(original)\n self.template = original.template\n self.position = original.position\n self.data = original.data\n self\n end", "def copy(source, destination, **options); end", "def make_copy\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend", "def copy_list \n\n\tend", "def copy(target, source)\n write target, read(source)\n end", "def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend", "def copy from, to\n add \"cp #{from} #{to}\", check_file(to)\n end", "def clone; end", "def clone; end", "def clone; end", "def copy\n self.public_send('|', 'pbcopy')\n self\n end", "def copied(src_item, item)\n end", "def clone() end", "def to_copy\n @to_copy ||= \"#{to_var( '_copy' )} = #{to_arg};\"\n end", "def copy(obj)\n obj.to_s.copy\nend", "def copy\n FileUtils.cp_r(@src, @dest)\n end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def initialize_copy(orig); end", "def copy object\r\n\tMarshal.load(Marshal.dump(object))\r\nend", "def __copy(i, j)\n\t\tbytes = @bytes.slice(i ... j).not_nil!\n\t\treturn Buffer.__new__(bytes)\n\tend", "def copy_from(source_list, &block); end", "def deep_copy(obj); end", "def clone\n end", "def clone\n end", "def clone\n end", "def copy (inboard)\n for i in (0..53)\n @board[i].copy(inboard[i])\n end\n end", "def initialize_copy(other)\n end", "def copy(from_object)\n to_object = nil\n to_object = @to_bucket.objects[from_object.key]\n\n if to_object.exists? && from_object.content_length == to_object.content_length\n puts \"Already exists : #{from_object.key}\"\n else\n to_object.copy_from(from_object)\n to_object.acl = :public_read\n puts \"Copy object : #{from_object.key}\"\n end\n end", "def copy(copy)\n\t\t\treturn Alimento.new(copy.nombre,copy.proteinas,copy.carbohidratos,copy.lipidos,copy.gei,copy.terreno)\n\t\tend", "def copy object\n\tMarshal.load(Marshal.dump(object))\nend", "def cop; end", "def cop; end", "def copy\n self.class.new(@x,@y)\n end", "def clone(*) end", "def clone(*) end", "def copydaysedit\n end", "def clone(source)\n copy(source, true)\n end", "def exact_copy(from_collection, to_collection: nil, label_plates: false)\n collection_type = from_collection.object_type\n if to_collection.nil?\n to_collection = make_new_plate(collection_type, label_plate: label_plates)\n end\n matrix = from_collection.matrix\n to_collection.matrix = matrix\n to_collection\n end", "def clone\n end", "def copy_board(board)\n board.dup\n end", "def copy(from: 0, to: length)\n editable? and @native.copy_text(from.to_i, to.to_i)\n end", "def clone\n self.copy\n end", "def clone\n self.copy\n end", "def copy(from, to)\n FileUtils.mkdir_p(File.dirname(to))\n # Pathname(a_path_to).mkpath # Throw Gem::LoadError (fileutils is not part of the bundle. Add it to your Gemfile.)\n\n # NOTE: Give the path regardless if is a File of Pathname\n path = from.path if from.respond_to?(:path)\n path ||= from\n\n # NOTE: See if a move, or another trick to avoid copy can be done here, for performances matter.\n FileUtils.cp(path, to)\n\n # Clean Tempfile\n from.close if from.respond_to?(:close) # Can be apply to File as well.\n from.unlink if from.respond_to?(:unlink) # Only for Tempfile\n\n nil\n end", "def copy\n Ripple.new(@pos)\n end", "def copy\n Marshal.load(Marshal.dump(self))\n end", "def copy(*froms, to)\n froms.each do |from|\n FileUtils.cp(from, to)\n end\n end", "def copy\n\t\t\treturn self.dup\n\t\tend", "def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end", "def initialize_copy(orig)\n #This is a stub, used for indexing\n end", "def copy(from, to)\n @parent.gemset_copy(from, to)\n end", "def destination(dest); end", "def destination(dest); end", "def copy_actions\r\n end", "def cp srcpath, dstpath\n end", "def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end", "def clone\n super\n end", "def copy_for_mission(mission)\n copies.for_mission(mission).first\n end", "def copy\n obj = self.dup\n obj.attributes = {\n :name => \"Copy of #{name}\",\n :active => false,\n :created_at => nil,\n :updated_at => nil\n }\n obj\n end", "def deep_copy\n deep_transform_values(&method(:_deep_copy))\n end", "def copy_revision(original)\n # we only copy the RevisionFile/RevisionDirectory entries\n new_revision = MemoryRevision.new(original.revision_identifier)\n new_revision.user_id = original.user_id\n new_revision.comment = original.comment\n new_revision.files_content = {}\n new_revision.timestamp = original.timestamp\n new_revision.server_timestamp = original.server_timestamp\n # copy files objects\n original.files.each do |object|\n if object.instance_of?(Repository::RevisionFile)\n new_object = Repository::RevisionFile.new(object.from_revision.to_s, {\n name: object.name,\n path: object.path,\n last_modified_revision: object.last_modified_revision,\n changed: false, # for copies, set this to false\n user_id: object.user_id,\n last_modified_date: object.last_modified_date,\n submitted_date: object.last_modified_date\n })\n new_revision.files_content[new_object.to_s] = original.files_content[object.to_s]\n else\n new_object = Repository::RevisionDirectory.new(object.from_revision.to_s, {\n name: object.name,\n path: object.path,\n last_modified_revision: object.last_modified_revision,\n last_modified_date: object.last_modified_date,\n submitted_date: object.last_modified_date,\n changed: false, # for copies, set this to false\n user_id: object.user_id\n })\n end\n new_revision.files.push(new_object)\n end\n new_revision # return the copy\n end", "def initialize_copy(other)\n # self\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def copy(options = {})\n copy_object(options)\n end", "def clone\n copy(false)\n end", "def to_patch\n { 'op' => 'copy', 'from' => @from, 'path' => @path }\n end", "def copied_from\n [ self[:copyfrom_path], self[:copyfrom_rev] ] if copyfrom_known?\n end", "def deepcopy(o)\n Marshal.load(Marshal.dump(o))\nend", "def deepcopy\n\t\tMarshal.load(Marshal.dump(self))\n\tend", "def copy_of *without, &block\n ASObj.from self, *without, &block\n end", "def copy\n Water.new(@pos)\n end", "def copy_attributes(hsh_copy_to, hsh_copy_from, attr_to_copy_list)\n\t\t\t\tattr_to_copy_list.each do |a_attr_to_copy|\n\t\t\t\t\thsh_copy_to[a_attr_to_copy] = hsh_copy_from[a_attr_to_copy]\n\t\t\t\tend\n\t\t\t\treturn hsh_copy_to\n\t\t\tend", "def copy\n ditto = self.class.new\n @images.each { |f| ditto << f.copy }\n ditto.scene = @scene\n ditto\n end", "def copy(dest, overwrite=false)\n NotImplemented\n end", "def copy_from(other)\n @stack = other.copy_stack\n end", "def copyfile from, to\n FileUtils.mkdir_p File.dirname to\n cp from, to\n end", "def deepcopy(o)\n Marshal.load(Marshal.dump(o))\nend", "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def __copy_on_write__(*)\n super.tap do\n new_set = __getobj__.instance_variable_get(:@set).dup\n __getobj__.instance_variable_set(:@set, new_set)\n end\n end", "def copy_values_from(other)\n self.name = other.name\n self.contributor = other.contributor\n self.share_mode = other.share_mode\n self.update_mode = other.update_mode\n self.public_view = other.public_view\n self.public_download = other.public_download\n end", "def clone\n Marshal.load(Marshal.dump self)\n end", "def copy(from, to, options = nil, binary = false)\n options ||= self.options if self.respond_to?(:options)\n if binary\n contents = File.new(from,\"rb\").read\n else\n contents = File.new(from).read\n end \n write_file to, contents, options, binary\n end", "def deep_copy(object)\n Marshal.load(Marshal.dump(object))\nend", "def copy\n new_attributes = self.attributes\n new_attributes.delete(:id)\n file = WSFile.create(new_attributes)\n owner = self.permissions(level: 'owner').user.first\n Permission.create(user: owner, file: file, level: \"owner\")\n self.assets.each do |asset|\n file.assets.push asset\n end\n self.children.each do |child|\n file.children.push child.copy\n end\n file.save\n file.data = self.data\n file\n end", "def copy\n GameObject.new(@animation.dup, @pos.dup)\n end", "def copy(donor, recipient)\n input = File.open(donor, 'r') {|f| f.read() }\n output = File.open(recipient, 'w') {|f| f.write(input) }\nend", "def file_copy(source, dest, options={})\n\t\tFileUtils.cp source, dest, options\n\tend", "def copy(from, to, options = nil, binary = false)\n options ||= self.options if self.respond_to?(:options)\n if binary\n contents = File.new(from,\"rb\").read\n else\n contents = File.new(from).read\n end\n write_file to, contents, options, binary\n end", "def deep_copy(o)\n Marshal.load(Marshal.dump(o))\nend", "def deep_copy(o)\n Marshal.load(Marshal.dump(o))\nend" ]
[ "0.8461407", "0.8036196", "0.79643023", "0.7836522", "0.6963185", "0.6870223", "0.6805511", "0.6796913", "0.679664", "0.67235106", "0.6699976", "0.6656682", "0.6642306", "0.6636167", "0.6632536", "0.6631695", "0.6631695", "0.6631695", "0.6627004", "0.65221107", "0.6518402", "0.647076", "0.643958", "0.6439441", "0.63991827", "0.63991827", "0.63991827", "0.63991827", "0.63991827", "0.63855994", "0.6370221", "0.63614297", "0.63554436", "0.63494456", "0.63494456", "0.63494456", "0.63432807", "0.6326982", "0.63222164", "0.6310398", "0.62704444", "0.6267844", "0.6267844", "0.6253562", "0.6252476", "0.6252476", "0.6236521", "0.62281686", "0.62213403", "0.6220618", "0.6220456", "0.62182754", "0.62143606", "0.62143606", "0.6211626", "0.62105864", "0.62080157", "0.6179321", "0.61735487", "0.617085", "0.6166116", "0.61605334", "0.6152979", "0.6152979", "0.6146983", "0.6136123", "0.6127863", "0.6120774", "0.612001", "0.6108999", "0.6108174", "0.61042637", "0.610417", "0.6098137", "0.6096907", "0.6092949", "0.6088914", "0.6079648", "0.60767776", "0.6073914", "0.606752", "0.6064614", "0.60516983", "0.60493076", "0.60405314", "0.6031899", "0.60283595", "0.60225755", "0.600791", "0.6006269", "0.59947866", "0.5991912", "0.59885114", "0.5982675", "0.59802276", "0.597348", "0.5973105", "0.5964849", "0.5963276", "0.59611887", "0.59611887" ]
0.0
-1
set up access control
def pr_user return nil unless current_user @pr_user ||= PrUser.find_by_ssm_id(current_user.id) unless @pr_user @pr_user = PrUser.create! :ssm_id => current_user.id end unless session[:login_stamped] || @pr_user.nil? @pr_user.update_attribute(:last_login, Time.now) session[:login_stamped] = true end @pr_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_control\n \n end", "def authorization; end", "def create_access_control\n nil\n end", "def set_access_control\n @access_control = AccessControl.find(params[:id])\n end", "def set_access\n @access = @current_event.accesses.find(params[:id])\n authorize @access\n end", "def AccessRights=(arg0)", "def authorization(*args, &block); end", "def initialize_rights\n @permissions ||= {}\n @user_groups ||= {}\n\n @public_access ||= []\n @protected_access ||= []\n end", "def user_access_control\n bot = Bot.find(params[:id])\n\n if current_user.admin?\n @bot = User.find(bot.account.user_id).admin? ? current_user.bots.find(params[:id]) : bot\n else\n @bot = current_user.bots.find(params[:id])\n end\n\n rescue\n response_access_denied\n end", "def access_control(object = nil)\n if object.present? && @cur_user.present?\n author = author?\n end\n perm = Permission\n perm.getReq(params[:controller], params[:action], request.request_method)\n redirect t('redirect.denied') unless perm.grant?(user_perm, author)\n end", "def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end", "def standard_authorized_user_rights\n public_access + protected_access \n end", "def set_access_level(access_level)\n if access_level >= 1\n self.commenter = true\n else\n self.commenter = false\n end\n if access_level >= 2\n self.editor = true\n else\n self.editor = false\n end\n if access_level >= 3\n self.administrator = true\n else\n self.administrator = false\n end\n end", "def set_access(*args)\n options = args.extract_options!\n options[:object] ||= Array(@_controller).first.to_s.singularize.to_sym if @_controller.present?\n permissions.add(*args, options)\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def standard_authorized_user_rights\n Lockdown::System.public_access + Lockdown::System.protected_access \n end", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def set_access_levels\n user_access_controls.each(&:disable!) if persisted? && disabled\n end", "def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end", "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def authorize(ctrl = params[:controller], action = params[:action], global = false)\n case action\n when \"rootwebdav\", \"webdavnf\"\n allowed = true\n else\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n end\n allowed ? true : deny_access\n end", "def check_access_control\n @bot = Bot.find(params[:id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @bot.account.user_id\n rescue\n response_access_denied\n end", "def create_access_check\n permission_check('create')\n end", "def create_access_check\n permission_check('create')\n end", "def create_access_check\n permission_check('create')\n end", "def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def define_global_privileges\n can :read, Project, public_can_view?: true\n can :index, Project\n can :read, Group\n end", "def check_can_access\n res = false\n read_actions = [ \"index\", \"list\", \"edit\" ]\n new_actions = [ \"new\", \"create\" ]\n edit_actions = [ \"edit\", \"update\", \"destroy\", \"update_logo\" ]\n\n res ||= (action_name == \"show_logo\")\n res ||= current_user.admin?\n\n if current_user.option_externalclients?\n res ||= (current_user.read_clients? and read_actions.include?(action_name))\n res ||= (current_user.edit_clients? and edit_actions.include?(action_name))\n res ||= (current_user.create_clients? and new_actions.include?(action_name))\n end\n\n if !res\n flash[\"notice\"] = _(\"Access denied\")\n redirect_from_last\n end\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def permissions = {}", "def check_rights\n unless is_app_authorizer?\n logger.warn 'User is not lea or sea admin and cannot access application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n end", "def initialize(user)\n #anyone can read anything, it's an encyclopedia, right?\n can :read, :all\n\n #if user isn't signed in, there are no more permissions for them\n return if user.nil?\n\n if user.dictator?\n can :manage, :all # they can do anything they want\n can :access, :rails_admin # grant access to rails_admin\n can :dashboard # ditto\n else\n #if they're not a dictator, they're a \"contributor\" and they can only\n #modify the following db objects\n can [:create, :update], [Page, Prerequisite, ConceptBundle, Question, Answer]\n end\n \n end", "def check_authorizations!\n raise FphsNotAuthorized unless can_create_in_list?\n\n unless list_class.no_master_association || from_master.allows_user_access\n raise FphsNotAuthorized, 'Master does not allow user access'\n end\n\n raise FphsNotAuthorized, \"No access to #{source_type}\" unless can_access_source_type?\n\n raise FphsNotAuthorized, \"No access to #{assoc_name}\" unless can_access_associated_table?\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def load_permissions\n authorize! :manage, :all\n end", "def acl=(_acl)\n fail Dav::Exception::Forbidden, 'Setting ACL is not allowed here'\n end", "def set_viewing_permissions\n @gqEnabled = Assessment::GuidanceQuiz.is_enabled? (@course)\n set_student_layout\n if @gqEnabled\n set_student_view\n set_hidden_sidebar_params\n end\n end", "def authorize\n end", "def authorize\n end", "def access_level\n config[:access] || 'private'\n end", "def has_access_to(cp)\n if can_review(cp) || can_edit(cp) || is_admin\n true\n end\n\n end", "def test_set3_13_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'ALL_PRIVILEGES'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'ALTER'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n priv_name = 'ALTER'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n priv_name = 'DROP'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end", "def authorization_mode; end", "def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end", "def set_acl_statement\n super\n end", "def allow_access\n !@current_user.nil?\n end", "def update_access_controls!\n update!(edit_users: permission_template.agent_ids_for(access: 'manage', agent_type: 'user'),\n edit_groups: permission_template.agent_ids_for(access: 'manage', agent_type: 'group'))\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def check_and_set_admin_access\n begin\n if params[:venue_name] == 'home'\n @venue = @actor\n @has_admin_access = @venue == @actor\n @has_link_access = @has_admin_access\n @is_homepage = true\n else\n @venue = Venue.where(:mention_name => params[:venue_name]).first\n @has_admin_access = @venue == @actor\n @is_public = true\n @has_link_access = false\n end\n rescue\n @venue = nil\n end\n unless @venue\n render :template =>\"bricks/page_missing\" and return\n end\n end", "def initialize_app_access(owner, app_name, path)\n router = ::UsrRouter.for(owner)\n\n app = ::OodApp.at(path: router.path_for(app: app_name))\n\n # app doesn't exist or you do not have access:\n raise ActionController::RoutingError.new('Not Found') unless app\n\n\n # run idempotent setup script to setup data for user and handle any errors\n app.run_setup_production\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if action is not public, force login\r\n return unless require_login \r\n # admin is always authorized\r\n return true if self.logged_in_user.admin?\r\n # if not admin, check membership permission \r\n @user_membership ||= Member.find(:first, :conditions => [\"user_id=? and project_id=?\", self.logged_in_user.id, @project.id]) \r\n if @user_membership and Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) \r\n return true\t\t\r\n end\t\t\r\n render :nothing => true, :status => 403\r\n false\r\n end", "def access\n if @ajar == true || if @unlocked == false\n raise ArgumentError.new(\"Further permissions required\")\n elsif @ajar == false && if @unlocked == true\n puts \"your wish is granted\"\n return @ajar = true\n end\n end\n end\n end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless !@user.admin? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end", "def acl\n 'public-read'\n end", "def allow_access\n !current_cas_user.nil?\n end", "def current_access_control\n @access_control\n end", "def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end", "def allow_to\n # owner of story can do anything? editing?\n super :owner, :all => true\n # approved users can create new stories\n super :user, :only => [:show, :index, :search, :new, :create]\n # everybody can list and watch\n super :all, :only => [:show, :index, :search]\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def set_access\n @access = Access.find(params[:id])\n end", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def checkAcl(path,principal,readGranted,writeGranted)\n acl = @authz.getacl(path)\n\t# check user1\n\tassert_not_nil(acl[principal],\"Expected for find ACE for #{principal}\"+@authz.hashToString(acl))\n\tace = acl[principal]\n\tif ( readGranted || writeGranted ) then\n\t assert_not_nil(ace[\"granted\"],\"Expected ace for #{principal} to have granted something granted ace was nil \"+@authz.hashToString(acl))\n\t puts(\"ACE for user #{principal} was \"+@authz.hashToString(ace)+\":\"+ace[\"granted\"].to_s)\n\tend\n\tif ( !readGranted || !writeGranted ) then\n assert_not_nil(ace[\"denied\"],\"Expected ace for #{principal} to have denied something, denied was nil \"+@authz.hashToString(acl))\n puts(\"ACE for user #{principal} was \"+@authz.hashToString(ace)+\":\"+ace[\"denied\"].to_s)\n end\n\n if ( readGranted ) then\n assert_equal(true,ace[\"granted\"].include?(\"jcr:read\"),\"Expected ace for #{principal} to have jcr:read granted ace was \"+@authz.hashToString(ace))\n if ( ace[\"denied\"] != nil ) then\n assert_equal(false,ace[\"denied\"].include?(\"jcr:read\"),\"Expected ace for #{principal} not to have jcr:read denied ace was \"+@authz.hashToString(ace))\n\t end\n else\n assert_equal(true,ace[\"denied\"].include?(\"jcr:read\"),\"Expected ace for #{principal} to have jcr:read denied ace was \"+@authz.hashToString(ace))\n if ( ace[\"granted\"] != nil ) then\n assert_equal(false,ace[\"granted\"].include?(\"jcr:read\"),\"Expected ace for #{principal} not to have jcr:read granted ace was \"+@authz.hashToString(ace))\n\t end\n end\n if ( writeGranted ) then\n assert_equal(true,ace[\"granted\"].include?(\"jcr:write\"),\"Expected ace for #{principal} to have jcr:write granted ace was \"+@authz.hashToString(ace))\n if ( ace[\"denied\"] != nil ) then\n assert_equal(false,ace[\"denied\"].include?(\"jcr:write\"),\"Expected ace for #{principal} not to have jcr:write denied ace was \"+@authz.hashToString(ace))\n\t end\n else\n assert_equal(true,ace[\"denied\"].include?(\"jcr:write\"),\"Expected ace for #{principal} to have jcr:write denied ace was \"+@authz.hashToString(ace))\n if ( ace[\"granted\"] != nil ) then\n assert_equal(false,ace[\"granted\"].include?(\"jcr:write\"),\"Expected ace for #{principal} not to have jcr:write granted ace was \"+@authz.hashToString(ace))\n\t end\n end\n end", "def login_required\n raise Forbidden unless @current_member #ログイン状態でないとForbiddenを発生させる\n end", "def authorize \n self.make 'authorization' \n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if user not logged in, redirect to login form\r\n unless session[:user]\r\n store_location\r\n redirect_to(:controller => \"account\", :action => \"login\")\r\n return false\r\n end\r\n # if logged in, check if authorized \r\n if session[:user].admin? or Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], session[:user].role_for_project(@project.id) ) \r\n return true\t\t\r\n end\t\t\r\n flash[:notice] = \"Acces denied\"\r\n redirect_to(:controller => \"\")\r\n false\r\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def authenticates_access\n include InstanceMethods\n end", "def host_authorization; end", "def host_authorization; end", "def allow\n Test::Spec::Rails::Macros::Authorization::TestGenerator.new(test_case,\n :access_denied?, false,\n 'Expected access to be allowed'\n )\n end", "def permissions_policy(&block); end", "def check_access\n permission_denied unless can_census?(year)\n end", "def index\n @access_controls = AccessControl.all\n end", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end", "def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def initialize(user)\n\n # guest user (not logged in) \n user ||= User.new \n\n # Alias to give proper abilities to the owner of his own course and profile\n alias_action :create, :update, :destroy, :mycourses, :myprofil, :to => :cud\n\n # Everyone can read all courses but only the owner can alter it\n can :read, Course\n can :cud, Course, :owner => user.id\n\n # Everyone can read all profiles but only the owner can alter it\n can :read, Profil\n can :cud, Profil, :user_id => user.id\n\n end", "def authorization_mode=(mode); end", "def authorize(ctrl = params[:controller], action = params[:action], global = false)\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n allowed ? true : deny_access\n end", "def authorize(ctrl = params[:controller], action = params[:action], global = false)\n allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project, :global => global)\n allowed ? true : deny_access\n end", "def initialize(user)\n if user.role == \"site_admin\"\n # can [:create, :update, :destroy], User\n can :manage, User\n # can [:create, :update, :destroy], Document\n can :manage, Document\n # can [:create, :update, :destroy], Folder\n can :manage, Folder\n can :manage, Project\n can :manage, [Stage, Factor]\n cannot :destroy, [Stage, Factor]\n elsif user.role == \"project_manager\"\n # can only manage projects which he is a part of\n can :manage, Project do |project|\n (project.membership_ids & user.membership_ids).present?\n end\n # TODO: promote / demote?\n \n # can manage his own account; *cannot change his own role -> set in view\n can :manage, User, :id => user.id\n \n # can edit other users (except site admins) in the same project; limitation to change role set in view\n can :update, User do |other_user|\n (other_user.project_ids & user.project_ids).present? # This is working =].\n end\n elsif user.role == \"normal_user\"\n # can only view projects with he is a part of\n can :read, Project do |project|\n (project.membership_ids & user.membership_ids).present?\n end\n # can create, edit, delete docs in projects he belongs to\n can :manage, Document do |doc|\n (doc.project.membership_ids & user.membership_ids).present?\n end\n # can edit his own account only; *cannot change his own role -> set in view\n cannot :manage, User\n can :manage, User, :id => user.id\n can :create, User\n cannot :destroy, User # can't destroy own account\n end\n end", "def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend", "def conf_acl\n ace = $ts.dut.call(\"mesa_ace_init\", \"MESA_ACE_TYPE_ANY\")\n ace[\"id\"] = 1\n action = ace[\"action\"]\n action[\"port_action\"] = \"MESA_ACL_PORT_ACTION_REDIR\"\n action[\"port_list\"] = \"#{$port_list[0]}\"\n ace[\"port_list\"] = \"#{$port_list[1]}\"\n policy = ace[\"policy\"]\n policy[\"value\"] = 1\n policy[\"mask\"] = 0x3f\n $ts.dut.call(\"mesa_ace_add\", 0, ace)\nend", "def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end" ]
[ "0.79815865", "0.7099419", "0.7001992", "0.6866247", "0.6696136", "0.66671526", "0.66639626", "0.6636336", "0.6605793", "0.6553478", "0.65270615", "0.651345", "0.65106803", "0.64920694", "0.64304835", "0.6428622", "0.6428622", "0.6417419", "0.63737434", "0.6372735", "0.6361745", "0.63221514", "0.63115454", "0.6306972", "0.6280135", "0.6267456", "0.6258041", "0.6258041", "0.6258041", "0.62578833", "0.62516665", "0.6236364", "0.6235187", "0.6235187", "0.6235187", "0.6235122", "0.6231859", "0.62142795", "0.62088746", "0.62081593", "0.6205739", "0.6186904", "0.6178469", "0.61738735", "0.61738735", "0.6158927", "0.61463106", "0.6144688", "0.6140216", "0.6140216", "0.6140216", "0.6140216", "0.6140216", "0.6137056", "0.6136475", "0.61120707", "0.6101632", "0.61015254", "0.6091654", "0.60911715", "0.6073467", "0.60731477", "0.6072301", "0.6071596", "0.607106", "0.6067581", "0.6067333", "0.6066696", "0.6061222", "0.6056753", "0.6047409", "0.6047409", "0.6047409", "0.6047409", "0.6047409", "0.6047409", "0.6047409", "0.6040038", "0.603424", "0.60307175", "0.6028249", "0.6024636", "0.6018158", "0.6016468", "0.6014633", "0.6014633", "0.60029113", "0.59951985", "0.5993416", "0.59891444", "0.59874207", "0.59772253", "0.59708756", "0.59688", "0.5966826", "0.5966826", "0.59663755", "0.59629464", "0.5955209", "0.595084", "0.5946542" ]
0.0
-1
Main method for changing the value of the env var
def prepend(layer_env = {}) all_values = [] layer_env.each do |layer_name, value| EnvProxy.validate_layer!(layer_name) value = Array(value).map(&:to_s) all_values << value @layer_env_hash[layer_name] ||= [] @layer_env_hash[layer_name].prepend(value) end ENV[@key] = [all_values, ENV[key]].compact.join(":") self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_Enviroment_007_SetEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_007_SetEnv\")\r\n puts2(\"#######################\")\r\n\r\n sEnvVarName = \"COMPUTERNAME\" # Is this one platform independent?\r\n sNewValue = \"MyNewName\"\r\n\r\n # Display the current value\r\n puts2(\"Current value of \" + sEnvVarName)\r\n printenv(sEnvVarName)\r\n\r\n puts2(\" Setting \" + sEnvVarName + \" to \" + sNewValue)\r\n\r\n # Set new value that will be in effect for duration of this Ruby session's test run\r\n setenv(sEnvVarName, sNewValue)\r\n\r\n # Display the current value\r\n puts2(\"Current value of \" + sEnvVarName)\r\n printenv(sEnvVarName)\r\n\r\n\r\n sNewEnvVarName = \"Ruby\"\r\n sNewSetting = \"Is Cool\"\r\n puts2(\" Setting a new Environment Variable \" + sNewEnvVarName + \" to a new setting \" + sNewSetting)\r\n\r\n # Set new value that will be in effect for duration of this Ruby session's test run\r\n setenv(sNewEnvVarName, sNewSetting)\r\n\r\n # Display the current value\r\n puts2(\"Current value of \" + sNewEnvVarName)\r\n printenv(sNewEnvVarName)\r\n\r\n end", "def env=(environment); end", "def env=(environment); end", "def setenv(softworkdir,project,chipIsModem,apconnection)\n\t#puts \"burp\"\n # Setup some environement variables.\n $PROJNAME = project\n $SOFT_WORKDIR = softworkdir\n $TOOLPOOL = $SOFT_WORKDIR + \"/toolpool\" \n $PLUGINS_WORKDIR = $TOOLPOOL + \"/plugins\"\n $SCRIPT_WORKDIR = $TOOLPOOL + \"/scripts\"\n $SCRIPT_GENDIR = $SCRIPT_WORKDIR + \"/ChipStd\"\n $SCRIPT_PROJDIR = $SCRIPT_WORKDIR + \"/\" + $PROJNAME.split[0]\n $COMMON_PLUGINS_WORKDIR = \"./rbbase/common/plugins\"\n\n if(chipIsModem.strip.casecmp(\"yes\") == 0)\n $CHIP_IS_MODEM = true\n else\n $CHIP_IS_MODEM = false\n end\n\n if(apconnection.strip.casecmp(\"yes\") == 0)\n $APCONNECTION = true\n else\n $APCONNECTION = false\n end\n\n # Add the path the working dir where the script under development are stored. \n $LOAD_PATH.unshift(\"./rbbase/\")\n $LOAD_PATH.unshift($TOOLPOOL)\n $LOAD_PATH.unshift($PLUGINS_WORKDIR)\n $LOAD_PATH.unshift($COMMON_PLUGINS_WORKDIR)\n $LOAD_PATH.unshift($SCRIPT_WORKDIR) \n $LOAD_PATH.unshift($SCRIPT_GENDIR) \n $LOAD_PATH.unshift($SCRIPT_PROJDIR) \n\t#$LOAD_PATH.unshift($SCRIPT_WORKDIR + \"/common\")\nend", "def set_remote_env(env); end", "def run()\n super() \n @@run_env[@name] = @value \n end", "def set(i) \n env = ENV[i.upcase] \n if env.nil? \n aborts(\"\\nCommand line arguments missing!,Clue : #{i}\\n\\n\") \n else \n instance_variable_set(\"@\" + i, env) \n end \n end", "def set(i)\n \n env = ENV[i.upcase]\n \n if env.nil?\n \n aborts(\"\\nCommand line arguments missing!,Clue : #{i}\\n\\n\")\n \n else\n \n instance_variable_set(\"@\" + i, env)\n \n end\n \n end", "def test_env!\n set_env('VALUE', 'value')\n assert_equal(Config.env!('VALUE'), 'value')\n end", "def setenv(n, v)\n debug \"Adding env: #{n}=#{v}\"\n debug \"prev value: #{@rye_getenv[n]}\"\n @rye_getenv[n] = v\n (@rye_current_environment_variables ||= {})[n] = v\n self\n end", "def default_environment=(env); end", "def env(key, value)\n @environment_variables[key] = value \n end", "def test_Enviroment_006_GetEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_006_GetEnv\")\r\n puts2(\"#######################\")\r\n\r\n sEnvVarName = \"COMPUTERNAME\" # Is this one platform independent?\r\n\r\n puts2(\"\")\r\n puts2(\"Retrieve all OS variables using getenv()\")\r\n hMyEnvVars = getenv() # Get them all\r\n\r\n # Loop through the hash and display each variable name and its setting\r\n hMyEnvVars.each do | key, value |\r\n puts2(\" OS variable: \\\"#{key.to_s}\\\" is set to \\\"#{value}\\\" \")\r\n end\r\n\r\n puts2(\"\")\r\n puts2(\"Retrieve a specific OS variable using getenv\")\r\n hMyEnvVars = getenv(sEnvVarName)\r\n\r\n # Loop through the hash and display each variable name and its setting\r\n hMyEnvVars.each do | key, value |\r\n puts2(\" OS variable: \\\"#{key.to_s}\\\" is set to \\\"#{value}\\\" \")\r\n end\r\n\r\n end", "def _env_change\n if @env_used\n @environments << @env\n @env = Bcpm::Tests::Environment.new\n @env_used = false\n end\n end", "def env(name, value)\n Stairs.configuration.env_adapter.set name, value\n end", "def check_and_set_environment\n check_env\n set_env\n end", "def test_single_environment_set_env_no_name\n cfg = DBGeni::Config.new\n cfg.load(\"environment('foo') { } \\n\")\n cfg.set_env\n assert_equal('foo', cfg.current_environment)\n end", "def set_or_init(i,val)\n \n env = ENV[i.upcase]\n \n if env.nil?\n \n instance_variable_set(\"@\" + i, val)\n \n else\n \n instance_variable_set(\"@\" + i, env)\n \n end\n \n end", "def static_env=(_arg0); end", "def static_env=(_arg0); end", "def static_env=(_arg0); end", "def test_Enviroment_005_PrintEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_005_PrintEnv\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"\")\r\n puts2(\" Display current settings of some OS variables using printenv()...\")\r\n printenv(\"BOGUS_ENVVAR\")\r\n printenv(\"COMPUTERNAME\") # Is this one platform independent?\r\n printenv(\"USERDNSDOMAIN\") # Is this one platform independent?\r\n printenv(\"NUMBER_OF_PROCESSORS\") # Is this one platform independent?\r\n printenv(\"OS\") # Is this one platform independent?\r\n printenv(\"PROCESSOR_IDENTIFIER\") # Is this one platform independent?\r\n printenv(\"SHELL\") # Is this one platform independent? Yes on: Ubuntu,\r\n printenv(\"USERNAME\") # Is this one platform independent? Yes on: Win, Ubuntu\r\n\r\n puts2(\"\")\r\n puts2(\"\")\r\n puts2(\" Display current settings of ALL OS variables using printenv()...\")\r\n printenv()\r\n\r\n end", "def setenv(key, value)\n @setenv ||= {}\n @setenv[key] = value\n end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env=(value)\n set :environment, value\n end", "def env(variable_name, variable_value, &block); end", "def set_env(env)\n current = Thread.current[ENVIRONMENT]\n Thread.current[ENVIRONMENT] = env\n current\n end", "def environ\n\t\tif @os.to_i == 0\n\t\t\tputs \"[\".light_red + \"X\".white + \"] Your target appears to be Winblows\".light_red + \"!\".white\n\t\t\tputs \"[\".light_red + \"X\".white + \"] This option is only available for *nix machines\".light_red + \"!\".white\n\t\telse\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Testing for \".light_green + \"/proc/self/environ\".white + \" RCE Vuln\".light_green + \".....\".white\n\n\t\t\tfilez = [ \"proc/self/./environ\", \"proc/self/environ\" ]\n\n\t\t\t@ua=0\n\t\t\t@found=0\n\t\t\t@accept=0\n\t\t\twhile @found.to_i < 1\n\t\t\t\tfilez.each do |file|\n\t\t\t\t\tif $module_required['Min'].to_i == 0\n\t\t\t\t\t\t@thegoods=\"/#{file}\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@thegoods=\"#{@stepstone}#{file}\"\n\t\t\t\t\tend\n\t\t\t\t\tbody = basicregex(@thegoods, 69)\n\t\t\t\t\t#Regex for /proc/self/environ file\n\t\t\t\t\tif body =~ /HTTP_USER_AGENT=/ or body =~ /HTTP_ACCEPT=/ or body =~ /DOCUMENT_ROOT=/ or body =~ /VHOST_ROOT=/ or body =~ /HTTP_HOST/\n\t\t\t\t\t\t@environ = 'true'\n\t\t\t\t\t\tif body =~ /HTTP_USER_AGENT=/\n\t\t\t\t\t\t\t@ua = 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif body =~ /HTTP_ACCEPT=/\n\t\t\t\t\t\t\t@accept = 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\t#Successful injection will match our regex, failure won't (concat on exec proves its working)\n\t\t\t\t\t\tif body =~ /:#{@rnd}:(.+):#{@rnd}:/ \n\t\t\t\t\t\t\t@envirores = $1 #make results available\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@found = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\t@environ = 'false'\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif @found.to_i == 0\n\t\t\t\t\t@found = 2 #break cause we are out of file options to test, will use value to offset from true success...\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif @environ == 'true'\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] File Found: \".light_green + \"/proc/self/environ\".white\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] User-Agent is present in response\".light_green + \"!\".white if @ua.to_i == 1\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Accept Header is present in response\".light_green + \"!\".white if @accept.to_i == 1\n\t\t\t\tenvirosupport\n\t\t\telse\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Sorry, \".light_red + \"/proc/self/environ\".white + \" doesn't appear to be available\".light_red + \".....\".white\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Returning to Previous Menu\".light_red + \"...\".white\n\t\t\tend\n\t\tend\n\tend", "def require_env(*args)\n args.each do |arg|\n env_var = \"#{arg}\".upcase\n if ENV[env_var]\n instance_variable_set(\"@#{env_var.downcase}\", ENV[env_var])\n else\n puts \"You need to provide the ENV variable '#{env_var}'\"\n exit 1\n end\n end\n end", "def restore_env(env); end", "def addtoenv(name,w,base)\n if ENV[name[0]] == nil\n ENV[name[0]] = base + \"/\" + w\n elsif ENV[name[0]].index(w) == nil\n ENV[name[0]] += \":\"+base + \"/\"+ w + \"/\"+name[1]\n end\nend", "def environment=(env)\n self.config[:environment] = env.to_sym\n end", "def original_env; end", "def visit_EnvNode(node)\n node.env.each_pair do |key,val|\n ENV[key] = val\n end\n Yap::Shell::Execution::Result.new(status_code:0, directory:Dir.pwd, n:1, of:1)\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app. But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/bash '\n f.puts ' '\n f.puts 'function fcomp() '\n f.puts '{ '\n f.puts ' awk -v n1=$1 -v n2=$2 \\'BEGIN{ if (n1 == n2) print \"yes\"; else print \"no\"}\\' '\n f.puts '} '\n f.puts ' '\n f.puts 'function multiplyArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' mulResult=`echo $input1 $input2 | awk \\'{printf \"%d\", $1*$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function divideArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' divResult=`echo $input1 $input2 | awk \\'{printf \"%.2f\", $1/$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function scaleArgs() '\n f.puts '{ '\n f.puts ' inputToken=$1 '\n f.puts ' factor=$2 '\n f.puts ' numberToken=`echo $inputToken | tr -cd [0-9] ` '\n f.puts ' argPrefix=`echo $inputToken | sed -e \\'s/m$//g\\' | tr -cd [a-zA-Z-+:=] ` '\n f.puts ' multiplyArgs $numberToken $factor '\n f.puts ' # Result saved in mulResult variable '\n f.puts ' scaled_number=$mulResult '\n f.puts ' scaled_token=${argPrefix}${scaled_number}m '\n f.puts '} '\n f.puts ' '\n f.puts '# There are 5 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s /home/vcap/app /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n end\n end", "def test_rubyopt\n with_fixture 'environment' do\n with_env \"RUBYOPT\" => \"-rtime\" do\n assert system(\"ruby\", ocra, \"environment.rb\", *DefaultArgs)\n assert system(\"environment.exe\")\n env = Marshal.load(File.open(\"environment\", \"rb\") { |f| f.read })\n assert_equal \"-rtime\", env['RUBYOPT']\n end\n end\n end", "def finish\n super\n @_env[ENV_KEY] = self\n end", "def []= key, value\n ENV[envify(key)] = value\n end", "def environment=(env)\n setup(env)\n end", "def env_key; end", "def set_initial_path\n `echo $PATH`.split(':').each do |path|\n add_env_path path\n end\nend", "def configure_environment\n\n=begin\n :: Expected Params ::\n \n Constants::REQUEST_PARAM_TEST => Server Mode (Is Production or Staging?) \n\n=end \n\n if params[Constants::REQUEST_PARAM_TEST].present?\n\n if params[Constants::REQUEST_PARAM_TEST] == \"1\"\n\n ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING] = '1'\n\n else\n \n ENV.delete(Constants::ENVIRONMENT_VAR_FOR_STAGING) \n\n end \n\n end \n\n render json: {status: status_code(:ok), message: \"\", data: {:is_staging => (ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING].present? ? 1 : 0)}}\n\n end", "def environment=(env)\n @environment = env\n end", "def add_env_var key, val\n key = key.to_s\n env_file = self[:ssh_env_file]\n escaped_val = Regexp.escape(val).gsub('/', '\\/').gsub(';', '\\;')\n # see if the key/value pair already exists\n if exec(Beaker::Command.new(\"grep ^#{key}=.*#{escaped_val} #{env_file}\"), :accept_all_exit_codes => true).exit_code == 0\n return # nothing to do here, key value pair already exists\n # see if the key already exists\n elsif exec(Beaker::Command.new(\"grep ^#{key}= #{env_file}\"), :accept_all_exit_codes => true).exit_code == 0\n exec(Beaker::SedCommand.new(self['platform'], \"s/^#{key}=/#{key}=#{escaped_val}:/\", env_file))\n else\n exec(Beaker::Command.new(\"echo \\\"#{key}=#{val}\\\" >> #{env_file}\"))\n end\n\n # update the profile.d to current state\n # match it to the contents of ssh_env_file\n mirror_env_to_profile_d(env_file)\n end", "def test_env\n reset\n assert_equal \"development\", evaluate(\"archetype-env()\")\n Compass.configuration.environment = :production\n assert_equal \"production\", evaluate(\"archetype-env()\")\n Compass.configuration.environment = :staging\n assert_equal \"staging\", evaluate(\"archetype-env()\")\n reset\n end", "def process(env); end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def environment=(environ)\n\n @environment = environ.to_sym\n\n end", "def save_env; end", "def setvar(key, value)\n if value.nil?\n ENV.delete(key)\n else\n ENV[key] = value\n end\n true\n end", "def set_config(key, value)\n system(\"git config --global #{key} '#{value}'\")\n end", "def set_env()\n @triggers.each(&:set_env)\n end", "def reset_env\n clear_env\n set_env self.env_defaults\n end", "def with_test_env\n in_separate_environment do\n # Overwrite environment variables with values for testing\n Dotenv.overload '.env.test'\n yield\n end\nend", "def replace_ENV! # rubocop:disable Naming/MethodName\n old = $VERBOSE\n $VERBOSE = nil\n Object.const_set(:ENV, self)\n ensure\n $VERBOSE = old\n end", "def from_env\r\n return if not @name\r\n @owner = true\r\n replace( ENV[@name] )\r\n end", "def update_env_file!\n present_env = ssh_read_file(app_username, \"#{ app_name }/.env\").to_s\n\n env = {\n \"RAILS_ENV\" => \"production\",\n \"PATH\" => \"/home/#{ app_username }/.rvm/wrappers/#{ app_name }:$PATH\",\n \"SECRET_KEY_BASE\" => SecureRandom.hex(64),\n }.merge(\n Dotenv::Parser.call(present_env)\n ).merge(\n options[:env] || {}\n ).map { |k, v|\n \"export #{ k }=#{ v.inspect }\\n\"\n }.join(\"\")\n\n ssh_write_file(app_username, \"#{ app_name }/.env\", env)\n end", "def with_environment(env); end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end", "def setup_environment; end", "def setEnvironment(e=:qa, url=nil)\n env={\n :qa => { :name => 'QA', :description => 'QA Env', :url => 'https://www.qa.com' },\n :qa2 => { :name => 'QA2', :description => 'QA2 Env', :url => 'https://www.qa2.com' },\n :prod => { :name => 'PROD', :description => 'CERT', :url => 'https://www.prod.com' }\n }\n\n\n if url.nil?\n @environment_under_test=env[e]\n else\n @environment_under_test={ :name => 'custom', :url => url.to_s }\n end\n\n\n end", "def handy_method()\n ENV[@sentinel_var] = \"foo\"\n new_env = { @sentinel_var => \"bar\" }\n\n Facter::Util::Resolution.with_env new_env do\n ENV[@sentinel_var].should == \"bar\"\n return\n end\n end", "def handy_method()\n ENV[@sentinel_var] = \"foo\"\n new_env = { @sentinel_var => \"bar\" }\n\n Facter::Util::Resolution.with_env new_env do\n ENV[@sentinel_var].should == \"bar\"\n return\n end\n end", "def set_env!(request, env_key, value)\n if block_given?\n old_value = request.env[env_key]\n request.env[env_key] = value\n yield\n request.env[env_key] = old_value\n else\n request.env[env_key] = value\n end\nend", "def test_Enviroment_001_showRubyEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_001_showRubyEnv\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"\\nTest - display_ruby_env\")\r\n # Record info on the Ruby Environment\r\n display_ruby_env() # Record output\r\n\r\n puts2(\"\\n\\nTest - display_ruby_environment\")\r\n display_ruby_environment()\r\n\r\n puts2(\"\\n\\nTest - display_watir_env\")\r\n display_watir_env()\r\n\r\n puts2(\"\\n\\nTest - find_tmp_dir\")\r\n puts2(find_tmp_dir)\r\n\r\n end", "def visit_EnvNode(node)\n debug_visit(node)\n node.env.each_pair do |key, arg_node|\n world.env[key] = process_EnvArgumentNode(arg_node)\n end\n Yap::Shell::Execution::Result.new(status_code:0, directory:Dir.pwd, n:1, of:1)\n end", "def add_var(key, value)\n put :add_var, {:key => key, :value => value}\n if Bushido::Command.last_command_successful?\n ENV[key.upcase] = value\n end\n end", "def static_env; end", "def static_env; end", "def static_env; end", "def run\n loader = RCLoadEnv::Loader.new @config_name,\n exclude: @exclude, include: @include, override: @override,\n project: @project, debug: @debug\n if @command_list\n loader.modify_env ENV\n exec(*@command_list)\n else\n loader.write_dotenv\n end\n end", "def envvar\n CircleCi.request(@conf, \"/project/#{username}/#{project}/envvar\").get\n end", "def set_env(papers, site_host, site_name, nwo)\n ENV['REVIEW_REPOSITORY'] = nwo\n ENV['DOI_PREFIX'] = \"10.21105\"\n ENV['PAPER_REPOSITORY'] = papers\n ENV['JOURNAL_URL'] = site_host\n ENV['JOURNAL_NAME'] = site_name\n end", "def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def patch_user_env_variables(vars)\n Application.run_in_application_lock(self) do\n op_group = PendingAppOpGroup.new(op_type: :patch_user_env_vars, args: {\"user_env_vars\" => vars}, user_agent: self.user_agent)\n self.pending_op_groups.push op_group\n result_io = ResultIO.new\n self.run_jobs(result_io)\n result_io\n end\n end", "def cli=(value); end" ]
[ "0.7532019", "0.7051032", "0.7051032", "0.68079", "0.67280114", "0.66835606", "0.6663836", "0.66494614", "0.6626137", "0.66074795", "0.6587406", "0.658582", "0.65290487", "0.6515455", "0.65063053", "0.6407259", "0.64021623", "0.6400869", "0.63857925", "0.63857925", "0.63857925", "0.6381898", "0.6364374", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.6247979", "0.62475723", "0.62314934", "0.62141424", "0.6211696", "0.61886334", "0.6120009", "0.6087554", "0.606934", "0.6029995", "0.6028994", "0.6024464", "0.60223", "0.6019231", "0.5981153", "0.5978766", "0.597003", "0.5968393", "0.5965938", "0.59531707", "0.59508365", "0.59469837", "0.59415835", "0.59260327", "0.59260327", "0.59260327", "0.59260327", "0.58933216", "0.58901656", "0.5886189", "0.5873406", "0.5871232", "0.58707535", "0.58660257", "0.5844561", "0.581847", "0.5816935", "0.58166087", "0.5810017", "0.5808322", "0.5799363", "0.57984924", "0.57984924", "0.57949966", "0.57942015", "0.57927376", "0.5785371", "0.5780416", "0.5780416", "0.5780416", "0.57787997", "0.575982", "0.5750534", "0.57281184", "0.57234365", "0.5708875", "0.570528" ]
0.0
-1
must yield a valid route as defined below == SCOPES returns the ActionDispatch::Routing::Route for this role_route
def route @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route\n @route\n end", "def timeline_route\n @timeline_route ||= begin\n result = @timeline.route_for_kind(Activr::Timeline::Route.kind_for_routing_and_activity(@routing_kind, @activity.kind))\n raise \"Failed to find a route for #{@routing_kind} / #{@activity.kind}: #{self.inspect}\" if result.nil?\n result\n end\n end", "def came_from_route\n @came_from_route\n end", "def routes\n context[:routes]\n end", "def routes\n raise NotImplementedError\n end", "def route_name; end", "def route_name; end", "def routes\n @routes || self.class.routes\n end", "def resource_role_scopes\n return @resource_role_scopes\n end", "def route_for(**url_details)\n @routes.select { |rt| url_details <= rt.url_details }.first\n end", "def routes_block\n identifier = resource.singular ? 'resource' : 'resources'\n name = resource.name.to_sym\n namespace = resource.namespace.to_sym\n resource_call = -> { send(identifier, name) }\n\n lambda do\n if namespace.present?\n send(:namespace, namespace) do\n instance_exec(&resource_call)\n end\n else\n instance_exec(&resource_call)\n end\n end\n end", "def route_for(request) #:nodoc:\n index, params = match(request)\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def _routes; end", "def rbac_role_resource\n url_for(:roles_role, credentials, id) \n end", "def each_route(&block)\n\t\tget_routes().each(&block)\n\tend", "def get_routes\n raise \"Method not implemented\"\n end", "def anchored_routes; end", "def each\n @routes.each do |rt|\n yield rt\n end\n self\n end", "def routes_normal\n return @routes[:inside_region]\n end", "def route\n return @children['route'][:value]\n end", "def routes(&block); end", "def routes(&block); end", "def route_sets; end", "def full_route\n @parent ? (ancestors.reverse + [self]).map(&:route).join('/').squeeze('/') : route\n end", "def named_route; end", "def route\n #TODO\n end", "def routes_out_of_region\n return Array.new\n end", "def live_route_ar\n route_descriptor_ar(ActionController::Routing::Routes)\n end", "def routes\n Resources::Routes.new(self)\n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def nested_router\n dest.routes if dest.respond_to?(:routes)\n end", "def route(name, namespace=nil)\n scope.send(roda_class.named_route(name, namespace), self)\n end", "def roles_path\n @roles_path ||= '/api/v2/roles'\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes_normal\n return Array.new\n end", "def all_routes\n matching_routes\n end", "def routes_map; end", "def route_for(name, *args); end", "def route() request.route end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def routes\n routes_method.call\n end", "def route_mode\n mode = :resource\n mode = :namespace if @endpoints.count == 0\n mode = :action if @subroutes.count == 0 && @parent && @parent.route_mode == :resource\n mode = :param if /^:/ === @prefix.last\n mode\n end", "def custom_routes; end", "def authorize_routing(session)\n true\n end", "def routes_for(event, event_namespace=nil, &block)\n\n # Grab the first level namespace from the namespace array\n # and remove it from the copy.\n event_namespace = copy_event_namespace( event, event_namespace ) || return\n namespace = event_namespace.shift\n\n # If the namespace matches the current namespace and we are\n # at the last namespace level, yield any controller/action\n # pairs for this event.\n #\n # If the namespace does not match, search the list of child\n # namespaces stored at this level for a match and delegate\n # to it's #routes_for method, passing along the current\n # copy of the event's namespace array.\n if namespace == @name and event_namespace.empty?\n actions[event.name].each do |klass,action|\n block.call klass, action\n end\n else\n child_namespace = event_namespace.first\n child = namespaces[child_namespace]\n child.routes_for event, event_namespace, &block unless child.nil?\n end\n end", "def route_for_current_step\n steps_routes_mapping[state] || steps_routes_mapping[:pending]\n end", "def routes\n [@name.downcase]\n end", "def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )\n end", "def route(env)\n routes.each do |route|\n return route if route.match(env)\n end\n\n nil\n end", "def route_for(request)\n index, params = if @around_match\n send(@around_match, request) { match(request) }\n else\n match(request)\n end\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def generate_routes m\n # routes\n unless command_has_resources\n # add routes like unnested scaffold \n # eg. map.resources books\n m.route_resources controller_file_name\n else\n resource_list = controller_file_name.map { |r| r.to_sym.inspect }.join(', ')\n parent_resource = parent_resource_name\n \n path = destination_path('config/routes.rb')\n content = File.read(path)\n \n logger.route \"resources #{resource_list}\"\n \n # map.resources :parents do |parent|\n # parent.resources :parents do |parent|\n sentinel = \"\\.resources(.*)?:#{parent_resource.pluralize}(.*)do(.*)\\\\|#{parent_resource}\\\\|\"\n \n if content =~ /#{sentinel}/\n gsub_file 'config/routes.rb', sentinel do |match|\n \"#{match}\\n #{parent_resource}.resources :#{table_name}\"\n end\n else\n # without do block\n # map.resources :parents \n # parent.resources :parents\n sentinel = \"\\.resources(.*):#{parent_resource.pluralize}\"\n if content =~ /#{sentinel}/\n gsub_file 'config/routes.rb', sentinel do |match|\n \"#{match} do |#{parent_resource}|\\n #{parent_resource}.resources :#{table_name}\\n end\"\n end\n end\n end\n end\n end", "def routes(&block)\n routes = Routes.new\n routes.instance_eval(&block) if block_given?\n @route_definition = routes\n end", "def genuine_rails_resources_route_ar(*args)\n temp_routes = ActionController::Routing::RouteSet.new\n temp_routes.draw {|map| map.resources(*args) }\n route_descriptor_ar(temp_routes)\n end", "def routes\n @routes ||= load_routes\n end", "def has_named_route?(name); end", "def routes\n @routes ||= []\n end", "def role_params\n {}\n end", "def is_route?\n self.object_type.downcase.to_s == \"route\"\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def my_routes\n my_routes = []\n exceptions = %w(Login Signin)\n self.class.routes['GET'].each do |r|\n route = r.first.to_s.gsub(/\\W+|mix/,'').capitalize\n my_routes << route unless exceptions.include?(route)\n end\n return my_routes\n end", "def routes\n request :get, '/routes'\n end", "def route\n @base_controller.route if @base_controller\n end", "def get_route 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_get_route_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::Datastream::V1::Route.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def route(&block)\n @router ||= Router.new\n @router.instance_eval(&block)\n end", "def get_route 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_get_route_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::Datastream::V1alpha1::Route.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def routes\r\n RoutesController.instance\r\n end", "def list_policies_for_role(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListPoliciesForRole'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :role_name\n\t\t\targs[:query]['RoleName'] = optional[:role_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def route_for(options = {})\n options = options.with_indifferent_access\n\n origin = ensure_place options[:origin]\n destination = ensure_place options[:destination]\n\n raise ArgumentError, 'Must provide origin and destination' if origin.nil? || destination.nil?\n\n routes_for(origin).detect { |route| route.destination == destination }\n end", "def select_route(uri)\n variables = nil\n selected_route = nil\n cached_route = self.cached_routes[uri.to_s]\n if cached_route == nil\n for route in self.routes\n variables = uri.extract_mapping(\n route.pattern, route.processor)\n if variables != nil\n selected_route = route\n self.cached_routes[uri.to_s] =\n selected_route\n break\n end\n end\n else\n selected_route = cached_route\n end\n return selected_route\n end", "def routes_out_of_region\n return @routes[:outside_region]\n end", "def get_user_route(user)\n try_route(:user, user)\n end", "def name\n parent_uri = self.parent.uri.to_s\n if not parent_uri.end_with?(\"/ROs/\")\n # Evil hack\n parent_uri += \"/ROs/\"\n end\n return URI.parse(parent_uri).route_to(self.uri.to_s).to_s\n end", "def route\n @route ||= self.route_id ? Route.find_by_id(self.route_id) : nil\n end", "def route\n @route ||= self.route_id ? Route.find_by_id(self.route_id) : nil\n end", "def treat_as(role)\n acl = @_aclize_acl.get_acl_for(role)\n path = request.path.gsub(/^#{relative_url_root}/, '')\n unauthorize! unless acl\n\n if acl.controllers.permitted?(controller_path, action_name)\n unauthorize! if acl.paths.denied?(path)\n else\n unauthorize! unless acl.paths.permitted?(path)\n end\n end", "def convert_route_block(block)\n block\n end", "def named_routes; end", "def nested_resources\n APP.goals.reject { |k, v| (v.routes != [(self.resource_tuple + [k.pluralize.to_sym])]) and\n (v.routes != [(self.resource_tuple + [k.singularize.to_sym])]) } # TODO: see if this can be cleaned up a bit.\n end", "def role\n @path = \"/services/Admin\"\n @role ||= Nephophobia::Resource::Role.new self\n end", "def recognized_route\n unless @recognized_route\n path = params[:resource_path] || params[:erp] || request.path\n environment = ::ActionController::Routing::Routes.extract_request_environment(request)\n environment.merge!(:method => params[:resource_method]) if params[:resource_method]\n @recognized_route ||= ::ActionController::Routing::Routes.routes_for_controller_and_action(controller_path, action_name).find do |route|\n route.recognize(path, environment)\n end or ResourcesController.raise_no_recognized_route(self)\n end\n @recognized_route\n end", "def index\n @rails_routes = RailsRoute.all\n end", "def _route\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n\n _save2 = self.pos\n while true # sequence\n _tmp = apply(:_AT)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_domain)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n if _tmp\n while true\n\n _save3 = self.pos\n while true # sequence\n _tmp = apply(:_AT)\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = apply(:_domain)\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\":\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_route unless _tmp\n return _tmp\n end", "def inspect\n route.to_s\n end", "def route(name=nil, namespace=nil, &block)\n if name\n routes = opts[:namespaced_routes][namespace] ||= {}\n routes[name] = define_roda_method(routes[name] || \"multi_route_#{namespace}_#{name}\", 1, &convert_route_block(block))\n self::RodaRequest.clear_named_route_regexp!(namespace)\n else\n super(&block)\n end\n end", "def route(name, group = nil)\n @sets.each { |set|\n if r = set[1].route(name, group)\n return r\n end\n }\n\n raise MissingRoute, \"Could not find route '#{name}'\"\n end", "def allowed_routes\n introspector.routes.keep_if(&method(:allow_route?))\n end" ]
[ "0.60644776", "0.5965119", "0.5847937", "0.5583974", "0.5568266", "0.55642855", "0.55642855", "0.55587715", "0.55432475", "0.55398685", "0.55173427", "0.55137485", "0.5513365", "0.5495576", "0.5467603", "0.5449172", "0.5441111", "0.54266876", "0.54241014", "0.54211766", "0.5410481", "0.5410481", "0.53925586", "0.5388623", "0.53778774", "0.53429294", "0.5334514", "0.53218716", "0.5312267", "0.53070474", "0.53070474", "0.5287771", "0.52877647", "0.5286392", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.52858776", "0.5280318", "0.5279038", "0.5264935", "0.525855", "0.52317846", "0.52176464", "0.52176464", "0.52176464", "0.52036554", "0.5202667", "0.5201488", "0.5197823", "0.5193295", "0.51929843", "0.51864403", "0.5169153", "0.516356", "0.51580966", "0.51415783", "0.51371294", "0.5136009", "0.5133944", "0.51290107", "0.5127727", "0.5109993", "0.5106232", "0.51046604", "0.51046604", "0.5103783", "0.50725913", "0.5069968", "0.5061614", "0.50571764", "0.5054557", "0.5045305", "0.5043875", "0.5042508", "0.5033536", "0.50300443", "0.50250417", "0.50238276", "0.50237113", "0.50237113", "0.5016842", "0.5011535", "0.5009195", "0.50076973", "0.5003287", "0.49978495", "0.4991651", "0.49850067", "0.4982541", "0.49818084", "0.49724373", "0.49638173" ]
0.7114458
0
rubocop:enable Metrics/AbcSize rubocop:disable Metrics/AbcSize
def layout_order_report_status order_status if order_status.eql? Settings.order.desc order_type = Settings.order.asc icon = Settings.icon.sort_up else order_type = Settings.order.desc icon = Settings.icon.sort_down end tags = html_escape("") link_to manager_reports_path(page: params[:page], date: params[:date], name: params[:name], email: params[:email], status: params[:status], order_status: order_type, order_created: params[:order_created]), class: "sort-report-link" do tags << content_tag(:span, t(".status")) tags << content_tag(:i, "", class: "fas fa-sort-#{icon}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def refutal()\n end", "def implementation; end", "def implementation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def used?; end", "def strategy; end", "def offences_by; end", "def isolated; end", "def isolated; end", "def suivre; end", "def custom; end", "def custom; end", "def spec; end", "def spec; end", "def intensifier; end", "def operations; end", "def operations; end", "def initialize\n\n end", "def initialize\n\n end", "def internal; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def celebration; end", "def initialize\n \n end", "def private_method\n end", "def missing; end", "def ignores; end", "def internship_passed; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def initialize\n \n end", "def extra; end", "def executor; end", "def executor; end", "def executor; end", "def villian; end", "def same; end", "def weber; end", "def initialize\n super()\n end", "def anchored; end", "def initialize\n\t\t\n\tend", "def formation; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize() end", "def who_we_are\r\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def sitemaps; end", "def identify; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def missing?; end", "def operation; end", "def ignore; end", "def init; end", "def init; end", "def init; end", "def init; end", "def apply\n end", "def processor; end", "def initialize\n # nothing here for now\n end", "def checks; end", "def common\n \n end", "def overrides; end", "def initialize\r\n\r\n end" ]
[ "0.7638504", "0.6362991", "0.6227548", "0.61983085", "0.61983085", "0.61882156", "0.61882156", "0.61882156", "0.61882156", "0.6161596", "0.5997375", "0.596157", "0.5928905", "0.5858953", "0.5858953", "0.58353126", "0.58192396", "0.58192396", "0.5805077", "0.5805077", "0.57918614", "0.5723402", "0.5723402", "0.56833744", "0.56833744", "0.5682188", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.56706154", "0.56648886", "0.5663022", "0.56605285", "0.5643765", "0.5632012", "0.5630463", "0.5630463", "0.55991435", "0.5598834", "0.55978465", "0.55978465", "0.55978465", "0.55962396", "0.55843335", "0.5576148", "0.55758715", "0.5575524", "0.5572282", "0.5569239", "0.5565785", "0.5565785", "0.5565785", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55629724", "0.55582285", "0.55559593", "0.55499065", "0.55499065", "0.55499065", "0.55499065", "0.55499065", "0.55499065", "0.55499065", "0.55499065", "0.55499065", "0.55463034", "0.55455637", "0.55369526", "0.55369526", "0.55369526", "0.55369526", "0.55263996", "0.55261946", "0.55259025", "0.55249447", "0.55249447", "0.55249447", "0.55249447", "0.55216944", "0.5520477", "0.55011654", "0.54971695", "0.54919434", "0.54874027", "0.54870754" ]
0.0
-1
Overrides the Rake `task` method to make sure every defined task depends on `environment`.
def task(*arguments) if arguments.first.kind_of?(Hash) super(*arguments) else super(arguments.first => :environment) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_environment(tasks)\n environment = tasks[:environment]\n if environment.nil?\n Kernel.abort(\"Unable to load details of environment '#{tasks[:environment_name]}'\")\n end\n environment\nend", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def remote_rake(task)\n on primary(:app) do\n within current_path do\n with rails_env: fetch(:rails_env) do\n rake task\n end\n end\n end\n end", "def initialize\n dependencies = if defined?(::Rails)\n [:environment]\n else\n []\n end\n\n define_tasks(dependencies)\n end", "def load_rails_environment\n require File.expand_path('../config/application', __FILE__)\n require 'rake'\n AppName::Application.load_tasks\nend", "def setup_rake_dependencies(task, multitask = nil)\n dependencies.reverse_each do |d|\n begin\n bb = ALL_BUILDING_BLOCKS[d]\n raise \"Error: tried to add the dependencies of \\\"#{d}\\\" to \\\"#{@name}\\\" but such a building block could not be found!\" unless bb\n\n if multitask and bb.pre_step\n multitask.prerequisites.unshift(bb.get_task_name)\n else\n task.prerequisites.unshift(bb.get_task_name)\n end\n rescue ExitHelperException\n raise\n rescue Exception => e\n Printer.printError e.message\n ExitHelper.exit(1)\n end\n end\n\n task\n end", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def foreground_rake(task)\n on roles(:app) do\n execute \"cd #{release_path} && bundle exec rake RAILS_ENV=#{fetch(:rails_env)} #{task}\"\n end\nend", "def load_rails_environment\n require File.expand_path('../config/application', __FILE__)\n require 'rake'\n Controlr::Application.load_tasks\nend", "def declare_rake_tasks\n @flavor.class.do_declare_resources do\n if snippet?('cookbook_base')\n rake_tasks['foodcritic'] = <<'END'\nrequire 'foodcritic'\nrequire 'foodcritic/rake_task'\n\nFoodCritic::Rake::LintTask.new(:foodcritic)\ntask style: :foodcritic\nEND\n end\n end\n end", "def create_all_library_tasks(env, libraries, dependent_task)\n libraries.each do | library |\n create_library_tasks(env, library, dependent_task)\n end\n\n desc \"Remove all dependency libraries from the lib directory\"\n task :clean do\n libraries.each do | library |\n rm_rf env.dependent_library_dir(library.name)\n end\n sh \"ino clean\"\n end\n\n desc \"Build the project\"\n task :build => dependent_task do\n sh \"ino build\"\n end\n end", "def list_available_build_tasks\n cd 'cookbooks/example'\n unset_bundler_env_vars\n run_simple 'bundle exec rake -T'\n end", "def setup\r\n rake_original_setup\r\n @original_rake = Rake.application\r\n @rake = Rake::Application.new\r\n Rake.application = @rake\r\n end", "def exec_setup\n exec_task_traverse 'setup'\n end", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def configure_tasks\n end", "def if_rails_loads(task_description, &block)\n error = nil\n\n begin\n Rake::Task['environment'].invoke\n rescue Exception => e\n error = e.message\n end\n\n if error\n puts \"Skipping #{task_description} because: #{error}\"\n else\n puts \"Running #{task_description}\"\n block.call\n end\n end", "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end", "def depends_on?(other_task)\n depends_on.include?(other_task)\n end", "def define_clean_tasks\n require 'rake/clean'\n end", "def define_packaging_tasks\n\n\t\t### Task: prerelease\n\t\tunless Rake::Task.task_defined?( :pre )\n\t\t\tdesc \"Append the package build number to package versions\"\n\t\t\ttask :pre do\n\t\t\t\trev = get_numeric_rev()\n\t\t\t\ttrace \"Current rev is: %p\" % [ rev ]\n\t\t\t\t$hoespec.spec.version.version << \"pre#{rev}\"\n\t\t\t\tRake::Task[:gem].clear\n\n\t\t\t\tGem::PackageTask.new( $hoespec.spec ) do |pkg|\n\t\t\t\t\tpkg.need_zip = true\n\t\t\t\t\tpkg.need_tar = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnamespace :deps do\n\n\t\t\tif RVM_GEMSET.exist?\n\t\t\t\tdesc \"Update the project's RVM gemset\"\n\t\t\t\ttask :gemset do\n\t\t\t\t\tdeps = make_gemset_recommendations( $hoespec.spec )\n\t\t\t\t\tupdates = deps.values.compact\n\n\t\t\t\t\tif !updates.empty?\n\t\t\t\t\t\t$stderr.puts \"%d gems in the current gemset have newer matching versions:\" %\n\t\t\t\t\t\t\t [ updates.length ]\n\t\t\t\t\t\tdeps.each do |old, newer|\n\t\t\t\t\t\t\tnext unless newer\n\t\t\t\t\t\t\t$stderr.puts \" #{old} -> #{newer}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif ask( \"Update? \" )\n\t\t\t\t\t\t\tupdate_rvm_gemset( deps )\n\t\t\t\t\t\t\trun 'rvm', 'gemset', 'import', RVM_GEMSET.to_s\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\tend\n\n\t\t### Make the ChangeLog update if the repo has changed since it was last built\n\t\tfile '.hg/branch'\n\t\tfile 'ChangeLog' => '.hg/branch' do |task|\n\t\t\t$stderr.puts \"Updating the changelog...\"\n\t\t\tcontent = make_changelog()\n\t\t\tFile.open( task.name, 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( content )\n\t\t\tend\n\t\tend\n\n\tend", "def ensure_has_environment_files()\n\n end", "def define\n task name do\n if not @unless\n log \"Running task: #{@name}\"\n exectask\n else\n log \"Skipping task: #{@name} due to unless condition specified in rakefile\"\n end\n end\n self\n end", "def setup\n return if resolved_model_definitions.present?\n @is_rake_task = false\n @is_rake_association_task = false\n @warnings = nil\n @log = false\n @log_clean = false\n check_rake_task\n @resolved_model_definitions = resolve_model_definition_classes_and_values\n end", "def define_tasks\n # Run the command on the local system\n def run(cmd)\n Kernel.system(cmd.runnable)\n end\n # Basic setup action\n def setup_application\n @options ||= PoolParty.options(ARGV.dup)\n end\n \n # Require the poolparty specific tasks\n compiled_rakefile\n \n desc \"Reload the static variables\"\n task :reload do\n reload!\n end\n true\n end", "def setup_environment; end", "def updateDeps(rakeTask)\n\t\t#no-op\n\tend", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def install_tasks\n load 'falkorlib/tasks/git.rake'\n load 'falkorlib/tasks/gitflow.rake'\n end", "def evaluate_pre_tasks\n if using_rake? and Pkg::Config.pre_tasks\n unless Pkg::Config.pre_tasks.is_a?(Hash)\n fail \"The 'pre_tasks' key must be a Hash of depender => dependency pairs\"\n end\n Pkg::Config.pre_tasks.each do |depender, dependency|\n add_dependency(depender, dependency)\n end\n end\n end", "def run_rails_rake_tasks(*names)\n ARGV.clear\n ARGV.concat(names)\n ARGV << \"RAILS_ENV=test\"\n Dir.chdir(RAILS_ROOT) do\n old = Rake.application\n Rake.application = Rake::Application.new\n begin\n Rake.application.run\n ensure\n Rake.application = old\n end\n end\nend", "def check_dependencies(target_task, context_task)\n return true if target_task == context_task\n context_task.all_prerequisite_tasks.include?(target_task)\n end", "def prepare_task\n end", "def execute_task task\n puts \"starting #{task}...\"\n Rake::Task[\"railties:install:migrations\"].reenable\n Rake::Task[task].reenable\n r = Rake::Task[task].invoke\n puts \"#{task} done! #{r}\"\nend", "def define\n desc @description\n task @name => Array(deps) do\n FileUtilsExt.verbose(@verbose) do\n puts \"Use TESTOPTS=\\\"--verbose\\\" to pass --verbose\" \\\n \", etc. to runners.\" if ARGV.include? \"--verbose\"\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{file_list_string} #{option_list}\"\n ruby args do |ok, status|\n if !ok && status.respond_to?(:signaled?) && status.signaled?\n raise SignalException.new(status.termsig)\n elsif !ok\n status = \"Command failed with status (#{status.exitstatus})\"\n details = \": [ruby #{args}]\"\n message =\n if Rake.application.options.trace or @verbose\n status + details\n else\n status\n end\n\n fail message\n end\n end\n end\n end\n self\n end", "def configure_tasks\n super\n all_object_files = []\n all_object_folders = []\n @toolchains.each do |toolchain, sources|\n toolchain.add_include_paths(@api_headers+@configuration_headers)\n object_files, object_folders = toolchain.create_compile_tasks(sources)\n all_object_files |= object_files\n all_object_folders |= object_folders\n end\n\n project_filename = @parent_project.project_name.to_s.gsub(':','-')\n library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename)\n dependencies = @dependencies+all_object_folders+library_folders+library_files\n\n desc \"Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'\"\n new_task = static_library_task @configuration_name => dependencies do |t|\n @post_build.call if @post_build.respond_to? :call\n puts \"built library #{t.name}.\"\n @tests.each do |test|\n if Rake::Task.task_defined? test\n Rake::Task[test].invoke\n else\n $stderr.puts \"warning: Skipping unknown test '#{test}'\"\n end\n end\n end\n new_task.api_headers = @api_headers\n new_task.configuration_headers = @configuration_headers\n new_task.library_files = library_files\n end", "def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end", "def ensure_env(*vars)\n unless env_set?(*vars)\n fail_task(\"Please set env: #{vars.join(' ')}\")\n end\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def define_default_tasks\n\n\t\t# task used to indicate that rake-deveiate has already been setup once; for\n\t\t# global rakefiles.\n\t\ttask :deveiate do\n\t\t\t# no-op\n\t\tend\n\n\t\tdesc \"The task that runs by default\"\n\t\ttask( :default => :spec )\n\n\t\tdesc \"Check in the current changes\"\n\t\ttask :checkin => [ :precheckin, :check, :test ]\n\t\ttask :commit => :checkin\n\t\ttask :ci => :checkin\n\t\ttask :precheckin\n\n\t\tdesc \"Sanity-check the project\"\n\t\ttask :check\n\n\t\tdesc \"Update the history file\"\n\t\ttask :update_history\n\n\t\tdesc \"Package up and push a release\"\n\t\ttask :release => [ :prerelease, :gem, :release_gem, :postrelease ]\n\t\ttask :prerelease\n\t\ttask :release_gem\n\t\ttask :postrelease\n\n\t\tdesc \"Run all the project's tests\"\n\t\ttask :test\n\t\ttask :spec\n\t\ttask :integration\n\n\t\tdesc \"Set up the project for development\"\n\t\ttask :setup do\n\t\t\tself.install_dependencies\n\t\tend\n\n\t\tdesc \"Turn on maintainer mode: build with extra warnings and debugging\"\n\t\ttask :maint do\n\t\t\tENV['MAINTAINER_MODE'] = 'yes'\n\t\tend\n\n\tend", "def define_all_task\n define_desc_task(\"Version, verify, document, package\", :all => [ :version, :verify, :doc, :package ])\n define_verify_task\n define_doc_task\n define_commit_task\n # This is a problem. If the version number gets updated, Gem::PackageTask\n # fails. This is better than if it used the old version number, I\n # suppose, but not as nice as if it just used @spec.version everywhere.\n # The solution for this is to do a dry run before doing the final +rake+\n # +commit+, which is a good idea in general.\n Gem::PackageTask.new(@spec) { |package| }\n end", "def rake_functionals(opts=nil)\n if ENV['RUBYOPT']\n # remove bundler/setup require that prematurely checks for gems and crashes\n ENV['RUBYOPT'] = ENV['RUBYOPT'].gsub(%r{-r\\s*bundler/setup}, '')\n end\n # runs all the tests for each ruby version in each rails dir\n system(\"bash test/test.sh #{opts}\")\nend", "def define\n logger.debug \"Defining tasks for #{name} #{version}\"\n\n namespace \"#{name}\" do\n define_download\n define_verify\n define_unpack\n define_patch\n define_build\n define_install\n\n task :done => \"#{name}:install\"\n task :default => \"#{name}:done\"\n end\n\n desc \"Build and Install #{name} #{version}\"\n task name => \"#{name}:default\"\n end", "def configure_tasks\n super\n all_sources = []\n @toolchains.each do |toolchain, sources|\n all_sources |= sources\n toolchain.output_folder = @output_folder\n toolchain.project_folder = @project_folder\n toolchain.output_decorator = \"-#{@configuration_name}\"\n CompiledConfiguration.add_framework_dependencies_to_toolchain(toolchain, @dependencies)\n end\n # Give the default toolchain an opportunity to scan all source files for\n # any special needs. For example, a toolchain might look for .cpp files\n # to determine that it should link a project with the \"g++\" vs \"gcc\".\n @default_toolchain.scan_sources(all_sources)\n end", "def invoke_or_reboot_rake_task(task)\n if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?\n ruby_rake_task task\n else\n Rake::Task[task].invoke\n end\n end", "def invoke_or_reboot_rake_task(task)\n if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?\n ruby_rake_task task\n else\n Rake::Task[task].invoke\n end\n end", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def require_tasks system_config\n system_config.gaudi_modules.each do |gm|\n mass_require(Rake::FileList[\"#{system_config.base}/tools/build/lib/#{gm}/tasks/*.rb\"])\n end\n end", "def define_sanitycheck_tasks\n\n\t\ttask 'hg:precheckin' => [:spec] if File.directory?( 'spec' )\n\t\ttask 'hg:prep_release' => [ :check_manifest, :check_history ]\n\n\t\t# Rebuild the ChangeLog immediately before release\n\t\ttask :check_manifest => 'ChangeLog'\n\t\ttask :prerelease => 'ChangeLog'\n\n\tend", "def define_package_tasks\n prerelease_version\n\n Gem::PackageTask.new spec do |pkg|\n pkg.need_tar = @need_tar\n pkg.need_zip = @need_zip\n end\n\n desc \"Install the package as a gem. (opt. NOSUDO=1)\"\n task :install_gem => [:clean, :package, :check_extra_deps] do\n install_gem Dir[\"pkg/*.gem\"].first\n end\n\n desc \"Package and upload; Requires VERSION=x.y.z (optional PRE=a.1)\"\n task :release => [:prerelease, :release_to, :postrelease]\n\n # no doco, invisible hook\n task :prerelease do\n abort \"Fix your version before you release\" if spec.version.to_s =~ /borked/\n end\n\n # no doco, invisible hook\n task :release_to\n\n # no doco, invisible hook\n task :postrelease\n\n desc \"Sanity checks for release\"\n task :release_sanity do\n v = ENV[\"VERSION\"] or abort \"Must supply VERSION=x.y.z\"\n\n pre = ENV[\"PRERELEASE\"] || ENV[\"PRE\"]\n v += \".#{pre}\" if pre\n\n c = changes[/\\d\\S+/]\n\n abort \"Versions don't match: %s vs %s\" % [v, version] if v != version\n abort \"Versions don't match %s: %s vs %s\" % [history_file, v, c] if v != c\n end\n end", "def declare_rakefile\n @flavor.class.do_declare_resources do\n # :nocov:\n lazy_vars = Chef::DelayedEvaluator.new do\n { tasks: rake_tasks }\n end\n # :nocov:\n add_templates(%w(Rakefile), :create, variables: lazy_vars)\n end\n end", "def rake_task?\n defined?(::Rake) && !Rake.application.top_level_tasks.empty?\n end", "def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end", "def add_standard_buildr_tasks\n add_standard_bundler_tasks\n desc 'Download all artifacts application if buildfile'\n command(:buildr_artifacts) do\n if File.exist?('buildfile')\n begin\n rbenv_exec('buildr artifacts:sources artifacts clean')\n rescue\n # ignored\n end\n end\n end\n\n desc 'Propose an update to dependency for all downstream projects in a automerge branch. Specify parameters DEPENDENCIES and VERSION'\n command(:propose_dependency_update, :in_app_dir => false) do |app|\n dependencies = Zim::Config.parameter_by_name('DEPENDENCIES').split(',')\n target_version = Zim::Config.parameter_by_name('VERSION')\n branch_key = Zim::Config.parameters['BRANCH_KEY'] || ''\n\n run(:real_clean, app)\n in_app_dir(app) do\n branches = (Zim.current_suite.application_by_name(app).tag_value('zim:branches') || current_default_branch).split(',')\n branches.each do |branch|\n git_checkout(branch)\n propose_dependency_update(app, branch_key, dependencies, target_version, branch)\n end\n end\n end\n end", "def updateDeps(rakeTask)\n\t\treturn true\n\tend", "def updateDeps(rakeTask)\n\t\treturn true\n\tend", "def define_extension_tasks\n\t\tENV['RUBY_CC_VERSION'] ||= RUBY_VERSION[ /(\\d+\\.\\d+)/ ]\n\n\t\trequire 'rake/extensiontask'\n\t\tself.extensions.each do |extconf|\n\t\t\tRake::ExtensionTask.new( extconf.pathmap('%{ext/,}d') )\n\t\tend\n\n\t\ttask :spec => :compile\n\n\t\ttask :maint do\n\t\t\tENV['V'] = '1'\n\t\t\tENV['MAINTAINER_MODE'] = 'yes'\n\t\tend\n\tend", "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def build_rake_step\n @rake_task << self.global_config # Open the rake Stek and get General Configuration information\n @rake_task << (self.render self.get_config_template) # get Specific Configuration. Defined in the [tool].rb module file (erb)\n @opt_parser.check_error # stop here if errors found in the configuration\n @rake_task << self.test_validation # step is already done ? Defined in the tool_template.rb file\n @rake_task << (self.render self.tool_template) # get specific Task Code. Defined in the [tool].rb module file (erb)\n @rake_task << self.write_validation # write the check file Defined in the tool_template.rb file\n @rake_task << self.close_step # To close the rake Step Defined in the tool_template.rb file\n end", "def gradle_task\n @gradle_task ||= \"ktlintCheck\"\n end", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def available_tasks\n gather_tasks = Proc.new do |tasks|\n Dir[File.join(Rooster::TASKS_DIR, \"*.rb\")].each do |filename|\n tasks << task_from_filename(filename) || next\n end\n end\n \n @@available_tasks ||= if Rails::VERSION::MAJOR == 2\n returning([]) {|tasks| gather_tasks.call(tasks) }\n elsif Rails::VERSION::MAJOR == 3\n [].tap {|tasks| gather_tasks.call(tasks)}\n else\n raise raise RuntimeError,\n \"Unknown Rails major version: '#{Rails::VERSION::MAJOR}'\"\n end\n end", "def starting_tasks\n each_task.reject do |task|\n task.dependency_backward_any?\n end\n end", "def define\n desc \"Create & migrate the DB for your named TIMESHEET\"\n task \"#{@name}:prepare\", [:timesheet] => [\"#{@name}:env\"] do |t, args|\n Enrar::Migrator.new.migrate!\n end\n\n desc \"Print the URL for the provided TIMESHEET\"\n task \"#{@name}:url\", [:timesheet] => [\"#{@name}:env\"] do |t, args|\n require 'socket'\n ip = Socket::getaddrinfo(Socket.gethostname,\"echo\",Socket::AF_INET)[0][3]\n puts \"http://#{ip}:#{@config[:port] || 8912}/\"\n end\n\n task \"#{@name}:env\", [:timesheet] do |t, args|\n @timesheet = File.expand_path('~/.secretary') unless args[:timesheet]\n @config = Vim::Secretary::Config.from_timesheet(@timesheet)\n end\n\n self\n end", "def generate_targets\n has_metaname = has_version?\n\n %w[clean update fetch configure export build install].each do |target|\n target_name = \"#{@name}_#{target}\".to_sym\n target_metaname = \"#{@metaname}_#{target}\".to_sym if has_metaname\n func = pkg_default_target_func(@name.to_sym, target)\n\n task = Rake::Task.define_task(target_name, &func)\n metatask = Rake::Task.define_task(target_metaname, &func) if has_metaname\n\n # Add per-task dependency\n case target\n when /install/i\n task.enhance([\"#{@name}_build\".to_sym])\n metatask.enhance([\"#{@metaname}_build\".to_sym]) if has_metaname\n when /build/i\n task.enhance([\"#{@name}_export\".to_sym])\n metatask.enhance([\"#{@metaname}_export\".to_sym]) if has_metaname\n\n # Generate package export dependencies\n @build_deps.each do |dep|\n task.enhance([\"#{dep}_export\".to_sym])\n metatask.enhance([\"#{dep}_export\".to_sym]) if has_metaname\n end\n\n # Generate package build dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_install\".to_sym])\n metatask.enhance([\"#{dep}_install\".to_sym]) if has_metaname\n end\n when /export/i\n task.enhance([\"#{@name}_configure\".to_sym])\n metatask.enhance([\"#{@metaname}_configure\".to_sym]) if has_metaname\n when /configure/i\n task.enhance([\"#{@name}_fetch\".to_sym])\n metatask.enhance([\"#{@metaname}_fetch\".to_sym]) if has_metaname\n when /clean/i\n # Generate package clean dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_clean\".to_sym])\n metatask.enhance([\"#{dep}_clean\".to_sym]) if has_metaname\n end\n end\n\n update_global_task(target, target_name)\n end\n\n # Create the default package task named after the package name\n task = Rake::Task.define_task(\"#{@name}\" => [\"#{@name}_install\".to_sym])\n metatask = Rake::Task.define_task(\"#{@metaname}\" => [\"#{@metaname}_install\".to_sym]) if has_metaname\n end", "def add_standard_bundler_tasks\n desc 'Install all dependencies for application if Gemfile present'\n command(:bundle_install) do\n rbenv_exec('bundle install') if File.exist?('Gemfile')\n end\n end", "def prepare_environment(env)\n load_environment_properties(env)\n raise 'environment problem:environment not found' if @env_config.nil?\n create_required_files @env_config\n load_master_config @env_config['config_file']\n end", "def check_and_set_environment\n check_env\n set_env\n end", "def uppper_depends(task_name)\n task_list = []\n @tasks.each { |t|\n if not t.dependency.nil? then\n task_list.push(t) if t.dependency.include?(task_name)\n end\n }\n task_list\n end", "def build(rakeTask)\n\t\t#we've called ourselves after updating prereqs and running them; now do our work\n\t\t\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes non-file prereq tasks, so do our own\n\t\t\tlinker().link(:objs => linkDepsOrdered(), :target => target())\n\t\tend\n\tend", "def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end", "def handle_rake_test_task\n test_task = @target\n all_tests = test_task.file_list\n\n @target = test_task.name\n @globs << test_task.file_list\n @options[:force] = true\n\n lambda do |changed|\n tests = all_tests & changed\n\n basenames = (changed - tests).collect do |f|\n File.basename(f).split(\".\").first\n end\n\n tests.concat all_tests.\n select { |t| basenames.any? { |b| t =~ /#{b}/ } }\n\n tests = all_tests.dup if tests.empty?\n\n # Nice API, Rake::TestTask.\n ENV[\"TEST\"] = \"{#{tests.uniq.join(',')}}\"\n end\n end", "def build_default_tasks\n @rake_task << self.step_template # get General Configuration information\n end", "def after(*dependencies, &block)\n depends_on = dependencies.flat_map { |dep| \"db:seed:#{dep}\" }\n dependent_task_name = @_seed_task.name + ':body'\n\n if Rake::Task.task_defined?(dependent_task_name)\n dependent_task = Rake::Task[dependent_task_name]\n else\n dependent_task = Rake::Task.define_task(dependent_task_name => depends_on, &block)\n end\n\n dependent_task.invoke\n end", "def setup!(rails_env)\n load_fakes_and_seed!(rails_env: rails_env) if rails_env.development?\n end", "def setup\n # NOTE: We do not yet assume any contents of the depot. When we do,\n # I have some code for populating test fixtures, although it leans a bit\n # toward Rails' conventions. We can probably 'derail' it. :)\n\n # Specify the environment, e.g. development vs. test, etc. It is assumed to be\n # test. This is done mainly so that the right configuration is used for connecting to\n # Perforce. This should probably be moved to a generic 'test_helper' which is\n # included in all tests.\n ENV['APP_ENV'] ||= 'test'\n end", "def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end", "def ruby_rake_task(task)\n Rake::Task[task].invoke\nend", "def rake(*tasks)\n \"rake #{tasks.join(' ')}\"\n end", "def upgrade_tasks\n if ENV['UPGRADE'].present?\n ENV['UPGRADE'].split(',')\n else\n all_upgrade_tasks\n end\n end", "def cleanall(rakeTask)\n\t\tif @cleanallRecurse\n\t\t\t@cleanallRecurse = false\n\t\t\tlinkDepsOrdered().select {|entity| BuildEnv::isBuilt?(entity)}.each do |entity|\n\t\t\t\ttask rakeTask.name => Builder::cleanAllTaskName(entity)\n\t\t\tend\n\t\t\trakeTask.reenable()\n\t\t\trakeTask.invoke() #run again, starting with our updated prereqs list\n\t\telse #we've called ourselves after updating prereqs and running them; now do our work\n\t\t\tclean()\n\t\tend\n\tend", "def depends_on( other_dependency )\n namespace name do\n task :build => \"#{other_dependency}:done\"\n end\n end", "def ensure_tasks_folder\n io.mkdir('.webbynode/tasks') unless io.directory?(\".webbynode/tasks\")\n %w[before_push after_push].each do |file|\n io.exec(\"touch .webbynode/tasks/#{file}\") unless io.file_exists?(\".webbynode/tasks/#{file}\")\n end\n end", "def set_env()\n @triggers.each(&:set_env)\n end", "def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end", "def call_rake(task, options = {})\n options[:rails_env] ||= Rails.env\n args = options.map { |k,v| \"#{k.to_s.upcase}='#{v}'\" }\n system \"rake #{task} #{args.join(' ')} --trace >> #{Rails.root}/log/rake.log &\"\n end", "def run_assets_precompile_rake_task\n # We want to make sure we have all the migrations ready to run, but we\n # don't actually want to run them now because we don't have a database yet.\n sh \"bundle exec rails g spree:install --auto-accept --user_class=Spree::User --enforce_available_locales=true --migrate=false --seed=false --sample=false\"\n\n # We use this instead of solidus_auth:install because this won't run\n # migrations.\n sh \"bundle exec rake railties:install:migrations\"\n\n # Okay, now we want to run whatever heroku normally does for a rails app\n # This includes:\n # * bundle install\n # * install node.js\n # * rake asset:precompile\n super\n end", "def define_newgem_tasks\n unless self.extra_dev_deps.find { |dep| dep.first == 'newgem' }\n require File.dirname(__FILE__) + '/../newgem'\n self.extra_dev_deps ||= []\n self.extra_dev_deps << ['newgem', \">= #{::Newgem::VERSION}\"] unless name == 'newgem'\n end\n \n return if Rake::Task.tasks.find { |t| t.name == 'gemspec' }\n desc \"Generate a #{name}.gemspec file\"\n task :gemspec do\n File.open(\"#{name}.gemspec\", \"w\") do |file|\n file.puts spec.to_ruby\n end\n end\n \n task :release do\n puts <<-EOS.gsub(/^ /,'')\n Remember to create tag your release; eg for Git:\n git tag REL-#{$hoe.version}\n\n Announce your release on RubyForge News:\n rake post_news\n EOS\n end\n\n task :check_version do\n unless ENV['VERSION']\n puts 'Must pass a VERSION=x.y.z release version'\n exit\n end\n unless ENV['VERSION'] == $hoe.version\n puts \"Please update your lib/#{$hoe.name}.rb to match the release version, currently #{$hoe.version}\"\n exit\n end\n end\n\n desc 'Install the package as a gem, without generating documentation(ri/rdoc)'\n task :install_gem_no_doc => [:clean, :package] do\n sh \"#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri\"\n end\n \n task :ruby_env do\n $ruby_app = if RUBY_PLATFORM =~ /java/\n \"jruby\"\n else\n \"ruby\"\n end\n end\n \n end", "def define_perforce_tasks\n warn :define_perforce_tasks if $DEBUG\n\n desc \"branch the project from dev to version dir\"\n task :branch do\n original_dir = File.basename(Dir.pwd)\n\n Dir.chdir \"..\"\n\n target_dir = File.directory?(version) ? version : original_dir\n branching = target_dir == original_dir && target_dir != version\n pkg = File.basename(Dir.pwd)\n\n begin\n p4_integrate original_dir, version if branching\n validate_manifest_file version\n p4_submit \"Branching #{pkg} to version #{version}\" if branching\n rescue => e\n warn e\n p4_revert version\n raise e\n end\n\n Dir.chdir version\n end\n\n task :prerelease => :branch\n\n task :postrelease => :announce do\n system 'rake clean'\n end\n\n desc \"Generate historical flog/flay data for all releases\"\n task :history do\n p4_history\n end\n end", "def background_rake(task)\n on roles(:app) do\n execute \"cd #{release_path}; ( ( nohup bundle exec rake RAILS_ENV=#{fetch(:rails_env)} #{task} &>/dev/null ) & )\"\n end\nend", "def load\n super()\n load_rspec_tasks\n load_generic_deploy_pack_tasks\n load_this_deploy_packs_tasks\n end", "def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end", "def force_task?(task)\n !!metadata[\"run_#{task}\"]\n end", "def post_process\n bind_files\n make_tasks\n end", "def load_task_libraries\n\t\ttaskdir = Pathname( __FILE__.delete_suffix('.rb') )\n\t\ttasklibs = Rake::FileList[ taskdir + '*.rb' ].pathmap( '%-2d/%n' )\n\n\t\tself.trace( \"Loading task libs: %p\" % [ tasklibs ] )\n\t\ttasklibs.each do |lib|\n\t\t\trequire( lib )\n\t\tend\n\n\t\tself.class.constants.\n\t\t\tmap {|c| self.class.const_get(c) }.\n\t\t\tselect {|c| c.respond_to?(:instance_methods) }.\n\t\t\tselect {|c| c.instance_methods(false).include?(:define_tasks) }.\n\t\t\teach do |mod|\n\t\t\t\tself.trace \"Loading tasks from %p\" % [ mod ]\n\t\t\t\textend( mod )\n\t\t\tend\n\n\t\tself.setup( self.name, **self.options )\n\tend", "def updateDeps(rakeTask)\n\t\tprevLinkDeps = []\n\t\tlinkDeps = linkDepsOrdered() - [mainObjFilepath()]\n\t\twhile !(linkDeps - prevLinkDeps).empty?()\n\t\t\t(linkDeps - prevLinkDeps).each do |dep|\n\t\t\t\tif BuildEnv::isBuilt?(dep)\n\t\t\t\t\tRake::Task[Builder::updateDepsTaskName(dep)].invoke()\n\t\t\t\tend\n\t\t\tend\n\t\t\tprevLinkDeps = linkDeps\n\t\t\tlinkDeps = linkDepsOrdered() - [mainObjFilepath()]\n\t\tend\n\n\t\tlinkDeps.each {|dep| addPrereq dep}\n\t\tbuildTask = Rake::Task[\"#{target()}\"]\n\t\tbuildTask.reenable()\n\t\tbuildTask.invoke() #run again, starting with our updated prereqs list\n\tend", "def build_package_tasks(config)\n # The name of the task to build the package\n package_task_name = \"build_#{config[:package_name]}\"\n\n # Add task name to the list of dependencies for the :deb_packages task\n task :deb_packages => package_task_name\n\n # The path to the package source directory\n pkg_src_dir = File.join(PACKAGE_CONSTRUCTION_DIR, source_dir_name(config))\n\n # Directory task to ensure the existence of the directory\n directory pkg_src_dir\n\n # Create the tarball task\n orig_source_tarball_path = File.join(PACKAGE_CONSTRUCTION_DIR, \"#{orig_tar_ball_name(config)}.orig.tar.gz\")\n\n # The File task to construct the original source tarball.\n file orig_source_tarball_path => PACKAGE_CONSTRUCTION_DIR do\n system \"tar zcf #{orig_source_tarball_path} --directory #{PACKAGE_CONSTRUCTION_DIR} #{source_dir_name(config)}\"\n end\n\n # The path to the debian directory within the extracted source directory\n package_debian_path = File.join(pkg_src_dir, 'debian')\n\n # Directory task to the package debian path to ensure existence.\n directory package_debian_path\n\n # The task that actually constructs the debian package\n task package_task_name => orig_source_tarball_path do\n # Build the spanky little thing.\n debuild_flag = ENV['debuild'] || 'true'\n if debuild_flag == 'true'\n system \"cd #{pkg_src_dir}; debuild -us -uc\"\n else\n puts \"Skipping build; debug flag was set\"\n end\n end\n\n # Ensure we have set up the tasks for all the files to be included\n # in the package.\n config[:exes].each do | exe_name |\n exe_path = File.join(pkg_src_dir, exe_name.split('.').first)\n file exe_path => pkg_src_dir do\n cp exe_name, exe_path\n end\n\n # Add the file path as a dependency of the source tarball\n task orig_source_tarball_path => exe_path\n end\n\n # Create the task to populate the debian directory\n debian_task = \"populate_#{config[:package_name]}_debian_files\"\n task debian_task => package_debian_path do\n cp_r \"package_source/#{config[:package_name]}/debian\", pkg_src_dir\n end\n\n # Finally add the debian task as a dependency for the package task.\n task package_task_name => debian_task\nend" ]
[ "0.67495036", "0.6550757", "0.638364", "0.63696617", "0.63375133", "0.63368475", "0.630216", "0.62644553", "0.62090397", "0.6207525", "0.613545", "0.60839725", "0.60793036", "0.6071417", "0.6071416", "0.6071416", "0.6071416", "0.60583013", "0.6013783", "0.6011177", "0.5935552", "0.59192055", "0.5903945", "0.5883744", "0.58518696", "0.5847659", "0.5843945", "0.5838841", "0.5815981", "0.57941145", "0.57941145", "0.57936764", "0.57739145", "0.5767753", "0.57491404", "0.5744936", "0.572786", "0.5705405", "0.57026196", "0.57021075", "0.5672732", "0.5661696", "0.5658038", "0.56516874", "0.56433535", "0.56133175", "0.557385", "0.556213", "0.556213", "0.5538976", "0.5531183", "0.5525581", "0.55169743", "0.5489366", "0.5488391", "0.54815185", "0.5478348", "0.54609734", "0.54609734", "0.5453091", "0.54469997", "0.54439574", "0.5438225", "0.540998", "0.540575", "0.5395231", "0.5381919", "0.53776103", "0.5374047", "0.53723264", "0.5368478", "0.5367557", "0.5361781", "0.53604275", "0.53600585", "0.5352991", "0.53374743", "0.53361446", "0.5332666", "0.5329388", "0.5328947", "0.53253996", "0.5315073", "0.53135127", "0.53125256", "0.5301041", "0.5294436", "0.52813774", "0.5262485", "0.5257845", "0.5252839", "0.52527696", "0.52490735", "0.52472675", "0.5241018", "0.5228685", "0.52232707", "0.5216269", "0.5189468", "0.5185362" ]
0.63365537
6
=> Validations => Becuse this is a subclass of Claim, we need to skip validations
def skip_validations true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_claims; end", "def required_claims; end", "def validated; end", "def validated?; end", "def subclass_validations ; true ; end", "def required_claims=(_arg0); end", "def required_claims=(_arg0); end", "def validator; end", "def validation; end", "def validation; end", "def validate\n super \n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate\n super\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def validate\n \n \n end", "def is_valid; end", "def validate!\n super()\n self\n end", "def pre_validation\n\n\n end", "def valid_before; end", "def pre_validation\n\n end", "def validate!\n # pass\n end", "def extra_validations\n success\n end", "def validate\n end", "def validation_context\n {}\n end", "def validate(vmode=nil)\n # Holding pattern. All models should use super, in principal\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def validate\r\n\r\n end", "def valid_policy\n double validate!: nil, validate: double(valid?: true, invalid?: false)\nend", "def validations\n {}\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def validate\n fail 'sub class to implement'\n end", "def validate\n\n end", "def validate\n super\n validates_presence [:code, :preference, :type_param_id, :application_id]\n end", "def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end", "def _before_validation\n end", "def test_should_not_validate_double_claiming\n claiming = create_claiming\n assert claiming.valid?\n claiming = create_claiming\n assert !claiming.valid?\n end", "def valid?\n policy_validator = EnumAttributeValidator.new('Object', ['RMF', 'DIACAP', 'Reporting'])\n return false unless policy_validator.valid?(@policy)\n registration_type_validator = EnumAttributeValidator.new('Object', ['Assess and Authorize', 'Assess Only', 'Guest', 'Regular', 'Functional', 'Cloud Service Provider'])\n return false unless registration_type_validator.valid?(@registration_type)\n organization_name_validator = EnumAttributeValidator.new('Object', ['Army', 'Navy', 'Air Force', 'Marines', 'DoD', 'Defense Information Systems Agency'])\n return false unless organization_name_validator.valid?(@organization_name)\n system_type_validator = EnumAttributeValidator.new('Object', ['IS Major Application', 'IS Enclave', 'Platform IT', 'Platform IT System', 'Interconnection', 'AIS Application'])\n return false unless system_type_validator.valid?(@system_type)\n authorization_status_validator = EnumAttributeValidator.new('Object', ['Authority to Operate (ATO)', 'Interim Authority to Operate (IATO)', 'Interim Authority to Test (IATT)', 'Authority to Operate with Conditions (ATO) w/Conditions)', 'Denied Authority to Operate (DATO)', 'Not Yet Authorized', 'Unaccredited', 'Decommissioned'])\n return false unless authorization_status_validator.valid?(@authorization_status)\n confidentiality_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless confidentiality_validator.valid?(@confidentiality)\n integrity_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless integrity_validator.valid?(@integrity)\n availability_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless availability_validator.valid?(@availability)\n mac_validator = EnumAttributeValidator.new('Object', ['I', 'II', 'III'])\n return false unless mac_validator.valid?(@mac)\n dod_confidentiality_validator = EnumAttributeValidator.new('Object', ['Public', 'Sensitive', 'Classified'])\n return false unless dod_confidentiality_validator.valid?(@dod_confidentiality)\n true\n end", "def is_valid\n\tend", "def is_valid\n\tend", "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def run_validations\n true\n end", "def validations\n []\n end", "def validate!\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end", "def validate\n token = jwt\n return unless token\n token.validate\n end", "def validate\n true\n end", "def initialize(params = {})\n super\n self.is_valid = true\n end", "def validate\n # add errors if not validate\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end", "def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end", "def verify_iss; end", "def verify_iss; end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end", "def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end", "def valid; end", "def validate(check_required_attributes = true)\n @processor = AttributeProcessor.new(to_hash)\n @processor.process\n\n # object identity is always required, even for patches\n missing_errors = {}\n missing_errors[identity.to_sym] = 'is missing' if self.class.method_defined?(identity) && blank?(send(identity))\n\n if check_required_attributes\n missing_attrs = required_attributes.select { |at| blank?(send(at)) }\n\n missing_attrs.each do |at|\n missing_errors[at] = 'is missing'\n end\n end\n\n @processor.errors.merge(missing_errors)\n end", "def validator=(_); end", "def validate_required!\n raise UserMissing if user.nil?\n raise PaymentMissing if payment.nil? || !payment.valid?\n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def verify_not_before; end", "def verify_not_before; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def valid?\n true && super\n end", "def validate!(t)\n # None.\n end", "def validate(obj, type); end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?\n event_type_validator = EnumAttributeValidator.new('String', [\"api_key.create\", \"acl.create\", \"acl.delete\", \"acl.update\", \"address.create\", \"address.delete\", \"address.update\", \"backend.create\", \"backend.delete\", \"backend.update\", \"billing.contact_update\", \"cache_settings.create\", \"cache_settings.delete\", \"cache_settings.update\", \"customer.create\", \"customer.pricing\", \"customer.update\", \"customer_feature.create\", \"customer_feature.delete\", \"director.create\", \"director.delete\", \"director.update\", \"director_backend.create\", \"director_backend.delete\", \"domain.create\", \"domain.delete\", \"domain.update\", \"gzip.create\", \"gzip.delete\", \"gzip.update\", \"header.create\", \"header.delete\", \"header.update\", \"healthcheck.create\", \"healthcheck.delete\", \"healthcheck.update\", \"invitation.accept\", \"invitation.sent\", \"invoice.failed_payment\", \"invoice.payment\", \"io_settings.create\", \"io_settings.delete\", \"io_settings.update\", \"logging.create\", \"logging.delete\", \"logging.update\", \"pool.create\", \"pool.delete\", \"pool.update\", \"request_settings.create\", \"request_settings.delete\", \"request_settings.update\", \"response_object.create\", \"response_object.delete\", \"response_object.update\", \"rule_status.update\", \"rule_status.upsert\", \"server.create\", \"server.delete\", \"server.update\", \"service.create\", \"service.delete\", \"service.move\", \"service.move_destination\", \"service.move_source\", \"service.purge_all\", \"service.update\", \"service_authorization.create\", \"service_authorization.delete\", \"service_authorization.update\", \"tls.bulk_certificate.create\", \"tls.bulk_certificate.delete\", \"tls.bulk_certificate.update\", \"tls.certificate.create\", \"tls.certificate.expiration_email\", \"tls.certificate.update\", \"tls.certificate.delete\", \"tls.configuration.update\", \"tls.private_key.create\", \"tls.private_key.delete\", \"tls.activation.enable\", \"tls.activation.update\", \"tls.activation.disable\", \"tls.globalsign.domain.create\", \"tls.globalsign.domain.verify\", \"tls.globalsign.domain.delete\", \"tls.subscription.create\", \"tls.subscription.delete\", \"tls.subscription.dns_check_email\", \"token.create\", \"token.destroy\", \"two_factor_auth.disable\", \"two_factor_auth.enable\", \"user.create\", \"user.destroy\", \"user.lock\", \"user.login\", \"user.login_failure\", \"user.logout\", \"user.password_update\", \"user.unlock\", \"user.update\", \"vcl.create\", \"vcl.delete\", \"vcl.update\", \"version.activate\", \"version.clone\", \"version.copy\", \"version.copy_destination\", \"version.copy_source\", \"version.create\", \"version.deactivate\", \"version.lock\", \"version.update\", \"waf.configuration_set_update\", \"waf.create\", \"waf.delete\", \"waf.update\", \"waf.enable\", \"waf.disable\", \"waf.owasp.create\", \"waf.owasp.update\", \"waf.ruleset.deploy\", \"waf.ruleset.deploy_failure\", \"wordpress.create\", \"wordpress.delete\", \"wordpress.update\"])\n return false unless event_type_validator.valid?(@event_type)\n true\n end", "def supports_validate_constraints?\n false\n end", "def supports_validate_constraints?\n false\n end", "def valid_attributes\n { }\n end", "def validate\n raise NoMethodError, \"must define method 'validate'\"\n end", "def validation\n # Rails.logger.debug \"#{self.class}.#{__method__} Default validator is empty\"\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validations_for(klass)\n validations[klass] ||= []\n end", "def validate_build\n end", "def validate\n errors.clear\n self.class.validator.invoke self\n end", "def validate\n @invalid=false\n end", "def valid?\n return false if @domain.nil?\n domain_validator = EnumAttributeValidator.new('String', [\"Notification\", \"Organization\", \"OrganizationGateway\", \"Product\", \"User\", \"Subscription\", \"Profile\", \"ProductRatePlan\", \"Client\", \"Invoice\", \"PricingComponentValue\", \"Account\", \"PricingComponentValueChange\", \"PricingComponentTier\", \"PricingComponent\", \"PricingCalculation\", \"Coupon\", \"CouponDiscount\", \"CouponDefinition\", \"CouponInstance\", \"CouponModifier\", \"CouponRule\", \"CouponBookDefinition\", \"CouponBook\", \"InvoiceLine\", \"Webhook\", \"WebhookSubscription\", \"SubscriptionCancellation\", \"NotificationSnapshot\", \"InvoicePayment\", \"Payment\", \"PaymentMethod\", \"PaymentMethodSubscriptionLink\", \"DunningLine\", \"CybersourceToken\", \"Card\", \"Alias\", \"PaypalSimplePaymentReconciliation\", \"FreePaymentReconciliation\", \"LocustworldPaymentReconciliation\", \"CouponInstanceExistingValue\", \"TaxLine\", \"TaxationStrategy\", \"TaxationLink\", \"Address\", \"AmendmentPriceNTime\", \"Authority\", \"UnitOfMeasure\", \"SearchResult\", \"Amendment\", \"AuditLog\", \"Password\", \"Username\", \"FixedTermDefinition\", \"FixedTerm\", \"Refund\", \"CreditNote\", \"Receipt\", \"AmendmentCompoundConstituent\", \"APIConfiguration\", \"StripeToken\", \"BraintreeToken\", \"BalancedToken\", \"AuthorizeNetToken\", \"PaypalToken\", \"SpreedlyToken\", \"SagePayToken\", \"TrustCommerceToken\", \"PayVisionToken\", \"SagePayOutstandingTransaction\", \"SagePayEnabledCardType\", \"SagePayTransaction\", \"GatewayRevenue\", \"Migration\", \"AdhocSubscription\", \"SubscriptionCharge\", \"ComponentChange\", \"Verification\", \"UsageRoundingStrategies\", \"PricingComponentValueMigrationChargeAmendmentMapping\", \"AmendmentDiscardAmendment\", \"EntityTime\", \"AggregatingComponent\", \"PricingComponentMigrationValue\", \"MetadataKeyValue\", \"Metadata\", \"AggregationLink\", \"BFPermission\", \"Role\", \"PermissionLink\", \"PayVisionTransaction\", \"KashToken\", \"DataSynchronizationJob\", \"DataSynchronizationJobError\", \"DataSynchronizationConfiguration\", \"DataSynchronizationAppConfiguration\", \"AggregationChildrenResponse\", \"InvoiceLinePayment\", \"EmailSubscription\", \"EmailProvider\", \"TimeResponse\", \"Email\", \"RevenueAttribution\", \"Unknown\"])\n return false unless domain_validator.valid?(@domain)\n return false if @action.nil?\n action_validator = EnumAttributeValidator.new('String', [\"Accept\", \"Active\", \"AwaitingPayment\", \"AwaitingRefund\", \"Cancelled\", \"Completed\", \"Created\", \"Error\", \"Expiring\", \"Expired\", \"Failed\", \"Migrated\", \"NeedsAmendments\", \"Paid\", \"Pending\", \"Provisioned\", \"Refunded\", \"Reject\", \"Trial\", \"Unknown\", \"Unpaid\", \"Updated\", \"Voided\", \"PaymentFailed\"])\n return false unless action_validator.valid?(@action)\n return false if @organization_id.nil?\n return false if @webhook_id.nil?\n return false if @entity_id.nil?\n return false if @destination_url.nil?\n return false if @format.nil?\n format_validator = EnumAttributeValidator.new('String', [\"JSON\", \"XML\"])\n return false unless format_validator.valid?(@format)\n return false if @ack_enabled.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"Unsent\", \"Sending\", \"Sent\"])\n return false unless state_validator.valid?(@state)\n return true\n end", "def permitted?; end", "def validate\r\n @invalid=false\r\n end", "def accept_mapped_claims\n return @accept_mapped_claims\n end", "def is_valid?\n end", "def validate_lock_customer_account\n\n end" ]
[ "0.71906656", "0.71906656", "0.67872167", "0.678302", "0.6727849", "0.66497064", "0.66497064", "0.6582732", "0.64907634", "0.64907634", "0.6486719", "0.6414438", "0.6414438", "0.6414438", "0.6414438", "0.6383493", "0.6361794", "0.6361794", "0.6361794", "0.63228613", "0.6306474", "0.6303508", "0.6282382", "0.6271599", "0.6237117", "0.62177247", "0.6208915", "0.620418", "0.61875147", "0.61856467", "0.61600715", "0.61600715", "0.61600715", "0.61565167", "0.6144972", "0.61352706", "0.6131791", "0.6131791", "0.6131791", "0.60811925", "0.60811687", "0.60623246", "0.60542846", "0.6026302", "0.59603757", "0.5950535", "0.5937192", "0.5928102", "0.5928102", "0.5906085", "0.5906085", "0.5905387", "0.58982897", "0.58857137", "0.5879602", "0.5875616", "0.5874605", "0.5865196", "0.5862487", "0.5861264", "0.586062", "0.5852557", "0.5852557", "0.58486116", "0.584759", "0.58421427", "0.5834997", "0.58063936", "0.5803727", "0.5794053", "0.57782114", "0.57782114", "0.57760286", "0.5774687", "0.5774687", "0.5762845", "0.5760335", "0.5747228", "0.5742143", "0.5742143", "0.5742143", "0.5742143", "0.5742143", "0.5741422", "0.5736866", "0.5736866", "0.5728598", "0.5728163", "0.5727115", "0.57260215", "0.57247883", "0.57224613", "0.5720337", "0.57169443", "0.5715554", "0.57151043", "0.5710884", "0.570937", "0.5701013", "0.5693636" ]
0.6020186
44
=> Email => Sends email to app/site owner
def send_email true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def funded_email_to_creator\n Pony.mail(:to => self.email, :from => 'admin@kittypool.com', :subject => 'the gift you created is now funded!', :body => 'yay! some people owe you money.')\n end", "def send_mail\n User.send_welcome_email(self.id)\n end", "def welcome_email(user)\n @user=user\n @url = \"http://strong-flower-5407.heroku.com/\"\n mail(:to => user.person.email, :subject => \"Welcome to my Scripting Application\")\n end", "def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end", "def send_to_user(email)\n @email = email\n mail(:to => email.user_email, :subject => 'Your email has been sent!')\n end", "def email\n end", "def welcome_email\n \t@user = params[:user]\n \t@url = 'https://recipeapp-mysticflower.herokuapp.com'\n \tmail(to: @user.email, subject: 'Welcome to My Awesome Site')\n \tend", "def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end", "def alert_email(user)\n @user = user\n mail( :to => 'amalaquina@kreitech.io',\n :subject => 'You have a request from: '+ @user.email )\n end", "def newcompany_email(company)\n @company = company\n @message = t('mailers.company.created')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n \n end", "def email; end", "def email; end", "def email; end", "def email; end", "def purchase_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end", "def food_mail(email)\n\n @url = 'http://foodcircles.net/?app=mobile_email'\n mail(:to => email, :reply_to => 'jk@joinfoodcircles.org', :subject => \"Your appetite is powerful.\")\n end", "def send_mail(email)\n mail to: email, subject: 'Welcome', body: 'body message'\n \n end", "def send_welcome_email(user)\n mail to: user.email, subject: \"Sign Up Confirmation - Welcome to NetworkMill\"\n Email.create(:user_id => user.id, :sent_to => user.email, :title => \"welcome_email\")\n end", "def send_email(email)\n email.deliver_now\n end", "def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end", "def approve\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "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", "def email\n options = { :from => params[:email], :to => \"support@telaeris.com\", :subject => params[:subject], :body => \"From: #{params[:user]} <#{params[:email]}>\\r\\nCategory: #{params[:category]}\\r\\nSubject:#{params[:subject]}\\r\\n\\r\\n#{params[:body]}\"}\n RequestMailer.deliver_generic(options)\n flash[:notice] = \"Your email was sent successfully\"\n redirect_to params[:redirect]\n end", "def email_cory(user)\n @user_info = user_info\n mail to: \"rachavez1974@gmail.com\"\n end", "def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end", "def send_signup_email\n mail( :to => 'davidbliu@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' ).deliver\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def setup_email(user)\n recipients user.email\n from self.contact_email\n sent_on Time.now\n end", "def send_email\n g = GmailSender.new(USER_NAME, PASSWORD)\n\n g.send(:to => to,\n :subject => @subject,\n :content => full_content)\n end", "def welcome_email(params)\n @user = params\n mail(to: @user.email,subject:\"Bienvenido a Mone Apps\")\n end", "def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end", "def email(id)\n\t\t@user = User.find(id)\t\n\t\t\tmail(\n\t\t :subject => 'Important information from Relationally.net' ,\n\t\t :to => @user.email , \n\t\t :track_opens => 'true'\n\t\t\t)\n\tend", "def send_signup_email(admin)\n @admin = admin\n mail( :to => @admin.email,:subject => 'Thanks for signing up ,you are welcome' )\n end", "def email(options)\n puts \"sending to #{options}\"\n Pony.mail(BASE_EMAIL.merge(options))\n end", "def send_by_email\n AccountMailer.send_by_email(@account, APP_CONFIG['password_to']).deliver\n respond_to do |format|\n format.html { redirect_to(@account,\n :notice => \"Successfully sent email to #{APP_CONFIG['password_to']}\") }\n end\n end", "def admin_order_inform\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def food_mail(email)\n\n @url = 'http://foodcircles.net/?app=mobile_email'\n mail(:to => email, :reply_to => 'jk@joinfoodcircles.org', :subject => \"Your hunger is powerful.\")\n end", "def post_email(to_email, user)\n \tif user.name && user.full_name\n \t\ttext = \"#{user.full_name} (#{user.name}) posted to #{user.provider.capitalize} using Coupon Sociable!\"\n \telse\n \t\ttext = \"#{user.full_name} posted to #{user.provider.capitalize} using Coupon Sociable!\"\n \tend\n \t\n mail( :to => to_email, \n :subject => text,\n :body => text)\n end", "def restaurant_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def test_email\n @brother.post_notification(\n \"Email testing. \",\n \"This email serves solely to ascertain that ADP Dashboard emails can reach your email address. \",\n root_url\n )\n\n redirect_to root_url, flash: { notice: \"Test email sent to #{@brother.email}. \" }\n end", "def send_thx_email\n @user = User.where(:uid => self.uid).first\n if !@user.nil? && !@user.email.nil?\n Services::Mandrill.mail(@user.email, 'PicsforPets_2013_Reportback', 'How to get puppies adopted')\n end\n end", "def thanks_email( user_email )\n @greeting = \"Thanks for contacting us!\"\n\n mail to: user_email\n end", "def welcome_email email_address\n @greeting = \"Hi\"\n @user_name = UserInfo.last.user\n\n mail to: email_address\n end", "def send_email_to_master\n\n\tend", "def contact_email\n \"webmaster@#{server_host}\"\n end", "def sendmail(object)\n email\n end", "def invitation_mail(email, sender)\n @email = email\n @sender = sender\n mail to: @email, subject: \"Invitation maill from Git-Api\"\n end", "def send_email(to, subject, content)\r\n\r\n end", "def second_round_email(email)\n @greeting = \"Hi\"\n\n mail to: email, subject: \"Your ASES Application Decision\"\n end", "def profile_email(user)\n @user = user\n @url = 'http://localhost:3000'\n mail(to: @user.email, subject: 'Welcome to CloudTrendz')\n end", "def mail; end", "def contact_owner(user)\n @user = user\n mail(to: 'christiansalas96@gmail.com', subject: 'Contact Us Form | Someone Reached Out!')\n end", "def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end", "def accepted_application_moderator(vacancy, user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def signup_email(user)\n mail( :to => user.email, :subject => \"Thanks for signing up for Sublets at Penn!\" )\n end", "def send_signup_email(user)\n @user = user\n mail( :to => @user.email ,\n :subject => '[Todo Manager] Welcome!' )\n end", "def weekly_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email\n return true unless RunLevel.is_normal?\n\n log_msg = \"SEND #{flavor} \" \\\n \"from=#{user&.login || \"nil\"} \" \\\n \"to=#{to_user&.login || \"nil\"} \" +\n queued_email_integers.map { |x|\n \"#{x.key}=#{x.value}\"\n }.join(\" \") +\n queued_email_strings.map do |x|\n \"#{x.key}=\\\"#{x.value}\\\"\"\n end.join(\" \")\n self.class.debug_log(log_msg)\n current_locale = I18n.locale\n result = false\n if user.present? && user == to_user\n unless Rails.env.test?\n raise(\"Skipping email with same sender and recipient: #{user.email}\\n\")\n end\n else\n result = deliver_email\n end\n I18n.locale = current_locale\n result\n rescue StandardError => e\n warn(\"ERROR CREATING EMAIL\")\n warn(log_msg)\n warn(e)\n warn(e.backtrace)\n I18n.locale = current_locale\n false\n end", "def product_email\n UserMailer.product_email\n end", "def signup_email(user)\n mail( :to => user.email, :subject => \"Thanks for signing up!\" )\n end", "def contact_email\n UserMailer.contact_email\n end", "def article_email\n UserMailer.article_email\n end", "def send_reminder_email \n UserMailer.reminder_email(self).deliver\n end", "def signup_email(user)\n @user = user\n mail(to: @user.email, subject: 'Thanks for signing up for our amazing app')\n end", "def add_to_team(email)\n @greeting = \"Hi\"\n mail(:to => email, :subject => \"Register to Persona website !\")\n end", "def welcome_email\n # User welcome email sent.\n end", "def new_application_email(bid)\n @bid = bid\n @task = bid.task\n mail to: @task.user.email, subject: \"New application\"\n end", "def rails_send_email(action)\n email = rails_create_email(action)\n email.public_send(rails_mailer_deliver_method)\n end", "def mail_sent_to_admin(user)\n subject \"4D Techlab - New user\"\n from \"4d Techlab Notifier <noreply@4dtechlab.com>\"\n headers \"Reply-to\" => \"info@4dtechlab.com\"\n recipients 'pavel.krusek@gmail.com'\n sent_on Time.now\n #content_type = \"text/plain\"\n body :user_url => user_url(user)\n end", "def signup_email(user)\n mail( :to => user.email, :subject => \"Thanks for signing up\" )\n end", "def send_approve_email\n 'send_approve_email'\n end", "def product_back_in_inventory\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def welcome_email(user, currenthost)\n\t @user = user\n\t @currenthost = currenthost\n\n\t mail(to: @user.email, subject: 'Welcome to Changefindr').deliver()\n\tend", "def do_email\n @manifest = Manifest.find(params[:id])\n @email = params[:email]\n \n Notifier.manifest(@email, @manifest).deliver\n \n flash[:notice] = \"El documento ha sido enviado con exito .\"\n redirect_to \"/manifests/#{@manifest.id}\"\n end", "def send_email\n InquiryMailer.inquiry_created_email(self).deliver\n end", "def send_signup_email(user)\n @user = user\n mail( :to => 'ajitkumarjain123@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' )\n end", "def send_mail(user)\n @greeting = \"Hi #{user.name}\"\n\n mail to: user.email\n end", "def send_to_alum(email)\n @email = email\n mail(:from => email.user_email, :to => email.alum_email, :subject => email.subject)\n end", "def send_farewell_email(user)\n @user = user\n mail( :to => @user.email ,\n :subject => '[Todo Manager] See you again!')\n end", "def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def signup_email\n @greeting = \"Hi\"\n\n mail to: @user.email, subject: \"Welcome to CheeseBae! Please confim your email!\"\n end", "def send_email_alert(sender_email, sender_pass, recipients, subject, body)\n log \"Sending e-mail alert.\"\n recipients.each do |r|\n Pony.mail(:to => r, :via => :smtp, :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => sender_email,\n :password => sender_pass,\n :authentication => :plain,\n :domain => \"HELO\",\n }, :subject => subject, :body => body)\n end\nend", "def send_signup_email(user)\n @user = user\n mail(:from => self.moovi_email, :to => @user.email,:subject => 'Thanks for signing up to Moovi' )\n end", "def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end", "def important_message\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_signup_email(email)\n mail( :to =>email,\n :subject => 'Room Booked')\n end", "def send_email(user)\n\t UserMailer.activate_email(user).deliver\n\tend", "def send_create_user_email(email, token)\n @token = token\n mail( :to => email,\n :subject => 'Your have been invited to WatchIoT!!')\n end", "def do_email\n @delivery = Delivery.find(params[:id])\n @email = params[:email]\n \n Notifier.delivery(@email, @delivery).deliver\n \n flash[:notice] = \"The delivery has been sent successfully.\"\n redirect_to \"/deliveries/#{@delivery.id}\"\n end", "def admin_email\n ContactMailer.admin_email\n end", "def signup_email(user)\n mail( :to => user.email,\n :subject => 'Thanks for signing up' )\n end", "def webmaster_summary\n set_logo\n @greeting = \"Hi, webmaster_summary\"\n\n mail to: ENV.fetch(\"TOUCHPOINTS_ADMIN_EMAILS\").split(\",\")\n end", "def welcome_email(user)\n @user = user\n @url = 'http://example.com/login' #\n mail(to: @user.email, subject: 'Welcome to My Awesome Site') #gets user email address and supplies a generic subject line\n end", "def first_round_email(email)\n @greeting = \"Hi\"\n\n mail to: email, subject: \"Your ASES Application Decision\"\n end", "def welcome_email\n # NewsletterMailer.welcome_email.deliver\n mail(:to => \"rajakuraemas@gmail.com\", :subject => \"Welcome to My Awesome Site\")\n end", "def reminder(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def email\n\n email = email_params\n ContactMailer.status_email(email[:email], email[:subject], email[:body]).deliver\n render nothing: true, status: 200\n\n # put logic for sending an email\n # TODO: send the email here.\n end" ]
[ "0.7429076", "0.7288798", "0.72651213", "0.72341835", "0.72322494", "0.7224285", "0.7212948", "0.72100276", "0.720717", "0.71550566", "0.7152755", "0.7149911", "0.7149911", "0.7149911", "0.7149911", "0.71330243", "0.71141946", "0.710926", "0.71062505", "0.7102102", "0.70955014", "0.7086209", "0.7081436", "0.7066058", "0.7054566", "0.7048017", "0.704316", "0.7026911", "0.7025798", "0.7018229", "0.70086926", "0.7006146", "0.7005614", "0.7003814", "0.7003184", "0.69959605", "0.69946647", "0.69880307", "0.69829416", "0.6980176", "0.69767374", "0.69755596", "0.69748306", "0.6974015", "0.697249", "0.69711876", "0.69679046", "0.69677377", "0.6966409", "0.69611883", "0.6956612", "0.6950627", "0.6950591", "0.6944109", "0.693659", "0.69258344", "0.6922226", "0.6916245", "0.69159687", "0.69039637", "0.69037485", "0.68992317", "0.68988764", "0.6890255", "0.68901324", "0.6886546", "0.6884822", "0.68839806", "0.68804437", "0.687756", "0.68753517", "0.6874901", "0.68717635", "0.68679804", "0.68648624", "0.6862099", "0.68600166", "0.68495315", "0.6847816", "0.6846051", "0.684389", "0.68414474", "0.68411815", "0.68385065", "0.68365306", "0.68340373", "0.6833539", "0.68325174", "0.683109", "0.68304", "0.6828995", "0.6826959", "0.6825616", "0.68251485", "0.6823764", "0.6822686", "0.68212306", "0.6818162", "0.6817443", "0.6816867" ]
0.71954095
9
=> Hubspot destroy => This needs to be implemented into admin area => Destroys hubspot listings from hubspot_id
def hubspot_destroy true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @listing.destroy\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.mark_destroyed(current_admin)\n\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @connector = Connector.find(params[:id])\n @connector.destroy unless @connector.nil?\n\n respond_to do |format|\n format.html { render 'status/index'}\n format.json { render nothing: true }\n end\n\n push_app_status\n\n end", "def destroy\n @spot_listing = SpotListing.find(params[:id])\n @spot_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to spot_listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n if current_user.admin == true\n @spot.destroy\n end\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :ok }\n end\n end", "def destroy\n current_site.grid_templates.find(params[:id]).destroy\n index\n end", "def destroy\n @wellist.destroy\n\n head :no_content\n end", "def destroy\n @listing.destroy\n redirect_to \"/listings\"\n end", "def delete\n api_delete(\"/listings/#{@listing_id}\")\n end", "def destroy\n #admin only\n return redirect_to static_pages_adminonlyerror_path if !current_user.is_admin \n @blessing = Blessing.find(params[:id])\n @blessing.destroy\n\n respond_to do |format|\n format.html { redirect_to blessings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spice.destroy\n\n head :no_content\n end", "def destroy\n @thing_list = ThingList.find(params[:id])\n @thing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def destroy\n @hub.destroy\n\n respond_to do |format|\n format.html { redirect_to hubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @microspot.destroy\n respond_to do |format|\n format.html { redirect_to microspots_url, notice: 'Microspot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to(highscore_brands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @custom_definition.destroy\n redirect_to @site\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; end", "def destroy; delete end", "def destroy\n @tech_listing.destroy\n respond_to do |format|\n format.html { redirect_to tech_listings_url, notice: 'Tech listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n end", "def destroy\n \n end", "def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hub=Hub.find(@warehouse.hub_id)\n @warehouse.destroy\n respond_to do |format|\n format.html { redirect_to hub_path(@hub), notice: 'Store location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @limits_elongation.destroy\n respond_to do |format|\n format.html { redirect_to limits_elongations_url, notice: 'Limits elongation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:listing_id])\n # need to delete on current user for security\r\n current_user.read_listings.delete(@listing)\r\n \n respond_to do |format|\r\n format.xml { head :ok }\n end\n end", "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n @sighting.destroy\n head :no_content\n end", "def destroy\n @shout_list.destroy\n respond_to do |format|\n format.html { redirect_to shout_lists_url, notice: 'Shout list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lb_pool = @object\n @lb_pool.destroy\n\n respond_to do |format|\n format.html { redirect_to lb_pools_url }\n format.xml { head :ok }\n end\n end", "def destroy!; end", "def destroy\r\n end", "def destroy\r\n end", "def destroy\n @bottling.destroy\n respond_to do |format|\n format.html { redirect_to admin_bottlings_url, notice: 'Bottling was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listings_poll.destroy\n respond_to do |format|\n format.html { redirect_to listings_polls_url, notice: 'Listings poll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place_visit.destroy\n\n head :no_content\n end", "def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @room_tenant_link.destroy\n respond_to do |format|\n format.html { redirect_to room_tenant_links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heatspot = Heatspot.find(params[:id])\n @heatspot.destroy\n \n redirect_to @heatmap\n end", "def destroy\n #delete venues trought users controller\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to(spots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to(spots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if @artist.artist_brands.size <= 1\n @artist.destroy\n else\n @artist.artist_brands.each do |ab|\n ab.destroy if ab.brand == website.brand\n end\n end\n respond_to do |format|\n format.html { redirect_to(admin_artists_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted artist: #{@artist.name}\")\n end", "def destroy\n @business_listing.destroy\n respond_to do |format|\n format.html { redirect_to business_listings_url, notice: 'Business listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @brand.destroy\n respond_to do |format|\n format.html { redirect_to(admin_brands_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted brand: #{@brand.name}\")\n end", "def destroy\n @list_item.destroy\n\n head :no_content\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n end", "def destroy\n @task_list.destroy\n\n head :no_content\n end", "def destroy\r\n end", "def del_brief_vendor\n brief = Brief.find(params[:brief_id])\n brief_can_read?(brief,@cur_user)\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n brief_vendor.destroy\n redirect_to(cheil_show_brief_url(params[:brief_id])) \n end", "def destroy\n @slisting.destroy\n respond_to do |format|\n format.html { redirect_to slistings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_features_brand.destroy\n respond_to do |format|\n format.html { redirect_to admin_features_brands_url, notice: 'Features brand was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blacklisted_site = BlacklistedSite.find(params[:id])\n @blacklisted_site.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_blacklisted_sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n end", "def destroy\n\n end", "def destroy\n @leaf_spot_imm_search.destroy\n respond_to do |format|\n format.html { redirect_to leaf_spot_imm_searches_url, notice: 'Leaf spot imm search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing.destroy\n redirect_to listings_url, notice: 'Listing was successfully deleted.'\n end", "def destroy\n\n @title = \"land use mapping\"\n\n @ss = SamplingSite.find(:first, :conditions => [ \"land_use_mappings_id = ?\", params[:id]])\n if !@ss.nil?\n flash[:error] = \"This entry cannot be deleted until used by another entries in the system...\"\n redirect_to :action => \"index\"\n return\n end\n\n @land_use_mapping = LandUseMapping.find(params[:id])\n @land_use_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to(land_use_mappings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @thng = Thng.find(params[:id])\n # @thng = Usr.find_by_opndd(session[:opndd]).thngs.find(params[:id])\n # @thng.destroy unless @thng.nil?\n flash[:notice] = \"In this site, a Thing cannot be removed.\"\n\n respond_to do |format|\n format.html { redirect_to(thngs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @brand = Brand.find(params[:id])\n @brand.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_brands_url }\n end\n end", "def destroy\n @railway_station.destroy\n respond_to do |format|\n format.html { redirect_to admin_railway_stations_path, notice: I18n.t('notices.railway_station_deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.is_not_staff?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @location_history = LocationHistory.find(params[:id])\n @location_history.destroy\n\tfor i in Bike.where(:location_id =>params[:id] )\n\t\ti.location_id = 1\n\tend\n\t\n respond_to do |format|\n format.html { redirect_to location_histories_url }\n format.json { head :ok }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bolog_list.destroy\n respond_to do |format|\n format.html { redirect_to bolog_lists_url, notice: 'Bolog list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # gets the todo items listing params :id\n @listing = Listing.find(params[:id])\n # destroys the current listing\n @listing.destroy\n \n # redirects you back to the (root) index page\n redirect_to listings_path\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end", "def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to(subways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @special_device_list.destroy\n respond_to do |format|\n format.html { redirect_to special_device_lists_url, notice: 'Special device list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @parking_spot = ParkingSpot.find(params[:id])\n @parking_spot.destroy\n\n respond_to do |format|\n format.html { redirect_to parking_spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n HardInfo.where(c_office: @use_case.c_office, use_case_no: @use_case.use_case_no, product_name: @use_case.product_name).destroy_all\n @use_case.destroy\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n\r\n end", "def destroy\n @brandlist = Brandlist.find(params[:id])\n @brandlist.destroy\n\n respond_to do |format|\n format.html { redirect_to brandlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to(listings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @email_listing = EmailListing.find(params[:id])\n @email_listing.destroy\n\n respond_to do |format|\n format.html { redirect_to email_listings_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6813851", "0.68113875", "0.67996943", "0.679222", "0.667996", "0.66640145", "0.66510624", "0.66404974", "0.6636274", "0.6620512", "0.6615548", "0.6593372", "0.65720886", "0.65698195", "0.6564775", "0.65605927", "0.6536889", "0.652333", "0.65203154", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.6495557", "0.648792", "0.64796275", "0.6468346", "0.6468346", "0.64537466", "0.6453616", "0.64398664", "0.64318556", "0.64146334", "0.64084", "0.6406184", "0.6403597", "0.63962066", "0.6392068", "0.6392068", "0.63895065", "0.63886935", "0.6387545", "0.6380734", "0.6377529", "0.63727546", "0.6371904", "0.63701403", "0.6362752", "0.6362658", "0.63613355", "0.63599694", "0.6355557", "0.6352857", "0.63519937", "0.63519937", "0.63519937", "0.63519937", "0.63519937", "0.6349788", "0.634459", "0.63429475", "0.6338027", "0.6337243", "0.63369566", "0.6335756", "0.63349015", "0.63349015", "0.63339496", "0.6321095", "0.6316758", "0.6314078", "0.63109094", "0.6306331", "0.63055754", "0.63050205", "0.6304742", "0.63018745", "0.6298377", "0.6296483", "0.62923306", "0.6291344", "0.6290808", "0.6289595", "0.6289595", "0.6289595", "0.6289595", "0.6289595", "0.6289458", "0.6285526", "0.62835217", "0.6281325", "0.62793183", "0.62793183", "0.62793183", "0.6278865" ]
0.75243163
0
Use callbacks to share common setup or constraints between actions.
def set_socioeduk_alojamento_jovem @socioeduk_alojamento_jovem = Socioeduk::AlojamentoJovem.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def socioeduk_alojamento_jovem_params params.require(:socioeduk_alojamento_jovem).permit(:socioeduk_jovem_id, :unidade_socioeducativa_id, :socioeduk_bloco_id, :socioeduk_quarto_id, :tamanho_roupa, :tamanho_cacaldo, :numero_kit, :justifica, :utilizar_exedente_vaga) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
PASSES (was checking number_to_currency type function)
def teardown @course = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend", "def disallow_currency_conversion!; end", "def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend", "def convert_to_euros(dollars)\n if dollars.is_a?(Numeric)\n dollars * 0.95\n end\nend", "def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end", "def is_currency?\n self =~ /\\A[+-]?[0-9]{1,3}(?:[0-9]*(?:[.,][0-9]{2})?|(?:,[0-9]{3})*(?:\\.[0-9]{2})?|(?:\\.[0-9]{3})*(?:,[0-9]{2})?)\\z/i\n end", "def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end", "def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend", "def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend", "def convert(dollars, currency)\n yield(dollars, currency) if dollars.is_a?(Numeric)\nend", "def convertToNum(price)\n \treturn Float(price.gsub(/\\s+/, \"\").gsub(\"USD \",\"\"))\n end", "def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end", "def convert_to_numeric(val)\n return BigDecimal(val, Float::DIG) if val.is_a?(Float)\n return val if val.is_a?(Numeric)\n # Eliminate any commas, $'s (or other currency symbol), or _'s.\n cursym = Regexp.quote(FatTable.currency_symbol)\n clean_re = /[,_#{cursym}]/\n val = val.to_s.clean.gsub(clean_re, '')\n return nil if val.blank?\n case val\n when /(\\A[-+]?\\d+\\.\\d*\\z)|(\\A[-+]?\\d*\\.\\d+\\z)/\n BigDecimal(val.to_s.clean)\n when /\\A[-+]?[\\d]+\\z/\n val.to_i\n when %r{\\A([-+]?\\d+)\\s*[:/]\\s*([-+]?\\d+)\\z}\n Rational($1, $2)\n end\n end", "def money_to_currency(money)\n if money && numeric?(money)\n #number_to_currency(money.to_d, unit: money.currency.symbol)\n number_to_currency(money.to_d, unit: current_tenant.default_currency.symbol)\n else\n number_to_currency(Monetize.parse(\"0\"))\n end\n end", "def currency\n number_to_currency(self)\n end", "def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend", "def to_currency(num)\n format(\"$%.2f\",num)\nend", "def convert_number(number)\n return 0 if number.nil?\n return number if number.is_a?(BigDecimal)\n\n number = number.gsub(\".\", \"\").gsub(\",\", \".\") unless number.is_a?(Numeric)\n number.to_d\n end", "def to_currency(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n o = \"00.#{o}\" if ( (o.length) == 1 )\n o = \"0.#{o}\" if ( (o.length) == 2 )\n\n result_string = o\n result_string = \"#{ko}...#{result_string}\" if ( ko != 0 )\n result_string = \"#{mo}...#{result_string}\" if ( mo != 0 )\n result_string = \"#{go}...#{result_string}\" if ( go != 0 )\n\n result_string = @currency.result_strin\n return(result_string)\n end", "def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end", "def to_currency_z(val, currency=:usd)\n if currency == :usd\n ApplicationController.helpers.number_with_precision(val,\n precision: 2, separator: '.')\n else\n val\n end\n end", "def checkCurrency(string_variable)\n # returns string_variable as a float\n # else returns false and error msg if string_variable can't be a number or a valid dollar amount \n \n if checkNum?(string_variable) == false\n return false\n end\n \n # check for max 2 places past decimal point\n decimalIndex = string_variable.index('.')\n if decimalIndex != nil\n if string_variable.length - decimalIndex > 3\n puts \"\\t#{string_variable} is NOT a valid dollar amount\"\n return false\n end\n end\n \n float_variable = string_variable.to_f\n if float_variable >= 0\n return float_variable\n else\n return false\n end\n end", "def number_euro number\n\t\tnumber_to_currency(number, locale: :ie)\n\tend", "def euros price\n price ? number_to_currency(price , :precision => 2 , :unit => \"€\") : 0.0\n end", "def amount_to_currency(number)\n number_to_currency(number.to_f, { unit: '£' })\n end", "def currency(number)\n currency = number.abs.round(2)\n\n # Check number of digits after decimal point and add 0 if necessary\n\n decimal_check = currency.to_s.slice(-2)\n if decimal_check.start_with?('.')\n currency.to_s + '0'\n else\n currency\n end\n end", "def validate_currency_format\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_one)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_two)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_three)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_four)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_five)\n raise 'Total is not in currency format' unless ValuesLib.check_currency_format(total_values)\n end", "def test_should_multiply_by_a_Fixnum_or_Float\n currency1 = Currency.new(\"USD\", 4.0)\n\n assert_equal Currency.new(\"USD\", 12.0), currency1 * 3\n end", "def currency; end", "def currency; end", "def number_to_currency(amount)\n super(amount, unit: \"₹\")\n end", "def convert_to(exchange_currency)\n begin\n exchange_currency = Money::InputSanitizer.sanitize_currency(exchange_currency,Money::CrossRate.get_all_available_currencies)\n Money::LiveConverter.new(@amount.to_f*Money::CrossRate.get_cross_value_for_currency(@currency,exchange_currency),exchange_currency)\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end", "def to_currency(amount)\n number_to_currency amount, :precision => 0\n end", "def currency_conversions(price = 0.0)\n convert_dollars = price * EXCHANGE_DOLLARS\n convert_euros = price * EXCHANGE_EUROS\n return convert_dollars, convert_euros\nend", "def test_converter_returns_error_for_unknown_currency\n assert_raises(UnknownCurrencyCodeError){Currency_Converter.new({'USD' => 1.00, 'JPY' => 120.0}).convert( Currency.new('JPY', 120.0), 'ALL' )}\n end", "def currency_to_locale number\n if params[:locale] == 'es'\n number = number*1.3\n end\n number_to_currency number\n end", "def test_basic_conversions\n assert_equal 1.292, 1.euro\n assert_equal 0.019, 1.rupee\n assert_equal 0.013, 1.yen\n assert_equal 1, 1.dollar\n end", "def number_type b\n if b.include?(\".\")\n return b.to_f.round(2)\n else\n return b.to_i\n end\nend", "def currency_as_string; end", "def ot_currency_code\n end", "def parse_currency(currency)\n BigDecimal.new(currency.gsub(/[^0-9.-]/, ''))\n end", "def detect_currency value\n case value.to_s.strip\n when /\\$|USD|dollar[s]?|бакс[а-я]{0,2}|доллар[а-я]{0,2}|грин[а-я]?/i\n :USD\n when /€|EUR[a-z]{0,2}|евро/i\n :EUR\n when /₽|RUB{0,4}|руб[a-zа-я]{0,4}|деревян[a-zа-я]{0,3}/i\n :RUB\n when /CAD/i\n :CAD\n else\n :not_expected\n end\nend", "def convert(euros, exchange_rate)\n euros * (exchange_rate / 100)\nend", "def coerce_money(v)\n SpookAndPuff::Money.new(v.to_s)\n end", "def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end", "def check_number( num )\n if num.to_f != 0 || [\"0\", \"0.0\"].include?(num)\n is_float = false\n if num.include? \".\"\n is_float = true\n end\n if is_float\n as_number = num.to_f\n else\n as_number = num.to_i\n end\n return {number_ok: true, as_number: as_number}\n else\n return {number_ok: false}\n end\nend", "def test_Currency_003_Format_From_Amount\n\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_003_Format_From_Amount\")\n puts2(\"#######################\")\n\n begin # convert_StringFromCurrency\n\n\n ############################\n sThisTaskName = \"$1,000 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000\".format_from_currency(\"$\", \",\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.00 to 1000000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.00\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1.000.50 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1.000.50\".format_from_currency(\"�\", \".\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1.000.5 to 1000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.000.5\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.50 to $1000000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.50\".format_from_currency( \"\", \",\",true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1,000,000.5 to 1000000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1,000,000.5\".format_from_currency(\"�\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"0.5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"0.5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1. to 1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$. to 0.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"Error and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"error\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_003_Format_From_Amount\")\n\n ensure\n\n end # convert_StringFromCurrency\n\n end", "def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend", "def currency(input)\n\t(/\\$?[+-]?[0-9]{1,3}((\\,)?[0-9]{3})*(\\.[0-9]{2})?/i =~ input)? \"true\" : \"false\"\nend", "def valid_dollar_amt?(num)\n num.to_f.positive? && (valid_int?(num) || dollar_format?(num))\nend", "def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end", "def number_to_currency(number, currency)\n case currency\n when 'GBP'\n symbol = '£'\n when 'EUR'\n symbol = '€'\n else\n symbol = '$'\n end\n \"#{symbol}#{\"%0.2f\" % (number.to_f / 100)}\"\n end", "def number_type a\n if a.include?(\".\")\n return a.to_f.round(2)\n else\n return a.to_i\n end\nend", "def convert_to(to_currency)\n Money.new(self.amount * exchange_rate(to_currency), to_currency)\n end", "def convert_to_currency(target_currency, date = Date.today)\n return moneys.inject(Money.zero(target_currency)) do |sum, (_, money)|\n sum + money.convert_to_currency(target_currency, date)\n end\n end", "def convert hash\n currency = detect_currency hash[:currency]\n return nil if currency == :not_expected\n\n amount = (hash[:amount]).delete(' _').sub(',', '.').to_f\n usdrub_rate = (usd_base_json['rates']['RUB']).to_f\n usdeur_rate = (usd_base_json['rates']['EUR']).to_f\n usdcad_rate = (usd_base_json['rates']['CAD']).to_f\n\n rate = usdrub_rate\n rate = usdrub_rate / usdeur_rate if currency == :EUR\n rate = usdrub_rate / usdcad_rate if currency == :CAD\n\n change_currency = currency != :RUB ? :RUB : :USD\n result = change_currency == :RUB ? (amount * rate) : (amount / rate)\n\n \"#{space_in result.round(2)} #{change_currency}\"\nend", "def number_to_currency(number, options = {})\n options = options.stringify_keys\n precision = options[\"precision\"] || 2\n unit = options[\"unit\"] || \"$\"\n separator = precision > 0 ? options[\"separator\"] || \".\" : \"\"\n delimiter = options[\"delimiter\"] || \",\"\n begin\n parts = number_with_precision(number, precision).split('.')\n unit + number_with_delimiter(parts[0], delimiter) + separator + parts[1].to_s\n rescue\n number\n end\n end", "def test_Currency_002_Format_To_Amount\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_002_Format_To_Amount\")\n puts2(\"#######################\")\n\n begin # convert_ToCurrency\n\n ############################\n sThisTaskName = \"1000 to $1,000.00\"\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \" 1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \" 1000 \".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000.5 to $1,000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000.5\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1.1 to $1.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1 to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n\n ############################\n sThisTaskName = \".01 to $0.01\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".01\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".1 to $0.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1. to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to 1,000,000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"\", \",\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to �1.000.000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"�\", \".\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.999 to �1:000:000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.999\".format_to_currency(\"�\", \":\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"*** ERROR and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"ERROR\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_002_Format_To_Amount\")\n\n ensure\n\n end # convert_StringToCurrency\n\n\n end", "def price_in_usd\n case @currency\n when :inr\n @price_per_share.to_i * 50\n when :gbp\n @price_per_share.to_i * 2\n else\n @price_per_share.to_i\n end\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def convert number\n raise_on_type_mismatch number\n typed_conversion number\n end", "def currency_converter amount, location\n case location\n when 'US' then \"$%.2f\" % amount\n when 'Japan' then \"$%.0f\" % amount\n when 'UK' then (\"$%.2f\" % amount).gsub('.', ',')\n end\nend", "def convert_to(target_currency)\n make_call(currencies(target_currency))\n end", "def dollars\n to_f\n end", "def dollars\n to_f\n end", "def dollars\n to_f\n end", "def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end", "def currency_should_be_in_supported\n self.errors.add(:currency, 'exchange rate can not be found and is not supported') if self.currency.present? && !Currency.exists?(:iso_code => self.currency)\n end", "def dollars; end", "def price(_currency)\n raise Sibit::NotSupportedError, 'price() doesn\\'t work here'\n end", "def getCurrencyValue(entry)\r\n\r\n # if entry is formatted as currency\r\n if isEntryCurrency?(entry)\r\n\r\n # ignore the initial $\r\n entry = entry[1..]\r\n\r\n # get rid of commas\r\n entry.gsub!(/,/, \"\")\r\n\r\n # convert to a number and return. We will convert everything to \r\n # a float for simplicity\r\n return entry.to_f()\r\n\r\n # if it is not formatted as currency, returns nil as an error value\r\n else\r\n return nil \r\n end\r\n end", "def as_ca_dollar\n exchange_to(\"CAD\")\n end", "def as_ca_dollar\n exchange_to(\"CAD\")\n end", "def as_ca_dollar\n exchange_to(\"CAD\")\n end", "def as_ca_dollar\n exchange_to(\"CAD\")\n end", "def get_price_of_bitcoin\n data = get_data_from_website(BLOCKCHAIN_WEBSITE)\n price = get_price_in_usd(data)\n # This converts the string to a floating point number\n # Another conversion instruction is to_i (integer)\n price.to_f\nend", "def convert_to(to_currency)\n\t\tfrom_currency = self.currency\n\t\trate = Money.getRate(from_currency, to_currency)\n\n\t\tconverted_amount = self.amount * rate\n\n\t\tMoney.new(converted_amount, to_currency)\n\tend", "def to_c(number)\n number_with_precision(number, :precision => 2, :delimiter => '.', :separator => ',') + ' kn' \n end", "def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end", "def test_convert_currency_one_to_two\n #AGAIN....test passes if it doesn't work\n assert_raises ArgumentError do \n @apples_to_oranges.convert_currency_one_to_two\n end\n\n @converted_value = @apples_to_oranges.convert_currency_one_to_two(@amount)\n @expected_value = @amount*@apples_to_oranges.conversion_rate\n\n # This test will pass if it is right!\n assert_equal @expected_value, @converted_value\n end", "def convert_to_cents(to_currency)\n if to_currency == currency\n cents\n else\n @currency.exchange(to_currency, cents)\n end\n end", "def convert(num)\n return num = num * 0.453592\nend", "def base_currency_to_currency(date, to_currency)\n currency_rate(date, to_currency)\n end", "def formated_in_provided_currency(amount_cents, currency_code, no_cents_if_whole = false)\n Money.new(amount_cents, currency_code).format(:no_cents_if_whole => no_cents_if_whole)\n end", "def convertCurrency(fromCurrencyCode, toCurrencyCode, price)\n fromRate = get_exchange_rate(fromCurrencyCode)\n toRate = get_exchange_rate(toCurrencyCode)\n (price * toRate) / fromRate\n end", "def number_to_currency(value, options = {})\n NumberToCurrency.convert(value, options)\n end", "def currency(amount)\n number_to_currency amount.to_s, {:unit => \"\", :delimiter => ',', :seperator => '.'}\n end", "def with_currency(new_currency); end", "def format_money(num)\n if num == WebScraper::NOT_APPLICABLE\n num\n else\n num[num.length] = '0' if num.index('.') == num.length - 2 # add a 0 if only 1 decimal place given\n WebScraper::MONEY_UNITS + num.gsub(WebScraper::COMMAS_REG_EXP, '\\\\1,')\n end\n end", "def convert(amount, currency_from, currency_to)\n return Money.new(amount, currency_from).exchange_to(currency_to).fractional\n end", "def cents; end", "def number_to_currency(number, options = {})\n # Blend default options with localized currency options\n options.reverse_merge!(LocalizationSimplified::NumberHelper::CurrencyOptions)\n options[:order] ||= [:unit, :number]\n options = options.stringify_keys\n precision, unit, separator, delimiter = options.delete(\"precision\") { 2 }, options.delete(\"unit\") { \"$\" }, options.delete(\"separator\") { \".\" }, options.delete(\"delimiter\") { \",\" }\n separator = \"\" unless precision > 0\n\n #add leading space before trailing unit\n unit = \" \" + unit if options[\"order\"] == [:number, :unit]\n output = ''\n begin\n options[\"order\"].each do |param|\n case param\n when :unit\n output << unit\n when :number\n parts = number_with_precision(number, precision).split('.')\n output << number_with_delimiter(parts[0], delimiter) + separator + parts[1].to_s\n end\n end\n rescue\n output = number\n end\n output\n end", "def same_currency?(currency1, currency2); end", "def us_dollar(cents); end", "def converted_amount(other)\n (currency == other.currency ? other : other.convert_to(currency)).amount.to_f\n end", "def get_rate(currency_iso_from, currency_iso_to); end", "def to_system_currency(value)\n value.to_d / currency.exchange_rate.to_d\n end", "def tobeamount(obj)\n\t\tif obj.to_s =~ /(\\d+)([.]\\d{1,2})?/\n\t\t\tamt = $1 + ($2 || '.00')\n\t\t\treturn amt.to_f\n\t\tend\n\t\treturn nil\n\tend" ]
[ "0.7419621", "0.7294744", "0.71460253", "0.70033616", "0.6935506", "0.6910056", "0.68724126", "0.68145037", "0.68145037", "0.68145037", "0.6671685", "0.6621612", "0.65696114", "0.65693504", "0.6568192", "0.65624815", "0.65414447", "0.65048486", "0.6500113", "0.6476299", "0.646724", "0.64374477", "0.6423155", "0.6420406", "0.63544923", "0.63528526", "0.6349218", "0.63467544", "0.6344255", "0.6344255", "0.63244504", "0.62842035", "0.6267715", "0.6251439", "0.62409776", "0.623683", "0.6223175", "0.6221552", "0.6211899", "0.62070394", "0.61990035", "0.6182174", "0.61807317", "0.6166533", "0.61503017", "0.6130054", "0.61090976", "0.6100277", "0.60890913", "0.608715", "0.6076277", "0.6076146", "0.60655093", "0.6064454", "0.60509634", "0.60491526", "0.6048172", "0.60462147", "0.6045583", "0.60360605", "0.60353273", "0.60353273", "0.60353273", "0.60353273", "0.6033617", "0.6011817", "0.60089844", "0.60089844", "0.60089844", "0.60028213", "0.6000488", "0.5999216", "0.599179", "0.5990458", "0.5976458", "0.5976458", "0.5976458", "0.5976458", "0.5971511", "0.5965939", "0.59624386", "0.59593844", "0.5956751", "0.5954883", "0.59436285", "0.5940482", "0.59385335", "0.593614", "0.5924487", "0.59216946", "0.59212685", "0.59134585", "0.59121805", "0.59110934", "0.590945", "0.5908825", "0.59067994", "0.5906013", "0.59018826", "0.5883618", "0.5883095" ]
0.0
-1
call migrates features key from the old fashioned to the new format. It must replicate feature keys with changes: from "avenue:traffic_lights" => 42 to "avenue:42" => traffic_lights
def call @from_redis.scan_each(match: "*", count: FeatureFlagger::Storage::Redis::SCAN_EACH_BATCH_SIZE) do |redis_key| # filter out resource_keys next if redis_key.start_with?("#{FeatureFlagger::Storage::Redis::RESOURCE_PREFIX}:") migrate_key(redis_key) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate(_key, _options); end", "def migrate(key, options); end", "def convert_key(key); end", "def convert_key(key); end", "def convert_key(key); end", "def migrate_update_keys update_keys\n path = '/activities'\n get(path, ids: update_keys)\n end", "def migrate(data)\n keys = I18n::Translate.hash_to_keys(data, @translate.options[:separator])\n keys.each do |key|\n entry = I18n::Translate.find(key, data, @translate.options[:separator])\n next unless I18n::Translate.is_enhanced?(entry)\n %w(old t).each do |prop|\n next unless entry[prop]\n value = entry.delete(prop)\n prop = case(prop)\n when \"old\"\n \"old_default\"\n when \"t\"\n \"translation\"\n end\n entry[prop] = value\n end\n I18n::Translate.set(key, entry, data, @translate.options[:separator])\n end\n data\n end", "def update_feature(feature_key, attributes)\n features[feature_key].update_attribute(attributes)\n save\n end", "def reorder_feature(feature_key_1, feature_key_2)\n f1 = features[key_1]\n f2 = features[key_2]\n raise \"should have the same father\" unless f1.parent_feature_key == f2.parent_feature_key\n end", "def convert_key dbkey\n arr = dbkey.split('_')\n arr.each {|s|s[0]=s[0].upcase}\n newkey = arr.join('')\n newkey[0]=newkey[0].downcase\n newkey\n end", "def __convert(key); end", "def upgrade_to_v1\n metadata['geoblacklight_version'] = '1.0'\n\n # ensure required fields\n metadata['dc_identifier_s'] = metadata['uuid'] if metadata['dc_identifier_s'].blank?\n\n # normalize to alphanum and - only\n metadata['layer_slug_s'].gsub!(/[^[[:alnum:]]]+/, '-') if metadata['layer_slug_s'].present?\n\n # remove deprecated fields\n metadata.except!(*DEPRECATED_KEYS_V1)\n\n # ensure we have a proper v1 record\n valid?\n end", "def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end", "def update_features(features)\n DressTypeFeature.where(:dress_type_id => id).delete_all\n add_features(features)\n end", "def transform\n params.transform_keys! { |key| key.tr('-', '_') }\n end", "def migrate_old_ssh_keys\n if migrate_old_ssh_keys?\n say \"-> migrating to cache private key for inception VM...\"\n inception_vm_private_key_path # to setup the path in settings\n settings[\"inception\"][\"key_pair\"] ||= {}\n settings[\"inception\"][\"key_pair\"][\"name\"] = \"fog_default\"\n settings[\"inception\"][\"key_pair\"][\"private_key\"] = File.read(settings[\"local\"][\"private_key_path\"]).strip\n settings[\"inception\"][\"key_pair\"][\"public_key\"] = File.read(settings[\"local\"][\"public_key_path\"]).strip\n settings.delete(\"local\")\n save_settings!\n end\n end", "def format_key(key)\n key.tr(\"_\", \"-\")\n .gsub(\"enabled\", \"enable\")\n .gsub(\"user-name\", \"username\")\n .gsub(/^registry-jwt-expiration-time-value$/, \"jwt-expiration-time\")\n .gsub(/^registry-catalog-page-value$/, \"catalog-page\")\n .gsub(/^check-ssl-usage-enable$/, \"secure\")\n .gsub(/^user-permission-change-visibility-enable$/, \"change-visibility-enable\")\n .gsub(/^user-permission-manage-namespace-enable$/, \"manage-namespace-enable\")\n .gsub(/^user-permission-create-namespace-enable$/, \"create-namespace-enable\")\n .gsub(/^user-permission-manage-team-enable$/, \"manage-team-enable\")\n .gsub(/^user-permission-create-team-enable$/, \"create-team-enable\")\nend", "def transform_keys(&block); end", "def remap_inputs(inputs)\n remapped = inputs.dup\n remapped[\"ref_vcf\"] = remapped.delete(\"benchmark_vcf\") if remapped.key?(\"benchmark_vcf\")\n remapped[\"ref_bed\"] = remapped.delete(\"benchmark_bed\") if remapped.key?(\"benchmark_bed\")\n remapped\n end", "def transform_keys!(&block); end", "def cleanup\n datas[:model_feature_values].each_pair { |model_key, feature_values| \n model = Model.find(model_key)\n feature_keys = []\n model.features_list { |feature| feature_keys << feature.key }\n values(model).delete_if { |feature_key, value| !feature_keys.include?(feature_key) }\n }\n end", "def new_key_format\n if GROUPS[:trivia].include?(self.key)\n if self.key.to_s =~ /(qs_)/\n \"old_question\"\n else\n \"trivia\"\n end\n else\n self.key.to_s\n end\n end", "def migrate_entities\n\n entity_keys = @source_redis.keys('entity:*')\n\n entity_keys.each do |entity_key|\n\n # TODO fix regex, check current code\n raise \"Bad regex for '#{entity_key}'\" unless entity_key =~ /\\Aentity:(#{ID_PATTERN_FRAGMENT})\\z/\n\n entity_id = $1\n\n entity_name = @source_redis.hget(entity_key, 'name')\n\n entity = Flapjack::Data::Entity.new(:id => entity_id, :name => entity_name)\n entity.save\n raise entity.errors.full_messages.join(\", \") unless entity.persisted?\n end\n\nend", "def transform_params\n params.transform_keys! { |key| key.tr(\"-\", \"_\") }\n end", "def update!(**args)\n @anchor_common_feature_set = args[:anchor_common_feature_set] if args.key?(:anchor_common_feature_set)\n @attachments = args[:attachments] if args.key?(:attachments)\n @babel_checkpoint_path = args[:babel_checkpoint_path] if args.key?(:babel_checkpoint_path)\n @caption_entity_anchor_features = args[:caption_entity_anchor_features] if args.key?(:caption_entity_anchor_features)\n @caption_span_anchor_features = args[:caption_span_anchor_features] if args.key?(:caption_span_anchor_features)\n @description_anchor_features = args[:description_anchor_features] if args.key?(:description_anchor_features)\n @filter_reason = args[:filter_reason] if args.key?(:filter_reason)\n @filtered = args[:filtered] if args.key?(:filtered)\n @generative_features = args[:generative_features] if args.key?(:generative_features)\n @instruction_anchor_features = args[:instruction_anchor_features] if args.key?(:instruction_anchor_features)\n @instruction_training_data_anchor_features = args[:instruction_training_data_anchor_features] if args.key?(:instruction_training_data_anchor_features)\n @label_language = args[:label_language] if args.key?(:label_language)\n @label_transformation = args[:label_transformation] if args.key?(:label_transformation)\n @list_anchor_features = args[:list_anchor_features] if args.key?(:list_anchor_features)\n @list_training_data_anchor_features = args[:list_training_data_anchor_features] if args.key?(:list_training_data_anchor_features)\n @multimodal_topic_features = args[:multimodal_topic_features] if args.key?(:multimodal_topic_features)\n @multimodal_topic_training_features = args[:multimodal_topic_training_features] if args.key?(:multimodal_topic_training_features)\n @normalized_babel_embedding = args[:normalized_babel_embedding] if args.key?(:normalized_babel_embedding)\n @ocr_anchor_feature = args[:ocr_anchor_feature] if args.key?(:ocr_anchor_feature)\n @ocr_description_training_data_anchor_features = args[:ocr_description_training_data_anchor_features] if args.key?(:ocr_description_training_data_anchor_features)\n @opinions_anchor_features = args[:opinions_anchor_features] if args.key?(:opinions_anchor_features)\n @qna_anchor_features = args[:qna_anchor_features] if args.key?(:qna_anchor_features)\n @rating_score = args[:rating_score] if args.key?(:rating_score)\n @safe_search_classifier_output = args[:safe_search_classifier_output] if args.key?(:safe_search_classifier_output)\n @text_similarity_features = args[:text_similarity_features] if args.key?(:text_similarity_features)\n @thumbnail_info = args[:thumbnail_info] if args.key?(:thumbnail_info)\n end", "def id2features\n mapping = feature_files.each_with_object({}) do |file, mp|\n feature_id = file.feature.identifier\n mp[feature_id] = file unless feature_id.nil?\n end\n\n return mapping\n end", "def migrate_key(node, key, options)\n begin\n if Redis::VERSION > '3.0.4'\n node.migrate(key, options)\n else\n node.migrate([options[:host], options[:port], key, options[:db], options[:timeout]])\n end\n rescue Redis::CommandError => e\n if e.message =~ TARGET_KEY_BUSY_REGEX\n # TODO check the value is correct, and delete the key from the old host\n # This might be better to be done by humans\n raise \"key #{key}: Target key busy!\"\n else\n raise e\n end\n end\n end", "def update_features(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/features\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n features:[{\"name\":\"public_dashboards\",\"enabled\":true},\n {\"name\":\"published_dashboards\",\"enabled\":true},\n {\"name\":\"downloadable_reports\",\"enabled\":true},\n {\"name\":\"scheduled_emails\",\"enabled\":true}]\n }.to_json)\n puts response.body\n puts \"Client's features were updated.\" if response.success?\n end", "def update!(**args)\n @features = args[:features] if args.key?(:features)\n end", "def transform_keys(type)\n @_transform_keys = type.to_sym\n end", "def adapt_feature(feature_ast)\n return nil unless feature_ast\n\n adapted_feature = {}\n\n # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data\n save_original_data(adapted_feature, feature_ast)\n clear_child_elements(adapted_feature, [[:tags],\n [:children]])\n\n adapted_feature['language'] = feature_ast.language\n adapted_feature['keyword'] = feature_ast.keyword\n adapted_feature['name'] = feature_ast.name\n adapted_feature['description'] = feature_ast.description\n adapted_feature['line'] = feature_ast.location.line\n adapted_feature['column'] = feature_ast.location.column\n\n adapted_feature['elements'] = adapt_child_elements(feature_ast)\n adapted_feature['tags'] = adapt_tags(feature_ast)\n\n adapted_feature\n end", "def migrate\n metrics_list = []\n timestamp = Time.now.to_i.to_s\n ipstring = @option[:ip_address].gsub '.', '-'\n\n # @result.each_pair do |key, value|\n # puts \"|#{key}|\"\n # value.each_pair do |ifname, ifvalue|\n # puts \"|#{ifname}|#{ifvalue}|\"\n # end\n # end\n [[:InSpeed, :InOctets], [:OutSpeed, :OutOctets]].each do |item|\n @result.each_pair do |vlannm, vlanvalue|\n #puts \"|#{vlannm}|\"\n if @exvlan.include? vlannm\n next\n end\n sorted = Hash[vlanvalue.sort_by {|a, b| -b[item[1]].to_i}]\n index = 0\n sorted.each_pair do |ifname, ifvalue|\n if @tops.to_i > 0 && index >= @tops.to_i\n break\n end\n index += 1\n\n #puts \"--#{ifname}, #{ifvalue}\"\n info = {\n :sn => ipstring + \"-\" + timestamp + \"-\" + ifname,\n :target => @option[:org_env] + \".\" + @option[:basetarget] +\n \".#{ipstring}.traffic.#{vlannm}.#{item[0]}\",\n :instance => ifname,\n :status => ifvalue[item[0]],\n :details => \"top#{index}\",\n :timestamp => Time.now().to_i() * 1000,\n :duration => 0,\n :attachments => []\n }\n #puts info\n metrics = Metrics.new(@option[:pin_code], info)\n #puts metrics\n metrics_list << metrics\n end\n end\n end\n\n merged = Metrics.merge(metrics_list)\n end", "def auto_upgrade!\n DataMapper.auto_upgrade!(name)\n end", "def convert_to_connection_string(key)\n # string = key.to_s =~ /[A-Z]{1}\\b/ ? key.to_s.insert(key.to_s =~ /[A-Z]{1}\\b/, \" \").capitalize : key.to_s.capitalize\n key.to_s =~ /[_]/ ? key.to_s.gsub!(/[_]/, \" \").split.map(&:capitalize)*' ' : key.to_s.capitalize\n #=> this has undesired effects on renaming conventions, messing up the logic\n # ————————————————————\n # key.to_s =~ /[A-Z]{1}\\b/ ? key.to_s.insert(key =~ /[A-Z]{1}\\b/, \" \").split.map(&:capitalize)*' ' : key.to_s.capitalize\n # ————————————————————\n\n # TODO: convert the \"Greenlinee\" to \"Greenline E\", \"Greenlineb\" to \"Greenline B\" and so on\n end", "def features\n set_members(FeaturesKey)\n end", "def update!(**args)\n @features = args[:features] if args.key?(:features)\n @pattern_id = args[:pattern_id] if args.key?(:pattern_id)\n @payload = args[:payload] if args.key?(:payload)\n end", "def convert_key(key)\n case key\n when '$'\n 'text'\n when 'D', 'Dm', 'F', 'FDm', 'FNm', 'G', 'Gm', 'Gn', 'H', 'Hm', 'Hn', 'Nm', 'P', 'Pp', 'PPd', 'PPn', 'S', 'T', 'U', 'V', 'W'\n key\n else\n key.to_s.strip.\n gsub('@', '').\n gsub(' ', '_').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n squeeze(\"_\").\n downcase\n end\n end", "def upcase_keys!\n replace(upcase_keys)\n end", "def downcase_keys!\n replace(downcase_keys)\n end", "def remap(mapping)\n from = mapping.keys.first\n to = mapping[from]\n add_step do |attrs|\n attrs[to] = attrs.delete(from) if attrs.has_key?(from)\n attrs\n end\n end", "def downcase_keys\n end", "def update!(**args)\n @contact_grounding_provider_features = args[:contact_grounding_provider_features] if args.key?(:contact_grounding_provider_features)\n @device_grounding_provider_features = args[:device_grounding_provider_features] if args.key?(:device_grounding_provider_features)\n @endpoint_grounding_provider_features = args[:endpoint_grounding_provider_features] if args.key?(:endpoint_grounding_provider_features)\n @media_grounding_provider_features = args[:media_grounding_provider_features] if args.key?(:media_grounding_provider_features)\n @podcast_grounding_provider_features = args[:podcast_grounding_provider_features] if args.key?(:podcast_grounding_provider_features)\n @provider_grounding_provider_features = args[:provider_grounding_provider_features] if args.key?(:provider_grounding_provider_features)\n end", "def migrate\n DataMapper.auto_migrate!\n end", "def transform_v1(record)\n new_hash = {}\n record.each do |key, value|\n new_key, sub_key = key.to_s.split('.')\n #new_key = new_key.to_sym\n unless sub_key.nil?\n #sub_key = sub_key.to_sym\n new_hash[new_key] = {} if new_hash[new_key].nil?\n new_hash[new_key].merge!({sub_key => value})\n else\n new_hash.store(key, value)\n end\n end\n new_hash\n end", "def rescale_inputs(collection, source_scaler, dest_scaler)\n collection.each_with_object({}) do |(key, value), data|\n input = Input.get(key.to_sym)\n\n # Old scenarios may use inputs which no longer exist; skip them.\n next unless input\n\n if ScenarioScaling.scale_input?(input)\n data[key] = rescale_input(value, source_scaler, dest_scaler)\n else\n data[key] = value\n end\n end\n end", "def rename_keys!(request, new_client_or_user_name)\n orig_keys_path = keys_path_base(request)\n new_keys_path = orig_keys_path.dup\n .tap { |path| path[-2] = new_client_or_user_name }\n\n key_names = list_data_or_else(request, orig_keys_path, nil)\n return unless key_names # No keys to move\n\n key_names.each do |key_name|\n # Get old data\n orig_path = [ *orig_keys_path, key_name ]\n data = get_data(request, orig_path, :data_store_exceptions)\n\n # Copy data to new path\n create_data(\n request,\n new_keys_path, key_name,\n data,\n :create_dir\n )\n end\n\n # Delete original data\n delete_data_dir(request, orig_keys_path, :recursive, :data_store_exceptions)\n end", "def update_features(feature_ids=[])\n existing_ad_features = self.ad_features\n existing_ad_features.select{|ad_feature| !feature_ids.include?(ad_feature.feature_id)}.each &:destroy\n feature_ids.each do |feature_id|\n ad_feature = existing_ad_features.find_by_feature_id(feature_id)\n ad_feature ||= self.ad_features.create(feature_id: feature_id)\n end\n end", "def convert_keys_to_id(params, *keys_to_change)\n return params if keys_to_change.nil? || params.nil?\n keys_to_change.each do |k|\n v = params.delete(k)\n params[(k.to_s << '_id').to_sym] = v unless v.blank? # resinsert value but with _id added to key\n end\n return params\n end", "def transform!(pallet)\n @key_transforms.each do |keytrans_item|\n # Enable early termination of transforms for a key\n # by wrapping execution in a catch block.\n catch do |abort_tag|\n key, transforms = keytrans_item.flatten\n context = {\n pallet: pallet,\n key: key,\n value: pallet[key, shallow: true],\n abort: abort_tag\n }\n\n transforms.each do |t|\n transform, param = t.flatten\n if self.respond_to?(transform.to_sym)\n if new_value = self.send(transform.to_sym, param, context)\n new_value = TraceableString.new(new_value)\n new_value.file = transform.file\n new_value.line = transform.line\n new_value.column = transform.column\n new_value.byte = transform.byte\n pallet[key] = new_value\n break\n end\n end\n end\n end\n end\n @hash\n end", "def remap_more_attributes(more_attributes, ingredient)\n new_more_attributes = more_attributes\n new_leaf_ids = ingredient.all_leafs.map(&:id)\n new_mappings = {}\n if more_attributes['ingredients'].present?\n more_attributes['ingredients'].values.each_with_index do |resource, index|\n new_id = new_leaf_ids[index]\n new_mappings[new_id] = resource\n end\n new_more_attributes['ingredients'] = new_mappings\n new_more_attributes\n else\n more_attributes\n end\n end", "def migrate_actions\n source_keys_matching('?*:?*:actions').each do |timestamp_key|\n timestamp_key =~ /\\A(#{ENTITY_PATTERN_FRAGMENT}):(#{CHECK_PATTERN_FRAGMENT}):actions\\z/\n entity_name = $1\n check_name = $2\n if entity_name.nil? || check_name.nil?\n raise \"Bad regex for #{timestamp_key}\"\n end\n\n check = find_check(entity_name, check_name)\n\n timestamps = @source_redis.hgetall(timestamp_key)\n timestamps.each_pair do |timestamp, action|\n\n start_range = Zermelo::Filters::IndexRange.new(nil, time, :by_score => true)\n previous_state = check.states.intersect(:created_at => start_range).last\n previous_cond = previous_state.nil? ? nil : previous_state.condition\n\n state = Flapjack::Data::State.new(:action => action,\n :condition => previous_cond, :created_at => timestamp,\n :updated_at => timestamp)\n\n state.save\n raise state.errors.full_messages.join(\", \") unless state.persisted?\n\n check.states << states\n end\n end\n end", "def feature_version(feature); end", "def do_feature_import(filename)\n country_type = Category.find_by_title('Nation')\n country_type_id = country_type.id\n current = 0\n feature_ids_with_changed_relations = Array.new\n feature_ids_with_object_types_added = Array.new\n puts \"#{Time.now}: Starting importation.\"\n self.do_csv_import(filename) do\n current+=1\n next unless self.get_feature(current)\n #begin\n self.add_date('features', self.feature)\n self.process_names(44)\n self.process_kmaps(15)\n feature_ids_with_object_types_added += self.process_feature_types(4)\n self.process_geocodes(4)\n feature_ids_with_changed_relations += self.process_feature_relations(15)\n self.process_contestations(3)\n self.process_shapes(3)\n self.process_descriptions(3)\n self.feature.update_attributes({:is_blank => false, :is_public => true})\n #rescue Exception => e\n # puts \"Something went wrong with feature #{self.feature.pid}!\"\n # puts e.to_s\n #end\n if self.fields.empty?\n puts \"#{Time.now}: #{self.feature.pid} processed.\"\n else\n puts \"#{Time.now}: #{self.feature.pid}: the following fields have been ignored: #{self.fields.keys.join(', ')}\"\n end\n end\n puts \"Updating cache...\"\n # running triggers on feature_relation\n feature_ids_with_changed_relations.each do |id| \n feature = Feature.find(id)\n feature.update_cached_feature_relation_categories\n feature.update_hierarchy\n end\n\n # running triggers for feature_object_type\n feature_ids_with_object_types_added.each do |id|\n feature = Feature.find(id)\n feature.update_cached_feature_relation_categories if !feature_ids_with_changed_relations.include? id\n feature.update_object_type_positions\n end\n puts \"#{Time.now}: Importation done.\"\n end", "def update\n @key_feature = KeyFeature.find(params[:id])\n\n if @key_feature.update(key_feature_params)\n audit(@key_feature, current_user)\n head :no_content\n else\n render json: @key_feature.errors, status: :unprocessable_entity\n end\n end", "def normalize_key(key)\n case key\n when Numeric, nil\n # nils never happen here in Ruby >= 2.3 since nils\n # skip the normalizer.\n key\n else\n key.to_s.downcase.strip\n .gsub(/(?:\\s+|-)/, '_')\n .gsub(/[^a-zA-Z0-9_]+/, '')\n .squeeze('_')\n .gsub(/_$/, '')\n .to_sym\n end\n end", "def destroy_feature(feature_key)\n features[feature_key].delete\n save\n end", "def normalize_keys\n transform_keys { |key| key.downcase.to_sym rescue key }\n end", "def stringify_keys!\n replace stringify_keys\n end", "def normalize_flat_keys(locale, key, scope, separator); end", "def normalize_flat_keys(locale, key, scope, separator); end", "def rename_keys(guides)\n parsed_result = {}\n data.each do |key, value|\n xml_name = guides.find { |hash| hash[:input] == key }[:result]\n parsed_result[xml_name] = value\n end\n parsed_result\n end", "def normalize(key)\n key.tr(\"-\", \"_\")\n end", "def munge_keys d\n\t\t\t\tif d.kind_of? Array\n\t\t\t\t\td.each do |o|\n\n\t\t\t\t\t\tnext if explicit_keys(o) && explicit_customer_key(o)\n\n\t\t\t\t\t\tformatted = []\n\t\t\t\t\t\to['CustomerKey'] = customer_key unless explicit_customer_key o\n\t\t\t\t\t\tunless explicit_properties(o)\n\t\t\t\t\t\t\to.each do |k, v|\n\t\t\t\t\t\t\t\tnext if k == 'CustomerKey'\n\t\t\t\t\t\t\t\tformatted.concat FuelSDK.format_name_value_pairs k => v\n\t\t\t\t\t\t\t\to.delete k\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\to['Keys'] = {'Key' => formatted }\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tformatted = []\n\t\t\t\t\td.each do |k, v|\n\t\t\t\t\t\tnext if k == 'CustomerKey'\n\t\t\t\t\t\tformatted.concat FuelSDK.format_name_value_pairs k => v\n\t\t\t\t\t\td.delete k\n\t\t\t\t\tend\n\t\t\t\t\td['CustomerKey'] = customer_key\n\t\t\t\t\td['Keys'] = {'Key' => formatted }\n\t\t\t\tend\n\t\t\tend", "def inflate_functional_fields(data, original_key_order)\n output = []\n data.each do |row|\n output_row = {}\n\n processed_keys = []\n original_key_order.each do |original_key|\n if %w[ec go ipr].include? original_key\n # First, we take all distinct keys that start with \"ec\", \"go\" or \"ipr\"\n annotation_keys = row.keys.select { |key| key.start_with? original_key }\n processed_keys += annotation_keys\n unless annotation_keys.empty?\n # Each of the values of the annotation_keys is an array. All respective values of each of\n # these arrays need to be put together into one hash. (E.g. {a => [1, 2], b=> [x, y]} --> [{a: 1, b: x}, {a: 2, b: y}])\n reconstructed_objects = []\n (0..row[annotation_keys[0]].length).each do |i|\n reconstructed_object = {}\n annotation_keys.each do |annotation_key|\n reconstructed_object[%w[ec_number go_term ipr_code].include?(annotation_key) ? annotation_key : annotation_key[annotation_key.index('_') + 1, annotation_key.length]] = row[annotation_key][i]\n end\n reconstructed_objects << reconstructed_object\n end\n output_row[original_key] = reconstructed_objects\n end\n elsif row.key? original_key\n output_row[original_key] = row[original_key]\n end\n end\n\n output << output_row\n end\n output\n end", "def rename_keys(guides)\n parsed_result = {}\n data.each do |key, value|\n xml_name = guides.find_input_result(key)\n parsed_result[xml_name] = value\n end\n parsed_result\n end", "def migrate(commit, delete_old_keys=false)\n say \"Processing commit ##{commit.id} (#{commit.project.name} #{commit.revision})...\"\n\n # first store all the keys that used to be associated with this commit\n old_keys = commit.keys.includes(translations: :translation_changes).to_a\n\n # reimport the commit to get potentially new android strings\n say \"Re-importing...\", true\n commit.import_strings force: true, inline: true\n\n # match old keys to new keys and update translations as necessary\n say \"Recombobulating translations from old keys...\", true\n commit.reload.keys.includes(:translations).each do |new_key|\n next unless new_key.importer == 'android'\n\n new_key_string = new_key.key.split(':').last\n blob_sha = cached_blob_sha(new_key.project, commit.revision, new_key.source[1..-1])\n xml = Nokogiri::XML(cached_blob_contents(new_key.project, blob_sha))\n tag = find_new_key(xml, new_key_string)\n old_key_string = old_key(tag)\n\n old_key = old_keys.detect { |k| k.key == \"#{new_key.source}:#{old_key_string}\" }\n unless old_key\n say \"[#{new_key.source}] Skipping #{new_key_string}; couldn't find corresponding #{old_key_string}\", true\n next\n end\n\n old_key.translations.each do |old_translation|\n next if old_translation.rfc5646_locale == commit.project.base_rfc5646_locale\n\n new_translation = new_key.translations.detect { |t| t.rfc5646_locale == old_translation.rfc5646_locale }\n new_translation.copy = old_translation.copy\n new_translation.approved = old_translation.approved\n new_translation.translator_id = old_translation.translator_id\n new_translation.reviewer_id = old_translation.reviewer_id\n new_translation.save!\n\n new_translation.translation_changes.delete_all\n old_translation.translation_changes.each do |tc|\n new_translation.translation_changes.create!(user: tc.user, diff: tc.diff)\n end\n end\n end\n\n if delete_old_keys\n say \"Destroying old keys...\", true\n Key.where(id: old_keys.map(&:id)).destroy_all\n end\nend", "def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end", "def normalize_keys(hash)\n hash.inject(HashWithIndifferentAccess.new) do |new_hash, (key, value)|\n new_hash[key.parameterize(separator: \"_\")] = value\n new_hash\n end\n end", "def reformat_hash(adventure_hash)\n reformatted_hash = {}\n adventure_hash[:knights].collect do |knight|\n reformatted_hash[knight[:name]] = knight[:favorite_color]\n end\n reformatted_hash\nend", "def create\n @key_feature = KeyFeature.new(key_feature_params)\n\n if @key_feature.save\n audit(@key_feature, current_user)\n render json: @key_feature, status: :created\n else\n render json: @key_feature.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @frame_features = args[:frame_features] if args.key?(:frame_features)\n end", "def update!(**args)\n @features = args[:features] if args.key?(:features)\n @starbust_version = args[:starbust_version] if args.key?(:starbust_version)\n @tokens = args[:tokens] if args.key?(:tokens)\n end", "def add_loaded_features(loaded_features); end", "def normalize_key(key)\n self.class.normalize_key(key)\n end", "def update!(**args)\n @required_features = args[:required_features] if args.key?(:required_features)\n end", "def update!(**args)\n @destination_field = args[:destination_field] if args.key?(:destination_field)\n @feature_id = args[:feature_id] if args.key?(:feature_id)\n end", "def convert_local_attributes\n if trigger.account\n if key =~ /local_(\\w+)/\n self.key = \"local_#{$1}_for_#{trigger.account.name}\"\n end\n end\n end", "def test_renaming_keys_deep\n json_response = \"{\\n \\\"kind\\\": \\\"Node\\\",\\n \\\"id\\\": \\\"127.0.0.1\\\",\\n \\\"uid\\\": \\\"b0ddfa00-8b5b-11e4-a8c4-3c970e4a436a\\\",\\n \\\"creationTimestamp\\\": \\\"2014-12-24T12:57:45+02:00\\\",\\n \\\"selfLink\\\": \\\"/api/v1beta1/nodes/127.0.0.1\\\",\\n \\\"resourceVersion\\\": 7,\\n \\\"apiVersion\\\": \\\"v1beta1\\\",\\n \\\"hostResources\\\": {\\n \\\"capacity\\\": {\\n \\\"cpu\\\": 1000,\\n \\\"memorySize\\\": 3221225472\\n }\\n }\\n}\"\n stub_request(:get, /.*nodes*/).\n to_return(:body => json_response, :status => 200)\n\n client = Kubeclient::Client.new 'http://localhost:8080/api/' , \"v1beta1\"\n original_hash = JSON.parse(json_response)\n #convert to ruby style\n hash_after_rename_underscore = client.rename_keys(deep_copy(original_hash),\"underscore\", nil)\n #convert back to camelized style with first word downcase\n hash_after_rename_camelize = client.rename_keys(deep_copy(hash_after_rename_underscore), \"camelize\", :lower)\n\n assert_equal(original_hash, hash_after_rename_camelize)\n assert_equal(3221225472,hash_after_rename_camelize[\"hostResources\"][\"capacity\"][\"memorySize\"])\n assert_equal(nil,hash_after_rename_underscore[\"host_resources\"][\"capacity\"][\"memorySize\"])\n assert_equal(3221225472,hash_after_rename_underscore[\"host_resources\"][\"capacity\"][\"memory_size\"])\n end", "def transform_params\n params.transform_keys! { |key| key.underscore }\n end", "def save_feature( args )\n app_name = args.delete( :app_name )\n route_info = args.delete( :route_info )\n environment = args.delete( :environment )\n \n row = { min_field(:app_name) => app_name, min_field(:env) => environment.to_s }\n if route_info\n row[min_field(:controller)] = route_info[:controller]\n row[min_field(:action)] = route_info[:action]\n else\n row[min_field(:context)] = args.delete( :path )\n end\n \n feature = features.find_one( row, :fields => ['_id'] )\n return feature['_id'] if feature\n\n now = args[:created_at]\n row[min_field(:date_id)] = \"%4d%02d%02d\" %[now.year, now.month, now.day]\n \n features.save( row )\n end", "def rubyize_keys\n transform_keys do |key|\n key\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n .to_sym\n end\n end", "def test_delete_feature()\n\t pg_lyr = create_poly_layer(@pg_ds)\n\t create_crazy_key\n\t \n\t\tpg_lyr.set_attribute_filter( \"PRFEDEA = 'CrazyKey'\" )\n\n\t feat = pg_lyr.get_next_feature()\n\t\tassert_not_nil(feat, \"Could not find feature\")\n \t pg_lyr.set_attribute_filter( \"\" )\n \t fid = feat.get_fid()\n\n assert(pg_lyr.delete_feature( fid ),\n 'DeleteFeature() method failed.' )\n\n\t\tpg_lyr.set_attribute_filter( \"PRFEDEA = 'CrazyKey'\" )\n feat = pg_lyr.get_next_feature()\n assert_nil(feat, 'DeleteFeature() seems to have had no effect.' )\n pg_lyr.set_attribute_filter(\"\")\n end", "def rekey_as_needed; end", "def convert feature\n Parser::KEYWORDS.each_with_index.map do |keyword, i|\n feature[i] ? keyword : nil\n end.compact.join(\" \")\n end", "def update!(**args)\n @feature_id = args[:feature_id] if args.key?(:feature_id)\n end", "def normalize_key(k)\n k.to_s.gsub('-', '_').gsub(INVALID_PATTERN, '').to_sym\n end", "def migrate(_key, _options)\n raise CannotDistribute, :migrate\n end", "def update!(**args)\n @common_features = args[:common_features] if args.key?(:common_features)\n @ocr_video_feature = args[:ocr_video_feature] if args.key?(:ocr_video_feature)\n @safe_search_classifier_output = args[:safe_search_classifier_output] if args.key?(:safe_search_classifier_output)\n @version = args[:version] if args.key?(:version)\n @video_generated_query_features = args[:video_generated_query_features] if args.key?(:video_generated_query_features)\n @video_multimodal_topic_features = args[:video_multimodal_topic_features] if args.key?(:video_multimodal_topic_features)\n end", "def migrate!(opts)\n raise NotSupportedError, \"Unable to migrate using `#{self}`\"\n end", "def normalize_key(key)\n KEY_NORMALIZER.call(key)\n end", "def upgrade_api_key_for(user)\n user.update(api_key: 2)\n end", "def adapter_key\n @key ||= Key.new(@feature.name, key)\n end", "def normalize_abbreviation_key(key); end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @other_feature_country_code = args[:other_feature_country_code] if args.key?(:other_feature_country_code)\n @other_feature_id = args[:other_feature_id] if args.key?(:other_feature_id)\n @other_feature_name = args[:other_feature_name] if args.key?(:other_feature_name)\n @other_feature_territorial_administrator = args[:other_feature_territorial_administrator] if args.key?(:other_feature_territorial_administrator)\n @other_feature_type = args[:other_feature_type] if args.key?(:other_feature_type)\n @overlap_fraction = args[:overlap_fraction] if args.key?(:overlap_fraction)\n @relation = args[:relation] if args.key?(:relation)\n @relation_is_reversed = args[:relation_is_reversed] if args.key?(:relation_is_reversed)\n @temporary_data = args[:temporary_data] if args.key?(:temporary_data)\n end", "def update!(**args)\n @features = args[:features] if args.key?(:features)\n @normalize_geometries = args[:normalize_geometries] if args.key?(:normalize_geometries)\n end", "def update!(**args)\n @features = args[:features] if args.key?(:features)\n @normalize_geometries = args[:normalize_geometries] if args.key?(:normalize_geometries)\n end", "def update_feature_header\n feature = Feature.find(params[:feature_id])\n is_a_new_label = (params[:label] != feature.label)\n feature.update_attributes({:label => params[:label], :automatic_rating_mode => params[:automatic_rating_mode], :extract => params[:extract]})\n if is_a_new_label\n Feature.rebuild!\n feature.update_path_and_sort\n end \n redirect_to(features_category_path(feature.category_id)) \n end", "def rebuild_feature_dictionary\n if current_domain.locked?\n warn \"[HERCULE] attempt to rebuild feature dictionary for locked domain '#{@domain}'\"\n return\n end\n\n # Extract the document instances from the cache hash values\n docs = current_domain.cache.values\n\n # Compile a list of unique features from each cached doc\n feature_dictionary = current_domain.dictionary\n feature_set = current_domain.feature_set\n\n max_dict_id = feature_dictionary.keys.max || -1\n\n docs.each do |doc|\n # Iterate all features for this doc instance, and unless the\n # dictionary already contains the feature, add it and assign a\n # new feature id\n doc.feature_list.each do |feature|\n unless feature_set.member?( feature )\n max_dict_id += 1\n feature_dictionary[max_dict_id] = feature\n feature_set << feature\n end\n end\n end\n\n # Rebuild all feature vectors for documents in this domain\n docs.each{ |doc| doc.calculate_feature_vector }\n end", "def attributize_keys\n keys.each do |key|\n self[key.parameterize.underscore.to_sym] = delete(key)\n end\n self\n end", "def rename_field dirty_key, opts={}\n do_token = opts[:auto_tokenize]\n do_token = self.auto_tokenize? if do_token.nil?\n to_field = opts[:field_renames] || self.field_renames\n clean_key = format_field(dirty_key)\n field_key = to_field[clean_key]\n field_key = do_token if field_key.nil? and (not do_token.nil?)\n case field_key\n when Symbol then field_key\n when true then clean_key.to_sym\n when false then clean_key\n else\n raise ArgumentError, \"Unknown Auto Rename Field Value: #{clean_key}\"\n end\n end" ]
[ "0.6301366", "0.62295955", "0.5466629", "0.5466629", "0.5466629", "0.5434035", "0.53715736", "0.5360552", "0.5155004", "0.5136298", "0.5098188", "0.50201136", "0.49748418", "0.49628422", "0.49136692", "0.48518652", "0.4793298", "0.479193", "0.47818497", "0.47798422", "0.47682396", "0.4764176", "0.47578615", "0.4753813", "0.4724354", "0.47233823", "0.4721381", "0.4716432", "0.47149107", "0.4712029", "0.47117326", "0.47078183", "0.46973363", "0.4685666", "0.46806216", "0.46626884", "0.46611205", "0.4660975", "0.46496737", "0.46495372", "0.46438646", "0.46373785", "0.46234816", "0.45956498", "0.45830965", "0.45666906", "0.45615998", "0.45473158", "0.45159632", "0.45145932", "0.4506101", "0.45055845", "0.4503844", "0.44957745", "0.44867575", "0.4486351", "0.44849274", "0.448001", "0.44784263", "0.44784263", "0.4477792", "0.4470187", "0.44562554", "0.4454625", "0.44499403", "0.44402954", "0.44399944", "0.443445", "0.44327885", "0.44316468", "0.4430876", "0.4426219", "0.44216233", "0.44162512", "0.44136715", "0.44091508", "0.44085678", "0.44062886", "0.4404096", "0.44039598", "0.44004795", "0.43942443", "0.43897063", "0.4389344", "0.43888944", "0.4385437", "0.43838185", "0.4378727", "0.4378206", "0.4377964", "0.43604186", "0.43571696", "0.4350539", "0.43479633", "0.43476576", "0.43476576", "0.4340002", "0.43327597", "0.43246338", "0.4324622" ]
0.4464286
62
Return a new generateduid
def new_generateduid CFUUIDCreateString(nil, CFUUIDCreate(nil)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end", "def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n end", "def generate_uid\n [Time.now.strftime('%Y%m%d%H%M%S'), \"%05d\" % rand(10000)].join\n end", "def generate_uid(prefix=\"uid\")\n\t$uid_base += 1\n\tdate_str = DateTime::now().strftime($uid_datetime_fmt)\n\treturn \"#{prefix}.#{date_str}.#{$uid_base}\"\nend", "def assign_uid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n uid = ''\n 1.upto(8) {\n i = rand(62)\n uid += chars[i]\n }\n self.uid = uid\n end", "def generate_new_id\n Util::UUID.generate\n end", "def new_uuid\n UUIDTools::UUID.timestamp_create.hexdigest\n end", "def random_uid\n SecureRandom.hex 5\n end", "def generate_new_id\n UUIDTools::UUID.random_create.to_s\n end", "def create_guid\n self.id ||= UUIDTools::UUID.random_create.to_s\n end", "def generate_uid\n if self.id && !self.uid\n self.uid = \"cld-#{self.id}\"\n Group.update_all({uid:self.uid}, {id: self.id})\n end\n return true\n end", "def get_new_uuid\n uuid = UUID.new\n return uuid.generate\n end", "def generate_uid\n random_uid = rand(1000000000)\n if(HardwareItem.where(uid: random_uid)).any?\n generate_uid\n else\n random_uid\n end\n end", "def generate_uid(io)\n SecureRandom.hex(30)\n end", "def new_id\n SecureRandom.uuid\n end", "def unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end", "def generate_id\n Util::UUID.generate\n end", "def get_uuid\n rand_str = SecureRandom.hex\n timestamp = Time.now.to_i.to_s\n\n rand_str + timestamp\n end", "def suuid; uuid; end", "def generate_uid\n if self.id && !self.uid\n self.uid = \"app-#{self.id}\"\n App.update_all({uid:self.uid}, {id: self.id})\n end\n return true\n end", "def assign_uuid\n self.id = UUIDTools::UUID.timestamp_create().to_s\n end", "def generate_suuid(data)\n\t\t\tself.class.generate_suuid(data)\n\t\tend", "def get_uid_int\n self.uid.to_i\n end", "def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end", "def uid_from(*args)\n build_uid(*args)\n end", "def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end", "def create_guid\n self.guid = SecureRandom.uuid\n end", "def generate_user_id\n # ap(generate_user_id: {})\n @user_data.insert({}).to_s\n end", "def uid() end", "def generate_unique_id\n \"1.3.6.1.4.1.21367.2009.5.14.#{id}.#{Time.now.to_i}\"\n end", "def generate_id \n end", "def gen_uuid\n `uuidgen -t`.chomp.delete('-')\nend", "def generate_uid\n def tri vals\n \"#{vals.sample}#{vals.sample}#{vals.sample}\"\n end\n chars = (\"A\"..\"Z\").to_a\n numbers = (\"0\"..\"9\").to_a\n self.uid = loop do\n uid = \"#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}\"\n break uid unless Ticket.where(uid: uid).exists?\n end\n end", "def generateGuid\n def s4() ((1 + rand) * 0x10000).round.to_s(16)[1..-1] end\n \"#{s4}#{s4}#{s4}#{s4}\"\n end", "def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end", "def uid\n# ustr = \"u#{user_id}t#{target_type}#{target_id}c#{created_at.strftime('%d%m%y%H%M%S')}\"\n # ustr.to_i(36)\n# ustr.hash.abs.to_i\n\n # Make a simple string of attributes concatenated together to act as an ID\n case target_type\n when \"Conversation\"\n ustr = \"1\"\n when \"Feedback\"\n ustr = \"2\"\n when \"FeedbackRequest\"\n ustr = \"3\"\n when \"Availability\"\n ustr = \"4\"\n else\n ustr = \"5\"\n end\n ustr = \"#{ustr}#{user_id}#{target_id}#{created_at.strftime('%d%m%y%H%M%S')}\"\n return ustr.to_i\n end", "def generate_uuid\n UUIDTools::UUID.random_create.to_s\n end", "def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end", "def create_uuid\n SecureRandom.uuid\n end", "def generate_temporary_id\n (Time.now.to_f*1000).to_i.to_s\n end", "def generate_id\n id_generator.call\n end", "def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end", "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", "def uid\n id && Base58GMP.encode(id)\n end", "def add_uuid\n self.uuid ||= UUIDTools::UUID.timestamp_create().to_s\n end", "def generate_uuid\n return Digest::MD5.hexdigest \"#{SecureRandom.hex(10)}-#{DateTime.now.to_s}\"\nend", "def _uid(uuid = @uuid)\n uuid && uuid[0,6]\n end", "def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end", "def set_guid\n \tif self.guid.nil?\n \t\t# we have a create (to whom ever is reading this, I am sure I could use something like before_create instead, but I prefer this more controlled method)\n \t\tself.guid = Digest::MD5.hexdigest(\"#{uid}--#{Time.now.to_i}\")\n \t\tend\n end", "def gen_id\n SecureRandom.hex(32)\n end", "def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend", "def assign_identifier\n self.id ||= SecureRandom.uuid\n end", "def generate_uuid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n self.uuid = (0..UUID_LEN-1).collect { chars[Kernel.rand(chars.length)] }.join\n end", "def unique_id\n id || @generated_dom_id || (@generated_dom_id = Time.now.to_f.to_s.gsub('.', '_'))\n end", "def createGuid\n chars = (0...2).map{ ('a'..'z').to_a[rand(26)] }.join\n prefix = \"#{Time.new.year}#{chars}-\"\n\n return prefix + SecureRandom.uuid\nend", "def create_uid(id)\n id.parameterize\n end", "def basic_generate_id(str); end", "def uid(*) end", "def uid\n @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')\n end", "def uid\n @name.to_s.downcase.gsub(/[^a-z0-9]+/, '').gsub(/-+$/, '').gsub(/^-+$/, '')\n end", "def generate_id\n now = Time.now\n parts = [now.to_i, now.usec, $$, rand(16**8)]\n parts.map {|i| i.to_s(16)}.join('-')\n end", "def create_uuid_for_id\n if self.id.nil?\n self.id = SecureRandom.uuid\n #self.id = SecureRandom.uuid.gsub('-','').upcase\n end\n end", "def id\n @uid\n end", "def assign_uuid\n self.uuid ||= \"_#{SecureRandom.uuid.tr('-', '_')}\"\n end", "def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end", "def set_uid\n write_attribute('uid', self.uid)\n end", "def uid_for(entity_id)\n case ::Settings.uuid_strategy\n when :human_readable then human_readable_uid(entity_id)\n when :uuids then sequence_uuid(entity_id)\n else raise \"Unknown UUID generating strategy: #{::Settings.uuid_strategy}. Choose from (:human_readable_uids, :sequence_uuids)\"\n end\n end", "def uid; end", "def gen_small_uuid\n %x[/usr/bin/uuidgen].gsub('-', '').strip\n end", "def generate_id\n SecureRandom.urlsafe_base64 21\n end", "def gen_small_uuid()\n %x[/usr/bin/uuidgen].gsub('-', '').strip\n end", "def set_unique_id\n self.update_column(:unique_id, Digest::MD5.hexdigest(self.id.to_s+Time.now.to_s))\n end", "def assign_uuid\n self.uuid ||= SecureRandom.urlsafe_base64(8)\n end", "def generate_tid\n # Input string we feed into the hash algorithm\n # It IS possible to have hash collisions:\n #\n # 1. Let's assume our system clock is perfect. The only way to get a hash\n # collision is to somehow submit multiple tag creation requests with the\n # same data at the exact same time. \n #\n # 2. Now, in reference to this article...\n # infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time\n # If our system clock screws up, hash collisions could happen in the\n # following manner:\n # * Leap seconds\n # * Clock somehow gets \"reset\" to some previous time in the past, allowing\n # someone to replay past requests at the exact same times.\n sha1 = OpenSSL::Digest::SHA1.new\n sha1 << self.location\n sha1 << self.user_id.to_s\n sha1 << Time.now.to_f.to_s\n tid = sha1.hexdigest\n\n self.tid = tid\n end", "def set_default_exuid\n self.exuid ||=\n Base32.encode(SecureRandom.random_bytes(16)).downcase.sub(/=*$/, '')\n end", "def generate_id\n @mutex.synchronize { @current_id += 1 }\n end", "def uuid!\n @uuid ||= ::UUID.timestamp_create.to_s\n end", "def create_uuid\n self.uuid = SecureRandom.hex(12)\n end", "def unique_id\n object_id.abs.to_s(16)\n end", "def generate_unique_name\n SecureRandom.uuid\n end", "def set_uid\n unless gn.blank? || sn.blank?\n self['uid'] = gn.to_slug.approximate_ascii.normalize.to_s + '.' + sn.to_slug.approximate_ascii.normalize.to_s if uid.blank?\n end\n end", "def set_default_exuid\n self.exuid ||=\n SecureRandom.random_bytes(8).unpack('Q').first & 0x7fffffffffffffff\n end", "def generate_id\n SecureRandom.hex(8)\n end", "def unique_id\n '%8x%s@%s' % [\n Time.now.to_i,\n Digest::SHA1.hexdigest(\n '%.8f%8x' % [ Time.now.to_f, rand(1 << 32) ]\n )[0, 32],\n Socket.gethostname\n ]\n end", "def generate_identifier\n self.identifier = Digest::MD5.hexdigest(\"PersonRecordIdentifier#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end", "def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend", "def genrateuid\n\n res1=@con.query(\"select uid from user order by uid desc limit 1\")\n row10=res1.fetch_row\n if row10.nil?\n @id=100\n \n else\n no=row10[0].to_i\n @id=no+1\n end\n\n res2=@con.prepare(\"insert into user values(?,?)\")\n res2.execute(@id,@name)\n end", "def generate_id\n # Max value is 9223372036854775807 (signed long in Java)\n rand(ID_RANGE)\n end", "def generate_token\n UUIDTools::UUID.random_create.to_s\n end", "def generate_uuid\n\t\t\t\tSecureRandom.hex(5)\n\t\t\tend", "def uid\n @uid\n end", "def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end", "def identifier\n SecureRandom.hex(16)\n end", "def generate_machine_id()\n \n end", "def uid\n @uid ||= (@in['uid_hi'] << 16) | @in['uid_lo']\n end", "def populate_uuid\n self.uuid = SecureRandom.uuid()\n end", "def get_next_uuid\n rand(8**32).to_s(36)\n end" ]
[ "0.850823", "0.8205398", "0.82017654", "0.80643654", "0.79963976", "0.7799288", "0.7789262", "0.7745595", "0.7724384", "0.7689694", "0.7663927", "0.76461434", "0.76276183", "0.76168764", "0.75199246", "0.7472211", "0.7452438", "0.74369764", "0.7379788", "0.735951", "0.7320901", "0.7307395", "0.73030597", "0.72665805", "0.72643155", "0.72488093", "0.72329897", "0.7225698", "0.72215986", "0.72203916", "0.72171503", "0.7205728", "0.7173989", "0.7170496", "0.71307606", "0.7120453", "0.71204066", "0.7104158", "0.7075926", "0.70509446", "0.70377", "0.7030798", "0.7022948", "0.7022948", "0.70183975", "0.70041096", "0.6999559", "0.6985916", "0.6977936", "0.69651556", "0.6961141", "0.6940213", "0.69256437", "0.6918352", "0.69097126", "0.6901471", "0.6887429", "0.6875653", "0.6861744", "0.6849284", "0.68353605", "0.68353605", "0.68325275", "0.68317705", "0.68206483", "0.68141174", "0.6807655", "0.6800444", "0.6798815", "0.67930025", "0.679132", "0.67890894", "0.6779811", "0.67775977", "0.6775584", "0.6773807", "0.6769656", "0.6766893", "0.67664844", "0.6764113", "0.675781", "0.6753062", "0.6747732", "0.67461646", "0.6742735", "0.6726328", "0.67250377", "0.67246467", "0.6723663", "0.67233306", "0.67207396", "0.67027783", "0.67009157", "0.6699793", "0.6699642", "0.6686723", "0.66863996", "0.6678127", "0.66747546" ]
0.8759782
1
Load the computer object Returns an NSDictionary representation of the the user.plist if it exists If it doesn't, it will return nil
def get_computer(name) @file = "/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/computers/#{name}.plist" NSMutableDictionary.dictionaryWithContentsOfFile(@file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end", "def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end", "def load_config\n @preferences = \"/Library/Preferences/com.apple.RemoteManagement.plist\"\n config = NSMutableDictionary.dictionaryWithContentsOfFile(@preferences)\n end", "def loadDataFromDisk\n begin\n data = NSKeyedUnarchiver.unarchiveObjectWithFile(pathForDataFile)\n print \"(Init) Loaded user data from disk: #{data.inspect}\\n\"\n rescue\n print \"(Init) Corrupt data store! Unarchiving failed! #{$!}\\n\"\n end\n self.user = ApplicationData.new(data)\n end", "def load_user(filepath)\n $user = load_yaml(filepath)\nend", "def load_user_hive\n debug \"Loading NTUSER.DAT for '#{@resource[:user]}'\"\n\n home_path = nil\n begin\n Win32::Registry::HKEY_LOCAL_MACHINE.open(\"SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\ProfileList\\\\#{@user_sid}\") do |key|\n home_path = key['ProfileImagePath']\n end\n rescue Win32::Registry::Error => error\n self.fail \"Cannot find registry hive for user '#{@resource[:user]}'\"\n end\n\n ntuser_path = File.join(home_path, 'NTUSER.DAT')\n\n Puppet::Util::Windows::Security.with_privilege(Puppet::Util::Windows::Security::SE_RESTORE_NAME) do\n result = self.class::WinAPI.RegLoadKey(Win32::Registry::HKEY_USERS.hkey, @user_sid, ntuser_path)\n unless result == 0\n raise Puppet::Util::Windows::Error.new(\"Could not load registry hive for user '#{@resource[:user]}'\", result)\n end\n end\n\n self.class.loaded_hives << { :user_sid => @user_sid, :username => @resource[:user] }\n end", "def load_plist(file)\n NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end", "def load_player(name, password, game_objects)\n goid = nil\n\n open_store \"players\" do |gd|\n goid = gd[name.downcase]\n end\n\n if goid.nil?\n log \"Could not fetch player info #{name}\"\n raise MUDError::UnknownCharacter\n end\n\n unless check_password name, password\n raise MUDError::BadPassword\n end\n\n log \"Loading player...#{goid}\"\n return load_object(goid, game_objects)\n end", "def loadData!\n v = validateWorkingDir!\n @plataforms = YAML::load_file(File.open(getWorkingDir+'/data.host', 'r'))\n if(@plataforms == false)\n @plataforms = Hash.new\n end\n return v\n end", "def loadUser(userName)\n if(userName == nil)\n return nil\n end\n userFile = @CONFIG_ROOT+@CONFIG_REST_PATH+userName+\".yaml\"\n if File.exist?(userFile)\n user = YAML.load_file(userFile)\n #puts \"User: #{user}\"\n return user\n end\n return nil\n end", "def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend", "def read_profile_preferences(profile)\n dir = profile.layout_on_disk\n File.read(File.join(dir, \"user.js\"))\n end", "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", "def load(identifier)\n user_hash = JSON.parse(redis(\"get\", \"user:session:#{identifier}\"))\n raise \"Given user is empty\" if user_hash.nil?\n\n @id = user_hash['id']\n @name = user_hash['name']\n @email = user_hash['email']\n @hash = Digest::MD5.hexdigest(user_hash['email'])\n @role = user_hash['role']\n @color = user_hash['color']\n @nsfw = user_hash['nsfw']\n end", "def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @letter = contents['letter']\n puts \"Game has been loaded from Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "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", "def load_launcher_data launcher_data_file=\"bin/LAUNCHER_TYPE\"\n launcher_data = nil\n\n begin\n File.open launcher_data_file do |f|\n launcher_data = YAML.load(f.read)\n end\n rescue Errno::ENOENT\n end\n\n return launcher_data\nend", "def load_profile(name); end", "def load_current_resource\n @my_home = new_resource.home ||\n \"#{node['user']['home_root']}/#{new_resource.username}\"\n @my_shell = new_resource.shell || node['user']['default_shell']\n @manage_home = bool(new_resource.manage_home, node['user']['manage_home'])\n @create_group = bool(new_resource.create_group, node['user']['create_group'])\n @ssh_keygen = bool(new_resource.ssh_keygen, node['user']['ssh_keygen'])\nend", "def load_favourite(name)\n @settings = {}\n if File.exists?(File.expand_path(\"~/.wormholes\"))\n sites = Psych.load(File.read(File.expand_path(\"~/.wormholes\")))\n if !sites[name].nil?\n @settings = sites[name]\n end\n end\nend", "def user=(user)\n # HKLU hive file\n @file = \"#{@profiles}/#{user}/NTUSER.DAT\"\n\n raise \"Invalid profile: #{@file}\" unless File.exists? @file\n end", "def load_user_and_profile\n\t\t@user = current_user\n\t\t@user.load_profile\n\t\t@profile = @user.profile\n\tend", "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", "def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end", "def load_plist(bundle, path)\n data = bundle.storage.open(path, &:read)\n plist = CFPropertyList::List.new(data: data)\n CFPropertyList.native_types(plist.value)\n end", "def profile\n threaded[:profile] ||= Profile.load\n end", "def profile\n threaded[:profile] ||= Profile.load\n end", "def load_launcher_data launcher_data_file=\"bin/LAUNCHER_TYPE\"\n launcher_data = nil\n\n begin\n File.open launcher_data_file do |f|\n launcher_data = YAML.load(f.read)\n end\n rescue Errno::ENOENT\n end\n\n return {'launcher_main' => 'org.jruby.Main'}\nend", "def pbLoadMetadata\n $PokemonTemp = PokemonTemp.new if !$PokemonTemp\n if !$PokemonTemp.pokemonMetadata\n if !pbRgssExists?(\"Data/metadata.dat\")\n $PokemonTemp.pokemonMetadata = []\n else\n $PokemonTemp.pokemonMetadata = load_data(\"Data/metadata.dat\")\n end\n end\n return $PokemonTemp.pokemonMetadata\nend", "def load_user\n @user = User.find_by_login(params[:user_id])\n @check_ownership_of = @user\n end", "def load_user\n @user = User.find_by_login(params[:user_id])\n @check_ownership_of = @user\n end", "def parse_people_config\n people_config_path = \"config/people/#{Etc.getlogin}.yml\"\n @people_config = ( YAML.load_file(people_config_path) if File.exist?(people_config_path) ) || YAML.load_file(\"config/people/roderik.yml\")\n end", "def load_profile(key)\n Merit::LoadProfile.load(load_profile_path(key))\n rescue NameError => ex\n raise(ex.message.match(/Merit$/) ? MeritRequired.new : ex)\n end", "def load\n @user ||= User.find(@id)\n end", "def load()\n\t\t\tif (!File.exists?File.dirname(CONFIG_FILE_PATH)+\"/config.dat\") then \n\t\t\t\t#puts \"Warning, the config.dat file was not found in the same directory as the running application.\"; \n\t\t\t\treturn false;\n\t\t\tend\n\t\t\tf=File.open(File.dirname(CONFIG_FILE_PATH)+\"/config.dat\",\"rb\")\n\t\t\tconfig=Marshal.load(f.read)\n\t\t\tf.close\n\t\t\treset()\n\t\t\t@identity_token, \n\t\t\t@application_id,\n\t\t\t@session_token, \n\t\t\t@profile_id,\n\t\t\t@testing,\n\t\t\t@revalidate,\n\t\t\t@ready_state,\n\t\t\t@renew_time = config.values_at *VALID_OPTIONS_KEYS\n\t\t\tvalidate_session(false)\n\t\tend", "def read\n # Alternative ways can be implemented here. (text file etc.)\n default = eval(Sketchup.read_default(\"Plugins_ae\", @identifier, \"{}\"))\n return (default.is_a?(Hash)) ? default : {}\nrescue\n return {}\nend", "def load_user_info\n\t\tif @user_info.has_key?(@@line_array[0].to_i)\n\t\t\t@user_info[@@line_array[0].to_i][@@line_array[1].to_i] = @@line_array[2].to_i\n\t\telse\n\t\t\t@user_info[@@line_array[0].to_i] = {@@line_array[1].to_i => @@line_array[2].to_i}\n\t\tend\n\tend", "def get_existing_profile(usr_prf)\n raise Utility::Errors::NotFound, \"Invalid UserProfile!\" unless usr_prf.present?\n get_prebuilt_profile(usr_prf.person_authentication_key)\n end", "def load\n if @file && File.exist?(@file) && File.stat(@file).size > 0\n h = YAML::load open(@file, 'r').read\n h.each { |k,v| self[k.to_sym] = v}\n return true\n end\n false\n end", "def profile()\n title = Sketchup.active_model.title or 'Untitled'\n @@profilemap[title]\n end", "def load_jnlp_object\n @first_parse = true\n begin\n if File.exists?(jnlp_object_path)\n @jnlp_object = YAML.load(File.read(jnlp_object_path))\n else\n update_jnlp_object\n end\n rescue ArgumentError\n if @first_parse\n @first_parse = false\n File.delete(jnlp_object_path)\n retry\n end\n raise\n end\n end", "def load_profile(cred_opts)\n creds = Wavefront::Credentials.new(cred_opts).config\n creds.transform_keys(&:to_sym)\n end", "def to_profile\n #load!\n profile = Profile.new(root, name)\n to_h.each do |k,v|\n next if PROFILE_OMIT.include?(k.to_s)\n profile.__send__(\"#{k}=\", v)\n end\n profile.resources.homepage = homepage\n profile.resources.repository = repository\n profile\n end", "def load_user\n if(user_signed_in?)\n @user = User.find(current_user.id)\n @config = @user.config\n @timer = @user.timer\n active_quest = @user.active_quest\n if(active_quest.nil?)\n @active_quest_model = nil\n @active_quest_name = ''\n @active_quest_url = '#'\n @active_quest_campaign_name = ''\n @active_quest__campaign_url = '#'\n else\n @active_quest_model = active_quest\n @active_quest_name = active_quest.name\n @active_quest_url = quest_path(active_quest)\n @active_quest_campaign_name = active_quest.campaign.name\n @active_quest_campaign_url = campaign_path(active_quest.campaign)\n end\n end\n end", "def load_profile(params)\n db = connect()\n profile = db.execute('SELECT * FROM users WHERE Id=?', params[\"id\"])\n return profile.first\n end", "def load_config(file_path)\n config = OpenStruct.new\n\tfile_path.gsub!(\"/\", \"\\\\\") if Selenium::WebDriver::Platform.windows?\n YAML.load_file(file_path).each do |k,v|\n config.send(\"#{k}=\", v)\n end\n\n config.browser ||= \"firefox\"\n config.username ||= config.user\n\n return config\n end", "def user_data\n require 'open-uri'\n begin\n open('http://169.254.169.254/latest/user-data').read\n rescue OpenURI::HTTPError => e\n nil\n end\n end", "def load_from_file!\n return unless File.exists?(uservoice_configuration_file)\n\n config = ERB.new(IO.read(uservoice_configuration_file)).result\n configuration = YAML::load(config)\n self.merge!(configuration[\"uservoice\"])\n end", "def de_serialiaze\n Logger.d(\"de_serialiazing the user object\")\n data_json = get_from_shared_prefs(@context, self.class)\n \n begin\n @data = JSON.parse(data_json) if not data_json.nil? and data_json.length > 0\n rescue Exception => e\n Logger.exception(:de_serialiaze, $!)\n end\n end", "def get_existing_profile(usr_prf)\n raise Utility::Errors::NotFound, \"Invalid UserProfile!\" unless usr_prf.present?\n get_prebuilt_profile(usr_prf.person_authenticated_key)\n end", "def load_hash(hash)\n @login = hash['login']\n @html_url = hash['html_url']\n @avatar_url = hash['avatar_url']\n @name = hash['name']\n @company = hash['company']\n @email = hash['email']\n end", "def load_game\n begin\n player = YAML.load_file(\"player.yaml\")\n return player\n rescue\n return nil\n end\nend", "def load_user\n @user = current_user\n @check_ownership_of = @user\n end", "def load_user\n if @intro_user == \"current\"\n puts \"placeholder, you exist!\"\n ## temp goes strait to file list without validation\n file_list\n elsif @intro_user == \"new\"\n create_account\n elsif @intro_user == \"exit\"\n puts \"ba-bye\"\n bye\n else \n puts \"I didn't get that! Try again\"\n intro\n end\n \nend", "def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end", "def info_plist_to_hash(path)\n require 'json'\n JSON.parse! %x[plutil -convert json -o - #{path}]\nend", "def retrieve_data\n File.file?(\"#{@username}\") ? customer = read_from_file : customer = User.new(username)\n customer\n end", "def retrieve_data\n File.file?(\"#{@username}\") ? customer = read_from_file : customer = User.new(username)\n customer\n end", "def plist name\n File.open(File.dirname(__FILE__) + \"/plist/#{name}.plist\").read\nend", "def data\n return @data if @data\n\n if File.exist?(settings_path)\n @data = YAML.load_file(settings_path)\n @data = user_settings.merge(@data)\n else\n puts \"ERROR: No settings file at #{settings_path}\"\n puts \"Please create a settings file via: ufo init\"\n exit 1\n end\n end", "def load_state\n save_file = File.read(\"saved_state.json\")\n json_hash = JSON.parse(save_file)\n @secret_word = json_hash[\"secret_word\"]\n @display_content = json_hash[\"display_content\"]\n @failed_attemps = json_hash[\"failed_attemps\"]\n end", "def user_data_obj(registry_endpoint, instance_id, dns, agent_id, network_spec, environment, vm_params, config, computer_name = nil)\n user_data = { registry: { endpoint: registry_endpoint } }\n if computer_name\n user_data[:'instance-id'] = instance_id\n user_data[:server] = { name: computer_name }\n else\n user_data[:server] = { name: instance_id }\n end\n user_data[:dns] = { nameserver: dns } if dns\n\n unless @uses_registry\n user_data.merge!(initial_agent_settings(agent_id, network_spec, environment, vm_params, config))\n user_data.delete(:registry)\n end\n\n user_data\n end", "def load_users\n\n $test_logger.log(\"Loading users...\")\n\n #Delete all users from terminal DB\n @@cmd_proc.delete_all_uers\n\n #Fetch finger images from resource\n finger1 = Resource.get_content(\"N1.pklite\", true)\n finger2 = Resource.get_content(\"N2.pklite\", true)\n\n #Create required user records on terminal DB\n user_map = {\n USER1_ID => User_DB_record.new({:name_UTF8 => \"Test MFU User 1\", :PIN_code_UTF8 => \"4455\",\n :first_finger_nb => 1,\n :templates => [User_templates.new(:template_type => Biofinger_template_type::Pklite,\n :template_data => finger1)]}),\n USER2_ID => User_DB_record.new({:name_UTF8 => \"Test MFU User 2\", :PIN_code_UTF8 => \"6677\",\n :first_finger_nb => 1,\n :templates => [User_templates.new(:template_type => Biofinger_template_type::Pklite,\n :template_data => finger2)]})\n }\n\n # USER_BAD_ID => User_DB_record.new({:name_UTF8 => \"Test bad quality id\",\n # :templates => [User_templates.new(:template_type => Biofinger_template_type::Pklite,\n # :template_data => bad_qual_finger)]})\n\n @@cmd_proc.call_thrift{user_DB_set_users(user_map, false)}\n \n end", "def plist; nil; end", "def plist; nil; end", "def user_configuration\n @user_configuration ||= begin\n path = File.join(::Rails.root, 'config', 'piwik.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]['piwik']\n end\n else\n {}\n end\n end\n end", "def load\r\n return unless File.exist?(STORAGE)\r\n\r\n props = YAML.load(File.read(STORAGE))\r\n props.each{|k, v| instance_variable_set(\"@#{k}\", v) }\r\n end", "def load_storage\n YAML.load_file(file_path) || {}\n end", "def _io_user_data(username)\n (node['etc'] && node['etc']['passwd'] && node['etc']['passwd'][username]) || {\n 'uid' => username,\n 'gid' => username,\n 'dir' => \"/home/#{username}\"\n }\nend", "def plist_file\n return @plist_file if defined? @plist_file\n\n name = \"#{resource[:name]}.plist\"\n glob = \"{\" + LAUNCHD_DIRS.join(\",\") + \"}/#{name}\"\n\n @plist_file = Dir[glob].first.to_s or raise \"Can't find #{name}.\"\n end", "def load_settings\n begin\n save = YAML.load_file('settings.yaml')\n unless save\n # the file is empty.. well, not valid YAML\n raise(ArgumentError)\n end\n \n # do something with the loaded values\n @maildirpath = save['maildirpath']\n @known = save['known']\n @ignore = save['ignore']\n @mailers = save['mailers']\n \n rescue Errno::ENOENT, ArgumentError => e\n # file not found or not valid\n # so create a valid one\n File.open('settings.yaml', 'w' ) do |out|\n save = {'maildirpath' => '/path/to/mh/',\n 'known' => {'Firstname Lastname' => ['user@server.tld']},\n 'ignore' => ['blacklist@bad.tld'],\n 'mailers' => {'Mailername' => ['RegEx']}\n }\n YAML.dump(save, out)\n end\n raise(ArgumentError, 'You should check settings.yaml before re-running this program')\n end\n end", "def get_pid_and_profile\n ck_valid\n \n # The PID file is required - If it is not found, it means we\n # cannot get any information for this instance. Bail out.\n raise InvalidInstance, _(\"Instance %s for %s is not running or did not \" +\n \"register its PID \") % \n [@num, @laboratory.name] unless File.exists? pid_file\n @pid = File.read(pid_file).chomp.to_i\n\n # However, the profile file is merely informational. We can safely\n # ignore it if it does not exist or is not readable\n begin\n @profile = Profile.find_by_id(File.read(prof_file).to_i)\n rescue Errno::ENOENT, Errno::EACCES\n @profile = nil\n end\n end", "def loaded_user\n user_type == 'MeetupUser' ? meetup_user : bridgetroll_user\n end", "def loader\n\t\tsave = loader_helper\n\t\tif save\n\t\t\tFile.open(\"saves/#{save}\", 'r'){ |f|\n\t\t\t\treturn YAML.load(f)\n\t\t\t} \n\t\tend\n\t\tfalse\n\tend", "def load\n manifest_uri, @manifest = @session.get_manifest(uri)\n @folders = extract_folders\n @resources = extract_resources\n @annotations = extract_annotations\n @loaded = true\n end", "def load\n\t @secure = true unless @secure\n\t @options = {}\n\t eval( File::open( \"p-album.conf\" ){|f| f.read }.untaint )\n\n\t # language setup\n\t @lang = 'ja' unless @lang\n\t begin\n\t instance_eval( File::open( \"#{PhotoAlbum::PATH}/p-album/lang/#{@lang}.rb\" ){|f| f.read }.untaint )\n\t rescue Errno::ENOENT\n\t @lang = 'ja'\n\t retry\n\t end\n\n\t @images_dir = './images/' unless @images_dir\n\t @thumbs_dir = './thumbs/' unless @thumbs_dir\n\t @perm = nil unless @perm\n\t @load_image_size = nil unless @load_image_size\n\n\t @index = './' unless @index\n\t @update = './update.rb' unless @update\n\n\t @index_page = '' unless @index_page\n\t @author_name = '' unless @author_name\n\t @recent = 5 unless @recent\n\t @html_title = '' unless @html_title\n\t @header = '' unless @header\n\t @footer = '' unless @footer\n\t @theme = 'default' if not @theme and not @css\n\n\t @options = {} unless @options.class == Hash\n\t if @options2 then\n\t @options.update( @options2 )\n\t else\n\t @options2 = {}.taint\n\t end\n\t @options.taint\n end", "def load\n end", "def load\n end", "def load\n end", "def load\n puts \"Would you like to load your previous game? (y/n)\"\n puts \"\"\n response = gets.strip.downcase\n puts \"\"\n if response == \"y\" && File.exist?(\"saves.yaml\")\n save = File.read(\"saves.yaml\")\n @computer = YAML::load(save)\n puts \"Your game has been loaded!\"\n puts \"\"\n else\n puts \"New game created!\"\n puts \"\"\n end\n end", "def load(data)\n\t\t\t\treset\n\t\t\t\t@config = data['config'] unless data['config'].nil?\n\t\t\t\t@plugin_config = data['plugin-config'] unless data['plugin-config'].nil?\n\t\t\t\t@valid_domains = data['valid_domains'] unless data['valid_domains'].nil?\n\t\t\t\t@default_domains = data['default_domains'] unless data['default_domains'].nil?\n\t\t\t\t@partials = data['partials'] unless data['partials'].nil?\n\t\t\t\tunless data['domains'].nil?\n\t\t\t\t\tdata['domains'].each_pair do |name, domain_data|\n\t\t\t\t\t\t@domains[name].load(domain_data)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ttrue\n\t\t\tend", "def load_storage\n path = Pathname.new(\"#{ENV['HOME']}/.hush/storage.yml\")\n path.file? ? YAML.load_file(path) : {}\n\n if path.file? && y = YAML.load_file(path)\n y\n else\n {}\n end\n end", "def load\r\n \r\n end", "def getUser(sessionId, userName)\n fullPath = \"#{@APPLICATION_HOME}/dashboard/.profiles/#{userName}.yaml\"\n if(userName != nil)\n\n return YAML.load_file(fullPath)\n end\n end", "def load_game\n\t\tload_gameplay = YAML.load(File.read 'saved_game.yaml')\n\t\t@board = load_gameplay[0]\n\t\t@current_player = load_gameplay[1]\n\t\tshow_board\n\t\tinput_validation\n\tend", "def load(dump)\n loader(dump).object\n end", "def read_plist_file(file_path)\n bad_xml_doctype = /^.*<!DOCTYPE plist PUBLIC -\\/\\/Apple Computer.*$/\n # We can't really read the file until we know the source encoding in\n # Ruby 1.9.x, so we use the magic number to detect it.\n # NOTE: We need to use IO.read to be Ruby 1.8.x compatible.\n if IO.read(file_path, binary_plist_magic_number.length) == binary_plist_magic_number\n plist_obj = CFPropertyList::List.new(:file => file_path)\n else\n plist_data = File.open(file_path, \"r:UTF-8\").read\n if plist_data =~ bad_xml_doctype\n plist_data.gsub!( bad_xml_doctype, plist_xml_doctype )\n Puppet.debug(\"Had to fix plist with incorrect DOCTYPE declaration: #{file_path}\")\n end\n begin\n # This is fucking terrible - I'm redirecting $stderr because I\n # can't swallow an error bubbled up by libxml when the file\n # /System/Library/LaunchDaemons/org.cups.cupsd.plist tries to\n # be parsed. That file has invalid double hyphens within an XML\n # comment, and even though the file passes `plutil -lint`, it's\n # invalid XML. It's been that way for fucking ever and it sucks.\n # I would REALLY appreciate a pull request to handle this better.\n orig_stderr = $stderr.clone\n $stderr.reopen('/dev/null', 'w+')\n plist_obj = CFPropertyList::List.new(:data => plist_data)\n $stderr.reopen(orig_stderr)\n rescue CFFormatError, LibXML::XML::Error => e\n Puppet.debug \"Failed with #{e.class} on #{file_path}: #{e.inspect}\"\n return nil\n end\n end\n CFPropertyList.native_types(plist_obj.value)\n end", "def load_archive\n {\n :user_data => self.read_key(self.user_data_key),\n :cloud_config => YAML::load(self.read_key(self.cloud_config_yaml_key)),\n :instance => YAML::load(self.read_key(self.instance_yaml_key))\n }\n end", "def load_game\n print_saves\n begin\n read_save\n rescue IOError, SystemCallError\n puts 'File not found'\n load_game\n end\n end", "def read_config\n @config = {}\n begin\n @config = Psych.load_file('config/prefs.yml')\n puts 'preferences loaded'\n rescue => e\n puts e\n puts e.backtrace\n puts 'An error occured while loading the preference file'\n puts 'User will be asked what to do'\n recreate_default_config\n read_config\n end\nend", "def load_user\n @user = User.find(params[:user_id])\n end", "def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end", "def load_pc(flush_it = false)\n if flush_it\n dispose_bitmaps_from_cache_tab(@pc_cache)\n else\n @pc_cache = {}\n @pc_data = Yuki::VD.new(PSDK_PATH + '/master/pc', :read)\n end\n end", "def loadRepositoryObject(path)\n #puts \"loadRepositoryObject :: #{path}\"\n if File.exist?(\"#{path}.obj\")\n loadeOb = File.open(\"#{path}.obj\").read\n repObj = YAML::load(loadeOb)\n return repObj\n else\n return nil\n end\n end", "def getUser login\n return false if !@usrData\n @usrData[login]\n end", "def cdb_load(name)\n Chef::CouchDB.new.load(\"webui_user\", name)\n end", "def load_prompt_file\n prompt_file = \"#{prompts_dir}/#{@host_param[:type]}_prompt.yml\"\n @prompt = load_yaml_file('prompt file', prompt_file)\n end", "def get_user(name)\n user = nil\n \n @user_pool.info\n @user_pool.each{ |u|\n if u.name==name\n user=Hash.new\n\n user[:id] = u.id\n user[:name] = u.name\n user[:password] = u[:password]\n end\n }\n return user\n end", "def parse_plist(path)\n plist_file_path = self.plist(path)\n if plist_file_path.present?\n Plist.parse_xml(plist_file_path)\n else\n ''\n end\n end" ]
[ "0.65846336", "0.632198", "0.61031497", "0.5831744", "0.56013286", "0.55993444", "0.5589866", "0.5400026", "0.5380556", "0.53011453", "0.5253398", "0.52241194", "0.519757", "0.5196514", "0.5191172", "0.5180691", "0.51286244", "0.5122096", "0.5077601", "0.5044679", "0.50346035", "0.50035095", "0.49641472", "0.49392936", "0.49188653", "0.49064428", "0.4900482", "0.4900482", "0.4899154", "0.48666188", "0.48650834", "0.48650834", "0.48624933", "0.48620725", "0.48597902", "0.48579565", "0.48501444", "0.48359594", "0.48345762", "0.48333323", "0.48269328", "0.48207644", "0.48188695", "0.48148283", "0.481367", "0.48063654", "0.47964352", "0.47943467", "0.47924906", "0.4788682", "0.47885433", "0.47868708", "0.47768056", "0.4775612", "0.4757505", "0.47508165", "0.47490972", "0.47245482", "0.47245482", "0.47184414", "0.4701816", "0.46996203", "0.46810624", "0.46800804", "0.4672317", "0.4672317", "0.46590155", "0.4656951", "0.46261382", "0.4624916", "0.4618475", "0.46125323", "0.4610394", "0.4600211", "0.4599612", "0.45941907", "0.45902386", "0.45820805", "0.45820805", "0.45820805", "0.4578174", "0.4572332", "0.45629978", "0.45617366", "0.45613185", "0.4555913", "0.45549923", "0.45421875", "0.45381087", "0.4520114", "0.45198572", "0.45139137", "0.45059714", "0.4499841", "0.44973972", "0.4492407", "0.44898972", "0.44894838", "0.4485639", "0.4478454" ]
0.6734758
0
Delete the user and applicable shadow hash file
def delete_computer begin FileUtils.rm_rf(@file) rescue Puppet::ExecutionFailure => detail fail("Could not destroy the computer record, #{resource[:name]}: #{detail}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_shadowhash_file(sender)\n raise ShadowHashError.new(ShadowHashError::UNSUPPORTED_OBJECT_ERR) unless sender.is_a? MacAdmin::User\n path = \"#{SHADOWHASH_STORE}/#{sender[:generateduid].first}\"\n FileUtils.rm path if File.exists? path\n !File.exists? path\n end", "def delete_user\n begin\n if @kernel_version_major < 11\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n FileUtils.rm_rf(password_hash_file)\n end\n FileUtils.rm_rf(@file)\n rescue Puppet::ExecutionFailure => detail\n fail(\"Could not destroy the user account #{resource[:name]}: #{detail}\")\n end\n end", "def destroy account\n destroy_file File.join(@ssh_home, account + \".identity\")\n destroy_file File.join(@ssh_home, account + \".identity.pub\")\n end", "def delete\n\t\tbegin\n\t\t\tFile.open(\"models/userDetails/#{@username}.txt\", \"r\") do |f|\n\t\t\t File.delete(f)\n\t\t\tend\n\t\trescue Errno::ENOENT\n\t\tend\n\tend", "def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end", "def delete(name)\n handle = system.run!(:search, \"user\", name, nil, @keyring)\n system.run!(:unlink, handle, @keyring)\n end", "def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue Errno::ENOENT\n end", "def purge\n ::FileUtils.rm(@fname)\n end", "def delete_from_file\n updated_data = []\n Login.load_data.each { |user| updated_data << user unless user['id'] == Login.user.uid.to_s }\n File.open(Login.userdata, 'w') do |f|\n f.puts JSON.pretty_generate(updated_data)\n end\n puts 'Your account has been deleted. The program will now exit.'.colorize(:light_red)\n @prompt.keypress('Press any key to continue..')\n exit\n end", "def destroy()\n FileUtils.remove_entry_secure(@keystore)\n end", "def destroy(file=@file)\n if self.legacy?\n return unless @password.send(:rm_file, self) \n end\n super\n end", "def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end", "def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def delete_temp_keychain()\n FileUtils.rm_rf(@temp_kc_path) if FileTest.exists? @temp_kc_path\n end", "def destroy\n file_store = FileStore.find_by_sha1_hash!(params[:id])\n if user['id'] == file_store.user_id || user['role'] == 'admin' ||\n (user['uname'] == 'file_store' && user['role'] == 'system')\n file_store.destroy\n head :no_content\n else\n render_error 403\n end\n end", "def remove_user_from_json\n hash = JSON.load File.new 'user_information/user_data.json'\n hash.delete @username\n File.open \"user_information/user_data.json\",\"w\" do |f|\n f.puts JSON.pretty_generate hash\n end\n end", "def unshare_file_in_db(file_id, user_id)\n $db.execute(\"DELETE FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id)\nend", "def delete\n # no need to delete all the associations because root_folder.delete does it\n self.root_folder.delete self\n # remove all friendships where the user is the source\n Friendship.all(source_id: self.id).destroy!\n # remove all friendships where the user is the target\n Friendship.all(target_id: self.id).destroy!\n\n # remove all associations where this user receives a file >BY< another user\n SharedToMeAssociation.all(user_id: self.id).destroy!\n # remove all associations where this user shared a file >TO< another user\n SharedByMeAssociation.all(user_id: self.id).destroy!\n\n self.destroy!\n end", "def delete_user(username)\n file_buffer = ''\n File.open(FTPUSERS_PATH, 'r') do |password_file|\n file_buffer = password_file.read\n end\n\n file_buffer.gsub!(/^#{username}.*$\\n/, '')\n\n File.open(FTPUSERS_PATH, 'w') do |password_file|\n password_file.write(file_buffer)\n end\n end", "def cleanup\n winrm.run_cmd( \"del #{base64_file_name} /F /Q\" )\n winrm.run_cmd( \"del #{command_file_name} /F /Q\" )\n end", "def delete_checksums\n # puts \"Del: #{@basename}\"\n @pkgdb.query(\"delete from checksums where basename = '#{@basename}'\")\n end", "def delete_rdf_file\n public_path = public_rdf_storage_path\n private_path = private_rdf_storage_path\n FileUtils.rm(public_path) if File.exist?(public_path)\n FileUtils.rm(private_path) if File.exist?(private_path)\n end", "def destroy(_)\n paths = [\n instance.provisioner[:root_path], instance.verifier[:root_path]\n ]\n paths.each do |p|\n FileUtils.rm_rf(p)\n logger.info(\"[Localhost] Deleted temp dir '#{p}'.\")\n end\n self.class.unlock!\n end", "def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end", "def cdb_destroy\n couchdb.delete(\"webui_user\", @name, @couchdb_rev)\n end", "def destroy\n File.delete(temp_path)\n end", "def delete_profile\n system 'clear'\n CoffeeMan.stay_logo\n @userid.delete\n puts \"Your account has been terminated\"\n puts \"NO CAFFEINE\"\n stop_music\n abort\n end", "def destroy\n \n @user = User.get(params[:id])\n \n\n user_dir = \"#{RAILS_ROOT}\" + \"/public/user_files/#{current_user.userid}/\"\n FileUtils.rm_rf user_dir\n \n # @mycarts = Mycart.all(:user_id => @user.id) \n # @mycarts.destroy\n\n @mytemplates = Mytemplate.all(:user_id => @user.id)\n @mytemplates.destroy\n \n @freeboards = Freeboard.all(:user_id => @user.id) \n @freeboards.destroy\n\n @myimages = Myimage.all(:user_id => @user.id) \n @myimages.destroy\n\n if @user.destroy\n redirect_to(admin_users_url) \n else\n puts \"에러 발생 ==========================================\"\n puts @user.errors\n redirect_to(admin_users_url) \n end\n \n\n end", "def delete current_user\n raise RequestError.new(:internal_error, \"Delete: no user specified\") if current_user.nil?\n\n # remove all its files\n self.files.each { |item| item.delete current_user }\n # remove all its children, meaning all its subdirectories. (all sub-sub-directories and sub-files will me removed as well)\n self.childrens.each { |children| children.delete current_user }\n\n if current_user.id != self.user_id then # if random owner \n # remove all links between this folder and the current user only\n FileUserAssociation.all(x_file_id: self.id, user_id: current_user.id).destroy!\n # remove all associations where this folder is a children of a folder belonging to the current user only\n FolderFolderAssociation.all(children_id: self.id).each do |asso|\n asso.destroy! if current_user.x_files.get(asso.parent_id)\n end\n # No sharing for folders: no SharedToMeAssociations\n\n else # if true owner \n # remove all links between this folder and ALL users\n FileUserAssociation.all(x_file_id: self.id).destroy!\n # remove all associations where this folder is a children of a folder belonging ALL users\n FolderFolderAssociation.all(children_id: self.id).destroy!\n # No sharing for folders: no SharedByMeAssociations\n\n # No need to remove the association where this folder is a parent (of a file or folder)\n # because the children have already been removed and all theirs associations\n #\n # FolderFolderAssociation.all(parent_id: self.id).destroy!\n # FileFolderAssociation.all(parent_id: self.id).destroy!\n \n # now remove the entity\n self.destroy!\n end\n end", "def delete_user(username, removehome=false)\n\t\t\tend", "def destroy account\n destroy_file File.join(@heroku_home, account + '.' + CREDENTIALS)\n end", "def clear_sandbox\n FileUtils.rm_rf sandbox\nend", "def local_remove(body)\n key_hash = _user_keyhash(body)\n raise \"Invalid username\" unless key_hash\n raise \"That user is signed in!\" if @var[:presence][key_hash]\n @connection.comm.rsa_keys.delete(body)\n @connection.comm.names.delete(key_hash)\n @var[:user_keys].delete body\n _save_env\n _notice \"User '#{body}' has been removed from your key repository\"\nend", "def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end", "def delete\n FileUtils.rm_rf(to_s)\n self\n end", "def test_cachedel_etcshadow\n assert_raise(Errno::EACCES) { File.cachedel(\"/etc/shadow\") }\n end", "def delete_script_files\n validate_before_delete_script_files!\n FileUtils.rm_rf root_dir if Dir.exists? root_dir\n FileUtils.rm symlink_file if File.symlink? symlink_file\n display.print \"Playwright script '#{script_name}' destroyed!\"\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def destroy\n\n # Deleting a file that is on the filsystem\n # if @user.filename\n # filename = Rails.root.join('public', 'uploads', @user.filename)\n # File.delete(filename) if File.exist?(filename)\n # end\n \n # Deleting image using Paperclip\n @user.avatar = nil\n \n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def teardown\n FileUtils.rm_rf(File.join('/tmp', @uuid))\n end", "def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end", "def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end", "def destroy_file\n db_file.destroy if db_file\n end", "def destroy\n FileUtils.rm_rf(target)\n end", "def remove_virus_affected_file()\n @import.destroy\n end", "def destroy_file\n File.delete full_file_path\n rescue\n end", "def destroy()\n\n path = self.get_dir\n FileUtils.remove_entry_secure(path, true)\n _clean_dir(File.dirname(path))\n\n super()\n end", "def destroy_file\n FileUtils.rm full_filename\n # remove directory also if it is now empty\n Dir.rmdir(File.dirname(full_filename)) if (Dir.entries(File.dirname(full_filename))-['.','..']).empty?\n rescue\n logger.info \"Exception destroying #{full_filename.inspect}: [#{$!.class.name}] #{$1.to_s}\"\n logger.warn $!.backtrace.collect { |b| \" > #{b}\" }.join(\"\\n\")\n end", "def reset_signup_folder\n FileUtils.rm_rf('./tmp/signup')\nend", "def remove_storage_file\n FileUtils.rm(file_path)\n end", "def clean!\n stop\n remove_instance_dir!\n FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)\n FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir\n md5.clean!\n FileUtils.remove_entry(config.version_file) if File.exists? config.version_file\n end", "def delete\n if stat.directory?\n FileUtils.rm_rf(file_path)\n else\n ::File.unlink(file_path)\n end\n ::File.unlink(prop_path) if ::File.exist?(prop_path)\n @_prop_hash = nil\n NoContent\n end", "def delete\n File.delete(header_file_full_path)\n File.delete(data_file_full_path)\n end", "def unlock!\n FileUtils.rm_f @path\n end", "def unshare\n login = params[:login]\n raise RequestError.new(:bad_param, \"Wrong login\") if login.nil? || login.length == 0\n user = User.all(login: login).first\n raise RequestError.new(:bad_param, \"User not found\") if user.nil?\n file = user.x_files_shared_to_me.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n\n file = WFile.unshare_to_user(session[:user], user, WFile.get(params[:id]))\n file.update_and_save\n @result = { success: true }\n session[:user].save\n end", "def clean_files\n ck_valid\n File.unlink(pid_file) if File.exists?(pid_file)\n File.unlink(prof_file) if File.exists?(prof_file)\n File.unlink(socket_file) if File.exists?(socket_file)\n end", "def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end", "def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end", "def destroy\n @user_info.destroy\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def destroy\n @user_trick.destroy\n end", "def teardown\n FileUtils.rm_rf(File.join('/tmp', @uuid))\n end", "def delete\r\n Marketplace::Database.instance.call_users(self)\r\n Marketplace::Database.instance.delete_user(self)\r\n ImageUploader.delete_image(self.picture, settings.root) if self.picture != nil\r\n items = Marketplace::Database.instance.items_by_user(self)\r\n items.each{ |item| item.delete }\r\n end", "def destroy\n FileUtils.rm_rf @root\n end", "def delete_user_route(user)\n self.client.delete(\"gh.storage.user.#{user}\")\n end", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def cleanup\n FileUtils.rm_f(@path)\n delete\n end", "def delete\n ::File.unlink(@path)\n end", "def purge\n\n FileUtils.remove_dir(@basepath)\n end", "def purge\n purge_file\n cdb_destroy\n end", "def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend", "def delete\n @linked_user.delete(@uri)\n end", "def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end", "def delete_tmp_dir(new_file)\n # versions hash is inicialized after storing all versions. We want to delete folder after all versions are restored\n # make sure we don't delete other things accidentally by checking the name pattern\n if versions.length > 0 && @cache_id_was.present? && @cache_id_was =~ /\\A[\\d]{8}\\-[\\d]{4}\\-[\\d]+\\-[\\d]{4}\\z/\n FileUtils.rm_rf(File.join(Rails.root.to_s,Refinery::PhotoGallery.photo_gallery_dir_relative_to_root, cache_dir, @cache_id_was))\n end\n end", "def shared_files\n if current_user.shared_files\n @assets = list_shared_assets\n \n assets = current_user.assets.all\n\n assets.each do |asset|\n if asset.tempfile == true\n asset.destroy\n end\n end\n end\n end", "def delete_user_account\n # delete their favorites before deleting user\n User.all.destroy(current_user.id)\n puts \"\n Your account have been removed! I will never tell, xoxo\n \"\n \n end", "def delete_temporary_files\n\t\t`rm -fr tmp/*`\n\tend", "def unlink_site\n FileUtils.rm_rf(self.absolute_path) if File.exists?(self.absolute_path)\n end", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend", "def delete_from_directory_for_user(directory, username)\n file_to_delete = File.join(directory, BitlbeeConfig::User.username_to_filename(username))\n File.delete(file_to_delete) if File.exist?(file_to_delete)\n end", "def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end", "def remove\n system(\"qconf -duser #{name}\")\n end", "def delete_opml_file\n if self.filename.present?\n Feedbunch::Application.config.uploads_manager.delete self.user_id, OpmlExporter::FOLDER, self.filename\n end\n end", "def destroy_scratch_dir\n FileUtils.rm_rf( @scratch_dir )\n end", "def safe_delete\n FileUtils.remove_entry_secure(SafeDeletable.path_for(self).to_s)\n rescue Errno::ENOENT\n # noop\n end", "def destroy\n @current_user.remove_avatar = true\n @current_user.save!\n head :no_content\n end", "def del_user login\n Command.new(\"deluser #{login} --remove-home -q\", check_file('/home/login', false))\n end", "def remove_chef_secure_path\n chef_secure_path.run_action(:delete)\n end", "def cleanTmp\n ts_str = \"/tmp/d\" + Date.today.strftime(\"%Y%m%d\") + \"-*\"\n Gitchefsync.logger.info \"clean up of #{ts_str}\"\n FS.cmdNoError \"sudo rm -fr #{ts_str}\"\n end", "def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end", "def destroy\n remove_files(@path + \"*\")\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def delete\n\t\tcurrent_user\n\t\tcurrent_user.regexpressions.destroy_all\n\t\tcurrent_user.tasks.destroy_all\n\t\tcurrent_user.clouds.destroy_all\n\t\tcurrent_user.platforms.destroy_all\n\t\tcurrent_user.demos.destroy_all\n\t\tcurrent_user.favorites.destroy_all\n\tend", "def delete\n self.users.each do |id|\n user = User.find_by_id(id)\n next if user.nil?\n user.databases.delete(self._id)\n user.working_db_id = nil if user.working_db == self\n user.save\n end\n super\n end", "def del\n File.delete(@file)\n end", "def destroy!\n FileUtils.rm_rf(self.path)\n end", "def cleanup\n File.delete(temp_file_path)\n end", "def delete!\n exist!\n File.unlink @path\n @path = nil\n end" ]
[ "0.80404484", "0.7054366", "0.67936337", "0.65763867", "0.6552159", "0.65131104", "0.64888465", "0.6463422", "0.6455796", "0.64265484", "0.6367067", "0.6345024", "0.6333642", "0.6321597", "0.62839127", "0.6239665", "0.6200543", "0.61945057", "0.6165592", "0.61498505", "0.61035126", "0.610188", "0.6073894", "0.6063646", "0.6045193", "0.60297847", "0.602567", "0.60226184", "0.601451", "0.6003306", "0.59843296", "0.59688", "0.5959411", "0.59574753", "0.59543824", "0.5948463", "0.59390664", "0.59368396", "0.5929837", "0.59272623", "0.5924015", "0.5916227", "0.5916227", "0.59148926", "0.5905981", "0.5893244", "0.58920103", "0.5884613", "0.58836246", "0.5879538", "0.5868836", "0.58606106", "0.58514583", "0.58480304", "0.5847432", "0.5845689", "0.5842627", "0.5841749", "0.5838429", "0.5837506", "0.58323413", "0.58323413", "0.582433", "0.58199686", "0.58187056", "0.5815537", "0.5814426", "0.58139265", "0.5807387", "0.5806434", "0.5802198", "0.5794664", "0.5788183", "0.5766871", "0.57628554", "0.5759169", "0.57572746", "0.5756854", "0.5755839", "0.575497", "0.5754126", "0.5754126", "0.57534885", "0.5753183", "0.574797", "0.5746592", "0.57433665", "0.57425326", "0.57373786", "0.57364136", "0.57355076", "0.57258445", "0.5725131", "0.57225907", "0.57134324", "0.5712587", "0.57118547", "0.57085866", "0.5706657", "0.56986517", "0.56985205" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_order_status @order_status = OrderStatus.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def order_status_params params.require(:order_status).permit(:status, :order_id, :detail) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
I worked on this challenge [ with: Angela Kosek]. 2. Pseudocode Input: method takes an arary of names Output: will return number of arrays with names in it for different groups Steps: DEF method create_group which takes an array as an argument Shuffle the array and assign it to variable shuffled_array SET variable new_groups to an empty array LOOP through shuffled_array ADD Every four elements as an array to new_groups END LOOP RETURN new_groups 3. Initial Solution
def new_groups(array) new_group = [] array.shuffle.each_slice(4){|acc| new_group << acc} if new_group.length > 1 && new_group.last.length <= 2 (new_group.last.length).times do |i| new_group[i].push(new_group.last.pop) new_group.pop end end new_group end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend", "def grouper(array)\n array = array.shuffle\n p num_groups = array.length / 4\n p remainder = array.length % 4\n groups = Array.new\n array.each_slice(4) {|slice| groups.push(slice)}\n if array.length == 6\n groups[1].push(groups[0][3])\n groups[0].pop\n\n elsif remainder == 0\n return groups\n elsif remainder == 1\n groups[0].push(groups[-1][0])\n groups.pop\n elsif remainder == 2\n groups[0].push(groups[-1][0])\n groups[1].push(groups[-1][1])\n groups.pop\n end\np groups\nend", "def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend", "def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend", "def groups(array_of_names)\r\n\r\n\tnum_people = array_of_names.length \t\t#how many people do we have?\r\n\tgroups_5 = num_people % 4 \t#how many groups will have 5\r\n\tgroups_4 = (num_people - (groups_5 * 5)) / 4 # how many groups will have 4\r\n\ttotal_groups = groups_4 + groups_5 \t\t#how many total groups\r\n\r\n\tgroup_hash = Hash.new([])\t#new hash initialized to empty arrays\r\n\t\r\n\tnum_group = 0\r\n\tindex = 0\r\n\r\n\tgroups_5.times do\r\n\t\tpeople_in_group = []\r\n\t\t5.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\tgroups_4.times do\r\n\t\tpeople_in_group = []\r\n\t\t4.times do\r\n\t\t\tpeople_in_group << array_of_names[index]\r\n\t\t\tindex += 1\r\n\t\tend\r\n\t\tgroup_hash[\"Accountability Group #{num_group}\"] = people_in_group\r\n\t\tnum_group += 1\r\n\tend\r\n\r\n\treturn group_hash\r\n\r\nend", "def group_gen_array(list,people=5)# list and number of people per group\n list = Array.new(list) #makes it so that it doesn't change original list\n x = list.length # gets a workable non changing length of list\n num = (x-(x % people))/people\n # ^ creates base number of groups subtract remainder as to not end up with small group\n acc_group = Array.new(num){[]} # create an array to store groups\n group_num = 0\n while x != 1\n x = list.length #changing list number\n y = rand(0...x) #random number\n case group_num\n when num #when exceed group number reset\n group_num = 0\n end\n acc_group[group_num] << list[y] #append random name\n list.delete_at(y) #remove name from list to prevent duplicates\n group_num += 1 if acc_group[group_num].length >= people#when group hits/is max people go to next group\n\n end\n return acc_group\nend", "def create_group(array)\nunit1=array.shuffle!.each_slice(4).to_a\nunit2=array.shuffle!.each_slice(4).to_a\nunit3=array.shuffle!.each_slice(4).to_a\nputs \"Unit1: #{unit1.to_s} Unit2: #{unit2.to_s} Unit3: #{unit3.to_s}\"\nend", "def accountability_groups(name_array, min_members)\n name_array = name_array.clone\n num_groups = name_array.length/min_members\n group_counter = 0\n group_array = Array.new(num_groups) { [] }\n\n while name_array.length > 0\n\ngroup_array[group_counter].push(name_array.delete_at(rand(0...name_array.length)))\n if group_counter == num_groups - 1\n group_counter = 0\n else\n group_counter += 1\n end\n end\n\n return group_array\n\nend", "def create_groups(list, shuffle = false)\n list.shuffle! if shuffle == true\n no_of_groups = list.size < 12 ? list.size/3 : list.size/4\n new_array = Array.new(no_of_groups) {[]}\n new_array.each_with_index {|x, i| new_array[i] << list.pop; break if list.size==0} until list.size == 0\n new_array\nend", "def assign_groups(team_list)\n # Set group size to 5 people in each group\n if team_list.length % 5 != 0\n num_groups = team_list.length/5 + 1\n end\n\n #Randomize the number of people in each group\n team = team_list.shuffle\n teams = Array.new(num_groups) { [] }\n\n #Put 5 people in each group\n teams.each do |index|\n 5.times do\n index << team.pop\n end\n end\n return teams\nend", "def group_creator(name_list)\n\n\taccountability_groups = []\n\trandomized_names = name_list.shuffle #Used non-destructive shuffle so that I can call on list again for unit 2/3\n\n\twhile (randomized_names.length > 4)\n\t\taccountability_groups << randomized_names.pop(4)\t\n\tend\n\n\tcounter = 0\n\tuntil (randomized_names.length == 0)\n\t\taccountability_groups[counter] << randomized_names.pop\n\t\tcounter\t+= 1\n\tend\n\t\t\n\tcounter = 0\n\tuntil accountability_groups[counter] == nil\n\t\tputs \"Group \" + (counter + 1).to_s + \":\" ; puts accountability_groups[counter]\n\t\tputs\n\t\tcounter += 1 \n\tend\nend", "def create_group(list) \n if list.length > 5 \n group = []\n group = list.shuffle.each_slice(5).to_a\n p group\n else\t\n p list\n end\nend", "def groupCreator(array)\n\t3.times do\n\t\tarray.shuffle!\n\t\t\tnewArray=array.each_slice(4).to_a\n\t\t\tnewArray.each do |x|\n\t\t\t\tif(x.length<4)\n\t\t\t\t\ti=0\n\t\t\t\t\tuntil x.length<=0\t\n\t\t\t\t\t\tnewArray[i]<<x.pop\n\t\t\t\t\t\ti+=1\n\t\t\t\t\tend\n\t\t\t\t\tnewArray.pop\n\t\t\t\tend\n\t\t\tend\n\t\t\tp newArray\n\tend\nend", "def acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups[2] << groups.last[2]\n\t\tgroups.pop\n\tend\n\ti = 1\n\twhile i <= groups.length\n\t\tputs \"Group \" + i.to_s\n\t\tputs groups[i-1]\n\t\ti += 1\n\tend\nend", "def name_array(array)\n group_size = 2\n # number_of_elements = array.length\n # number_of_arrays = number_of_elements / group_size.to_i\n shuffled = array.shuffle\n sliced = shuffled.each_slice(group_size).to_a\n if shuffled.length % 2 == 1\n sliced[-2] << sliced[-1][0]\n sliced.delete_at(-1)\n else\n sliced\n end\n sliced\nend", "def make_groups(array)\n groups=Hash.new\n counter = 1\n while array.length > 3\n selection = array.sample(4)\n groups[counter] = selection\n selection.each {|x| array.delete(x)}\n counter += 1\n end\n while array.length != 0\n counter -= 1\n groups[counter] << array.pop\n end\n groups\nend", "def acct_groups(array)\n if array.length % 5 != 0\n num_groups = array.length/5 + 1\n end\n \n cohort = array.shuffle\n groups = Array.new(num_groups) {[]}\n \n groups.each do |group|\n 5.times do \n group << cohort.pop\n end\n end\n \n return groups\nend", "def group(names)\n\tunits = []\n\t3.times do\n\t\tnames = names.shuffle\n\t\tremainder = []\n\t\tcount = names.length % 4\n\t\tcount.times do\n\t\t\tremainder << names.shift\n\t\tend\n\t\tgroupsArray = names.each_slice(4).to_a\n\t\twhile count != 0\n\t\t\tgroupsArray[count-1] << remainder.shift\n\t\t\tcount -= 1\n\t\tend\n\t\tunits << groupsArray\n\tend\n\treturn units\nend", "def accountability_group(dbcCohort_array)\n array_output = dbcCohort_array.shuffle.each_slice(4).to_a\n if array_output.length % 4 == 0 \n return array_output \n else \n remainder_people = array_output.pop \n for i in 0...array_output.length \n array_output[i].push(remainder_people[i])\n end\n return array_output\n end \nend", "def acct_groups(namelist)\n\tfull_size = namelist.size\n\tsize_of_group = 4 #because I counted the full list and counted 88 members... not sure how you'd go about it without having that number available\n\tnumber_of_groups = full_size / size_of_group #In this case 88/4 = 22\n\trandom_order = namelist.shuffle\n\tgroups = Array.new(number_of_groups) {[]}\n\t\tuntil random_order.empty?\n\t\t\tgroups.each do |group| \n\t\t\tgroup << (random_order.pop)\n\t\t\tend\n\t\tend\n\t\nreturn groups\nend", "def group_maker(array)\n group_hash = {}\n arrays = array.each_slice(5).to_a\n arrays.each do |item|\n if item.length == 2\n arrays[0].push(item[0])\n arrays[1].push(item[1])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n \n elsif item.length == 1\n arrays[0].push(item[0])\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n group_hash.delete_if {|k,v| v.length <= 2}\n else\n num = arrays.index(item)+1\n group_hash[\"group #{num}\"] = item\n end\n end\n return group_hash\nend", "def make_groups(all_students)\n\n #calculate how many groups of 5, with one group of leftovers\n num_full_groups = all_students.size / 5\n leftovers = all_students.size % 5\n group_avg = all_students.size.to_f / num_full_groups\n\n #each entry in group_sizes represents one group - put 5 in each full one\n group_sizes = Array.new\n for i in 0...num_full_groups\n group_sizes[i] = 5\n end\n\n #if there's a leftover group- while its size is (1 or more) students less than average, move students into it from other groups one by one\n if leftovers != 0\n i = 0\n while ((group_avg - leftovers) >= 1)\n group_sizes[i] -= 1\n leftovers += 1\n if i.next == num_full_groups\n i = 0\n else\n i = i.next\n end\n end\n group_sizes << leftovers #add leftovers group to group_sizes list\n end\n\n #now we have an array of group sizes, ex: [4,4,5,5,4]\n #populate new groups_names array with arrays of student names of those sizes\n\n groups_names = Array.new\n groupcount=0\n group_sizes.cycle(1) do |i|\n groups_names[groupcount] = Array.new\n for j in 0...i\n groups_names[groupcount][j] = all_students.shift\n end\n groupcount += 1\n end\n\n groups_names\n\nend", "def fidder_crabs(names)\n\n # Create empty container for everyone in the group\n everybody = Hash.new\n # Create a counter for group number, defalt to 1\n counter = 1\n\n names.shuffle\n #Mix it up.!!!!!\n\n #while the list is longer than 8 people, put 5 each in a group.\n while names.length >= 8 do\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter +=1\n names = names.drop(5)\n end\n\n #if the remainder is 5, have the last group with 5 people\n if names.length == 5\n names_in_group = names[0..4]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(5)\n\n #if the remaiinder group is 7, then we need to split the group into 4 and 3\n elsif names.length == 7\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n #creating the last group\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if the remainder is 6, we can have 2 groups of 3's\n elsif names.length == 6\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n #creating last group of 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n\n #if there is a remainder of 4 then create 1 group\n elsif names.length == 4\n names_in_group = names[0..3]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(4)\n\n #if the remainder is 3, then create the last group with 3\n elsif names.length == 3\n names_in_group = names[0..2]\n everybody[counter] = names_in_group\n counter += 1\n names = names.drop(3)\n else\n names.length < 3\n names_in_group = names[0..1]\n everybody[counter] = names_in_group\n names = names.drop(3)\n end\n\n # since we filter by 8, the highest remainder is 7 and the lowest is 3, only 7 and 6 need to be split into 2 groups, while 3 and 4 could be in 1 group by themselfs.\n everybody\n #Return the hash of everybody in their group number with their names.\nend", "def create_groups(list)\n list_copy = []\n list.each {|item| list_copy.push(item)}\n all_groups = []\n list_copy.shuffle!\n while list_copy.size >= 4\n group = list_copy.pop(4)\n all_groups << group\n end\n if list_copy.size > 0\n list_copy.each_with_index do |person, index|\n person = list_copy.pop\n all_groups[index].push(person)\n end\n end\n hash = {}\n all_groups.each_with_index do |group, index|\n hash[\"Accountability Group #{index}\"] = group\n end\n p hash\nend", "def make_groups(list_of_names)\n result = []\n num_people = list_of_names.length\n cur_group = []\n list_of_names.each do |name|\n cur_group.push(name)\n if cur_group.length == 4 || (cur_group.length == 3 && num_people == 3)\n result.push(cur_group)\n cur_group=[]\n end\n end\n # Right now the solution doesn't gracefully handle 6 people.\n # I should write a find_available function to find an open group to stick someone\n # in.\n if cur_group.length == 2\n name = cur_group.pop\n result[1].push(name)\n end\n if cur_group.length == 1\n name = cur_group.pop\n result[0].push(name)\n end\n return result\nend", "def group\n students = (1...59).to_a\n students.shuffle.each_slice(5).to_a\nend", "def assign(group)\n\tif group.length % 5 == 0\n\t\treturn group.shuffle.each_slice(5).to_a\n\telsif group.length % 5 == 1\n\t\treturn group.shuffle.each_slice(4).to_a\n\telsif group.length % 5 == 2\n\t\treturn group.shuffle.each_slice(4).to_a\n\telsif group.length % 5 == 3\n return group.shuffle.each_slice(5).to_a\n\telsif group.length % 5 == 4\n return group.shuffle.each_slice(5).to_a\n\tend\nend", "def assign_to_groups(number_of_students)\n if not ((number_of_students % 5) == 1 || (number_of_students % 5) == 2)\n group_size = 5\n easy = true\n else\n group_size = 4\n stragglers = number_of_students % group_size\n if stragglers == (0||3)\n easy = true\n else\n easy = false\n end\n end\n my_student_array = (1..number_of_students).to_a.shuffle\n group_assignments = Hash.new\n if easy == true\n assign(my_student_array, 0, group_assignments)\n else #easy = false\n assign(my_student_array, stragglers, group_assignments)\n while my_student_array.length > 0\n group_number -=1\n x = my_student_array.shift\n group_assignments[x] = group_number\n end\n end\n return group_assignments\nend", "def acct_groups(names)\r\n\r\n\tnum_groups = names.size / 4\r\n\r\n\tgroups_ary = Array.new(num_groups) { Array.new }\r\n\r\n\tnames.each_with_index do |name, index|\r\n\t\tgroups_ary[index % num_groups] << name\r\n\tend\r\n\r\n\tgroups_hash = Hash.new\r\n\tgroups_ary.each_with_index do |group_ary, index|\r\n\t\tgroups_hash[\"Accountability Group \" + (index+1).to_s] = group_ary\r\n\tend\r\n\r\n\treturn groups_hash\r\n\r\nend", "def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend", "def method_people(names, number)\n names_array = names.shuffle.map\n teams = (names.length.to_f / number).ceil\n new_array = Array.new(teams) { Array.new }\n count = 0\n names_array.map do |name|\n new_array[count] << name\n count == (teams - 1) ? (count = 0) : (count += 1)\n end\n new_array\n end", "def sort_groups_initial(array)\n\t#Set number of groups (one if there are less than four people)\n\tgroup_num = array.length / 4\n\tgroup_num = 1 if array.length < 4\n\n\tcounter = 1\n\n\t#Create a new hash with a default value of an empty array for any key\n\tgroup_hash = Hash.new { |k,v| k[v] = [ ] }\n\n\tarray.each do |i|\n\t\t#Add name to group number\n\t\tgroup_hash[counter] << i\n\n\t\t#Increase group number, or loop back to first group\n\t\tif counter == group_num\n\t\t\tcounter = 1\n\t\telse\n\t\t\tcounter += 1\n\t\tend\n\tend\n\n\treturn group_hash\nend", "def accountability_groups(students)\nnum_of_groups = (1..15).to_a #turns number of groups needed into an array\n\nstudent_groups = Array.new #array of arrays of 4 or 5 students \nacct_groups = Hash.new #keys[num_of_groups], value(student_groups)\n\nstudents.each_slice(4) { |s| student_groups << s } #returns array of 14 groups of 4, 1 group of 1\n\nleftover = student_groups.pop #assigns variable name to the group of 1 student\n\nstudent_groups[-1].push leftover #pushes 1 leftover student into the 14th group \n\nnum_of_groups.each_with_index { |i, j| acct_groups[i]=student_groups[j] } #assigns number of groups needed (15 groups) as the hash keys and assigns each student group to a key's value.\n\np acct_groups\n\nend", "def accounts(group)\n if group.length % 5 == 0\n return group.shuffle.each_slice(5).to_a\n end\nend", "def generate_groups(list)\n\n # decides how many accountability groups to make\n no_of_groups = (list.length/5.0).ceil\n sets = []\n\n # loops once per accountability group to assign cohortians\n no_of_groups.times do\n\n set = []\n while set.length < 5 && list.length > 0\n selected = rand(list.length)\n set << list[selected] unless set.include?(list[selected])\n list.delete_at(selected)\n end\n\n sets << set\n end\n\n # pulls two cohortians from other groups if the last group is smaller than 3\n if sets[-1].length < 3\n sets[-1] << sets[-2][0]\n sets[-2].delete_at(0)\n sets[-1] << sets[-3][0]\n sets[-3].delete_at(0)\n end\n\n n = 1\n sets.each { |set| puts \"Group #{n} is #{set}.\"; n += 1}\nend", "def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend", "def accountability_groups(students)\n\nthrowaway = []\nunit = []\ngroups = []\n\n3.times do\n\tthrowaway = students.dup\n\ti = 0\n\n\twhile(throwaway.size > 0) do\n\n\t\tunit << throwaway.sample(4) if throwaway.size % 4 == 0 \n\t\tunit << throwaway.sample(5) if throwaway.size % 4 != 0\n\t\tunit[i].each { |student| throwaway.delete(student) }\n\t\ti += 1\n\tend\n\n\tgroups << unit.dup\n\tunit.clear\nend\ngroups\nend", "def make_acct_groups\n\tputs \"Type in the number of students you have: \"\n\tnumber_students = gets.chomp.to_i\n\n\t# Construct the array with the numbers 1 ... number_stdnts\n\tstudent_id = Array.new(number_students) {|i| i+1 }\n\t#print student_id\n\n\tshuffle_id = student_id.shuffle.to_a\n\t#print shuffle_id\nmod4 = number_students % 4\n\n\tif (number_students == 6)\n\t\tnumber_groups = 2\n\telsif (mod4 ==3)\n\t\tnumber_groups = (number_students / 4) + 1\n\telse\n\t\tnumber_groups = (number_students / 4)\n\tend\n\n\tacct_groups = {} \t\n\tif (number_students == 6)\n\t\tfor i in 1..2\n\t\t\tif (i == 1)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[0], shuffle_id[1], shuffle_id[2]]\n\t\t\telse\t\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[3], shuffle_id[4], shuffle_id[5]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 3)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= number_groups -1\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 2)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= (number_groups-2)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telsif (i == (number_groups -1))\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i], shuffle_id[4*i+1]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 1)\n\t\tfor i in 1..number_groups\n\t\t\tif i <= (number_groups-1)\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\t\telse\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1], shuffle_id[4*i]]\n\t\t\tend\n\t\tend\n\telsif (mod4 == 0)\n\t\tfor i in 1..number_groups\n\t\t\t\tacct_groups[i.to_s] = [shuffle_id[4*i-4], shuffle_id[4*i-3], shuffle_id[4*i-2], shuffle_id[4*i-1]]\n\t\tend\n\tend\n\treturn acct_groups\nend", "def acct_groups(cohort)\n\tgroups_array = []\n\tcohort_array = cohort.split(\", \").shuffle!\n\theadcount = cohort_array.size\n\t\tif headcount < 6\n\t\t\tputs \"Too few students to sort!\"\n\t\telsif headcount == 6 || headcount == 9\n\t\t\tcohort_array.each_slice(3) { |three_person|\tgroups_array.push(three_person) }\n\t\telsif headcount <= 8 || headcount % 4 == 0\n \t\t\tcohort_array.each_slice(4) { |four_person| groups_array.push(four_person) }\n\t\telsif headcount % 5 == 0 || headcount >= 11\n \t\t\tcohort_array.each_slice(5) { |five_person| groups_array.push(five_person) }\t\t\n\t\twhile groups_array.last.size < 3\n\t\t\tgroups_array.last.push(groups_array[0][0]); groups_array[0].shift\n\t\t\tgroups_array.last.push(groups_array[1][0]); groups_array[1].shift\n\t\tend\n\t\tend\n\tgroups_hash = Hash.new\n\tnum = 0\n\tgroups_array.each { |team| groups_hash[num += 1] = team }\n\treturn groups_hash\nend", "def groups (student_arr)\n num_of_arrays = student_arr.size/5\n if student_arr.size%5 != 0\n num_of_arrays += 1\n end\n\n i = 0\n j = 0\n answer = Array.new(num_of_arrays) {Array.new}\n while j < student_arr.size\n while i < num_of_arrays\n answer[i] << student_arr[j]\n i += 1\n j += 1\n end\n i = 0\n\n end\n p answer\nend", "def output_groups(names_array, size_of_group)\n\tgroup_id = 1\n\tuntil names_array.size == 0 do\n\t\tputs \"Group \" + group_id.to_s\n\t\tputs \"=================\"\n\t\tputs names_array.shift(size_of_group)\n\t\tputs\n\t\tgroup_id += 1\n\tend\nend", "def create_teams(names_array, num_people_per_team)\n @newArray = []\n while names_array.length > 0\n @newArray << random(names_array)\n end\n @twoArray =[]\n\n (0...@newArray.length).step(num_people_per_team).each do |index|\n arr=[]\n for i in 0...num_people_per_team\n arr << @newArray[index + i]\n end\n @twoArray << arr\n end\n return @twoArray\nend", "def make_groups(name_master_list, group_size, min_group_size, shuffle_first = false)\n\tgroups = {}\n\t# Set initial group number\n\tgroup_num = 1\n\tname_master_list.shuffle! if shuffle_first\n\t\n\tname_master_list.each_with_index do |name, index|\n\t\t# Set the value as an empty array if it doesn't already exist\n\t\tgroups[\"Group #{group_num}\"] ||= [] \n\t\tgroups[\"Group #{group_num}\"] << name\n\t\t# Test whether we have either reached the group size already\n\t\t# Or if we have reached the final name (The item at the next index is nil)\n\t\tif (index + 1) % group_size == 0 && name_master_list[index + 1] != nil\n\t\t\t# Time to make a new group with a new group number\n\t\t\tgroup_num += 1\n\t\tend\n\tend\n\n\t# The last group will be the one with the current group_num value\n\tlast_group = groups[\"Group #{group_num}\"]\n\t# Test if the last group is too small; if so, add its members to the other groups\n\tif last_group.length < min_group_size\n\t\t# Make the second-to-last group the new group for the first member\n\t\tnew_group_num = group_num - 1\n\t\tlast_group.each do |name|\n\t\t\t# Put the member into its new group\n\t\t\tgroups[\"Group #{new_group_num}\"] << name\n\t\t\t# Set a different new group for the next member\n\t\t\tnew_group_num -= 1\n\t\tend\n\t\t# Get rid of the group that was too small, now that its members have new groups\n\t\tgroups.delete(\"Group #{group_num}\")\n\tend\n\n\treturn groups\nend", "def generate_one_grouping(size)\n\tstudents_array = self.students.to_a\n\tstudents_array.shuffle!\n \tgroup_sizes_array = determine_group_sizes(size)\n \tgroups = []\n \tgroup_sizes_array.each do |size|\n \t\tgroup = []\n\t\twhile group.length < size\n\t\t\tgroup << students_array.slice!(0)\n\t\tend\n\t\t\tgroups << group\n \tend\n \tgroups\n end", "def group(list)\n\tfinalArray = Array.new(0)\n\tsubArray = Array.new(0)\n\tmemCounter = 0\n\tgroupMemCounter = 0\n\tgroupCounter = 0\n\tlist.length.times do\n\t\tsubArray.push(list[memCounter])\n\t\tmemCounter += 1\n\t\tgroupMemCounter += 1\n\t\tif groupMemCounter > 4\n\t\t\tfinalArray.push(subArray)\n\t\t\tgroupCounter += 1\n\t\t\tgroupMemCounter = 0\n\t\t\tsubArray = []\n\t\t\tif memCounter == (list.length) and subArray.empty? != true\n\t\t\t\tfinalArray.push(subArray)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tif subArray.length < 3 and subArray.length != 0\n\t\tpreviousGroup = finalArray[groupCounter-1]\n\t\tfinalArray.pop\n\n\t\tsubArray.push(previousGroup[(previousGroup.length-1)])\n\t\tpreviousGroup.pop\n\t\tsubArray.push(previousGroup[(previousGroup.length-1)])\n\t\tpreviousGroup.pop\n\n\t\tfinalArray.push(previousGroup)\n\t\tgroupCounter += 1\n\tend\n\tif subArray.empty? != true\n\t\tfinalArray.push(subArray)\n\tend\n\tprint finalArray\nend", "def acct_groups(array)\n group_1 = []\n group_2 = []\n group_3 = []\n group_4 = []\n group_5 = []\n group_6 = []\n group_7 = []\n group_8 = []\n group_9 = []\n group_10 = []\n prime_group = []\n\n i = 0\n while i < array.length\n if (i % 3 == 0) && !(i % 4 == 0) && !(i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_1 << array[i]\n elsif (i % 4 == 0) && !(i % 5 == 0) && !(i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_2 << array[i]\n elsif (i % 5 == 0) && !(i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_3 << array[i]\n elsif (i % 6 == 0) && !(i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_4 << array[i]\n elsif (i % 7 == 0) && !(i % 11 == 0) && !(i % 13 == 0)\n group_5 << array[i]\n elsif i % 11 == 0\n group_6 << array[i]\n elsif i % 13 == 0\n group_7 << array[i]\n else\n prime_group << array[i]\n end\n i += 1\n end\n x = 0\n while x < prime_group.length\n if (x % 2 == 0) && !(x % 3 == 0)\n group_8 << prime_group[x]\n elsif x % 3 == 0\n group_9 << prime_group[x]\n else\n group_10 << prime_group[x]\n end\n x += 1\n end\n\n\n\n puts group_1\n puts group_1.length\n puts group_2\n puts group_2.length\n puts group_3\n puts group_3.length\n puts group_4\n puts group_4.length\n puts group_5\n puts group_5.length\n puts group_6\n puts group_6.length\n puts group_7\n puts group_7.length\n #puts prime_group\n #puts prime_group.length\n puts group_8\n puts group_8.length\n puts group_9\n puts group_9.length\n puts group_10\n puts group_10.length\n puts array.length\nend", "def acct_groups(arr)\n\n num = arr.length\n if num % 5 == 0\n arr.each_slice(5) {|a| p a}\n elsif num % 4 == 0\n arr.each_slice(4) {|a| p a}\n elsif num % 3 == 0\n arr.each_slice(3) {|a| p a}\n elsif (num - 1) % 3 == 0\n arr.each_slice(3) {|a| p a}\n elsif (num + 1) % 3 == 0\n p arr.pop(5)\n arr.each_slice(3) {|a| p a}\n elsif (num - 1) % 4 == 0 || (num + 1) % 4 == 0\n arr.each_slice(4) {|a| p a}\n else\n arr.each_slice(5) {|a| p a}\n end\nend", "def test5(array)\n\tputs \"Test5: Groups should be created randomly ->\"\n\tgroupMaker(array) != groupMaker(array) ? true : false\nend", "def randomize(names_array)\n\tnames_array.shuffle!\nend", "def randomizer(names)\r\n shuffled = names.shuffle\r\n sliced = shuffled.each_slice(2).to_a\r\n if shuffled.length % 2 == 1\r\n sliced[-2] << sliced[-1][0]\r\n sliced.delete_at(-1)\r\n sliced\r\n else\r\n sliced\r\n end\r\nend", "def groupSlice(fireflies)\n \n unit_one = fireflies.shuffle.each_slice(4).to_a\n unit_one[0] << unit_one.pop\n unit_one[0].flatten!\n\n unit_two = fireflies.shuffle.each_slice(4).to_a\n unit_two[0] << unit_two.pop\n unit_two[0].flatten!\n \n unit_three = fireflies.shuffle.each_slice(4).to_a\n unit_three[0] << unit_three.pop\n unit_three[0].flatten!\nend", "def group_creator\n group = Random.new.rand(1..3)\n return group\nend", "def create_groups(cohort)\n if cohort.length % 5 == 0\n hash = {} \t\n \tcounter = 1\n group_count = cohort.length / 5\n remainder = cohort.length % 5 \t\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..4)\n counter += 1\n end\n else\n \thash = {}\n counter = 1 \n group_count = cohort.length / 4\n remainder = cohort.length % 4\n # Set to groups(keys) to members(values)\n group_count.times do\n hash[counter] = cohort.slice!(0..3)\n counter += 1\n end\n end\n # Add remainders\n counter = 1\n cohort.each do |string|\n hash[counter] << string\n counter += 1\n end\nreturn hash\nend", "def number_of_groups(list_of_students)\n\tif list_of_students.length % 5 == 0\n\t\tnumber_of_groups = (list_of_students.length / 5) \n\telse\n\t\tnumber_of_groups = (list_of_students.length / 5) + 1\n\tend\nend", "def order_per_team(input_array, per_team)\n array = input_array.dup\n # Creates the bulk of teams\n output = (0...(array.length / per_team)).map do\n (0...per_team).map {array.delete_at(rand(array.length))}\n end\n # Corral any stragglers into last array element\n stragglers = []\n stragglers = (0...array.length).map { array.delete_at(rand(array.length)) }\n # binding.pry\n if stragglers.length < per_team -1\n output[0].concat(stragglers)\n else\n output << stragglers\n end\n raise \"order_per_team failed to add all elements to the outputs\" if array.length > 0\n output\nend", "def test5(array)\n\tputs \"Test5: Groups should be created randomly ->\"\n\tabg_maker(array) != abg_maker(array) ? true : false\nend", "def acct_groups(students)\nnum_students = students.length\n\n#driver code\n# p num_students\n\nif num_students <= 5\n p students\nelsif num_students % 5 == 0 || num_students % 5 >= 3\n p students.each_slice(5).to_a\nelsif num_students % 4 == 0 || num_students % 4 >= 3\n p students.each_slice(4).to_a {|group| p group}\nelsif num_students % 3 == 0\n p students.each_slice(3).to_a {|group| p group}\nelse\n p students.shift(3)\n p students.each_slice(5).to_a\nend\nend", "def test4(array)\n\tputs \"Test4: Groups should have 4 members max -> \"\n\tgroupMaker(array).any? {|x| x.length > 4} ? false : true\nend", "def random_pairs()\r\n\r\n\tpair_ups = []\r\n\r\n\tnamelist = [\"Allen\", \"Brian\", \"Cummie\", \"Dover\", \"Edwin\", \"FrankM\",\r\n\r\n\t\t\"FrankC\", \"George\", \"Jayvon\", \"John\", \"Khalifa\", \"Lee\", \"Lisa\",\r\n\r\n\t\t\"Matt\", \"Max\", \"Mike\", \"Pat\", \"Patrick\", \"Sheri\", \"Takhir\", \"Teela\"]\r\n\r\n\trandom_num = rand(0..9)\r\n\r\n\tshuffled_list = namelist.shuffle.each_slice(2)\r\n\r\n\tshuffled_list.each do |pairs|\r\n\r\n\t\tif pairs.length == 2\r\n\r\n\t\t\tpair_ups.push(pairs)\r\n\r\n\t\telse\r\n\r\n\t\t\tpair_ups[random_num].push(pairs[0])\r\n\r\n\t\tend\r\n\r\n\tend\r\n\r\n\treturn pair_ups\r\n\r\n# puts pair_ups.inspect\r\n\r\nend", "def generate_collection(array)\n array =[]\n 50.times do |n|\n array << n + 1\n end\n return array.shuffle\nend", "def generate_n_sets(array, number_of_sets)\n\nend", "def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end", "def group\n students = (1...59).to_a\n students.each_slice(5).to_a\n\nend", "def shuffle(array)\n ## record the length of the array\n x = array.length\n ## create a second array\n changedarray = []\n ## define a new variable to count through the items\n y = 0\n ## go through the array X times and insert\n ## the number of the item and the array item\n ## into the new second array\n ## then loop by adding 1 to 'y'cs\n x.times do\n changedarray.insert(y, array[y])\n y += 1\n end\n ## create a new array for the shuffled array\n shuffled = []\n ## while the length of the array isn't zero\n while x > 0\n ## make 'y' a random number within the number of\n ## items in the array\n y = rand(x)\n ## push a slice of the changedarray item (not\n ## the number) into the new 'shuffled' array\n shuffled.push changedarray.slice!(y)\n ## keep looping by taking one from the length\n ## every time\n x -= 1\n end\n return shuffled\nend", "def count_SE_groups(a)\n return 1 if a.length == 1\n record = Hash.new\n len_elem = a[0].length\n if len_elem > 1\n a.length.times do |i|\n atemp = Array.new(2,\"\")\n len_elem.times do |j|\n atemp[j % 2] += a[i][j]\n end\n atemp = atemp[0].chars.sort!*\"\" + atemp[1].chars.sort!*\"\"\n a[i] = atemp\n end\n end\n p a.sort!\n count_of_groups = 0\n a.length.times do |i|\n count_of_groups += 1 if a[i + 1] != a[i]\n end\n count_of_groups\nend", "def puzzle_2 \n newArr = []\n arr = [\"John\", \"KB\", \"Oliver\", \"Cory\", \"Matthew\", \"Christoper\"]\n arr.shuffle!\n for i in arr\n puts i\n newArr << i if i.length > 5\n end\n puts newArr\nend", "def test4(array)\n\tputs \"Test4: Groups should have 4 members max -> \"\n\tabg_maker(array).any? {|x| x.length > 4} ? false : true\nend", "def g5_games(teams)\n games = Array.new\n teams.each do |team|\n 2.times do\n games << [team, G5_RATINGS.sample]\n end\n end\n\n games\nend", "def group(array)\n\t\tif (array.length%2) == 0 \n\t\t\tarray2=array[0..(array.length-1)/2]\n\t\t\tarray=array[(array.length)/2..array.length]\n\t\t\treturn array.zip(array2)\n\t\telse\n\t\t\todd_man = array[-1]\n\t\t\tarray = array[0..array.length-2]\n\t\t\tgrouped = group(array)\n\t\t\tgrouped[-1] = grouped[-1].push(odd_man)\n\t\t\tgrouped\n\t\tend\nend", "def names_two(names)\n\t\tnames.map{ |i| %Q('#{i}') }.join(',')\n\t\tnames = names.map(&:capitalize)\n\t\tlittle_array = []\n\t\tsets = names.shuffle\n\tif names.length % 2 == 0\n\t\ta = names.length/2\n\t\ta.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\n\telse \n\t\textra = sets.pop\n\t\tb = names.length/2\n\t\tb.times do \n\t\tsets_1 = sets.pop(2).to_a\n\t\tlittle_array << sets_1\n\t\tset_1 = 0\n\tend\n\tlittle_array[0] << extra\nend\nclean_array = clean(little_array)\np clean_array\nend", "def print_groups(groups)\n\tx = 0\n\t3.times do\n\tputs \"Unit #{x + 1} Groups\"\n\tgroups[x].each { |group| puts \"#{group} \\n\" }\n\tx += 1\nend\nend", "def random_name_generator\n letter_array = (\"A\" .. \"Z\").to_a\n three_letters = letter_array.shuffle.pop(3).join(\"\")\n three_numbers = (1..9).to_a.shuffle.pop(3).join(\"\")\n result = three_letters + three_numbers\n end", "def create_example_groups(groups_count = 100)\n # FIXME: What if Example organization is not found?\n organization = Organization.where(:name => 'Example').first\n \n # Get example students\n users = User.where(:firstname => 'Student', :organization_id => organization.id).all\n user_counter = 0\n \n # Create groups and submissions\n for i in (1..groups_count)\n # Create group\n group = Group.new(:course_instance_id => self.id, :name => \"Group #{i}\", :max_size => 3)\n group.save(:validate => false)\n\n # Add users to group\n students_count = rand(3) # self.groupsizemin + rand(self.groupsizemax - self.groupsizemin + 1)\n for j in (0..students_count)\n user = users[user_counter]\n group.add_member(user) if user\n user_counter += 1\n end\n\n break if user_counter >= users.size\n end\n end", "def names_thingy\n arr = %w(John, KB, Oliver, Cory, Matthew, Christopher)\n arr.shuffle!\n for name in arr\n puts name\n end\n arr.reject { |elem| elem.length <= 5 }\nend", "def gay_array(number_of_buttons, search_letter, search_buttons) \n \tarray = [ ] \n\t\n\twhile array.length <= number_of_buttons - (1 + search_buttons) do\n \t\tarray.push(new_letter(search_letter))\n \tend\n \t\n search_buttons.times do array.push(search_letter)\n\tend\t\t\n \t\t\n \treturn array.shuffle\n \n end", "def shufflers5(a)\n b = list([a[0]])\n c = Array.new(b.length)\n for i in 0...b.length\n temp = []\n for j in 0...a[0].length\n if a[0][j] == b[i]\n temp[temp.length] = a[1][j]\n end\n end\n c[i] = temp\n end\n return [b,c] #[[id[]],[names[]]]\nend", "def group_in_fours(i, b)\n b.push(i)\n if b.size() == 4 then\n puts b.to_s\n b.clear\n end\nend", "def account_group(cohort)\n group_of_3 = cohort.sample(3)\n cohort -= group_of_3\n puts \"Accountability Group(3 people): \"\n group_of_3.each do |index|\n puts index\n end\n group_of_4 = cohort.sample(4)\n cohort -= group_of_4\n puts \"Accountability Group(4 people): \"\n group_of_4.each do |index|\n puts index\n end\nuntil cohort.empty?\n group_of_5 = cohort.sample(5)\n cohort -= group_of_5\n puts \"Accountability Group: \"\n group_of_5.each do |index|\n puts index\n end\nend\nend", "def shuffler(a)\n a.flatten.shuffle.each_slice(2).to_a\nend", "def shuffle(length, array)\n \n array.to_a.sample(length)\n\nend", "def output_groups(students, size_of_group)\n group_id = 1\n until students.size == 0 do\n puts \"Group \" + group_id.to_s\n puts \"=================\"\n students.shift(size_of_group).each { |student| puts student.name }\n puts\n group_id += 1\n end\nend", "def shuffle(array)\n return array.shuffle\nend", "def generate_pairs\n students.shuffle.each_slice(2).to_a\n end", "def name(arr)\n arr.sample\nend", "def group_array(array, size)\n out = [[]]\n idx = 0\n array.each do |a|\n if out[idx].length == size\n out << []\n idx += 1\n end\n out[idx] << a\n end\n return out\nend", "def acct_group(list)\n groups=[]\n if list.length<=5 \n groups = list \n else\n i=0\n while i <=list.length-3\n groups = groups << list[i..i+2]\n i+=3\n end \n groups[0] = groups[0]+list[i..list.length-1] \n end\n p groups\nend", "def name(array)\n array.sample\nend", "def sorted_triples(array)\n sort_array = []\n array.each_slice(3) do |group|\n sort_array << group.sort\n end\n return sort_array\nend", "def randomize_array(array_length)\n (0..array_length).to_a.shuffle\n end", "def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend", "def randomArray(directoryLength, arrayLength)\n array = []\n 0.upto(directoryLength) {|num| array << num}\n array.shuffle!\n array.slice(0, arrayLength)\nend", "def build_shuffler(deck_count = 1)\n arr = []\n\n for i in 1..deck_count\n for j in 1..52\n arr << rand(MAX_INT)\n end\n end\n arr\n end", "def nombres(arr)\n puts arr.shuffle.join(\" \")\n puts arr.select{ |nombre| nombre.length>5 }.join(\" \")\nend", "def generate_groups(groups, type)\r\n [].tap do |results|\r\n groups.each do |n, obj|\r\n group = {}\r\n group[\"name\"] = obj['name']\r\n group[\"code\"] = n\r\n group[\"risk_category\"] = \"AUTO\"\r\n group[type] = obj[type]\r\n results << group\r\n end\r\n end\r\nend", "def music_shuffle filenames\n\t# Slice the array into three sets i.e. [[],[],[]]\n\tthree_sets = filenames.each_slice(3).to_a\n\t# Let's shuffle the outer array\n\tthree_sets.shuffle!\n\t# Now let's suffle the inner arrays\n\tthree_sets.each {|set| set.shuffle!}\n\t# Now let's get back to having just one array of file names\n\tthree_sets.flatten!\nend", "def shuffle_cities(array)\n @array_of_city_arrangements = []\n while @array_of_city_arrangements.size < factorial(array.size) \n x = array.shuffle\n if !(@array_of_city_arrangements.include?(x))\n @array_of_city_arrangements.push(x)\n\n end\n end \n #array of array of two element arrays\n @array_of_city_arrangements\n end", "def split_teams\n @split_teams ||= shuffled_teams.each_slice(team_count/2).to_a\n end", "def create_values_and_split\n arr = []\n 0.upto(51).each{|num| arr.push(num)}\n arr.shuffle!\n\n user_1_deck = []\n user_2_deck = []\n\n arr.each_with_index do |num,index|\n if index % 2 == 0\n user_1_deck.push(num)\n else\n user_2_deck.push(num)\n end\n end\n\n user_1_deck = user_1_deck.join(',')\n user_2_deck = user_2_deck.join(',')\n\n return user_1_deck,user_2_deck\n\n end", "def generate_pairs\n @pairs = []\n 3.times do\n @a = @students_id.sample(2)\n @pairs << @a\n #find the names again e.g. pluck(:full_name)\n end\n end", "def populate_groups_for_round i=@round\r\n temp_groups = []\r\n (1..@number_of_groups).each_entry do |x|\r\n temp_group = Group.new(:position => i, :day => x, :schedule_dataset => self)\r\n temp_groups.push(temp_group)\r\n end\r\n\r\n # Add seminarians who need to be assigned to a single day\r\n seminarians_left = seminarians_for_round(i)\r\n seminarians_left.shuffle.each do |sem|\r\n possible_grps = sem.possible_groups(temp_groups)\r\n sem.add_to_group(possible_grps.first) if possible_grps.count == 1 && !possible_grps.first.full?\r\n end\r\n\r\n # Add seminarians with too many duplicates to a group with least number of seminarians\r\n seminarians_left = seminarians_for_round(i)\r\n seminarians_left.shuffle.each do |sem|\r\n possible_grps = sem.possible_groups(temp_groups).sort_by{|g| g.seminarians.count}\r\n sem.add_to_group(possible_grps.first) if sem.duplicate_days >= @duplicate_days_allowed && !possible_grps.first.full?\r\n end\r\n\r\n # Add at least one seminarian to each group\r\n seminarians_left = seminarians_for_round(i)\r\n seminarians_left.shuffle.each do |sem|\r\n possible_grps = sem.possible_groups(temp_groups).shuffle\r\n sem.add_to_group(possible_grps.first) if possible_grps.count < @number_of_groups && possible_grps.first.seminarians.count == 0\r\n end\r\n\r\n seminarians_left = seminarians_for_round(i)\r\n \r\n while seminarians_left.any? do\r\n\r\n #Find the smallest groups\r\n smallest_number = temp_groups.sort_by{|g| g.seminarians.count}.first.seminarians.count\r\n small_groups = temp_groups.select{|tg| tg.seminarians.count == smallest_number}\r\n\r\n best_match = nil\r\n best_score = 9000\r\n\r\n small_groups.shuffle.each do |group|\r\n seminarians_left.shuffle.each do |sem|\r\n \r\n #Find the best match of seminarians and small groups\r\n if sem.score_for_group(group) < best_score\r\n best_match = [sem, group]\r\n best_score = sem.score_for_group(group)\r\n end\r\n end\r\n end\r\n \r\n best_match.first.add_to_group(best_match.second) if best_match\r\n seminarians_left = seminarians_for_round(i)\r\n end\r\n \r\n temp_groups.each{|g| @groups.push(g)}\r\n end" ]
[ "0.8218012", "0.78980106", "0.78374815", "0.78374815", "0.7735198", "0.7643933", "0.7635971", "0.7543966", "0.7509818", "0.7454669", "0.7410339", "0.7408823", "0.74038017", "0.7399894", "0.7376428", "0.72676086", "0.7234703", "0.72297436", "0.72282547", "0.72173566", "0.7159092", "0.71568936", "0.7125748", "0.7059938", "0.7043606", "0.6947845", "0.6897468", "0.68880165", "0.68749326", "0.67998695", "0.67849666", "0.6746936", "0.67462623", "0.6670212", "0.6639557", "0.6632286", "0.6630546", "0.66126496", "0.6593566", "0.6587058", "0.65545315", "0.649896", "0.6458184", "0.64532685", "0.64527166", "0.6405234", "0.63665307", "0.6360361", "0.63359004", "0.631867", "0.6314083", "0.6289298", "0.6223904", "0.6200218", "0.61737126", "0.6166741", "0.61145157", "0.6072402", "0.6051451", "0.6048113", "0.6046622", "0.6005007", "0.59824973", "0.59156287", "0.59090346", "0.5879914", "0.5843984", "0.5738146", "0.5732494", "0.57145137", "0.5708819", "0.5708407", "0.56903136", "0.56718075", "0.5670125", "0.56608665", "0.5646811", "0.56391543", "0.56357867", "0.56311053", "0.5630733", "0.5625286", "0.56161994", "0.5589769", "0.5577381", "0.55663884", "0.556191", "0.55615705", "0.55604184", "0.5557124", "0.555245", "0.55477554", "0.554444", "0.5532454", "0.5525609", "0.5522299", "0.55221736", "0.55216634", "0.5506559", "0.5498302" ]
0.7817571
4
In our views, we use jquery.get with the _url option. When running with passenger, it always makes the URL http even if https is used. We use the _url because of Sub URI installs To resolve the missing https, we've added a config option to config/application.rb When the environment is a production env and https is true we manual set urls to https. We only do for production, so devs do not need to worry about this.
def default_url_options(options ={}) if Rails.env.production? if TestDB::Application.config.ssl_enabled == true options.merge({ :only_path => false, :protocol => 'https' }) else options.merge({}) end else options.merge({}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_https\n if Rails.env.production?\n if get_protocol != 'https://'\n return redirect_to \"https://#{request.url[(get_protocol.size)..(-1)]}\"\n end\n end\n end", "def url\n 'https://' + request.host\n end", "def try_https\n # Makes modifications to URL behavior\n begin\n uri = RequestHelper.parse_url(self.url)\n unless (uri.scheme == 'https')\n self.url.gsub!(/^http:/i, 'https:')\n RequestHelper.request_url(self.url, 'Get').value\n end\n rescue\n self.url.gsub!(/^https:/i, 'http:')\n end\n end", "def http_url\n context[:http_url] || context[:base_url]\n end", "def default_url_options\n if request\n { port: request.port, protocol: request.protocol, host: request.host }\n else\n { protocol: 'https', host: provider.external_domain }\n end\n end", "def ssl_if_prod(url)\n if Rails.env.production?\n url.gsub!('http', 'https')\n end\n url\n end", "def url\n @url = \"#{@http_mode}://#{self.config.servers[0]}\"\n @url << \"/#{self.config.context}\" if(!self.config.context.empty?)\n #self.config.log.debug_msg(\"Request base URL: #{@url}\")\n @url\n end", "def url\n url = \"#{config.url[config.env]}/#{@path}\"\n url = \"#{url}?#{@params.to_param}\" unless @params.empty?\n url\n end", "def https?; end", "def force_ssl\n if !request.ssl? && Rails.env.production?\n redirect_to :protocol => 'https'\n end\n end", "def web_url\n @sandbox ? \"http://www.sandbox.freelancer.com\":\"http://www.freelancer.com\"\n end", "def _http_url\n HTTPURI + _uri_path\n end", "def url_options; end", "def url\n options[:test] ? options[:test_url] : options[:production_url]\n end", "def url\n options[:test] ? options[:test_url] : options[:production_url]\n end", "def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end", "def base_url\n self.mode == 'production' ? Ebay::Search::Api::PRODUCTION_URL : Ebay::Search::Api::SANDBOX_URL\n end", "def set_default_values\n set_url_parts(ssl_enabled? ? 'https://' : 'http://', domain)\n end", "def ssl_options(options = {})\n {:protocol => \"https\", :only_path => false} unless Rails.env.development?\n end", "def default_url_options\n { host: ScihistDigicoll::Env.lookup!(:app_url_base) }\n end", "def protocol\n default_url_options.fetch(:protocol, 'http').to_sym\n end", "def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end", "def url(request = nil)\n @url ||= begin\n if request.try(:ssl?)\n \"https://#{ENV.fetch('HOST')}/blog/#{slug}\"\n else\n \"http://#{ENV.fetch('HOST')}/blog/#{slug}\"\n end\n end\n end", "def url\n return @url if @url\n\n case environment\n when :production\n PRODUCTION_API_ENDPOINT\n when :sandbox\n SANDBOX_API_ENDPOINT\n end\n end", "def require_https\n if request.protocol == \"http://\" && request.host == 'HOSTNAME'\n redirect_to('https://' + request.host_with_port + request.fullpath, status: :moved_permanently)\n end\n end", "def default_url_options\n if defined?(Settings.application.protocol) && !Settings.application.protocol.blank?\n Rails.logger.debug(\"Setting default URL protocol to #{Settings.application.protocol}\")\n {protocol: Settings.application.protocol}\n else\n {}\n end\n end", "def default_url_options; end", "def require_ssl\n if request.ssl? or Rails.env == 'development' \n true\n else\n redirect_to({:protocol => 'https://'}.merge(params), :flash => flash)\n false\n end\n end", "def require_ssl\n log \"NAV: Checking for SSL\"\n # check for enviroment variable\n return unless ENV['REQUIRE_HTTPS']\n\n unless request.ssl?\n log \"NAV OVERRIDE: Redirecting to https://#{request.host_with_port}#{request.fullpath}\"\n redirect_to({:protocol => 'https://'}.merge(params), :flash => flash)\n end\n end", "def default_url_options\n {\n host: ScihistDigicoll::Env.lookup(:app_url_base)\n }\n end", "def my_url\n url 'my'\n end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def site_url\n if development_environment?\n request.protocol + request.host + ':' + request.port.to_s\n else\n request.protocol + 'rehttp.me'\n end\n end", "def base_url\n return url\n end", "def https_get(url, cookie = \"\")\n uri = URI.parse url\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n \n meta, body = http.request_get uri.path, 'User-Agent' => \"Mozilla/5.0 RailsAppHelper\", 'Cookie' => cookie\n return [meta, body]\n end", "def url\n return @@nfg_urls['sandbox']['url'] if @use_sandbox\n @@nfg_urls['production']['url']\n end", "def old_url\n \"http://#{site.default_host.hostname}#{path}\"\n end", "def initial_url\n options.fetch(:url) { \"https://#{FaaInfo.domain}/\" }\n end", "def api_url\n @api_url ||=\"#{base_url}#{@options['api_url']}\"\n end", "def get_url\n @url\n end", "def add_url_protocol\n unless url[/\\Ahttp:\\/\\//] || url[/\\Ahttps:\\/\\//]\n self.url = \"http://#{self.url}\"\n end\n end", "def ssl_requirement\n return unless Rails.env.production?\n if ssl_required? && ! request.ssl? then\n # Send to https://\n flash.keep\n redirect_to 'https://' + request.host_with_port + request.fullpath\n elsif ! ssl_required? && request.ssl? then\n # Send to http://\n flash.keep\n redirect_to 'http://' + request.host_with_port + request.fullpath\n end\n end", "def add_http_to_url\n if !self.website_url.blank?\n unless self.website_url[/\\Ahttp:\\/\\//] || self.website_url[/\\Ahttps:\\/\\//]\n self.website_url = \"http://#{self.website_url}\"\n end\n end\n end", "def full_url(env)\n \"#{ SSL_SCHEME }://#{ host }:#{ port }#{ ::Rack::Request.new(env).fullpath }\"\n end", "def hubssolib_ensure_https\n unless request.ssl?\n # This isn't reliable: redirect_to({ :protocol => 'https://' })\n redirect_to (hubssolib_promote_uri_to_ssl(request.request_uri, request.host))\n return false\n else\n return true\n end\n end", "def url\n super\n end", "def url\n Config.site.url.chomp('/') + self.path\n end", "def enforce_ssl\n redirect_to url_for(protocol: 'https')\n end", "def get(url); end", "def default_url_options(options)\n defaults = {} \n my_controller = (options[:controller] || controller_name).to_sym\n my_action = (options[:action] || action_name).to_sym\n secure = ActionController::Base::SECURE\n \n if USE_SSL\n options[:override_only_path] ? options[:only_path] = options[:override_only_path] : options[:only_path] = false \n if ((secure[my_controller] || []).include?(my_action))\n defaults[:protocol] = 'https://' \n else\n defaults[:protocol] = 'http://'\n end\n end\n options.delete :override_only_path \n return defaults\n end", "def geturl() \n\t\treturn self.response.geturl()\n end", "def local_https_enabled\n get('beef.http.https.enable') || false\n end", "def get_url(is_local = true)\n is_local ? (return '../../../www/public/') : (return 'https://whimsy.apache.org/public/')\n end", "def url(request = nil)\n @url ||= begin\n if request.try(:ssl?)\n \"https://#{ENV.fetch('HOST')}/blog/tags/#{slug}\"\n else\n \"http://#{ENV.fetch('HOST')}/blog/tags/#{slug}\"\n end\n end\n end", "def site_url\n if Rails.env.production?\n # Place your production URL in the quotes below\n \"http://www.ezonline.com/\"\n else\n # Our dev & test URL\n \"http://ezonline-dev.com:3000\"\n end\n end", "def default_url_options\n { host: ENV[\"DOMAIN\"] || \"localhost:3000\" }\n end", "def url\n env[:url]\n end", "def url_with_conditional_ssl(*args)\n url_without_conditional_ssl(*args).sub(/\\Ahttps?:/, '')\n end", "def url_options\n {}\n end", "def url\n \"http://#{self.cms_site.hostname}#{self.full_path}\"\n end", "def force_https(url)\n uri = URI(url)\n return url unless uri.scheme == 'http'\n\n uri.scheme = 'https'\n uri.to_s\n end", "def solr_url\n if ENV['SOLR_URL'] || ENV['WEBSOLR_URL']\n URI.parse(ENV['SOLR_URL'] || ENV['WEBSOLR_URL'])\n end\n end", "def url\n if Rails.application.routes.default_url_options[:host] && Spree::Core::Engine.routes.url_helpers.respond_to?(:product_url)\n Spree::Core::Engine.routes.url_helpers.product_url(product,\n host: Rails.application.routes.default_url_options[:host],\n protocol: Rails.application.config.force_ssl ? \"https\" : \"http\")\n end\n end", "def get_url(url, options = {})\n options = make_options(:url, url, options)\n get(options)\n end", "def url\n options[:url]\n end", "def api_url\n @sandbox ? \"http://api.sandbox.freelancer.com\":\"http://api.freelancer.com\"\n end", "def getHTTP(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n request = Net::HTTP::Get.new(uri.request_uri)\n http.request(request)\nend", "def ssl?\n return @request_uri.scheme == \"https\"\n end", "def try_https\n begin\n uri = URI.parse(self.url)\n unless (uri.kind_of?(URI::HTTPS))\n self.url.gsub!(/^http:/i, 'https:')\n Media.request_url(self.url, 'Head').value\n end\n rescue\n self.url.gsub!(/^https:/i, 'http:')\n end\n end", "def set_url_host \n @url_host = request.protocol() + request.host_with_port() + '/' \n end", "def url(*args)\n super_url = super\n File.exists?(\"#{root}#{super_url}\") ? super_url : default_url\n end", "def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end", "def ssl= bool\n @uri.scheme = bool ? \"https\" : \"http\"\n end", "def ssl= bool\n @uri.scheme = bool ? \"https\" : \"http\"\n end", "def ssl?\n @url.scheme == 'https'\n end", "def _url path = request.path, options = {}\n\t\tstr = path\n\t\tunless options.empty?\n\t\t\tstr += '?'\n\t\t\toptions.each do | k, v |\n\t\t\t\tstr = str + k.to_s + '=' + v.to_s + '&'\n\t\t\tend\n\t\tend\n\t\tstr\n\tend", "def url\n @url ||= params['url']\n end", "def force_ssl; end", "def force_ssl; end", "def url\n \"http://#{self.domain}/#{self.path}\"\n end", "def fix_protocol\n use_https = is_logged_in || [\"login\", \"login_action\"].include?(action_name)\n\n if Rails.env.production?\n if use_https && request.protocol != \"https://\"\n return redirect_to \"https://#{request.url[(request.protocol.size)..(-1)]}\"\n end\n\n if !use_https && request.protocol != APP_PROTOCOL\n return redirect_to \"#{APP_PROTOCOL}#{request.url[(request.protocol.size)..(-1)]}\"\n end\n end\n end", "def use_ssl?; end", "def server_url\n url\n end", "def protocol\n if secure?\n 'https'\n else\n 'http'\n end\n end", "def public_https_enabled?\n get('beef.http.public.https') || false\n end", "def iadmin_url\n @test_mode ? @test_url : @production_url\n end", "def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend", "def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend", "def url\n SETTINGS[:url] || raise(\"Must provide URL - please edit file\")\nend", "def set_url(opts)\n opts = check_params(opts,[:urls])\n super(opts)\n end", "def url=(_); end", "def http_options\n {\n followlocation: true,\n ssl_verifypeer: false,\n ssl_verifyhost: 0\n }\n end", "def httpsRequest (url)\n\turi = URI.parse(url)\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\trequest = Net::HTTP::Get.new(uri.request_uri)\n\tresponse = http.request(request)\n\treturn response\nend", "def web_url\n return @web_url\n end", "def web_url\n return @web_url\n end", "def web_url\n return @web_url\n end", "def url(path = nil, params = nil)\n path = path[1..-1] if path&.chr == '/'\n \"https://#{URI.parse(beyond_api_url).host}/#{path}#{'?' +params&.to_query if params.present?}\"\n end", "def url_options\n options = {protocol: url_protocol, host: url_host}\n return options if url_protocol == \"http\" && url_port == 80 || url_protocol == \"https\" && url_port == 443\n options[:port] = url_port\n options\n end", "def ssl_required\n if ENV['RAILS_ENV'] == \"production\" && Substruct.override_ssl_production_mode == false\n if !request.ssl?\n redirect_to \"https://\" + request.host + request.request_uri\n flash.keep\n return false\n end\n end\n end", "def default_url_options(options = {})\n\n # Force for url locale\n options[:l] = I18n.locale if !options.keys.include?(:l)\n determine_host! options\n\n # Force Content Format\n if defined?(params) && options[:format].nil? && params[:format]\n if !params[:format].to_s.match(/^ajax|asset/)\n options[:format] = params[:format]\n end\n end\n\n options\n end" ]
[ "0.7244246", "0.70158035", "0.6680517", "0.6158217", "0.61501104", "0.6103289", "0.60588825", "0.6057326", "0.6041692", "0.59898025", "0.5955842", "0.5935436", "0.5932267", "0.5920195", "0.5920195", "0.5919465", "0.5914554", "0.5900213", "0.58826375", "0.5866544", "0.5858194", "0.58567244", "0.5855191", "0.58523184", "0.5843727", "0.58321637", "0.58285624", "0.58163565", "0.5798121", "0.57927656", "0.57802045", "0.5777341", "0.5774277", "0.577246", "0.57580054", "0.57543933", "0.5751854", "0.5742772", "0.5737754", "0.57345766", "0.5729448", "0.57096046", "0.5705334", "0.5700705", "0.56991166", "0.5691506", "0.5685058", "0.56807786", "0.56441355", "0.56436384", "0.5637338", "0.5637002", "0.5631893", "0.5630975", "0.5627122", "0.5623355", "0.5611888", "0.56076884", "0.5604737", "0.56022733", "0.5590647", "0.55900586", "0.5589098", "0.55873746", "0.55857605", "0.5584216", "0.55805534", "0.55758363", "0.5575739", "0.5575699", "0.5573225", "0.5570151", "0.556861", "0.556861", "0.5566444", "0.5555518", "0.5555004", "0.5554721", "0.5554721", "0.5552025", "0.5550702", "0.5547162", "0.55461484", "0.5538553", "0.55215114", "0.5507159", "0.5505345", "0.5505345", "0.5505345", "0.5492731", "0.5486912", "0.54856765", "0.5469681", "0.54685587", "0.54685587", "0.54685587", "0.5465721", "0.5465442", "0.5463096", "0.54627573" ]
0.6578501
3
/update_version_select/1 Get the versions for the current product Then render the small versions drop down partial for index search This is used for searches on index pages with a product. Ex. see assignments and and results (execute) index page
def update_version_select versions = Version.where(:product_id => params[:id]).order(:version) unless params[:id].blank? render :partial => "versions", :locals => { :versions => versions } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_from_combobox\n @versions = Project.find(params[:project_id]).shared_versions\n @sorted_versions = []\n @versions.each do |version|\n @sorted_versions.push(version.name.to_s)\n end\n @natural_sorted_versions = \\\n Naturalsorter::Sorter.sort_version(@sorted_versions, false)\n @version = params[:id].to_s\n end", "def minimum_version_options\n possible_versions = versions.decorate.reverse\n h.options_from_collection_for_select(possible_versions, :id, :name, minimum_version_id)\n end", "def versions_for_select(unit_member)\n static_options = [['Most Recent','']]\n dynamic_options = package_branch.packages.map {|p| [p.version, p.id]}\n static_options + dynamic_options\n end", "def dev_version_select(project, version)\n project_find(project)\n dev = @project.all('a[class=unreleased-link]', text: \"#{version}\").first\n dev.click\n end", "def rel_version_select(project, version)\n project_find(project)\n release = @project.all('a[class=released-link]', text: \"#{version}\").first\n release.click\n end", "def show_version\n @fdn_org_hierarchy = Fdn::OrgHierarchy.find(params[:id])\n @current_rel_id = params[:current_rel_id]\n @org_elements = @fdn_org_hierarchy.org_hie_elements\n @ver = params[:ver]||@fdn_org_hierarchy.org_hie_versions.first.ver\n end", "def versions\n @page = ComatosePage.find params[:id]\n @version_num = (params[:version] || @page.versions.length).to_i\n @version = @page.find_version(@version_num)\n end", "def site_option_value_changed\n @product = Product.find(params[:product_id])\n # find all variants that have the given option_value (option_type.id => option_value.id) as primary option\n @selected_variants = Variant.find_by_option_values(@product.id, params[:option_values_primary]).select(&:available?)\n respond_to do |format|\n format.js { render :template => \"products/site_option_values_changed.js.erb\"}\n end\n end", "def show_version\n \t\t@policy = Policy.find(params[:id])\n\t\t@versions = @policy.versions\n \t@policy = @policy.versions[params[:version].to_i].reify if params[:version]\n \tend", "def versions\n @page = Comatose::Page.find_is_snippet params[:id]\n @version_num = (params[:version] || @page.versions.length).to_i\n @version = @page.find_version(@version_num)\n end", "def versions_for_select(unit_member)\n static_options = [['Most Recent','']]\n pb = package_branch\n pb.bind_to_scope(unit_member)\n dynamic_options = pb.packages.map {|p| [p.version, p.id]}\n static_options + dynamic_options\n end", "def si_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def of_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def admin_index \n return if !user_is_allowed('products', 'edit') \n @product = Product.find(params[:product_id])\n \n if @product.variants.nil? || @product.variants.count == 0\n v = Variant.new\n v.product_id = @product.id\n v.option1 = @product.default1 if @product.option1\n v.option2 = @product.default2 if @product.option2\n v.option3 = @product.default3 if @product.option3\n v.status = 'Active'\n v.save \n end\n @variant = params[:variant_id] ? Variant.find(params[:variant_id]) : @product.variants[0]\n @highlight_variant_id = params[:highlight] ? params[:highlight].to_i : nil\n render :layout => 'caboose/admin' \n end", "def so_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def productVersion \n \"productVersion\" \n end", "def pack_material_product_pack_material_type_code_search_combo_changed\n\tpack_material_type_code = get_selected_combo_value(params)\n\tsession[:pack_material_product_search_form][:pack_material_type_code_combo_selection] = pack_material_type_code\n\t@pack_material_product_codes = PackMaterialProduct.find_by_sql(\"Select distinct pack_material_product_code from pack_material_products where pack_material_type_code = '#{pack_material_type_code}'\").map{|g|[g.pack_material_product_code]}\n\t@pack_material_product_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('pack_material_product','pack_material_product_code',@pack_material_product_codes)%>\n\n\t\t}\n\nend", "def it_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def fetch_version (resource_version,identifier,params={})\n uri = '/api/page_version/' + resource_version.to_s + '/' + identifier\n alt_http_get(uri,params)\n end", "def product_product_subtype_code_search_combo_changed\n\tproduct_subtype_code = get_selected_combo_value(params)\n\tsession[:product_search_form][:product_subtype_code_combo_selection] = product_subtype_code\n\t@tag1s = Product.find_by_sql(\"Select distinct tag1 from products where product_subtype_code = '#{product_subtype_code}' and product_type_code = 'PACK_MATERIAL' and is_composite = 'true'\").map{|g|[g.tag1]}\n\t@tag1s.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('product','tag1',@tag1s)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_product_tag1'/>\n\t\t<%= observe_field('product_tag1',:update => 'tag2_cell',:url => {:action => session[:product_search_form][:tag1_observer][:remote_method]},:loading => \"show_element('img_product_tag1');\",:complete => session[:product_search_form][:tag1_observer][:on_completed_js])%>\n\t\t}\n\nend", "def show\n # to add tools to product\n if params[:select].present? \n @new_parent = Product.find(params[:select])\n if @new_parent\n ProductToTool.find_or_create_by_product_id_and_tool_id(@product.id,@new_parent.id)\n end\n end\n @products = Product.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n @product_variants = @product.product_variants\n \n if params[:show_products].present? \n @show_products = true\n end \n end", "def virtual_studio\n \n @spec = Specification.where(florist_id: session[\"found_florist_id\"]).where(id: params[\"spec_id\"]).first\n @products = Product.joins(:designed_products).where(\"designed_products.florist_id\" => session[\"found_florist_id\"]).where(\"designed_products.event_id\" => @spec.event.id).uniq\n @used_products = @products.order(\"name\")\n @list_of_product_types = @products.uniq.pluck(:product_type).sort\n @list_of_product_ids = @products.uniq.pluck(:id) \n \n \n \n \n #Generate dropdown list for adding new products to the Virtual Studio Page\n products = Product.where(status: \"Active\").where(florist_id: session[\"found_florist_id\"]).order(\"name\")\n dropdown = []\n for product in products\n dropdown << product.name\n end\n for item in @products\n dropdown = dropdown - [item.name]\n end\n @dropdown = dropdown\n render (:virtual_studio) and return\n end", "def fnVer\n\n puts (\"Out Put: #{@params}\")\n resultHash = @params\n String buf = \"\"\n buf += \"Product Version : \" + resultHash[\"productVersion\"] + \"\\n\"\n buf += \"Hot Fixes: \"\n resultHash[\"hotFixes\"].each {|x| buf += x + ', '}\n buf += \"\\n\"\n buf += 'Components:' + \"\\n\"\n resultHash[\"componentVersions\"].each {|component| buf += '' + component[\"module\"] + \" is version \" + component[\"version\"] + \"\\n\"}\n puts buf\n WebView.execute_js(\"fnVer('#{buf}')\")\n\n end", "def show\n @admin_version = Admin::Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_version }\n end\n end", "def update_test_plan_select \n test_plans = TestPlan.where(:product_id => params[:id]).order(:name) unless params[:id].blank?\n\n # Verify user can view this schedule. Must be in his product\n authorize_product!(Product.find(params[:id]))\n \n render :partial => \"test_plans\", :locals => { :test_plans => test_plans }\n end", "def versions\n authorize @page\n @versions = @page.versions\n status = params[:by_status] && Page.statuses[params[:by_status]]\n if status\n @versions = @versions.where_object(status: status)\n end\n @versions = @versions.reorder(created_at: :desc, id: :desc).page params[:page]\n end", "def rmt_variety_qc_level_season_code_changed\n\tseason_code = get_selected_combo_value(params)\n\tsession[:rmt_variety_qc_level_form][:season_code_combo_selection] = season_code\n\t@ids = RmtVarietyQcLevel.ids_for_season_code(season_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('rmt_variety_qc_level','id',@ids)%>\n\n\t\t}\n\nend", "def fg_product_item_pack_product_code_search_combo_changed\n\titem_pack_product_code = get_selected_combo_value(params)\n\tsession[:fg_product_search_form][:item_pack_product_code_combo_selection] = item_pack_product_code\n\t@unit_pack_product_codes = FgProduct.find_by_sql(\"Select distinct unit_pack_product_code from fg_products where item_pack_product_code = '#{item_pack_product_code}'\").map{|g|[g.unit_pack_product_code]}\n\t@unit_pack_product_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('fg_product','unit_pack_product_code',@unit_pack_product_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_fg_product_unit_pack_product_code'/>\n\t\t<%= observe_field('fg_product_unit_pack_product_code',:update => 'carton_pack_product_code_cell',:url => {:action => session[:fg_product_search_form][:unit_pack_product_code_observer][:remote_method]},:loading => \"show_element('img_fg_product_unit_pack_product_code');\",:complete => session[:fg_product_search_form][:unit_pack_product_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def carton_pack_product_type_code_search_combo_changed\n\ttype_code = get_selected_combo_value(params)\n\tsession[:carton_pack_product_search_form][:type_code_combo_selection] = type_code\n\t@basic_pack_codes = CartonPackProduct.find_by_sql(\"Select distinct basic_pack_code from carton_pack_products where type_code = '#{type_code}'\").map{|g|[g.basic_pack_code]}\n\t@basic_pack_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('carton_pack_product','basic_pack_code',@basic_pack_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_carton_pack_product_basic_pack_code'/>\n\t\t<%= observe_field('carton_pack_product_basic_pack_code',:update => 'carton_pack_style_code_cell',:url => {:action => session[:carton_pack_product_search_form][:basic_pack_code_observer][:remote_method]},:loading => \"show_element('img_carton_pack_product_basic_pack_code');\",:complete => session[:carton_pack_product_search_form][:basic_pack_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def item_pack_product_commodity_code_search_combo_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:item_pack_product_search_form][:commodity_code_combo_selection] = commodity_code\n\t@marketing_variety_codes = ItemPackProduct.find_by_sql(\"Select distinct marketing_variety_code from item_pack_products where commodity_code = '#{commodity_code}'\").map{|g|[g.marketing_variety_code]}\n\t@marketing_variety_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('item_pack_product','marketing_variety_code',@marketing_variety_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_item_pack_product_marketing_variety_code'/>\n\t\t<%= observe_field('item_pack_product_marketing_variety_code',:update => 'actual_count_cell',:url => {:action => session[:item_pack_product_search_form][:marketing_variety_code_observer][:remote_method]},:loading => \"show_element('img_item_pack_product_marketing_variety_code');\",:complete => session[:item_pack_product_search_form][:marketing_variety_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def show\n @version = Version.find(params[:id])\n @versionconfig= @version.version_configurations.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end", "def versions\n authorize @page\n @versions = @page.versions\n status = params[:by_status] && Page.statuses[params[:by_status]]\n if status\n @versions = @versions.where_object(status: status)\n end\n @versions = @versions.reorder(created_at: :desc, id: :desc).page params[:page]\n end", "def index\n @versions = Version.all\n end", "def size_ref_commodity_code_search_combo_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:size_ref_search_form][:commodity_code_combo_selection] = commodity_code\n\t@size_ref_codes = SizeRef.find_by_sql(\"Select distinct size_ref_code from size_refs where commodity_code = '#{commodity_code}'\").map{|g|[g.size_ref_code]}\n\t@size_ref_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('size_ref','size_ref_code',@size_ref_codes)%>\n\n\t\t}\n\nend", "def update\n @product_option = ProductOption.find(params[:product_option][:id])\n @product = Product.find(params[:product_id])\n @product_option.update_attributes(params[:product_option])\n \n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def production_run_pack_material_fg_product_code_changed\n fg_code = get_selected_combo_value(params)\n @carton_setup_codes = CartonSetup.find_all_by_production_schedule_id_and_fg_product_code(session[:current_closed_schedule].id, fg_code).map { |c| [c.carton_setup_code, c.id] }\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t<%= select('production_run_pack_material','carton_setup_code',@carton_setup_codes)%>\n\n\t\t}\n end", "def set_version\n @version = Version.find(params[:id])\n end", "def set_version\n if request.post?\n @page = Comatose::Page.find_is_snippet params[:id]\n @version_num = params[:version]\n @page.revert_to!(@version_num)\n end\n redirect_to :controller=>self.controller_name, :action=>'index'\n end", "def rmt_variety_qc_level_id_search_combo_changed\n\tid = get_selected_combo_value(params)\n\tsession[:rmt_variety_qc_level_search_form][:id_combo_selection] = id\n\t@season_ids = RmtVarietyQcLevel.find_by_sql(\"Select distinct season_id from rmt_variety_qc_levels where id = '#{id}'\").map{|g|[g.season_id]}\n\t@season_ids.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('rmt_variety_qc_level','season_id',@season_ids)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_rmt_variety_qc_level_season_id'/>\n\t\t<%= observe_field('rmt_variety_qc_level_season_id',:update => 'rmt_variety_id_cell',:url => {:action => session[:rmt_variety_qc_level_search_form][:season_id_observer][:remote_method]},:loading => \"show_element('img_rmt_variety_qc_level_season_id');\",:complete => session[:rmt_variety_qc_level_search_form][:season_id_observer][:on_completed_js])%>\n\t\t}\n\nend", "def update\n respond_to do |format|\n if @version.update(version_params)\n format.html { redirect_to @version, notice: 'Version was successfully updated.' }\n format.json { render :show, status: :ok, location: @version }\n else\n format.html { render :edit }\n format.json { render json: @version.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_version_admin_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.get_version_admin ...'\n end\n # resource path\n local_var_path = '/api/kratos/admin/version'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse2001'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryToken']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.get_version_admin\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_version_admin\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_version( result )\n self.id = result['id'].gsub(/\\A_design\\//, '')\n self.rev = result['rev']\n end", "def si_update_receipt_and_order_select_from_project\n project = params[:order]\n if project != '0'\n @project = Project.find(project)\n @receipt_notes = @project.blank? ? receipts_dropdown : receipts_dropdown_by_project(@project)\n @purchase_orders = @project.blank? ? unbilled_purchase_orders_dropdown : unbilled_purchase_orders_dropdown_by_project(@project)\n else\n @receipt_notes = receipts_dropdown\n @purchase_orders = unbilled_purchase_orders_dropdown\n end\n # Notes array\n @notes_dropdown = notes_array(@receipt_notes)\n # Orders array\n @purchase_orders_dropdown = purchase_orders_array(@purchase_orders)\n # Setup JSON\n @json_data = { \"note\" => @notes_dropdown, \"order\" => @purchase_orders_dropdown }\n render json: @json_data\n end", "def result_list\n supported = ['2.0.3', '3.0']\n unless supported.include? params[:version] then\n raise ActionController::RoutingError.new('Not Found')\n end\n\t\t\n @version = params[:version]\n @event = Event.find(params[:id])\n respond_to do |format|\n format.xml { render :layout => false }\n end\n end", "def update_options\r\n\t\t@current_menu = 'products'\r\n\r\n\t\t@product = Product.find(params[:id])\r\n\r\n\t\tif params[:hide_option_value]\r\n\t\t\tcur_option_value = nil\r\n\t\t\tparams[:hide_option_value].each_key do |cur_option_value_id|\r\n\t\t\t\tcur_option_value = OptionValue.find(cur_option_value_id)\r\n\t\t\tend\r\n\t\t\tProductOptionValue.delete_all([ \"product_id = #{@product.id} AND option_value_id = #{cur_option_value.id}\" ])\r\n\t\telsif params[:show_option_value]\r\n\t\t\tcur_option_value = nil\r\n\t\t\tparams[:show_option_value].each_key do |cur_option_value_id|\r\n\t\t\t\tcur_option_value = OptionValue.find(cur_option_value_id)\r\n\t\t\tend\r\n\t\t\tcur_default = (cur_option_value.option[:default_value] == cur_option_value[:id].to_s) ? 1 : 0\r\n\t\t\t@product.product_option_values.create(:option_value_id => cur_option_value[:id], :position => cur_option_value[:position], :default_value => cur_default)\r\n\t\telsif params[:remove]\r\n\t\t\toption_values = OptionValue.find(:all, :conditions => [ \"option_id = #{params[:option_id]}\" ])\r\n\t\t\toption_values.each do |cur_option_value|\r\n\t\t\t\tProductOptionValue.delete_all([ \"product_id = #{@product.id} AND option_value_id = #{cur_option_value.id}\" ])\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\tredirect_to :action => :product, :id => @product.id, :anchor => 'options'\r\n\tend", "def merchant_pricing_trends_product_versions(params = {}, options = {}, &block)\n default_option(options, :record_class, MerchantPricingTrendProductVersion)\n perform_request(:post, 'merchant_pricing_trends/product_versions', options.merge(body: params), &block)\n end", "def index\n @manage_app_versions = Manage::AppVersion.all\n end", "def index\n @package_versions = PackageVersion.all\n end", "def index\n @admin_versions = Admin::Version.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_versions }\n end\n end", "def index\n @active_page = :versions\n\n respond_to do |format|\n format.html\n format.xml do\n find_versions\n @versions_count = @versions.size\n @versions = @versions[ @page_limit * (@current_page - 1), @page_limit ].to_a\n render :action => :index, :layout => false\n end\n end\n end", "def versions\n versions = {}\n versions['All Versions'] = 'all'\n versions[self.version + ' (Current Version)'] = 'current'\n MapRating.where(map_slug: self.slug).select(:map_version).map(&:map_version).uniq.sort_by {|ver| ver}.reverse!.each do |version|\n versions[version] = version.downcase.gsub('.', '_') unless version == self.version\n end\n versions\n end", "def page_versions\n list_versions_for(latest_version_of(@item.path))\n end", "def pack_material_product_commodity_group_code_changed\n\tcommodity_group_code = get_selected_combo_value(params)\n\tsession[:pack_material_product_form][:commodity_group_code_combo_selection] = commodity_group_code\n\t@commodity_codes = PackMaterialProduct.commodity_codes_for_commodity_group_code(commodity_group_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('pack_material_product','commodity_code',@commodity_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_pack_material_product_commodity_code'/>\n\t\t<%puts observe_field('pack_material_product_commodity_code',:update => 'marketing_variety_code_cell',:url => {:action => session[:pack_material_product_form][:commodity_code_observer][:remote_method]},:loading => \"show_element('img_pack_material_product_commodity_code');\",:complete => session[:pack_material_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t<%= observe_field('pack_material_product_commodity_code',:update => 'marketing_variety_code_cell',:url => {:action => session[:pack_material_product_form][:commodity_code_observer][:remote_method]},:loading => \"show_element('img_pack_material_product_commodity_code');\",:complete => session[:pack_material_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def rmt_variety_qc_level_commodity_code_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:rmt_variety_qc_level_form][:commodity_code_combo_selection] = commodity_code\n\t@rmt_variety_codes = RmtVarietyQcLevel.rmt_variety_codes_for_commodity_code(commodity_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('rmt_variety_qc_level','rmt_variety_code',@rmt_variety_codes)%>\n\n\t\t}\n\nend", "def import_versions(vs)\n logger.debug 'updating valueset versions '\n vset = vs[:valueset]\n versions = vs[:versions] || []\n versions.sort! { |a, b| a.versionNumber <=> b.versionNumber }\n versions = [versions.last] if params[:use_latest]\n versions.each do |ver|\n create_vs_and_responses(vset, ver)\n end\n end", "def index\n @versions = @application.versions.all\n respond_to do |format|\n format.html\n format.json { render json: VersionsDatatable.new(view_context) }\n end\n end", "def partial_page_versions(partial)\n list_versions_for(latest_version_of(partial))\n end", "def set_version\n if request.post?\n @page = ComatosePage.find params[:id]\n @version_num = params[:version]\n @page.revert_to!(@version_num)\n end\n redirect_to :controller=>self.controller_name, :action=>'index'\n end", "def trade_environment_setup_id_search_combo_changed\n\tid = get_selected_combo_value(params)\n\tsession[:trade_environment_setup_search_form][:id_combo_selection] = id\n\t@production_schedule_ids = TradeEnvironmentSetup.find_by_sql(\"Select distinct production_schedule_id from trade_environment_setups where id = '#{id}'\").map{|g|[g.production_schedule_id]}\n\t@production_schedule_ids.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('trade_environment_setup','production_schedule_id',@production_schedule_ids)%>\n\n\t\t}\n\nend", "def get_skus\n if params[:id].present?\n @msg = 'nothing'\n respond_to do |format|\n format.json { render :json => {:variant => @msg }}\n return\n end\n end\n\n @product = Spree::Product.find(params[:product_id])\n self_parent = @product.variants.map(&:parent_id)\n self_parent << @product.master.id\n self_parent = self_parent.flatten\n @variant = params[:variant]\n @products = @product.seller.products.where(:is_approved=>true)\n @product_hash = []\n @products.each do |product|\n product_variants = []\n product_variants << (product.variants.present? ? product.variants : product.master)\n product_variants = product_variants.flatten\n product_variants.each do |pv|\n if !pv.parent_id.present? && !(self_parent.include? pv.id)\n if pv.option_values.present?\n @product_hash << {:name=> (product.name+\" -> \"+pv.option_values.first.presentation+\" (\"+pv.sku.to_s+\")\"), :id=>pv.id}\n else\n @product_hash << {:name=> (product.name+\" (\"+pv.sku.to_s+\")\"), :id=>pv.id}\n end\n end\n end\n end if @products.present?\n @variant = Spree::Variant.new(:product_id => @product.id)\n @variant.attributes = @variant.product.master.attributes.except('id', 'created_at', 'deleted_at',\n 'sku', 'is_master')\n # Shallow Clone of the default price to populate the price field.\n @variant.default_price = @variant.product.master.default_price.clone\n respond_to do |format|\n format.html { render :partial=>\"map_variant\", :locals => {:product => @product, :variant => @variant}}\n end\n end", "def index\n @tbl_products = TblProduct.all\n @selected =\"Electronics\"\n\n end", "def index\n @design_versions = @project.design_version.all\n end", "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def choose_version(version)\n if version =~ /(\\d+)\\.(\\d+)\\.(\\d+)/\n major = $1\n minor = $2\n patch = $3\n if config[:major]\n major = major.to_i + 1\n minor = 0\n patch = 0\n end\n if config[:minor]\n minor = minor.to_i + 1\n patch = 0\n end\n patch = patch.to_i + 1 if config[:patch]\n version = \"#{major}.#{minor}.#{patch}\"\n Chef::Log.debug(\"New version is #{version}\")\n else\n Chef::Log.error(\"Version is in a format I cannot auto-update\")\n exit 1\n end\n version\n end", "def si_update_selects_from_company\n company = params[:org]\n if company != '0'\n @company = Company.find(company)\n @projects = @company.blank? ? projects_dropdown : @company.projects.order(:project_code)\n else\n @projects = projects_dropdown\n end\n # Setup JSON\n @json_data = { \"project\" => @projects }\n render json: @json_data\n end", "def get_versions\r\n versions_nodes = BankNodestructure.version_gather(params[:subject], params[:grade])\r\n render json: versions_nodes.to_json\r\n end", "def version_params\n params[:version].permit(:version, :status, :current, :committee)\n end", "def select\n @product = Product.find_by_param!(params[:product_id])\n @product.option_types << OptionType.find(params[:id])\n @product.reload\n @option_types = @product.option_types\n set_available_option_types\n end", "def update_version( result ) \n self.id = result['id']\n self.rev = result['rev']\n end", "def standard_size_count_commodity_code_search_combo_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:standard_size_count_search_form][:commodity_code_combo_selection] = commodity_code\n\t@standard_size_count_values = StandardSizeCount.find_by_sql(\"Select distinct standard_size_count_value from standard_size_counts where commodity_code = '#{commodity_code}'\").map{|g|[g.standard_size_count_value]}\n\t@standard_size_count_values.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('standard_size_count','standard_size_count_value',@standard_size_count_values)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_standard_size_count_standard_size_count_value'/>\n\t\t<%= observe_field('standard_size_count_standard_size_count_value',:update => 'basic_pack_code_cell',:url => {:action => session[:standard_size_count_search_form][:standard_size_count_value_observer][:remote_method]},:loading => \"show_element('img_standard_size_count_standard_size_count_value');\",:complete => session[:standard_size_count_search_form][:standard_size_count_value_observer][:on_completed_js])%>\n\t\t}\n\nend", "def of_update_selects_from_request\n request = params[:request]\n project_id = 0\n work_order_id = 0\n charge_account_id = 0\n store_id = 0\n payment_method_id = 0\n if request != '0'\n @offer_request = OfferRequest.find(request)\n @request_items = @offer_request.blank? ? [] : @offer_request.offer_request_items\n @projects = @offer_request.blank? ? projects_dropdown : @offer_request.project\n @work_orders = @offer_request.blank? ? work_orders_dropdown : WorkOrder.where(id: @offer_request.work_order)\n @charge_accounts = @offer_request.blank? ? charge_accounts_dropdown : @offer_request.charge_account\n @stores = @offer_request.blank? ? stores_dropdown : @offer_request.store\n @payment_methods = @offer_request.blank? ? payment_methods_dropdown : @offer_request.payment_method\n if @request_items.blank?\n @products = @offer_request.blank? ? products_dropdown : @offer_request.organization.products.order(:product_code)\n else\n @products = @offer_request.products.group(:product_code)\n end\n project_id = @projects.id rescue 0\n work_order_id = @work_orders.id rescue 0\n charge_account_id = @charge_accounts.id rescue 0\n store_id = @stores.id rescue 0\n payment_method_id = @payment_methods.id rescue 0\n else\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = charge_accounts_dropdown\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_orders)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown,\n \"project_id\" => project_id, \"work_order_id\" => work_order_id,\n \"charge_account_id\" => charge_account_id, \"store_id\" => store_id,\n \"payment_method_id\" => payment_method_id }\n render json: @json_data\n end", "def get_version_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdminApi.get_version ...'\n end\n # resource path\n local_var_path = '/version'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'InlineResponse2001'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"AdminApi.get_version\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdminApi#get_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_vmware_patch_info(login_url,product_url,username,password,release)\n update_list = {}\n update = \"\"\n options = Selenium::WebDriver::Firefox::Options.new\n options.add_argument('--headless')\n driver = Selenium::WebDriver.for :firefox\n driver.get(login_url)\n driver.find_element(:id => \"username\").send_keys(username)\n driver.find_element(:id => \"password\").send_keys(password)\n driver.find_element(:id => \"button-login\").click\n driver.get(product_url)\n driver.find_element(:name => \"product\").find_element(:css,\"option[value='ESXi (Embedded and Installable)']\").click\n driver.find_element(:name => \"product\").find_element(:css,\"option[value='ESXi (Embedded and Installable)']\").click\n driver.find_element(:name => \"product\").find_element(:css,\"option[value='ESXi (Embedded and Installable)']\").click\n driver.find_element(:name => \"version\").send_keys(release)\n driver.find_element(:name => \"version\").send_keys(release)\n driver.find_element(:xpath,\"//*[@src='/patchmgr/resources/images/support_search_button.gif']\").click\n page = driver.page_source\n page = Nokogiri::HTML.parse(page)\n info = page.css(\"span\").css(\"input\")\n info.each do |download|\n value = download[\"value\"]\n if !value.match(/http/)\n update = value\n else\n if value.match(/ESX/)\n update_list[update] = value\n end\n end\n end\n return update_list\nend", "def version\n v = params[:version].to_i\n @group = Group.find(params[:id])\n @effective_version = @group.version\n @group.revert_to(v) if v != @effective_version\n end", "def si_update_product_select_from_order_item\n i = params[:i]\n product_id = 0\n if i != '0'\n @item = PurchaseOrderItem.find(i)\n product_id = @item.blank? ? 0 : @item.product_id\n end\n # Setup JSON\n @json_data = { \"product\" => product_id }\n render json: @json_data\n end", "def generate_version_list\n @list_title = 'Version List'\n @list_type = 'version'\n\n asset('version_list.html', erb(:full_list))\nend", "def show\n @version = Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end", "def so_update_selects_from_project\n project = params[:project]\n projects = projects_dropdown\n if project != '0'\n @project = Project.find(project)\n @contracting_requests = @project.blank? ? projects_contracting_requests(projects) : projects_contracting_requests(@project)\n @work_order = @project.blank? ? work_orders_dropdown : @project.work_orders.order(:order_no)\n @charge_account = @project.blank? ? projects_charge_accounts(projects) : charge_accounts_dropdown_edit(@project)\n @store = project_stores(@project)\n else\n @contracting_requests = projects_contracting_requests(projects)\n @work_order = work_orders_dropdown\n @charge_account = projects_charge_accounts(projects)\n @store = stores_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_order)\n # Contracting requests array\n @constracting_requests_dropdown = contracting_requests_array(@contracting_requests)\n # Setup JSON\n @json_data = { \"contracting_request\" => @constracting_requests_dropdown, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_account, \"store\" => @store }\n render json: @json_data\n end", "def index\n @product_sliders = @current_branch.product_sliders\n end", "def view_version\n @version = params[:version].to_i\n @story = Story.find(params[:id])\n @story = @story.versions[@version].reify\n\n respond_to do |format|\n format.html { render :version }\n format.html { head :no_content }\n end\n end", "def size_commodity_code_search_combo_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:size_search_form][:commodity_code_combo_selection] = commodity_code\n\t@size_codes = Size.find_by_sql(\"Select distinct size_code from sizes where commodity_code = '#{commodity_code}'\").map{|g|[g.size_code]}\n\t@size_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('size','size_code',@size_codes)%>\n\n\t\t}\nend", "def versions(sku, offer, location = @location, publisher = @publisher)\n raise ArgumentError, \"No location specified\" unless location\n raise ArgumentError, \"No publisher specified\" unless publisher\n\n url = build_url(\n location, 'publishers', publisher, 'artifacttypes', 'vmimage',\n 'offers', offer, 'skus', sku, 'versions'\n )\n\n JSON.parse(rest_get(url)).map{ |element| element['name'] }\n end", "def set_ver\n @ver = Ver.find(params[:id])\n end", "def upgrade\n respond_to do |wants|\n wants.json {\n ver = params[:ver]\n soft = SoftVersion.find_new_version_by_ver(ver)\n hash = {}\n if soft and soft.is_a?SoftVersion\n hash[:newversion] = true\n hash[:url] = \"http://#{request.host_with_port}/welcome/download?soft=#{soft.soft_name}&version=#{soft.version}\"\n else\n hash[\"newversion\"] = false\n hash[\"url\"] = \"No new version\"\n end\n render :json => hash.to_json, :layout => false\n }\n end\n\n end", "def set_version(override_version=nil)\n versioned_request = VersionCake::VersionedRequest.new(request, override_version)\n @requested_version = versioned_request.extracted_version\n @derived_version = versioned_request.version\n @is_latest_version = versioned_request.is_latest_version?\n if !versioned_request.is_version_supported?\n raise UnsupportedVersionError.new('Unsupported version error')\n end\n @_lookup_context.versions = versioned_request.supported_versions\n end", "def index\n\n # get the gauges to choose from\n @gauges = Product.gauges\n\n @device = detect_browser()\n\n # get the applications to choose from\n @applications = Product.applications\n\n @products = Product.all\n\n prod_params = params[:product]\n @selected_app = \"\"\n @selected_awg = \"\"\n\n if prod_params != nil\n if prod_params[\"selected_app\"] != nil\n @selected_app = prod_params[\"selected_app\"]\n @products = @products.single_application(@selected_app)\n logger.debug \"products single app: #{@products.inspect}\"\n end\n if prod_params[\"selected_awg\"] != nil\n @selected_awg = prod_params[\"selected_awg\"]\n @products = @products.single_gauge(@selected_awg)\n logger.debug \"products single gauge: #{@products.inspect}\"\n end\n\n #params[:page] = prod_params[\"page\"] if params[:page] == nil\n\n end\n\n @search_terms = params[\"search_terms\"] unless params[\"search_terms\"] == nil\n\n if params[:page] == nil\n @products = @products.search(params[\"search_terms\"], 1)\n @page = 1\n else\n @products = @products.search(params[\"search_terms\"], params[:page])\n @page = params[:page]\n end\n end", "def index\n @version_controls = VersionControl.all\n end", "def getVersions\r\n\t\t\t\t\treturn @versions\r\n\t\t\t\tend", "def update_client_users_list\n render :update do |page|\n users = Client.find(params[:client_id]).client_users\n page.replace_html 'client_user_select', :partial => 'user_select', :locals => { :users => users }\n end\n end", "def show\n @stores = Store.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n if params[:update_products].present? \n @products = Product.order(sort_column + \" \" + sort_direction)\n @update_products = true\n end \n end", "def build_current_versions\n version_list = []\n new_resource.package_name.each_with_index do |name, index|\n version = if new_resource.version && !new_resource.version[index].nil?\n powershell_exec(build_powershell_package_command(\"Get-Package '#{name}'\", new_resource.version[index]), timeout: new_resource.timeout).result\n else\n powershell_exec(build_powershell_package_command(\"Get-Package '#{name}'\"), timeout: new_resource.timeout).result\n end\n if version.empty?\n version = nil\n end\n version = version.strip if version.respond_to?(:strip)\n version_list.push(version)\n end\n version_list\n end", "def versions\n JSON.parse(RestClient.get(\"#{VERSION_URL}/.json\", self.default_headers))[\"versions\"].collect { |v| v[\"id\"] }.uniq\n end", "def update_version( result ) \n self.id = result['id']\n self.rev = result['rev']\n end", "def get_version\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}\", {\n headers: {\"Fastly-Key\" => $key}\n })\n end", "def get_selected_variant_data\n @variant = Spree::Variant.where(:id => params[:variant_id]).first\n @sku = @dispatch_no = @variant.sku+\"_\"+Time.now.strftime('%y%m%d%H%L')\n price = @variant.price\n respond_to do |format|\n format.json { render :json => {:variant => @variant,\n :sku => @sku, :price => price }}\n end\n end", "def update\n respond_to do |format|\n if @ver.update(ver_params)\n format.html { redirect_to @ver, notice: 'Ver was successfully updated.' }\n format.json { render :show, status: :ok, location: @ver }\n else\n format.html { render :edit }\n format.json { render json: @ver.errors, status: :unprocessable_entity }\n end\n end\n end", "def products\n @products = Product.where(florist_id: session[\"found_florist_id\"]).order(\"status\", \"product_type\", \"name\").paginate(:page => params[:page], :per_page => 25) \n @PRODUCT_UPDATE_MUST_HAVE = PRODUCT_UPDATE_MUST_HAVE\n render(:products) and return\n end", "def enterprise_version(v)\n reset_all\n add_enterprise_versions Gem::Version.new(v)\n end", "def select_project_to_update_production_progress\n @projects = current_user.assigned_projects_for( PROJECT_ROLE[:post_production] ) \n add_breadcrumb \"Select Project\", 'select_project_to_update_production_progress_url'\n \n render :file => \"projects/project_management/select_project_to_update_production_progress\"\n end", "def get_survey_version\n @survey = @current_user.surveys.find(params[:survey_id])\n @survey_version = @survey.survey_versions.find(params[:survey_version_id])\n end" ]
[ "0.6672751", "0.6340233", "0.6335548", "0.6306724", "0.622417", "0.6133397", "0.6099903", "0.60944396", "0.6087498", "0.6010113", "0.59525603", "0.5943714", "0.59316754", "0.5914761", "0.58474874", "0.5846949", "0.5791928", "0.5751249", "0.5698358", "0.56675607", "0.5591197", "0.5585135", "0.55724907", "0.5550216", "0.5548817", "0.5546711", "0.55374753", "0.5532745", "0.55234146", "0.55175716", "0.5504404", "0.54936", "0.5483311", "0.5482287", "0.54685706", "0.54539496", "0.5450903", "0.54261833", "0.5421079", "0.5414772", "0.5406776", "0.5391996", "0.53886396", "0.5380076", "0.53634125", "0.5356129", "0.5356047", "0.53503656", "0.53410083", "0.5336167", "0.5335327", "0.53229624", "0.5319184", "0.5316358", "0.53096527", "0.53094035", "0.53063524", "0.5305698", "0.5304685", "0.5301099", "0.52973783", "0.52952814", "0.5293795", "0.5292685", "0.5290306", "0.5287598", "0.5286002", "0.52859664", "0.52831393", "0.52826846", "0.527787", "0.52722394", "0.5271506", "0.52644897", "0.5262863", "0.5260637", "0.52516496", "0.52469105", "0.5243093", "0.5226764", "0.52201974", "0.5219741", "0.52186936", "0.5214664", "0.5212849", "0.5212061", "0.5208311", "0.5207711", "0.5206199", "0.52042353", "0.519155", "0.5189852", "0.51871717", "0.5185125", "0.5177964", "0.5177207", "0.5173741", "0.5170003", "0.51667243", "0.51620454" ]
0.8145799
0
Verify user is logged in If not refer to login page
def require_login unless current_user redirect_to login_path(:referer => request.fullpath) return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end", "def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end", "def verify_logged_in\n redirect_to root_path unless logged_in?\n end", "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end", "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end", "def logged_in_verification\n if is_logged_in?(session)\n @user = current_user(session)\n else\n flash[:message] = \"You must be logged in to access that page.\"\n redirect \"/login\"\n end\n end", "def verify_logged_in\n if !logged_in?\n redirect_to \"/modal/login?return_url=\" + URI.encode(request.fullpath)\n return false\n end \n return true \n end", "def check_logged_in?\n if !logged_in?\n redirect_to root_path\n end\n end", "def logged_in?\n if current_user == nil\n redirect_to new_user_session_path, alert: \"Kindly Login!\"\n end\n end", "def is_logged_in\n if !logged_in?\n redirect_unauthorized(:back, \"You must be logged in to perform this action.\")\n end\n end", "def check_if_logged_in\n unless @current_user.present?\n flash[:login_error] = \"Please login to view that page.\"\n redirect_to login_path\n end\n end", "def check_authentication\n unless logged_in?\n flash[:warning] = \"You must be logged in to view the requested page.\"\n request.env[\"HTTP_REFERER\"] ? (redirect_to :back) : (redirect_to :action => \"index\", :controller => \"site\")\n return false\n end\n end", "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", "def logged_in_user\n unless logged_in?\n redirect_to login_url\n end\n end", "def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end", "def check_logged_in\n return if current_user.present?\n\n redirect_to new_session_path and return\n end", "def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend", "def check_login\n if !session[:user_name]\n redirect_to sign_in_path\n end\n end", "def is_logged_in\n redirect_to login_path unless logged_in?\n end", "def check_logged_in\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n\n return\n end", "def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end", "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end", "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end", "def logged_in?\n if session[:user_id].nil?\n redirect_to root_path\n else\n true\n end\n end", "def check_login_status\n # If user hasn't logged in\n unless logged_in?\n # Show reminder message\n flash[:info] = \"Log in to continue.\"\n\n # Redirect user to login page\n redirect_to login_url\n end\n end", "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", "def check_login\n redirect_to root_url, alert: \"You must login to view this page.\" if current_user.nil?\n end", "def logged_in?\n if current_user == nil\n redirect_to \"/sign_in\"\n end\n end", "def logged_in_user?\n unless logged_in?\n redirect_to new_user_session_path\n flash[:danger] = \"Please login to do that action\"\n end\n end", "def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "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", "def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end", "def check_if_already_logged_in\n redirect_to(user_url(current_user)) if logged_in?\n end", "def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end", "def logged_in_user?\n if logged_in?\n redirect_to user_path(current_user)\n end\n end", "def log_in?\n if current_user\n redirect_to user_path\n end\n end", "def logged_in?\n redirect_to(root_path, notice: 'Unauthorized access!') unless current_user\n end", "def logged_in?\n unless User.find_by(id:session[:user_id])\n redirect_to login_url, notice:\"Please log in as a user before viewing this page.\"\n end\n end", "def authenticate_user\n \tif !logged_in?\n \tredirect_to login_url\n \tend\n end", "def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end", "def ensure_logged_in\n if (!logged_in?)\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: \"Please log in.\" }\n end\n end", "def check_login\n head :forbidden unless self.current_user\n end", "def logged_in_user\n if !logged_in?\n flash[:failure] = \"You must sign in first.\"\n redirect_to(login_url)\n end\n end", "def logged_in_user\n if !logged_in?\n flash[:failure] = \"You must sign in first.\"\n redirect_to(login_url)\n end\n end", "def check_if_logged_in\n # if the current request is coming from a user who is not logged in\n # redirect them to the login page\n # any controller actions that should only be available to\n # logged in users will need to run this method before performing\n unless @current_user.present?\n flash[:error] = 'You must be logged in to perform that action'\n redirect_to login_path\n end # unless\n end", "def authenticated\n\t\tif current_user || current_admin\n\t\t\ttrue\n\t\telse\n\t\t\tflash[:error] = \"You must log in to view that page!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "def user_redirect_check\n if session[:user_id] && current_user\n return true\n else\n redirect_to login_path\n end\n end", "def require_user\n unless logged_in?\n store_target_location\n flash[:notice] = \"Debe iniciar sesion para poder acceder a esta pagina\"\n redirect_to login_url\n return false\n end\n true\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "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", "def redirect_if_not_logged_in\n #redirect the user if the user is not logged in\n end", "def login_required\n unless session[:user_id].present?\n redirect_to login_user_index_path\n end\n end", "def must_be_logged_in\n unless current_user\n redirect_to new_user_session_path\n end\n end", "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", "def logged_in_user\n unless logged_in?\n flash[:negative] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def check_for_login\n #if not, back home with you!\n redirect_to root_path unless @current_user.present?\n end", "def logged_in_user\n unless logged_in?\n flash[:info] = \"Please log in!\"\n redirect_to login_url\n end\n end", "def logged_in_user?\n unless logged_in?\n store_location\n flash[:info] = 'please log in first'\n redirect_to login_path\n end\n end", "def check_login\n unless logged_in?\n access_denied\n end\n end", "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", "def logged_in?\n !!link_to_account_detail_page\n end", "def logged_in_user\n unless logged_in?\n flash[:warning] = \"Please log in\"\n redirect_to root_url\n end\n end", "def must_be_logged_in\n redirect_to root_path unless logged_in?\n end", "def confirm_logged_in\n unless session[:username]\n redirect_to authenticate_login_path\n else\n true\n end\n end", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path, alert: \"You are not logged in\"\n end\n end", "def check_session\n if session[:user_id].nil?\n session[:return_to] = request.request_uri\n flash[:messgae] = \"Please sign-in or sign-up to access any of these pages.\"\n redirect_to :controller => 'user', :action => 'index'\n return\n end\n end", "def require_logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Veuilliez vous connecter svp.\"\n redirect_to login_path\n end\n end", "def check_login\n unless is_logged_in?\n # all cool\n redirect_to new_session_path\n end\n end", "def logged_in\n\t \t!current_user.nil?\n\t end", "def is_logged_in?\n if current_reserver == nil\n flash[:alert]=\"Please log in\"\n redirect_to client_login_url\n end\n end", "def verified_user\n redirect_to '/' unless logged_in?\n end", "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: 'Por favor, faça login' }\n end\n end", "def 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", "def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end", "def verify_user\n ## redirect to appropriate path\n redirect_to root_url, notice: 'You have already signed out. Please sign in again.' unless !current_user.nil?\n end", "def login_required\n return true unless session[:user_id].blank?\n return false\n end", "def check_if_login_required\n false\n end", "def login_required\n redirect_to login_path unless logged_in?\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "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", "def is_user_authenticate\r\n redirect_to '/users/sign_in' if current_user.nil?\r\n end" ]
[ "0.83395827", "0.8292265", "0.82782316", "0.81271154", "0.81271154", "0.8060002", "0.8051386", "0.8023653", "0.7991681", "0.7910934", "0.78918064", "0.7880072", "0.78715014", "0.7852641", "0.7848119", "0.78474313", "0.78348446", "0.7830171", "0.7824766", "0.78112847", "0.7785202", "0.77804846", "0.77804846", "0.7780396", "0.77797896", "0.77774704", "0.7772968", "0.77721906", "0.77712744", "0.7769898", "0.776713", "0.776713", "0.776713", "0.774853", "0.77346534", "0.7727855", "0.7720594", "0.7720311", "0.7714127", "0.771265", "0.76968", "0.76929516", "0.7691489", "0.7678486", "0.7671207", "0.76709455", "0.7667804", "0.7667804", "0.76600266", "0.76551634", "0.7653038", "0.76511484", "0.7648454", "0.76405674", "0.76399595", "0.7639466", "0.7636908", "0.7636122", "0.76305103", "0.76296985", "0.76234543", "0.76219654", "0.7620758", "0.7618791", "0.7618099", "0.7614381", "0.76143575", "0.76141465", "0.7613097", "0.7612709", "0.7602227", "0.7587793", "0.75852877", "0.757932", "0.7579046", "0.7578202", "0.75775707", "0.7570304", "0.7567819", "0.75620085", "0.7557719", "0.7552102", "0.7547455", "0.75470835", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.754449", "0.75427276", "0.75422907" ]
0.0
-1
Authorize product raises an exception if user tries to a access a product that they do not have access to This is used in controller. The check for views is in the application helper
def authorize_product!(product) unless product.nil? unless current_user.products.include?(product) raise Exceptions::ProductAccessDenied end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize\n if session[:user_id] != 3\n raise AccessDenied\n #render \"public/404\", status: :not_found, layout: false\n end\n end", "def show\n # Prevents unauthorized access by other users\n # if !current_user.purchases.where(:id => @purchase.id).any?\n # flash[:notice] = \"You don't have permission to view that page!\"\n # redirect_to current_user\n # return\n # end\n\n end", "def verify_ownership\n\t\tif @current_user.id != Cart.find(params[:id]).user.id\n\t\t\tflash.now[:error] = \"Oops! You do not have permission to view this page.\"\n\t\t\trender :file => File.join(Rails.root, 'public', '403.html'), \n \t :status => 403\n\t\tend\n\tend", "def require_owner\n unless @product.owned_by?(current_user)\n flash[:alert] = \"Access denied\"\n redirect_to root_path\n end\n end", "def check_use\r\n if !(current_user.role.name==\"admin\")\r\n redirect_to frontend_root_path,\r\n notice: \"URL not found\"\r\n end\r\n end", "def show\n return unless check_permission\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def authorize\n if !current_user.has_role? :admin\n render text:\"No Access For You!!!\"\n end\n end", "def show\n #@product = Product.find(params[:id])\n #authorize! :show, @product\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end", "def show\n # authorize Admin\n end", "def show\n skip_authorization\n end", "def authorize\n if !current_user.has_role? :admin\n render plain:\"No access for you!\"\n end\n end", "def user_not_authorized(exception)\n\t\tpolicy_name = exception.policy.class.to_s.underscore\n\t\tredirect_to current_user_root_path, alert: I18n.t(\"pundit.#{policy_name}.#{exception.query}\")\n\tend", "def authorised?\n if current_user.role === 'SUPERVISOR' || current_user.role === 'ENGINEER'\n respond_to do |f|\n f.html { redirect_to root_path, alert: 'You are not authorised to access this page.' }\n end\n end\n end", "def show\n # authorize @item\n end", "def authorize_user\n if !user_signed_in? || !current_user.admin?\n raise ActionController::RoutingError.new(\"Not Found\")\n end\n end", "def authorized?\n if !@extra_page.editable_by? current_user, current_cookbook\n redirect_to sections_path, alert: \"You are not allowed to edit this extra page.\"\n end\n end", "def show\n enforce_view_permission(@user)\n \n end", "def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end", "def check_rights\n unless is_app_authorizer?\n logger.warn 'User is not lea or sea admin and cannot access application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n end", "def require_login\n\t\tauthorize_request || render_unauthorized(\"Access Denied\")\n\tend", "def check_can_access\n res = false\n read_actions = [ \"index\", \"list\", \"edit\" ]\n new_actions = [ \"new\", \"create\" ]\n edit_actions = [ \"edit\", \"update\", \"destroy\", \"update_logo\" ]\n\n res ||= (action_name == \"show_logo\")\n res ||= current_user.admin?\n\n if current_user.option_externalclients?\n res ||= (current_user.read_clients? and read_actions.include?(action_name))\n res ||= (current_user.edit_clients? and edit_actions.include?(action_name))\n res ||= (current_user.create_clients? and new_actions.include?(action_name))\n end\n\n if !res\n flash[\"notice\"] = _(\"Access denied\")\n redirect_from_last\n end\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def access_denied\n render \"common/access_denied\"\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def show\n authorize User\n end", "def show\n authorize User\n end", "def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def show\n authorize!\n end", "def show\n authorize!\n end", "def show\n authorize!\n end", "def check_authorization!\n #check_current_user!\n #authorized = current_user.present? && valid_organisation_date?\n\n # TODO check due_date\n if !current_user\n flash[:alert] = \"Por favor ingrese.\"\n redirect_to new_session_url(subdomain: 'app') and return\n elsif !current_user.present?# || current_organisation.dued_with_extension? || !authorized_user?\n redir = request.referer.present? ? :back : home_path\n\n if request.xhr?\n render text: '<div class=\"alert alert-warning flash\"><h4 class=\"n\">Usted no tiene los privilegios para ver esta página</h4><div>'\n else\n flash[:alert] = \"Usted ha sido redireccionado por que no tiene suficientes privilegios.\"\n redirect_to redir and return\n end\n end\n end", "def access_denied\n redirect_to main_app.root_url, alert: \"Not authorized\"\n end", "def appctrl_not_permitted\n render( { :text => 'Action not permitted', :status => 403 } )\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def show\n forbidden unless current_catalog_user.read_artwork\n end", "def check_backend_access\r\n\t\t\t#@toda ugly announce\r\n\t\t\tif !current_user.present? or !current_user.backend_access\r\n\t\t\t\trender plain: 'You are not authorized to perform this action!'\r\n\t\t\tend\r\n\t\tend", "def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end", "def tiene_permiso?\n if not protect?(action_name)\n return true\n end\n if @session['user'] and autorizado?(@session['user'], controller_name)\n return true\n end\n store_location\n access_denied\n return false\n end", "def show\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n end", "def show\n\t\tif current_usuario.asignacion_roles.where(esActual: true, id: Rol.where(nombre: \"Voluntario\"), proyecto: @requisito.actividad.proyecto) && current_usuario.asignacion_roles.where(esActual: true, proyecto: @requisito.actividad.proyecto).count == 1\n\t\t\traise CanCan::AccessDenied if !Requisito.accessible_by(current_ability, :show).include?(@requisito)\n\t\telse\n\t\t\tauthorize! :show, Requisito\n\t\tend\n end", "def access!(user, access)\n return if access?(user, access)\n\n raise Exceptions::NotAuthorized\n end", "def check_permissions\n redirect_to index_path, alert: lack_permission_msg unless admin_or_organizer?\n end", "def authorized\n if logged_in?\n return View(\"sessions/page_requires_login\"); \n end\n return View(\"Index\")\n end", "def show\n authorize @coupon\n end", "def show\n authorize Session\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def vendor_view\n# @vendor = curren_vendor # current vendor sign_in\n# if @vendor.access_key == @vendor_questionnaire.access_key\n @action_url = vendor_answer_path(@vendor_questionnaire)\n @vendor_answer = @vendor_questionnaire.vendor_answer\n @vendor_signatures = @vendor_questionnaire.signatures.first\n# else\n# flash[:error] = \"You are not authorized to access this page.\"\n# redirect_to main_menu_path and return false\n# end\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def check_authorization \n user = current_user\n unless session[\"permission_\" + action_name + \"_\" + controller_name] && user\n unless logged_in? and user.roles.detect { |role|\n role.permissions.detect { |permission|\n permission.action.to_s.include? action_name and permission.controller == self.class.controller_path\n }\n } \n flash[:warning] = \"You are not authorized to view the requested page.\"\n request.env[\"HTTP_REFERER\"] ? (redirect_to :back) : (redirect_to :action => \"index\", :controller => \"site\")\n\n return false\n end\n session[\"permission_\" + action_name + \"_\" + controller_name] = true\n end\n end", "def show\n #@cost_setup = CostSetup.find(params[:id])\n authorize User\n end", "def is_view_permitted?(user_or_project = nil)\n return false\n end", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def show\n\t\traise CanCan::AccessDenied if !Presupuesto.accessible_by(current_ability, :show).include?(@presupuesto) \n end", "def show\n authorize @activist_front\n end", "def show\n authorize @development\n end", "def obtains_product\n product = Product.find(params[:product_id])\n @product = product.user_id == @current_user.id ? product : nil\n (render(json: { e: 'AUTH' }, status: :unauthorized) && nil) if @product.nil?\n end", "def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end", "def check_permissions\n unless current_user.is_organizer?\n redirect_to index_path, alert: 'You do not have the permissions to visit this section of hardware.'\n end\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def show\n @order = Order.find(params[:id])\n if session[:user_permission] == 0 and @order.user.id != session[:user_id]\n redirect_to login_url, alert: \"Permission denied. Your are not an administrator.\"\n end\n end", "def ensure_authorized_to_view\n @listing = Listing.find(params[:id])\n unless @listing.visible_to?(@current_user, @current_community)\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>unless\"\n if @listing.visibility.eql?(\"everybody\")\n # This situation occurs when the user tries to access a listing\n # via a different community url.\n flash[:error] = \"this_content_is_not_available_in_this_community\"\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>if\"\n redirect_to community_home_path and return\n elsif @current_user\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>elsif\"\n flash[:error] = \"you_are_not_authorized_to_view_this_content\"\n redirect_to community_home_path and return\n else\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>else\"\n session[:return_to] = request.fullpath\n flash[:warning] = \"you_must_log_in_to_view_this_content\"\n redirect_to login_path and return\n end\n end\n end", "def authorize\n debug 'authorize:'\n unless User.authorized? params[:controller], params[:action], params[:func]\n flash[:error] = I18n.t('general.Flash.NotAuth')\n debug 'authorize: not authorized'\n raise \"User not authorized\"\n end\n debug 'authorize: authorized'\n true\n rescue => err\n error 'authorize: ' + err.to_s\n redirect_to :controller => 'reservation', :action => 'list'\n end", "def validate_access\n if @user_logged_in != @answer.user\n render status: :forbidden\n end\n end", "def show\n\n authorize Article\n end", "def render?\n return true if can?(RS::AuthorisationHelper::VIEW_RETURNS)\n\n false\n end", "def render?\n return true if can?(RS::AuthorisationHelper::VIEW_RETURNS)\n\n false\n end", "def user_not_authorized(e)\n flash[:error] = \"Please enroll in the class to see this content.\"\n redirect_to @course\n end", "def show\n respond_to do |format|\n format.html { render :text => \"You don't have permission to view this\" }\n end\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def ensure_authorized_to_view\n # If listing is not found (in this community) the find method\n # will throw ActiveRecord::NotFound exception, which is handled\n # correctly in production environment (404 page)\n begin\n @listing = @current_community.listings.find(params[:id])\n raise ListingDeleted if @listing.deleted?\n\n unless Policy::ListingPolicy.new(@listing, @current_community, @current_user).visible?\n if @current_user\n flash[:error] = if @listing.closed?\n t(\"layouts.notifications.listing_closed\")\n else\n t(\"layouts.notifications.you_are_not_authorized_to_view_this_content\")\n end\n redirect_to search_path and return\n else\n session[:return_to] = request.fullpath\n flash[:warning] = t(\"layouts.notifications.you_must_log_in_to_view_this_content\")\n redirect_to login_path and return\n end\n end\n rescue Exception => e\n redirect_to error_gone_path\n end\n end", "def show\n authorize @account\n # if authorize @account != true\n\n # end\n end", "def authorize\n redirect_to login_path, alert: 'You must be logged in to access this page.' if current_user.nil?\n end", "def authorize\n if current_user.nil? || current_user.tipo_usuario == \"Empleado\"\n redirect_to login_url, notice: \"No esta autorizado para ver esto. Por favor ingrese al sistema o reingrese como administrador.\"\n end\n end", "def http_authorize \n redirect_to login_path, alert: 'Authorization required' if !logged_in? \n end", "def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end", "def show\n authorize! :view, Var\n end", "def authorized?\n render nothing: true, status: :forbidden if !current_account\n end", "def show\n authorize Section\n end", "def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end", "def check_buyable\n raise PermissionDeniedError, \"出品したアイテムはサポートできません\" if @item.owner?(current_user)\n end", "def show\n\t\tauthorize! :show, DetalleRestriccion\n end", "def user_not_authorized(exception)\n flash[:error] = I18n.t(\"collection_draft_proposal_policy.#{exception.query}\", scope: 'pundit', default: :default)\n\n if exception.query == 'new?' || exception.query == 'create?'\n # the user has no permissions to access proposal mode\n clear_session_and_token_data\n redirect_to root_url\n else\n redirect_to manage_collection_proposals_path\n end\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def show\n authorize! :show, @kit\n end", "def rescue_cancan\n redirect_to login_path, alert:'You are not authorized to access that page!'\n end", "def show\n redirect_to root_path unless ViewMerchant.new(current_company_user, current_admin, current_merchant_user).check\n determine_user_role()\n load_permission_names()\n end", "def show\n render status: :forbidden, text: \"Forbidden!\" unless @transaction.user == current_user\n end", "def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end", "def show\n authorize @formation\n end", "def show\n authorize @fuel_supply\n end", "def show\n authorize @service_template\n end" ]
[ "0.6654826", "0.6486122", "0.6402508", "0.6393314", "0.6371291", "0.63313234", "0.63107234", "0.63074964", "0.6305529", "0.6282004", "0.6245829", "0.62382656", "0.62273705", "0.62078995", "0.6201282", "0.6196096", "0.61855185", "0.617958", "0.61782175", "0.6176873", "0.614276", "0.6142135", "0.61363035", "0.6122246", "0.6113356", "0.61026573", "0.60999525", "0.6092598", "0.6092598", "0.6086579", "0.6078242", "0.6078242", "0.60631084", "0.60631084", "0.60631084", "0.60511726", "0.6047968", "0.60423404", "0.6038951", "0.6038951", "0.6038951", "0.60307497", "0.6028273", "0.6010368", "0.59819955", "0.59749126", "0.59737974", "0.59657985", "0.59631526", "0.5955365", "0.5954975", "0.5954627", "0.59494585", "0.5941876", "0.5941422", "0.5941313", "0.5940887", "0.5940408", "0.59365857", "0.5933584", "0.59314555", "0.5930814", "0.5920117", "0.59187627", "0.5918007", "0.59168667", "0.591541", "0.59125566", "0.5906884", "0.5906615", "0.59052575", "0.59042186", "0.5899097", "0.5899097", "0.58983076", "0.5896704", "0.5896016", "0.5896016", "0.5893363", "0.5880191", "0.5877215", "0.5867992", "0.58678925", "0.58667946", "0.5865931", "0.58649707", "0.5861105", "0.58544177", "0.58534116", "0.5852075", "0.58448815", "0.5838766", "0.5836394", "0.5836245", "0.5835163", "0.5834762", "0.5833742", "0.58271664", "0.5826285", "0.58234066" ]
0.6899302
0
Call to set timezone for user
def set_user_time_zone Time.zone = current_user.time_zone if current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timezone\n u = User.find_by_id(current_user.id)\n u.timezone = params[:timezone]\n u.save\n render :layout => false\n end", "def set_timezone\n Time.zone = @user.time_zone if has_session?\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone if current_user.try(:time_zone)\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone unless current_user.nil?\n end", "def set_timezone\n Time.zone = current_user.try(:time_zone) || 'Eastern Time (US & Canada)'\n end", "def set_time_zone\n Time.zone = current_user.time_zone\n end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_time_zone\n Time.use_zone(current_user.time_zone) { yield }\n end", "def set_user_time_zone\n user = current_user || (params[:user_name].presence && User.find_by(:userid => params[:user_name]))\n session[:user_tz] = Time.zone = (user ? user.get_timezone : server_timezone)\n end", "def user_timezone=(value)\n @user_timezone = value\n end", "def set_timezone(&action)\n Time.use_zone(current_user.time_zone, &action)\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone if signed_in?\n end", "def set_timezone\n tz = Profile.find_by_user_id(current_user.id).timezone\n @timezone = Time.now.in_time_zone(tz).strftime('%z')\n if current_user\n User.current = current_user\n end\n end", "def set_timezone\n tz = current_user ? current_user.time_zone : nil\n Time.zone = tz || ActiveSupport::TimeZone[\"UTC\"]\n end", "def set_timezone()\n current_tz = Time.zone\n if logged_in?\n Time.zone = current_user.timezone\n end\n ensure\n Time.zone = current_tz\n end", "def set_timezone\n Time.zone = if user_signed_in?\n current_user.timezone\n else\n 'Eastern Time (US & Canada)'\n end\n end", "def set_time_zone(&block)\n time_zone = if user_signed_in?\n current_user.user_location.try(:time_zone) || 'UTC'\n else\n 'UTC'\n end\n Time.use_zone(time_zone, &block)\n end", "def set_timezone\n if user_signed_in?\n Time.zone = current_user.timezone\n else\n Time.zone = 'Eastern Time (US & Canada)'\n end\n end", "def set_user_time_zone\n if logged_in? && !current_user.time_zone.nil?\n Time.zone = current_user.time_zone\n else\n Time.zone = 'Eastern Time (US & Canada)'\n end\n end", "def set_timezone\n Time.zone = current_account.time_zone if current_account.time_zone\n end", "def set_timezone(force = false)\n if self.current_sign_in_ip && (force || self.time_zone.blank?)\n coordinates = Geocoder.search(self.current_sign_in_ip).first.coordinates\n timezone = Timezone::Zone.new(latlon: coordinates) unless [0.0, 0.0]\n self.update_attribute(:time_zone, timezone) if timezone\n end\n end", "def to_user_tz(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def set_time_zone\n if logged_in?\n old_time_class = Chronic.time_class\n begin\n Time.use_zone( self.current_user.time_zone ) do\n Chronic.time_class = Time.zone\n yield\n end\n ensure\n Chronic.time_class = old_time_class\n end\n else\n yield\n end\n end", "def set_timezone(opts = {})\n cmd = command_builder('clock timezone', opts)\n configure(cmd)\n end", "def change_time_zone\n\t\t#Is user logged in?\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\t\t\n\t\t@user.time_zone = params[:time_zone]\n\t\t@user.save\n\t\t\n\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\tend", "def user_time_zone(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def user_time_zone(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def user_timezone(&block)\n return yield unless current_user\n\n Time.use_zone(current_user.timezone, &block)\n end", "def set_time_zone\n old_time_zone = Time.zone\n\n new_time_zone = user_time_zone()\n \n Time.zone = new_time_zone if new_time_zone\n\n yield\n ensure # make sure we restore old time zone\n Time.zone = old_time_zone\n end", "def with_timezone\n Time.use_zone(current_user.try(:get_time_zone)) { yield }\n end", "def set_timezone\n \tTime.zone = \"Pacific Time (US & Canada)\"\n \tend", "def set_timezone\n loc = Location.find(self.location_id)\n self.time_zone, self.localGMToffset = loc.time_zone, loc.localGMToffset\n end", "def set_timezone\n offset, lookup_type = nil, nil\n if geonames_available?\n lookup_type = 'geoname'\n latlon = [params[:latitude].to_f, params[:longitude].to_f]\n timezone = Timezone::Zone.new latlon: latlon\n offset = timezone.utc_offset / (60 * 60)\n end\n\n if offset.nil?\n if params[:offset]\n lookup_type = 'javascript'\n offset = params[:offset]\n # Have to flip the sign because getTimezoneOffset is backward\n offset = -offset.to_i\n else\n lookup_type = 'default'\n current_offset = current_user.preferences[:timezone_offset]\n offset = current_offset ? current_offset : 0\n end\n end\n\n current_user.preferences[:timezone_offset] = offset\n current_user.save\n\n respond_to do |format|\n format.html { render json: { offset: offset, lookup: lookup_type } }\n end\n end", "def set_Timezone(value)\n set_input(\"Timezone\", value)\n end", "def set_timezone\n Time.zone = cookies[\"time_zone\"]\n end", "def timezone\n ret = {}\n if logged_in?\n puts 'SET TIMEZONE ' + params.inspect\n tz = ActiveSupport::TimeZone[params[:offset].to_i]\n if tz\n puts 'tz=' + tz.name\n current_user.time_zone = tz.name\n current_user.save(:dirty=>true)\n ret[:timezone] = tz.name\n end\n end\n render :json=>ret\n end", "def set_timezone\n Time.zone = Time.zone_default\n end", "def with_timezone\n Time.use_zone(current_user_timezone) { yield }\n end", "def set_time_zone\n Time.use_zone('Europe/Moscow') { yield }\n end", "def set_user_timezone(user_id, timezone_name)\n \t# validate\n\t begin\n tz = TZInfo::Timezone.get(timezone_name)\n rescue => e\n return false\n end\n\n # store in database\n user_timezone = USER_TIMEZONE[user_id: user_id]\n \tif user_timezone.nil?\n USER_TIMEZONE << {\n user_id: user_id, \n timezone: timezone_name, \n last_changed: utc_now.to_time.to_i\n }\n else\n # make sure they're not trying to play the system\n now = user_now(user_id)\n next_change = get_next_time_can_change_timezone(user_id)\n return false if now < next_change\n\n user_timezone = USER_TIMEZONE.where(user_id: user_id)\n user_timezone.update(timezone: timezone_name)\n user_timezone.update(last_changed: utc_now.to_time.to_i)\n end\n \t\n \treturn true \n end", "def time_zone=(_arg0); end", "def time_zone=(_arg0); end", "def set_time_zone\n # Make sure blank is always nil\n self.time_zone = nil if time_zone.blank?\n # If there are coordinates, use them to set the time zone, and reject\n # changes to the time zone if the coordinates have not changed\n if georeferenced?\n if coordinates_changed?\n lat = ( latitude_changed? || private_latitude.blank? ) ? latitude : private_latitude\n lng = ( longitude_changed? || private_longitude.blank? ) ? longitude : private_longitude\n self.time_zone = TimeZoneGeometry.time_zone_from_lat_lng( lat, lng ).try(:name)\n self.zic_time_zone = ActiveSupport::TimeZone::MAPPING[time_zone] unless time_zone.blank?\n elsif time_zone_changed?\n self.time_zone = time_zone_was\n self.zic_time_zone = zic_time_zone_was\n end\n end\n # Try to assign a reasonable default time zone\n if time_zone.blank?\n self.time_zone = nil\n self.time_zone ||= user.time_zone if user && !user.time_zone.blank?\n self.time_zone ||= Time.zone.try(:name) unless time_observed_at.blank?\n self.time_zone ||= 'UTC'\n end\n if !time_zone.blank? && !ActiveSupport::TimeZone::MAPPING[time_zone] && ActiveSupport::TimeZone[time_zone]\n # We've got a zic time zone\n self.zic_time_zone = time_zone\n self.time_zone = if rails_tz = ActiveSupport::TimeZone::MAPPING.invert[time_zone]\n rails_tz\n elsif ActiveSupport::TimeZone::INAT_MAPPING[time_zone]\n # Now we're in trouble, b/c the client specified a valid IANA time\n # zone that TZInfo knows about, but it's one Rails chooses to ignore\n # and doesn't provide any mapping for so... we have to map it\n ActiveSupport::TimeZone::INAT_MAPPING[time_zone]\n elsif time_zone =~ /^Etc\\//\n # If we don't have custom mapping and there's no fancy Rails wrapper\n # and it's one of these weird oceanic Etc zones, use that as the\n # time_zone. Rails can use that to cast times into other zones, even\n # if it doesn't recognize it as its own zone\n time_zone\n else\n ActiveSupport::TimeZone[time_zone].name\n end\n end\n self.time_zone ||= user.time_zone if user && !user.time_zone.blank?\n self.zic_time_zone ||= ActiveSupport::TimeZone::MAPPING[time_zone] unless time_zone.blank?\n if !zic_time_zone.blank? && ActiveSupport::TimeZone::MAPPING[zic_time_zone] && ActiveSupport::TimeZone[zic_time_zone]\n self.zic_time_zone = ActiveSupport::TimeZone::MAPPING[zic_time_zone]\n end\n true\n end", "def set_timezone\n if session[:timezone]\n\t Time.zone = session[:timezone][\"name\"]\n\t # flash.now.alert = \"set TZ to \" + session[:timezone][\"name\"]\n\telse\n\t # flash.now.alert = \"TZ is \" + Time.zone.to_s\n\tend\n end", "def time_zone=(value)\n @time_zone = value\n end", "def set_timezone\n default_timezone = Time.zone\n client_timezone = cookies[:timezone]\n # puts \"Na to to coooookie\"\n # puts client_timezone\n Time.zone = client_timezone if client_timezone.present?\n yield\n ensure\n Time.zone = default_timezone\n end", "def set_time_zone\n Time.zone = 'Warsaw'\n end", "def set_time_zone(&block)\n if cookies[:tz]\n puts \"*\" * 60\n puts \"Time zone: #{cookies[:tz]}\"\n puts \"*\" * 60\n Time.use_zone(cookies[:tz], &block)\n else\n # The around method must yield to execute the action.\n # http://guides.rubyonrails.org/action_controller_overview.html#after-filters-and-around-filters\n yield\n end\n end", "def update!(**args)\n @timezone = args[:timezone] if args.key?(:timezone)\n end", "def setup_time_zone(&block)\n Time.use_zone(Time.find_zone!(@mentor.time_zone.to_i.hours), &block)\n end", "def timezone\r\n\t\t@usr_timezone\r\n\tend", "def zone=(time_zone)\n Thread.current[:time_zone] = get_zone(time_zone)\n end", "def before_setup\n @original_time_zone = Time.zone\n super\n end", "def set_timezone\n offset = [ Time.now.beginning_of_year.utc_offset, Time.now.beginning_of_year.change(:month => 7).utc_offset ].min\n offset *= 3600 if offset.abs < 13\n Time.zone = ActiveSupport::TimeZone.all.select { |zone| zone.utc_offset == offset }.first\n end", "def set_timezone\n offset = [Time.now.beginning_of_year.utc_offset, Time.now.beginning_of_year.change(month: 7).utc_offset].min\n offset *= 3600 if offset.abs < 13\n Time.zone = ActiveSupport::TimeZone.all.select { |zone| zone.utc_offset == offset }.first\nend", "def setup_timezone\n timezone = config.dig(\"timezone\").split(\"-\").first.chomp(\" \")\n\n application nil do\n <<~CONFS\n # Default timezone\n config.time_zone = \"#{timezone}\"\n\n CONFS\n end\n end", "def time_zone=(value)\n if value.is_a? ActiveSupport::TimeZone\n super\n else\n zone = ::Time.find_zone(value) # nil if can't find time zone\n super zone\n end\n end", "def tenant_default_timezone=(value)\n @tenant_default_timezone = value\n end", "def set_request\n @timezones = TZInfo::Timezone.all.map { |t| [t.friendly_identifier(true), t.identifier] }.sort\n if @timezones && params[:id]\n @timezone = @timezone.find(params[:id])\n end\n end", "def set_timezone_from_browser(options = {})\n prepend_before_action :set_timezone_from_browser_cookie, options\n end", "def update!(**args)\n @time_zone = args[:time_zone] if args.key?(:time_zone)\n end", "def nil_timezone_update\n if current_user.timezonepref.nil?\n parent_id = current_user.parent_id\n parent_timezone = User.find(parent_id).timezonepref\n flash[:error] = 'We strongly suggest that instructors specify their preferred timezone to'\\\n ' guarantee the correct display time. For now we assume you are in ' + parent_timezone\n current_user.timezonepref = parent_timezone\n end\n end", "def set_zone_from_session\n Time.zone = ActiveSupport::TimeZone[session[:timezone_offset]] if session[:timezone_offset]\n end", "def timezone\n\n\t\tusersnumber = params[\"From\"]\n\n\t\t@ix = Telapi::InboundXml.new do\n\t\t \tGather(\n\t\t \t\t :action => 'http://afternoon-badlands-6611.herokuapp.com/wake/time.xml',\n\t\t :method => 'POST',\n\t\t :numDigits => '4',\n\t\t :finishOnKey => '#') {\n\t\t \tSay 'Please enter four digits for your selected wakeup time. As an example, for ten thirty p m, enter 1 0 3 0.'\n \t\t}\t \n \t\tend\n\n \t\trespond_to do |format| \n \t\tformat.xml { render :xml => @ix.response } \n\t\tend\n\n\t\t@timezone = params[\"Digits\"]\n\t\t#@user = Caller.new\n\t\t@user = Caller.where(:number => usersnumber).first\n\n\t\tif @timezone == \"1\"\n\t\t\t@user.timezone = \"EST\"\n\n\t\telsif @timezone == \"2\"\n\t\t\t@user.timezone = \"CST\"\n\n\t\telsif @timezone == \"3\"\n\t\t\t@user.timezone = \"MST\"\n\n\t\telsif @timezone == \"4\"\n\t\t\t@user.timezone = \"PST\"\n\n\t\tend\n\t\t\t\t\n\t\t@user.save\n\n\tend", "def set_tz_request\n @tz_request = TzRequest.find(params[:id])\n end", "def time_zone\n super\n end", "def scheduled_for_time_to_utc\n self.scheduled_for = ActiveSupport::TimeZone\n .new(self.user.timezone)\n .local_to_utc(self.scheduled_for)\n end", "def user_timezone_specified\n ExpertizaLogger.error LoggerMessage.new(controller_name, session[:user].name, 'Timezone not specified', request) if current_user.timezonepref.nil?\n flash.now[:error] = 'You have not specified your preferred timezone yet. Please do this before you set up the deadlines.' if current_user.timezonepref.nil?\n end", "def timezone=(timezone)\n if !timezone.nil?\n @timezone = ActiveSupport::TimeZone[timezone]\n else\n @timezone = ActiveSupport::TimeZone['Etc/UTC']\n end\n end", "def timezone(identifier); end", "def timezone(identifier); end", "def timezone(identifier); end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def timezone=(tz)\n if tz.nil?\n @redis.del(\"contact_tz:#{self.id}\")\n else\n # ActiveSupport::TimeZone or String\n @redis.set(\"contact_tz:#{self.id}\",\n tz.respond_to?(:name) ? tz.name : tz )\n end\n end", "def timezone=(timezone)\n if timezone.nil?\n fail ArgumentError, 'timezone cannot be nil'\n end\n\n if timezone.to_s.length < 1\n fail ArgumentError, 'invalid value for \"timezone\", the character length must be great than or equal to 1.'\n end\n\n @timezone = timezone\n end", "def user_timezone\n return @user_timezone\n end", "def create_timezone\n raise_not_implemented('create_timezone')\n end", "def default_tzid=(value)\n @default_tzid=value\n end", "def timezone=(timezone)\n validator = EnumAttributeValidator.new('String', [\"Pacific/Niue\", \"Pacific/Pago_Pago\", \"Pacific/Honolulu\", \"Pacific/Rarotonga\", \"Pacific/Tahiti\", \"Pacific/Marquesas\", \"America/Anchorage\", \"Pacific/Gambier\", \"America/Los_Angeles\", \"America/Tijuana\", \"America/Vancouver\", \"America/Whitehorse\", \"Pacific/Pitcairn\", \"America/Dawson_Creek\", \"America/Denver\", \"America/Edmonton\", \"America/Hermosillo\", \"America/Mazatlan\", \"America/Phoenix\", \"America/Yellowknife\", \"America/Belize\", \"America/Chicago\", \"America/Costa_Rica\", \"America/El_Salvador\", \"America/Guatemala\", \"America/Managua\", \"America/Mexico_City\", \"America/Regina\", \"America/Tegucigalpa\", \"America/Winnipeg\", \"Pacific/Galapagos\", \"America/Bogota\", \"America/Cancun\", \"America/Cayman\", \"America/Guayaquil\", \"America/Havana\", \"America/Iqaluit\", \"America/Jamaica\", \"America/Lima\", \"America/Nassau\", \"America/New_York\", \"America/Panama\", \"America/Port-au-Prince\", \"America/Rio_Branco\", \"America/Toronto\", \"Pacific/Easter\", \"America/Caracas\", \"America/Asuncion\", \"America/Barbados\", \"America/Boa_Vista\", \"America/Campo_Grande\", \"America/Cuiaba\", \"America/Curacao\", \"America/Grand_Turk\", \"America/Guyana\", \"America/Halifax\", \"America/La_Paz\", \"America/Manaus\", \"America/Martinique\", \"America/Port_of_Spain\", \"America/Porto_Velho\", \"America/Puerto_Rico\", \"America/Santo_Domingo\", \"America/Thule\", \"Atlantic/Bermuda\", \"America/St_Johns\", \"America/Araguaina\", \"America/Argentina/Buenos_Aires\", \"America/Bahia\", \"America/Belem\", \"America/Cayenne\", \"America/Fortaleza\", \"America/Godthab\", \"America/Maceio\", \"America/Miquelon\", \"America/Montevideo\", \"America/Paramaribo\", \"America/Recife\", \"America/Santiago\", \"America/Sao_Paulo\", \"Antarctica/Palmer\", \"Antarctica/Rothera\", \"Atlantic/Stanley\", \"America/Noronha\", \"Atlantic/South_Georgia\", \"America/Scoresbysund\", \"Atlantic/Azores\", \"Atlantic/Cape_Verde\", \"Africa/Abidjan\", \"Africa/Accra\", \"Africa/Bissau\", \"Africa/Casablanca\", \"Africa/El_Aaiun\", \"Africa/Monrovia\", \"America/Danmarkshavn\", \"Atlantic/Canary\", \"Atlantic/Faroe\", \"Atlantic/Reykjavik\", \"Etc/GMT\", \"Europe/Dublin\", \"Europe/Lisbon\", \"Europe/London\", \"Africa/Algiers\", \"Africa/Ceuta\", \"Africa/Lagos\", \"Africa/Ndjamena\", \"Africa/Tunis\", \"Africa/Windhoek\", \"Europe/Amsterdam\", \"Europe/Andorra\", \"Europe/Belgrade\", \"Europe/Berlin\", \"Europe/Brussels\", \"Europe/Budapest\", \"Europe/Copenhagen\", \"Europe/Gibraltar\", \"Europe/Luxembourg\", \"Europe/Madrid\", \"Europe/Malta\", \"Europe/Monaco\", \"Europe/Oslo\", \"Europe/Paris\", \"Europe/Prague\", \"Europe/Rome\", \"Europe/Stockholm\", \"Europe/Tirane\", \"Europe/Vienna\", \"Europe/Warsaw\", \"Europe/Zurich\", \"Africa/Cairo\", \"Africa/Johannesburg\", \"Africa/Maputo\", \"Africa/Tripoli\", \"Asia/Amman\", \"Asia/Beirut\", \"Asia/Damascus\", \"Asia/Gaza\", \"Asia/Jerusalem\", \"Asia/Nicosia\", \"Europe/Athens\", \"Europe/Bucharest\", \"Europe/Chisinau\", \"Europe/Helsinki\", \"Europe/Istanbul\", \"Europe/Kaliningrad\", \"Europe/Kiev\", \"Europe/Riga\", \"Europe/Sofia\", \"Europe/Tallinn\", \"Europe/Vilnius\", \"Africa/Khartoum\", \"Africa/Nairobi\", \"Antarctica/Syowa\", \"Asia/Baghdad\", \"Asia/Qatar\", \"Asia/Riyadh\", \"Europe/Minsk\", \"Europe/Moscow\", \"Asia/Tehran\", \"Asia/Baku\", \"Asia/Dubai\", \"Asia/Tbilisi\", \"Asia/Yerevan\", \"Europe/Samara\", \"Indian/Mahe\", \"Indian/Mauritius\", \"Indian/Reunion\", \"Asia/Kabul\", \"Antarctica/Mawson\", \"Asia/Aqtau\", \"Asia/Aqtobe\", \"Asia/Ashgabat\", \"Asia/Dushanbe\", \"Asia/Karachi\", \"Asia/Tashkent\", \"Asia/Yekaterinburg\", \"Indian/Kerguelen\", \"Indian/Maldives\", \"Asia/Calcutta\", \"Asia/Kolkata\", \"Asia/Colombo\", \"Asia/Katmandu\", \"Antarctica/Vostok\", \"Asia/Almaty\", \"Asia/Bishkek\", \"Asia/Dhaka\", \"Asia/Omsk\", \"Asia/Thimphu\", \"Indian/Chagos\", \"Asia/Rangoon\", \"Indian/Cocos\", \"Antarctica/Davis\", \"Asia/Bangkok\", \"Asia/Hovd\", \"Asia/Jakarta\", \"Asia/Krasnoyarsk\", \"Asia/Saigon\", \"Indian/Christmas\", \"Antarctica/Casey\", \"Asia/Brunei\", \"Asia/Choibalsan\", \"Asia/Hong_Kong\", \"Asia/Irkutsk\", \"Asia/Kuala_Lumpur\", \"Asia/Macau\", \"Asia/Makassar\", \"Asia/Manila\", \"Asia/Shanghai\", \"Asia/Singapore\", \"Asia/Taipei\", \"Asia/Ulaanbaatar\", \"Australia/Perth\", \"Asia/Pyongyang\", \"Asia/Dili\", \"Asia/Jayapura\", \"Asia/Seoul\", \"Asia/Tokyo\", \"Asia/Yakutsk\", \"Pacific/Palau\", \"Australia/Adelaide\", \"Australia/Darwin\", \"Antarctica/DumontDUrville\", \"Asia/Magadan\", \"Asia/Vladivostok\", \"Australia/Brisbane\", \"Australia/Hobart\", \"Australia/Sydney\", \"Pacific/Chuuk\", \"Pacific/Guam\", \"Pacific/Port_Moresby\", \"Pacific/Efate\", \"Pacific/Guadalcanal\", \"Pacific/Kosrae\", \"Pacific/Norfolk\", \"Pacific/Noumea\", \"Pacific/Pohnpei\", \"Asia/Kamchatka\", \"Pacific/Auckland\", \"Pacific/Fiji\", \"Pacific/Funafuti\", \"Pacific/Kwajalein\", \"Pacific/Majuro\", \"Pacific/Nauru\", \"Pacific/Tarawa\", \"Pacific/Wake\", \"Pacific/Wallis\", \"Pacific/Apia\", \"Pacific/Enderbury\", \"Pacific/Fakaofo\", \"Pacific/Tongatapu\", \"Pacific/Kiritimati\"])\n unless validator.valid?(timezone)\n fail ArgumentError, \"invalid value for \\\"timezone\\\", must be one of #{validator.allowable_values}.\"\n end\n @timezone = timezone\n end", "def populate_timezones\n if new_record?\n self.created_at_timezone ||= Time.zone.name\n else\n if self.deleted?\n self.deleted_at_timezone ||= Time.zone.name\n end\n end\n end", "def set_tzid(time_zone_identifier)\n self.tzid = time_zone_identifier\n self\n end", "def use_zone(time_zone)\n old_zone, ::Time.zone = ::Time.zone, get_zone(time_zone)\n yield\n ensure\n ::Time.zone = old_zone\n end", "def current_user_timezone\n app_get_geo_data_by_ip.try(:timezone) || \"America/La_Paz\"\n end", "def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end", "def tz\n ActiveSupport::TimeZone.new timezone\n end", "def utc() end", "def set_timezone_override(timezone_id:)\n {\n method: \"Emulation.setTimezoneOverride\",\n params: { timezoneId: timezone_id }.compact\n }\n end", "def with_timezone\n timezone = Time.find_zone(cookies[:timezone])\n Time.use_zone(timezone) { yield }\n end", "def set_time_zone_context(id)\n if id\n @time_zone_context = {id: id}\n else\n @time_zone_context = nil\n end\n end", "def set_fips_tz\n @fips_tz = FipsTz.find(params[:id])\n end", "def set_node_timezone(node_city, timezone)\n @nodes[node_city].timezone = timezone\n end", "def initialize_time_zone\n if configuration.time_zone\n zone_default = Time.__send__(:get_zone, configuration.time_zone)\n\n unless zone_default\n raise \\\n 'Value assigned to config.time_zone not recognized.' +\n 'Run \"rake -D time\" for a list of tasks for finding appropriate time zone names.'\n end\n\n Time.zone_default = zone_default\n\n if defined?(ActiveRecord)\n ActiveRecord::Base.time_zone_aware_attributes = true\n ActiveRecord::Base.default_timezone = :utc\n end\n end\n end" ]
[ "0.8412679", "0.8209255", "0.81636345", "0.81419426", "0.813415", "0.8126488", "0.80992466", "0.80992466", "0.80992466", "0.80992466", "0.80992466", "0.80600506", "0.80131316", "0.79884493", "0.7979498", "0.7974073", "0.7963608", "0.7935895", "0.7837778", "0.78250784", "0.77304196", "0.7723305", "0.7716017", "0.7642472", "0.74635094", "0.74569696", "0.7360175", "0.7348636", "0.7321354", "0.72990686", "0.7297765", "0.7277669", "0.7247043", "0.7215308", "0.7209729", "0.71954143", "0.7180442", "0.7179038", "0.7125057", "0.7068332", "0.7063238", "0.69759274", "0.6962958", "0.6943436", "0.6900469", "0.6900469", "0.68136966", "0.68103886", "0.67752326", "0.67709684", "0.67650187", "0.67630553", "0.6689394", "0.66700435", "0.6628067", "0.6595056", "0.65727085", "0.6555408", "0.65068185", "0.64614516", "0.64447486", "0.6404558", "0.6384245", "0.63672924", "0.6358216", "0.6347816", "0.62831044", "0.62585276", "0.625497", "0.62458324", "0.62311924", "0.6226243", "0.62008244", "0.61952007", "0.61952007", "0.61952007", "0.61456805", "0.61456805", "0.61456805", "0.61456805", "0.61456805", "0.61327475", "0.6052035", "0.6047723", "0.6041692", "0.6039023", "0.59785014", "0.5941887", "0.5935997", "0.5906864", "0.59003097", "0.5886336", "0.58643585", "0.58395016", "0.5819797", "0.58194405", "0.57948315", "0.57606775", "0.575778", "0.5755777" ]
0.8202663
2
Traverses the category tree to find the parent category Finds the product_id set for the parent category Returns the product_id
def get_product_id_from_category_id(category_id) authorize! :read, TestCase category = Category.find(category_id) if category.product_id return category.product_id else return get_product_id_from_category_id(category.category_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_category_id\n parent.id if parent\n end", "def parent\n \tif self.parent_id == -1\n \t\treturn nil\n \telse\n \t\treturn Category.find(self.parent_id)\n \tend\n end", "def product_category_id=(id)\n self.parent = if id.blank?\n nil\n else\n ProductCategory.find(id)\n end\n end", "def parent\n @parent ||= begin\n parent_id = data[\"parentId\"]\n client.categories.find(parent_id) if parent_id\n end\n end", "def parent\n return nil unless catalog\n\n unless defined?(@parent)\n if parents = catalog.adjacent(self, :direction => :in)\n # We should never have more than one parent, so let's just ignore\n # it if we happen to.\n @parent = parents.shift\n else\n @parent = nil\n end\n end\n @parent\n end", "def parent_categories\n c = self\n categories = []\n until c.parent.blank? do\n c = c.parent\n categories.unshift c\n end\n categories\n end", "def getChildCategories\n Category.find(:all, :conditions => \"parent_category_id = #{self.id}\", :order => ':id')\nend", "def parent\n tree.parent_for(parent_id).first\n end", "def top_category_id\n Category.check_parent_id(category)\n end", "def set_parent_category\n @parent_category = ParentCategory.find(params[:id])\n end", "def parent_id\n @values.fetch('ai.operation.parentId') { \n @values['ai.operation.parentId'] = nil\n }\n end", "def parent_id(*args)\n return call_ancestry_method(:parent_id) if use_ancestry?\n\n rels = parent_ids(*args).take(2)\n raise _(\"Multiple parents found.\") if rels.length > 1\n rels.first\n end", "def getParentCategory()\n self.level == 1 ? false : Category.find(self.parent_category_id)\nend", "def parent_id\n self[self.nested_set_options[:parent_column]]\n end", "def parent_of?(category, options = {})\n category.parents.exists?(id)\n end", "def setCategoryChain()\n @parentCategory = getParentCategory\n \n if (@parentCategory != false)\n @parentCategory.subparent = self\n superParent = @parentCategory.setCategoryChain \n elsif\n superParent = self\n end\n \n return superParent\nend", "def parent\n dataset.nested.filter(self.primary_key => self.parent_id).first if self.parent_id\n end", "def parent_id\n data[:parent_id]\n end", "def get_parent_id()\r\n result = nil\r\n if @coll_id #if coll_id is false, than collection_service is used by environment so no parent\r\n info = Transformer::KeyBuilder.collection_info(@env_id, @coll_id)\r\n result = @db_interface.get_hash_value(info, Transformer::KeyBuilder::PARENT_ID_KEY)\r\n end\r\n return result\r\n end", "def parent_id\n self.tagvalues[\"is_a\"].first\n end", "def category_id\n if category then category.category_id end\n end", "def parent_id\n object[\"parent_id\"]\n end", "def assign_category\n path = @row[:category]\n root = path.shift\n\n # this just needs to be set, for apparently no valid reason\n # I think think model is complely useless\n taxonomy = Spree::Taxonomy.find_or_create_by!(name:root)\n\n # here is real root of taxonomy tree\n taxon = Spree::Taxon.find_or_create_by!(parent_id: nil, taxonomy_id: taxonomy.id, name: root)\n\n # now check for existance of 2 parent elements, 3 and n+ is ignorred\n taxon = Spree::Taxon.find_or_create_by!(parent_id: taxon.id, taxonomy_id: taxonomy.id, name: path[0]) if path[0]\n taxon = Spree::Taxon.find_or_create_by!(parent_id: taxon.id, taxonomy_id: taxonomy.id, name: path[1]) if path[1]\n\n # it is weird why this model is named Spree::Classification instead of Spree::ProductsTaxon\n # it maps to \"spree_products_taxons\" table\n Spree::Classification.find_or_create_by! product_id: @product.id, taxon_id: taxon.id\n end", "def top_level_ancestor(carrier_products, test_cp)\n return test_cp if test_cp.carrier_product_id.nil?\n\n parent = carrier_products.detect { |cp| cp.id == test_cp.carrier_product_id }\n raise QueryError.new(\"Carrier products parent was not found in supplied carrier products\") if parent.nil?\n\n self.top_level_ancestor(carrier_products, parent)\n end", "def parent\n if parent_id.blank? then nil else unscoped_find(parent_id) end\n end", "def product_category\n product_categories.first\n rescue\n nil\n end", "def parent\n self.class.find_by_id(self.parent_id) unless self.parent_id.nil?\n end", "def get_parent(taxonomy_hierarchy,id)\n taxonomy_hierarchy.each do |k| \n k[1][:children].each do |v|\n return {id: k[0],name: k[1][:name]} if v[:id] == id\n end\n end\n nil\n end", "def parent_id\n\n h.parent_id ?\n Ruote::FlowExpressionId.new(h.parent_id) :\n nil\n end", "def path\n return @path_array if @path_array\n parent_category = self\n @path_array = [parent_category]\n while (parent_category = parent_category.parent) != nil do\n @path_array.insert(0, parent_category) \n end\n @path_array\n end", "def products_arel\n if self.root?\n @products_arel ||= Product.joins(:dp_categories).where(\"dp_categories.id in (?)\", (self.children.collect do |dpc| dpc.id end << self.id))\n else\n @products_arel ||= self.products\n end\n @products_arel\n end", "def find_parent_comment_id\n comment = Comment.find_by_id(self.likeable_id)\n comment.parent_comment_id\n end", "def parent_id\n self.parent._id.to_s\n end", "def CategoryPathName(category_id)\n category = Category.find(category_id)\n name = category.name\n\n # Is this isn' the parent category keep digging\n # For each parent category, add it to the tree\n while !category.product_id\n category = Category.find(category.category_id)\n name = category.name + '/' + name\n end\n\n return name\n end", "def parent_id\n parent_ids.last\n end", "def parent_association\n if params[:id].nil?\n return parent_object.all_parent_relations \n end\n # Gotta find it seperately, will get a recursive stack error elsewise\n o = FeatureRelation.find(params[:id])\n parent_object.id == o.parent_node.id ? parent_object.all_child_relations : parent_object.all_parent_relations\n end", "def parent\n if @resource[:parent] =~ /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/\n gindex = $ngs.index { |i| i['id'] == @resource[:parent] }\n $ngs[gindex]['id']\n else\n @property_hash[:parent]\n end\n end", "def parent_id\r\n return nil unless ar_object\r\n ar_object[ar_p]\r\n end", "def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end", "def show\n #require \"debugger\"\n #debugger\n @category = Category.find(params[:id])\n current_category = @category\n #@parent_stack = []\n # \n #while current_category.parent do\n # @parent_stack.unshift(current_category.parent)\n # current_category = current_category.parent\n #end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def find_parent_by\n self.class.find_parent_by || :id\n end", "def parent_association\n @parent_object=parent_object # ResourceController normally sets this\n if params[:id].nil?\n return parent_object.all_parent_relations \n end\n # Gotta find it seperately, will get a recursive stack error elsewise\n o = FeatureRelation.find(params[:id])\n parent_object.id == o.parent_node.id ? parent_object.all_child_relations : parent_object.all_parent_relations\n end", "def relist_parent_id\n item_hash.deep_find(:relist_parent_id)\n end", "def apply_category_filter\n top_level_category_ids = Category.top_level.\n where(id: @category_ids).\n pluck(:id)\n subcategory_ids = @category_ids +\n Category.where(parent_id: top_level_category_ids).pluck(:id)\n\n subcategory_ids\n end", "def category_parents(max_distance)\n @parents[0] = [@entity] if @parents[0].empty?\n add_relatives(@parents,1,max_distance,:parents){|r| r.eponymous_articles.flat_map{|a| a.categories.to_a } }\n @parents\n end", "def get_parent\n\n get_expression_pool.fetch_expression(@parent_id)\n end", "def parent_id\n return @values['ai.operation.parentId'] if @values.key?('ai.operation.parentId')\n @defaults['ai.operation.parentId']\n end", "def find_my_direct_parent\n \t\n \t self.findpapa\n \t directparents = @@directparent.dup\n \t @@directparent.clear\n \t \n \t return directparents\n \t \n end", "def parent\n @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child\n end", "def get_parent\n return nil\n end", "def move_to_child_of(category)\n self.update_attribute(:parent_id, category.id) unless self.parent_id == category.id\n end", "def parent\n\t\treturn parent_of @current_node\n\tend", "def get_category(category_code, id, root_cat)\n root = Category.root_pulve if root_cat.eql?(:pulve)\n root = Category.root_labour if root_cat.eql?(:labour)\n root = Category.root_facture if root_cat.eql?(:facture)\n root = Category.root_produit if root_cat.eql?(:produit)\n root = Category.root_vente if root_cat.eql?(:vente)\n category = Category.find_by_code(category_code)\n if (root && category && category.root.eql?(root))\n return category.id\n else\n invalid = \"categorie non valide #{category_code}\"\n add_invalid(invalid, id)\n end\n end", "def find_parent_node\n @parent_node ||= Node.find(params[:parent_node_id]) if params[:parent_node_id]\n end", "def reparent(new_parent)\n unless new_parent.is_a?(Category)\n new_parent = Category.find(new_parent)\n end\n new_parent_id = new_parent.id\n if new_parent.leaf?\n errors.add(:base, \n \"Can't reparent to a leaf category.\")\n elsif get_descendents.include?(new_parent_id)\n errors.add(:base, \n \"Can't reparent a category to one of its own descendents.\")\n else\n begin\n Category.transaction do \n old_parent = Category.find(parent_id)\n\n # Move the node (and its subtree) to the new parent.\n update_attributes!(:parent_id => new_parent_id)\n\n # Fix up the product families, products, and attributes\n # where for old parent category.\n old_parent.merge_families\n old_parent.merge_products\n old_parent.propagate_families_up\n old_parent.propagate_products_up\n old_parent.generate_attributes_up\n\n # Fix up the product families, products, and attributes\n # where for new parent category.\n self.propagate_families_up\n self.propagate_products_up\n new_parent.generate_attributes_up\n end\n rescue Exception => e\n errors.add(:base, \"Reparent of category failed: #{e}\")\n end\n end\n end", "def parent\n if self.rep_parent.nil?\n if self.parent_id.nil?\n return nil\n else\n return Activity.find(self.parent_id)\n end\n\n else\n return self.rep_parent.parent\n end\n end", "def parent(node_id)\n node_id >> 1 # node_id / 2\n end", "def the_parent(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.parent\n else\n \"<strong>Error:</strong> No parent information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end", "def parent_list\n parents = []\n if @attributes.key?('parentCollectionList') then\n parents = DSpaceObj.convert_value(nil, @attributes['parentCollectionList'])\n end\n if @attributes['parentCommunity'] then\n com = DSpaceObj.convert_value(nil, @attributes['parentCommunity'])\n parents << com if com\n end\n if @attributes.key?('parentCommunityList') then\n list = DSpaceObj.convert_value(nil, @attributes['parentCommunityList'])\n parents += list if list\n end\n parents\n end", "def update_product_category\n return true if self.category.blank?\n categories = self.category.ancestors.collect{|x| x.id}.reverse.push(self.category.id)\n category_names = self.category.ancestors.collect{|x| x.name.downcase}.reverse.push(self.category.name.downcase).join(\" | \")\n product_cat = ProductCat.find_or_create_by_product_id(self.id)\n product_cat.fourth_category_id = categories[3] unless categories[3].blank?\n product_cat.third_category_id = categories[2] unless categories[2].blank?\n product_cat.second_category_id = categories[1] unless categories[1].blank?\n product_cat.first_category_id = categories[0] unless categories[0].blank?\n product_cat.categories_delimited = category_names\n product_cat.user = self.user\n product_cat.save\n end", "def parent\n o = Object.const_get(parent_model) rescue nil\n o && o.get(parent_id)\n end", "def parent\n self.class.find_in_nested_set(self[parent_col_name]) if self[parent_col_name]\n end", "def parent\n ltree_scope.find_by \"#{self.class.table_name}.#{ltree_path_column} = SUBPATH(?, 0, NLEVEL(?) - 1)\", ltree_path,\n ltree_path\n end", "def parent_id=(value)\n self[self.nested_set_options[:parent_column]] = value\n end", "def parent\n self.parents.where('forestify_level = ?', self.forestify_level - 1).first\n end", "def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n category_url_key.strip!\n category = Gemgento::Category.find_by(url_key: category_url_key, parent_id: parent_id)\n unless category.nil?\n pc = Gemgento::ProductCategory.find_or_create_by!(category: category, product: product, store: self.store)\n parent_id = category.id\n pc.sync_needed = true\n pc.save\n else\n self.process_errors << \"Row ##{@index}: Unknown category url key '#{category_url_key}' - skipped\"\n end\n end\n end\n end", "def parent\n @parent ||= @parent_id ? @book.find_account_by_id(@parent_id) : nil\n end", "def parent_rel_ids\n rel = relationships\n if rel.kind_of?(Array) || rel.try(:loaded?)\n rel.reject { |x| x.ancestry.blank? }.collect(&:parent_id)\n else\n rel.where.not(:ancestry => [nil, \"\"]).select(:ancestry).collect(&:parent_id)\n end\n end", "def getCategoryId\r\n\t\t\t\t\treturn @categoryId\r\n\t\t\t\tend", "def category_tree\n cats = []\n categories.each do |cat|\n cats << cat\n cats = cats + cat.ancestors\n end\n return cats\n end", "def parent_of(post)\n posts.find { |t| t.id == post.parent_post }\n end", "def parent_document\n pi = parent_item\n return if pi == nil\n pi_id = pi.id\n return if pi_id == nil\n DocumentRepository.find(pi_id)\n end", "def show\n #locates the selected category\n @category = Category.find(params[:id])\n #assigns the parent of the selected category\n @parent = @category.parent_id ? Category.find(@category.parent_id) : nil\n #creates a sorted array using all categories\n @all_categories = Category.all.sort {|x,y| x.name <=> y.name }\n #creates a sorted array using all related products\n @related_products = @category.products.sort {|x,y| x.name <=> y.name }\n\n if(!@category.parent_id.nil?)\n @category_parent = Category.find(@category.parent_id)\n else\n @category_parent = nil\n end\n\n respond_to do |format|\n format.html # popup_showp_show.html.erb\n format.json { render json: @category }\n format.xml { render :xml => @category }\n end\n end", "def query_parent_id\n @attributes[:query_parent_id]\n end", "def edit\n @product = Product.find(params[:id])\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.where(parent_id: nil).order(:name)\n end", "def current_parent\n\t Parent.where(id: session[\"parent_id\"]).first\n\tend", "def parent_ids\n if ancestor_ids.empty? then\n nil\n else\n branches.map { |branch| cast_primary_key(branch.split('/').last) }\n end\n end", "def parent_rel(*args)\n rels = parent_rels(*args).take(2)\n raise _(\"Multiple parents found.\") if rels.length > 1\n rels.first\n end", "def parent_foreign_key\n @parent_hierarchy_relationship.foreign_key\n end", "def get_parent\n @parent = Article.find_by_id(params[:article_id]) if params[:article_id]\n @parent = Comment.find_by_id(params[:comment_id]) if params[:comment_id]\n \n redirect_to root_path unless defined?(@parent)\n end", "def update\n @category = Category.find(params[:id])\n @rollover = @category.rollover\n \n unless params[:category][:parent_id].empty?\n @parent = Category.find(params[:category][:parent_id])\n @category.move_to_child_of(@parent) if @parent != @category.parent\n end\n \n respond_to do |format|\n if @category.update_attributes(params[:category]) and ( @rollover.update_attributes(params[:rollover]) unless @category.is_home?)\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(@category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def ancestors\n \tif parent_name.blank?\n\t \tancestors = [] \n \telse\n \t\tp = Category.where(name: parent_name).first\n \t\tancestors = p.ancestors\n \t\tancestors << parent_name\n \tend\n \tancestors\n end", "def parent_list\n self.parent_lists[0]\n end", "def get_closest_processed_parent(parent_commit_id)\n parent = repo.each_commit_starting_at(parent_commit_id).find do |rev|\n commit_exists?(repo_name, rev.getId.name)\n end\n\n parent.getId.name if parent\n end", "def ultimate_parent # note: ultimate parent is self, not nil, if self has no parent...\n if parent_id.blank?\n self\n else\n parent.ultimate_parent\n end\n end", "def parent(*args)\n return call_ancestry_method(:parent) if use_ancestry?\n\n rels = parent_rels(*args).take(2)\n raise _(\"Multiple parents found.\") if rels.length > 1\n rels.first.try(:resource)\n end", "def parent(id)\n if id != @h[id]\n @h[id] = parent(@h[id])\n else\n id\n end\n end", "def parent_ids\n []\n end", "def parent(node)\n value = node.value\n parent_node = nil\n current_node = @root\n while (current_node)\n if value > current_node.value\n parent_node = current_node #always keep a pointer to the parent\n #before traversing down\n current_node = current_node.right\n elsif value < current_node.value\n parent_node = current_node\n current_node = current_node.left\n else\n return parent_node\n end\n end\n nil\n end", "def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end", "def create\n @category = Category.new(params[:category])\n \n # Create rollover\n @rollover = Rollover.create(params[:rollover])\n @category.rollover = @rollover\n\n respond_to do |format|\n if @category.save\n \n # Assign to parent\n unless params[:category][:parent_id].empty?\n @parent = Category.find(params[:category][:parent_id])\n @category.move_to_child_of(@parent)\n end\n \n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(@category) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def check_parent_ids\n # This should not be necesary as parent_ids should be included on reflections.\n #parent_resources.each { |res| parent_ids << \"#{res.singular}_id\" }\n\n # Model foreign keys \n resource.model.reflections.each do |key, refl|\n if refl.macro == :belongs_to || refl.macro == :has_and_belongs_to_many\n parent_ids << refl.primary_key_name\n foreing_models[refl.primary_key_name.to_s]= refl.class_name.constantize\n end\n end\n self.parent_ids= Set.new(self.parent_ids)\n end", "def container_parent\n parent_id = data.at_xpath(\"/c/did/container/@parent\")\n return unless parent_id\n parent = data.at_xpath(\"//c[@id='#{parent_id}']/did/container\")\n \"#{parent.attribute('type').value.capitalize} #{parent.content}\"\n end", "def tree_path\n root = Category.root\n parent = self.parent\n path = self.name\n\n while !parent.nil? && parent != root do\n path = \"#{parent.name} > #{path}\"\n parent = parent.parent\n end\n\n return path\n end", "def parent_id\n @path.split('/').last if @path\n end", "def show\n @product = Product.find(params[:id])\n @title=@product.title\n @linked=@product.linked\n @cart_item = @current_cart.cart_items.new(product_id: @product.id, quantity:1)\n \n @category = Category.find(params[:category_id])\n\n @breadcrumbs=[]\n @breadcrumbs << @product\n if params[:category_id]\n tmp=Category.find(params[:category_id])\n while tmp do \n @breadcrumbs << tmp\n tmp=tmp.parent\n end\n @breadcrumbs=@breadcrumbs.reverse\n end\n\n end", "def list\r\n\t\t@current_area = 'categories'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tif params[:select]\r\n\t\t\tif params[:delete]\r\n\t\t\t\t# you MUST manually move child nodes in an acts_as_tree up before calling\r\n\t\t\t\t# the destroy! method. Otherwise Rails will automatically go and delete all\r\n\t\t\t\t# the child nodes even before the selected nodes' 'before_destroy' callback\r\n\t\t\t\t# is triggered!\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tthe_cat = Category.find(k)\r\n\t\t\t\t\tthe_cat.move_children_up()\r\n\t\t\t\t\tCategory.destroy(the_cat.id)\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_up]\r\n\t\t\t\t# We have to use a Hash as Array iterators do not like sparse indexing.\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Hash.sort converts the hash into a nested array before sorting; [0] = key, [1] = value.\r\n\t\t\t\t\t# Note that we only want the IDs which are contained in the index 'j'.\r\n\t\t\t\t\tparent.sort{|a,b| (a[1]<=>b[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_higher\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_down]\r\n\t\t\t\t# See comments for move_up above\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Note order of b/a is swapped to move down. This and move_lower instead of move_higher\r\n\t\t\t\t\t# is the only difference between this and the move_up code above.\r\n\t\t\t\t\tparent.sort{|a,b| (b[1]<=>a[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_lower\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\texpire_fragment(:controller => :products, :action => :home, :part => 'category_menu')\r\n\t\tend\r\n\r\n\t\t@root_cat = Category.find(1)\r\n\tend", "def find_element_parent(el_depth, index, ordering)\n\t\ti = index - 1\n\t\twhile i >= 0 #until the beginning\n\t\t\tif ordering[i].model == \"Node\" #if it's a node, not just a note\n\t\t\t\tcurr_node = Node.find(ordering[i].id)\n\t\t\t\tif el_depth > curr_node.depth #if curr_node has a lesser depth, it's its parent\n\t\t\t\t\treturn curr_node\n\t\t\t\tend\n\t\t\tend\n\t\t\ti = i-1\n\t\tend\n\t\treturn nil #if no parent found\n\tend", "def lowest_categories\n categories.reject { |category| categories.any? { |child| child.parent == category } }\n end", "def getParentRec\n outcomes = Tree.where(\n tree_type_id: self.tree_type_id,\n version_id: self.version_id,\n subject_id: self.subject_id,\n grade_band_id: self.grade_band_id,\n code: self.parentCode\n )\n\n if outcomes.count == 0\n return nil\n else\n return outcomes.first\n end\n end", "def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end" ]
[ "0.78865933", "0.7274526", "0.7004113", "0.6916846", "0.66909015", "0.6671625", "0.64338595", "0.64231527", "0.63682073", "0.6352396", "0.6283373", "0.61828023", "0.61278033", "0.6122003", "0.61192626", "0.6084206", "0.6060345", "0.6054688", "0.6032154", "0.60180104", "0.5959196", "0.5944932", "0.59376", "0.5936097", "0.58986163", "0.58912545", "0.5880282", "0.5866175", "0.5861589", "0.58554274", "0.58517414", "0.5840022", "0.58346367", "0.5833421", "0.58031666", "0.5803048", "0.5765844", "0.5759002", "0.575489", "0.57471037", "0.5731946", "0.572833", "0.5692814", "0.5667703", "0.5667332", "0.56327075", "0.56317323", "0.56268275", "0.562418", "0.5621601", "0.56194735", "0.5619135", "0.56173515", "0.56151706", "0.56120884", "0.56106997", "0.56097007", "0.5604633", "0.5604034", "0.5600453", "0.5598081", "0.5589649", "0.558351", "0.5578387", "0.55766034", "0.5576226", "0.55607283", "0.5559278", "0.5553116", "0.5543056", "0.55362445", "0.5535624", "0.5532776", "0.55306494", "0.5524934", "0.5523363", "0.5522843", "0.55214566", "0.55006754", "0.5499341", "0.54990894", "0.54975617", "0.5491761", "0.5491639", "0.5491184", "0.54843897", "0.5479044", "0.5478909", "0.5475672", "0.54714024", "0.54616797", "0.54575574", "0.54540575", "0.5445051", "0.5437443", "0.54143494", "0.5412843", "0.54123944", "0.5409036", "0.54075146", "0.5401097" ]
0.0
-1
Build a VirtualContext from applying the rule to the input.
def parse(path) elems = path.split('/') i = 0 vc = VirtualContext.new(@defs) @defs.zip(elems).map do |d, e| # register field order vc.append_allfields(d.vars) # not enough elems, incomplete path break if e.nil? # extract values vc.append_values(d.parse_values(e)) unless e.empty? i += 1 # last token is multimatch, stop to complete it break if (i == elems.size and is_multimatch(e)) end # puts (i - 1) vc.set_current_index(i - 1) return vc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_context\n Context.new(@req[:context])\n end", "def context\n @_context ||= {\n :argv => START_CTX[:argv].map { |arg| arg.dup },\n :cwd => START_CTX[:cwd].dup,\n 0 => START_CTX[0].dup,\n }.tap do |ctx|\n rewrite_context(ctx)\n end\n end", "def create_execution_context()\n app_ctx = self.application_context\n app_ctx ||= VAPI::Core.create_default_application_context()\n sec_ctx = self.security_context\n sec_ctx ||= VAPI::Core::SecurityContext.new\n return VAPI::Core::ExecutionContext.new(app_ctx, sec_ctx)\n end", "def build_context(language, context_lines, position_in_line)\r\n context_info = fix_context(language, context_lines, position_in_line)\r\n return nil unless context_info\r\n element = instantiate_context_element(language, context_info)\r\n if element\r\n after_label = false\r\n if context_info.role\r\n if context_info.role.is_a?(Integer)\r\n feature = language.unlabled_arguments(element.class.ecore)[context_info.role] \r\n else\r\n feature = element.class.ecore.eAllStructuralFeatures.find{|f| f.name == context_info.role}\r\n after_label = true\r\n end\r\n else\r\n feature = nil\r\n end\r\n Context.new(element, feature, context_info.prefix, context_info.in_array, context_info.in_block, after_label, context_info.problem)\r\n else\r\n Context.new(nil, nil, context_info.prefix, context_info.in_array, context_info.in_block, false, context_info.problem)\r\n end\r\n end", "def set_virtual_context\n @virtual_context = VirtualContext.includes(:virtual_context_type).find(params[:id])\n end", "def __init__ context\n function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)\n clazz = Virtual::BootSpace.space.get_or_create_class :Kernel\n method = clazz.resolve_method :main\n me = Virtual::Self.new(Virtual::Reference)\n code = Virtual::Set.new(Virtual::Self.new(me.type), me)\n function.add_code(code)\n function.add_code Virtual::MethodCall.new(method)\n return function\n end", "def initialize(input)\n @machine = self.class.machine\n @context =\n case (input)\n when Mua::State::Context\n input\n else\n self.class.context.new(\n input: input,\n state: @machine.initial_state\n )\n end\n\n yield(self) if (block_given?)\n end", "def computed(context)\n self.class.new(name: computed_name(context),\n path: computed_path(context),\n **@options)\n end", "def build_context(operation, dependencies)\n RailsWorkflow::Context.new(\n parent: operation,\n data: prepare_context_data(dependencies) || operation.process.data\n )\n end", "def apply_to(rep)\n Nanoc3::RuleContext.new(rep).instance_eval &@block\n end", "def create\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.create(params[:context_rule])\n redirect_to context_path(@context)\n end", "def contextify\n self.class.monadic_context.new self\n end", "def build_context(\n rack_env: nil,\n for_type: :transaction\n )\n agent&.build_context(rack_env: rack_env, for_type: for_type)\n end", "def eval_context(context, node); end", "def call( (wrap_ctx, original_args), **circuit_options )\n (original_ctx, original_flow_options), original_circuit_options = original_args\n\n returned_ctx, _ = wrap_ctx[:return_args] # this is the Context returned from `call`ing the task.\n\n # returned_ctx is the Context object from the nested operation. In <=2.1, this might be a completely different one\n # than \"ours\" we created in Input. We now need to compile a list of all added values. This is time-intensive and should\n # be optimized by removing as many Context creations as possible (e.g. the one adding self[] stuff in Operation.__call__).\n # _, mutable_data = returned_ctx.decompose # DISCUSS: this is a weak assumption. What if the task returns a deeply nested Context?\n\n original_ctx = wrap_ctx[:vm_original_ctx]\n\n # let user compute the output.\n output_ctx = @filter.(original_ctx, returned_ctx, **original_circuit_options)\n # output_ctx = apply_filter(returned_ctx, original_flow_options, original_circuit_options)\n\n # new_ctx = @strategy.( original_ctx, output ) # here, we compute the \"new\" options {Context}.\n\n wrap_ctx = wrap_ctx.merge( return_args: [output_ctx, original_flow_options] )\n\n # and then pass on the \"new\" context.\n return Trailblazer::Activity::Right, [ wrap_ctx, original_args ]\n end", "def _prepare_context\n @view_flow = OutputFlow.new\n @output_buffer = ActionView::OutputBuffer.new\n @virtual_path = nil\n end", "def compile_vexpression\n out = expect :number, :identifier,\n :istring, :lparen,\n :sstring, :operator,\n :keyword,\n :regex,\n :newline,\n :istring_begin,\n :iheredoc_begin,\n :plus, :minus,\n :lbrace => :object,\n :lbrack => :array,\n :arrow => :function,\n [\n :preunop, :unop\n ] => :unop,\n [\n :heredoc_ref, :iheredoc_ref\n ] => :href,\n [\n :heredoc, :iheredoc\n ] => :heredoc\n\n value_expect(out)\n end", "def parse_context; end", "def parse_context; end", "def apply_context\n return unless self._context\n\n self._context.each do |field_name, uri|\n next if fields[field_name]\n next unless RDF::Vocabulary.find_term(uri)\n\n create_accessors field_name\n\n # Apply instance properties to resource\n resource_class.property(field_name.to_sym, predicate: RDF::Vocabulary.find_term(uri))\n end\n end", "def build(&build)\n @context.instance_exec(&build)\n end", "def contextualize(arg, &blk)\n if blk\n clone._set_context(context.scoped_filter & arg).instance_exec(&blk)\n else\n Filter::Scoped.new(context.scoped_filter & arg, self)\n end\n end", "def environment\n constituents = @rule.length - 2 # what's present in the environment\n # some env may have been passed by the rules, takes priority\n # combine environment given from rules with original phomo environment\n @environment ||= @rule[2] if constituents >= 1\n env_construct(@environment, @rule[3], @rule[4]) # translate constituents\n end", "def initialize(context_hash, extra_inputs={})\n raise \"Nil context hash\" unless context_hash\n raise \"Need a hash\" unless context_hash.kind_of?(Hash)\n [ \"[]\", \"keys\" ].each do |mname|\n unless extra_inputs.respond_to?(mname)\n raise \"Extra inputs must respond to hash-like [] operator and methods #keys and #each\"\n end\n end\n\n # store extra inputs\n if extra_inputs.kind_of?(Hash)\n @extra_inputs= {}\n extra_inputs.each { |k,v| @extra_inputs[k.to_s] = v } # smooth out the names\n else\n @extra_inputs = extra_inputs\n end\n\n collect_object_and_subcontext_defs context_hash\n\n # init the cache\n @cache = {}\n @cache['this_context'] = self\n end", "def new_context(env)\n\n makara_context, makara_status = makara_values(env)\n\n context = nil\n\n # if the previous request was a redirect, let's keep that context\n if makara_status.to_s =~ /^3/ # 300+ redirect\n context = makara_context\n end\n\n context ||= Makara::Context.get_current if env['rack.test']\n context ||= Makara::Context.generate(env[\"action_dispatch.request_id\"])\n context\n end", "def initialize(env) #:nodoc:\n @env = env.dup\n # a parent router may be assuming a successful match\n # but this subrouter may not, so we explicitly set it to not matched\n # on creation\n not_matched\n @rules = []\n # Actually create the rules so that the procs we create are in the\n # context of an instance of this object. This is most important when the\n # rule is based on a symbol. We need that symbol to resolve to an\n # instance method; however, instance methods are not available until\n # after an instance is created.\n self.class.rules.each {|rule| match *rule }\n\n @prerequisites = []\n self.class.prerequisites.each do |prerequisite|\n @prerequisites << normalize_match_params(prerequisite)\n end\n end", "def execution_context\n initialize_context!(Object.new)\n end", "def call(contract, result, context)\n Evaluator.new(contract, values: result, keys: keys, _context: context, &block)\n end", "def receiver\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 64 )\n return_value = ReceiverReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __EJS312__ = nil\n string_literal313 = nil\n primary310 = nil\n function311 = nil\n new_target314 = nil\n arguments315 = nil\n\n tree_for_EJS312 = nil\n tree_for_string_literal313 = nil\n stream_NEW = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token NEW\" )\n stream_EJS = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token EJS\" )\n stream_arguments = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule arguments\" )\n stream_primary = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule primary\" )\n stream_new_target = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule new_target\" )\n stream_function = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule function\" )\n begin\n # at line 677:3: ( primary -> primary | function -> function | EJS -> EJS | ( 'new' new_target ( arguments )? )=> 'new' new_target ( arguments )? -> ^( 'new' new_target ( arguments )? ) )\n alt_74 = 4\n look_74_0 = @input.peek( 1 )\n\n if ( look_74_0 == GENERAL || look_74_0 == GET || look_74_0 == REGEX || look_74_0 == LBRACE || look_74_0 == LBRACK || look_74_0 == SET || look_74_0 == DDOC || look_74_0 == LPAREN || look_74_0.between?( DGENERAL, MACRO ) || look_74_0 == THIS || look_74_0 == TRUE || look_74_0 == DSTRING || look_74_0 == EACH || look_74_0 == UNDEFINED || look_74_0 == NULL || look_74_0 == FALSE || look_74_0.between?( POUND, OBJECT_DEF ) || look_74_0.between?( ID, DOC ) || look_74_0.between?( T__148, T__150 ) )\n alt_74 = 1\n elsif ( look_74_0 == ARROW || look_74_0 == FUNCTION )\n alt_74 = 2\n elsif ( look_74_0 == EJS )\n alt_74 = 3\n elsif ( look_74_0 == NEW ) and ( syntactic_predicate?( :synpred9_Jejune ) )\n alt_74 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 74, 0 )\n end\n case alt_74\n when 1\n # at line 677:5: primary\n @state.following.push( TOKENS_FOLLOWING_primary_IN_receiver_4774 )\n primary310 = primary\n @state.following.pop\n if @state.backtracking == 0\n stream_primary.add( primary310.tree )\n end\n # AST Rewrite\n # elements: primary\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 677:14: -> primary\n @adaptor.add_child( root_0, stream_primary.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 678:5: function\n @state.following.push( TOKENS_FOLLOWING_function_IN_receiver_4785 )\n function311 = function\n @state.following.pop\n if @state.backtracking == 0\n stream_function.add( function311.tree )\n end\n # AST Rewrite\n # elements: function\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 678:14: -> function\n @adaptor.add_child( root_0, stream_function.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 679:5: EJS\n __EJS312__ = match( EJS, TOKENS_FOLLOWING_EJS_IN_receiver_4795 )\n if @state.backtracking == 0\n stream_EJS.add( __EJS312__ )\n end\n # AST Rewrite\n # elements: EJS\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 679:14: -> EJS\n @adaptor.add_child( root_0, stream_EJS.next_node )\n\n\n\n return_value.tree = root_0\n\n end\n when 4\n # at line 680:5: ( 'new' new_target ( arguments )? )=> 'new' new_target ( arguments )?\n string_literal313 = match( NEW, TOKENS_FOLLOWING_NEW_IN_receiver_4828 )\n if @state.backtracking == 0\n stream_NEW.add( string_literal313 )\n end\n @state.following.push( TOKENS_FOLLOWING_new_target_IN_receiver_4830 )\n new_target314 = new_target\n @state.following.pop\n if @state.backtracking == 0\n stream_new_target.add( new_target314.tree )\n end\n # at line 681:24: ( arguments )?\n alt_73 = 2\n look_73_0 = @input.peek( 1 )\n\n if ( look_73_0 == LPAREN )\n alt_73 = 1\n end\n case alt_73\n when 1\n # at line 681:24: arguments\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_receiver_4832 )\n arguments315 = arguments\n @state.following.pop\n if @state.backtracking == 0\n stream_arguments.add( arguments315.tree )\n end\n\n end\n # AST Rewrite\n # elements: new_target, arguments, NEW\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 681:35: -> ^( 'new' new_target ( arguments )? )\n # at line 681:38: ^( 'new' new_target ( arguments )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_NEW.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_new_target.next_tree )\n # at line 681:58: ( arguments )?\n if stream_arguments.has_next?\n @adaptor.add_child( root_1, stream_arguments.next_tree )\n\n end\n\n stream_arguments.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 64 )\n\n end\n \n return return_value\n end", "def context\n @_context ||= begin\n ptr = MemoryPointer::new( Context )\n error = OpenCL.clGetProgramInfo(self, CONTEXT, Context.size, ptr, nil)\n error_check(error)\n Context::new( ptr.read_pointer )\n end\n end", "def buildContextClause(context, tableName)\n context = normalizeTerm(context) if context\n\n # case context\n # when REGEXTerm\n # when Array\n # else\n [\"#{tableName}.context=?\", context] if context\n # end\n end", "def rule\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n @rule_stack.push( @@rule.new )\n return_value = RuleReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n modifier = nil\n arg = nil\n rt = nil\n __DOC_COMMENT39__ = nil\n string_literal40 = nil\n string_literal41 = nil\n string_literal42 = nil\n string_literal43 = nil\n char_literal45 = nil\n string_literal46 = nil\n char_literal51 = nil\n char_literal53 = nil\n id44 = nil\n throws_spec47 = nil\n options_spec48 = nil\n rule_scope_spec49 = nil\n rule_action50 = nil\n alt_list52 = nil\n exception_group54 = nil\n\n tree_for_modifier = nil\n tree_for_arg = nil\n tree_for_rt = nil\n tree_for_DOC_COMMENT39 = nil\n tree_for_string_literal40 = nil\n tree_for_string_literal41 = nil\n tree_for_string_literal42 = nil\n tree_for_string_literal43 = nil\n tree_for_char_literal45 = nil\n tree_for_string_literal46 = nil\n tree_for_char_literal51 = nil\n tree_for_char_literal53 = nil\n stream_DOC_COMMENT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token DOC_COMMENT\" )\n stream_RET = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RET\" )\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__71\" )\n stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token BANG\" )\n stream_T__76 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__76\" )\n stream_T__75 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__75\" )\n stream_FRAGMENT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token FRAGMENT\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ARG_ACTION\" )\n stream_T__77 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__77\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n stream_throws_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule throws_spec\" )\n stream_rule_action = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rule_action\" )\n stream_exception_group = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule exception_group\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n stream_rule_scope_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rule_scope_spec\" )\n stream_alt_list = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule alt_list\" )\n begin\n # at line 150:4: ( DOC_COMMENT )? (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )? id ( '!' )? (arg= ARG_ACTION )? ( 'returns' rt= ARG_ACTION )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* ':' alt_list ';' ( exception_group )?\n # at line 150:4: ( DOC_COMMENT )?\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == DOC_COMMENT )\n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 150:4: DOC_COMMENT\n __DOC_COMMENT39__ = match( DOC_COMMENT, TOKENS_FOLLOWING_DOC_COMMENT_IN_rule_786 )\n if @state.backtracking == 0\n stream_DOC_COMMENT.add( __DOC_COMMENT39__ )\n end\n\n end\n # at line 151:3: (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )?\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == FRAGMENT || look_17_0.between?( T__75, T__77 ) )\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 151:5: modifier= ( 'protected' | 'public' | 'private' | 'fragment' )\n # at line 151:14: ( 'protected' | 'public' | 'private' | 'fragment' )\n alt_16 = 4\n case look_16 = @input.peek( 1 )\n when T__75 then alt_16 = 1\n when T__76 then alt_16 = 2\n when T__77 then alt_16 = 3\n when FRAGMENT then alt_16 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 16, 0 )\n end\n case alt_16\n when 1\n # at line 151:15: 'protected'\n string_literal40 = match( T__75, TOKENS_FOLLOWING_T__75_IN_rule_796 )\n if @state.backtracking == 0\n stream_T__75.add( string_literal40 )\n end\n\n when 2\n # at line 151:27: 'public'\n string_literal41 = match( T__76, TOKENS_FOLLOWING_T__76_IN_rule_798 )\n if @state.backtracking == 0\n stream_T__76.add( string_literal41 )\n end\n\n when 3\n # at line 151:36: 'private'\n string_literal42 = match( T__77, TOKENS_FOLLOWING_T__77_IN_rule_800 )\n if @state.backtracking == 0\n stream_T__77.add( string_literal42 )\n end\n\n when 4\n # at line 151:46: 'fragment'\n string_literal43 = match( FRAGMENT, TOKENS_FOLLOWING_FRAGMENT_IN_rule_802 )\n if @state.backtracking == 0\n stream_FRAGMENT.add( string_literal43 )\n end\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rule_810 )\n id44 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id44.tree )\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @rule_stack.last.name = ( id44 && @input.to_s( id44.start, id44.stop ) ) \n # <-- action\n end\n # at line 153:3: ( '!' )?\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0 == BANG )\n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 153:3: '!'\n char_literal45 = match( BANG, TOKENS_FOLLOWING_BANG_IN_rule_816 )\n if @state.backtracking == 0\n stream_BANG.add( char_literal45 )\n end\n\n end\n # at line 154:3: (arg= ARG_ACTION )?\n alt_19 = 2\n look_19_0 = @input.peek( 1 )\n\n if ( look_19_0 == ARG_ACTION )\n alt_19 = 1\n end\n case alt_19\n when 1\n # at line 154:5: arg= ARG_ACTION\n arg = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_825 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( arg )\n end\n\n end\n # at line 155:3: ( 'returns' rt= ARG_ACTION )?\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0 == RET )\n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 155:5: 'returns' rt= ARG_ACTION\n string_literal46 = match( RET, TOKENS_FOLLOWING_RET_IN_rule_834 )\n if @state.backtracking == 0\n stream_RET.add( string_literal46 )\n end\n rt = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_838 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( rt )\n end\n\n end\n # at line 156:3: ( throws_spec )?\n alt_21 = 2\n look_21_0 = @input.peek( 1 )\n\n if ( look_21_0 == T__79 )\n alt_21 = 1\n end\n case alt_21\n when 1\n # at line 156:3: throws_spec\n @state.following.push( TOKENS_FOLLOWING_throws_spec_IN_rule_846 )\n throws_spec47 = throws_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_throws_spec.add( throws_spec47.tree )\n end\n\n end\n # at line 156:16: ( options_spec )?\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0 == OPTIONS )\n alt_22 = 1\n end\n case alt_22\n when 1\n # at line 156:16: options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_rule_849 )\n options_spec48 = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( options_spec48.tree )\n end\n\n end\n # at line 156:30: ( rule_scope_spec )?\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == SCOPE )\n alt_23 = 1\n end\n case alt_23\n when 1\n # at line 156:30: rule_scope_spec\n @state.following.push( TOKENS_FOLLOWING_rule_scope_spec_IN_rule_852 )\n rule_scope_spec49 = rule_scope_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_scope_spec.add( rule_scope_spec49.tree )\n end\n\n end\n # at line 156:47: ( rule_action )*\n while true # decision 24\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == AT )\n alt_24 = 1\n\n end\n case alt_24\n when 1\n # at line 156:47: rule_action\n @state.following.push( TOKENS_FOLLOWING_rule_action_IN_rule_855 )\n rule_action50 = rule_action\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_action.add( rule_action50.tree )\n end\n\n else\n break # out of loop for decision 24\n end\n end # loop for decision 24\n char_literal51 = match( T__78, TOKENS_FOLLOWING_T__78_IN_rule_860 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal51 )\n end\n @state.following.push( TOKENS_FOLLOWING_alt_list_IN_rule_862 )\n alt_list52 = alt_list\n @state.following.pop\n if @state.backtracking == 0\n stream_alt_list.add( alt_list52.tree )\n end\n char_literal53 = match( T__71, TOKENS_FOLLOWING_T__71_IN_rule_864 )\n if @state.backtracking == 0\n stream_T__71.add( char_literal53 )\n end\n # at line 158:3: ( exception_group )?\n alt_25 = 2\n look_25_0 = @input.peek( 1 )\n\n if ( look_25_0.between?( T__84, T__85 ) )\n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 158:3: exception_group\n @state.following.push( TOKENS_FOLLOWING_exception_group_IN_rule_868 )\n exception_group54 = exception_group\n @state.following.pop\n if @state.backtracking == 0\n stream_exception_group.add( exception_group54.tree )\n end\n\n end\n # AST Rewrite\n # elements: id, arg, rule_action, throws_spec, rule_scope_spec, exception_group, options_spec, rt, RET, alt_list\n # token labels: arg, rt\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_arg = token_stream( \"token arg\", arg )\n stream_rt = token_stream( \"token rt\", rt )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 159:6: -> ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n # at line 159:9: ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( RULE, \"RULE\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, ( modifier ? @adaptor.create(modifier) : nil ) )\n # at line 159:67: ( ^( ARG[$arg] $arg) )?\n if stream_arg.has_next?\n # at line 159:67: ^( ARG[$arg] $arg)\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( ARG, arg ), root_2 )\n\n @adaptor.add_child( root_2, stream_arg.next_node )\n\n @adaptor.add_child( root_1, root_2 )\n\n end\n\n stream_arg.reset();\n # at line 159:86: ( ^( 'returns' $rt) )?\n if stream_rt.has_next? || stream_RET.has_next?\n # at line 159:86: ^( 'returns' $rt)\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( stream_RET.next_node, root_2 )\n\n @adaptor.add_child( root_2, stream_rt.next_node )\n\n @adaptor.add_child( root_1, root_2 )\n\n end\n\n stream_rt.reset();\n stream_RET.reset();\n # at line 160:9: ( throws_spec )?\n if stream_throws_spec.has_next?\n @adaptor.add_child( root_1, stream_throws_spec.next_tree )\n\n end\n\n stream_throws_spec.reset();\n # at line 160:22: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 160:36: ( rule_scope_spec )?\n if stream_rule_scope_spec.has_next?\n @adaptor.add_child( root_1, stream_rule_scope_spec.next_tree )\n\n end\n\n stream_rule_scope_spec.reset();\n # at line 160:53: ( rule_action )*\n while stream_rule_action.has_next?\n @adaptor.add_child( root_1, stream_rule_action.next_tree )\n\n end\n\n stream_rule_action.reset();\n @adaptor.add_child( root_1, stream_alt_list.next_tree )\n # at line 162:9: ( exception_group )?\n if stream_exception_group.has_next?\n @adaptor.add_child( root_1, stream_exception_group.next_tree )\n\n end\n\n stream_exception_group.reset();\n @adaptor.add_child( root_1, @adaptor.create( EOR, \"EOR\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n @rule_stack.pop\n\n end\n \n return return_value\n end", "def build_context(context: Context.current)\n builder = Builder.new(correlations_for(context).dup)\n yield builder\n context.set_value(CORRELATION_CONTEXT_KEY, builder.entries)\n end", "def as_in_context(context)\n return self if self.context == context\n copy_to(context)\n end", "def build_context\n site = stub_jekyll_site\n site.liquid_renderer.file(\"\").parse(\"{% context_thief %}\") \\\n .render!(site.site_payload, :registers => { :site => site })\n ContextThief.context\n end", "def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end", "def define_context_rule(name, trace, productions)\n productions = [productions] unless productions.is_a?(Enumerable)\n context[name.to_sym] = Rule.new(name.to_sym, Rule.build_ast(productions, self), trace)\n end", "def map_to_context!(context)\n @index_steps.each do |index_step|\n # Don't bother if we're skipping this record\n break if context.skip?\n\n context.index_step = index_step\n accumulator = log_mapping_errors(context, index_step) do\n index_step.execute(context) # will always return [] for an each_record step\n end\n\n if accumulator.size > 0\n accumulator.compact!\n (context.output_hash[index_step.field_name] ||= []).concat accumulator\n end\n\n context.index_step = nil\n end\n\n return context\n end", "def map_to_context!(context)\n @index_steps.each do |index_step|\n # Don't bother if we're skipping this record\n break if context.skip?\n\n context.index_step = index_step\n accumulator = log_mapping_errors(context, index_step) do\n index_step.execute(context) # will always return [] for an each_record step\n end\n\n if accumulator.size > 0\n accumulator.compact!\n (context.output_hash[index_step.field_name] ||= []).concat accumulator\n end\n\n context.index_step = nil\n end\n\n return context\n end", "def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end", "def call(env)\n Parser.new(self, env).perform\n end", "def deep_copy\n alt = map {|t| Token.new( t.type, t.data, t.depth ) } \n RuleAlt.new( alt, @recursivity, @arity, @min_depth )\n end", "def build(rule)\n Expr.build ArithmeticParser.new.parse(rule).to_sexp\n end", "def new_selection\n Monty::Core::RuleSelection.new(:rule => self)\n end", "def new_scope\n self.class.new(@input, @output, @wrap_at,\n @page_at, @indent_size, @indent_level)\n end", "def compile\n @instance ||= new\n end", "def parse(virtual); end", "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgramReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n statement1 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 14:5: ( statement )+\n # at file 14:5: ( statement )+\n match_count_1 = 0\n while true\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( AMP, AMP_ASGN ) || look_1_0 == POST_DECR || look_1_0.between?( GEQ, AREF ) || look_1_0.between?( GREATER, HAT ) || look_1_0.between?( ARROW, HAT_ASGN ) || look_1_0.between?( ASGN, REGEX ) || look_1_0.between?( IN, RETURN ) || look_1_0 == INCR || look_1_0.between?( BREAK, RSHIFT3 ) || look_1_0.between?( LABEL, CATCH ) || look_1_0 == RSHIFT_ASGN || look_1_0 == LEQ || look_1_0.between?( LESS, SLASH ) || look_1_0.between?( SLASH_ASGN, CONTINUE ) || look_1_0.between?( STAR, DECR ) || look_1_0 == STAR_ASGN || look_1_0.between?( LSHIFT, THIS ) || look_1_0 == THROW || look_1_0.between?( MINUS, MOD ) || look_1_0.between?( MOD_ASGN, TYPEOF ) || look_1_0.between?( NEQ, UMINUS ) || look_1_0.between?( NEQQ, UNDEFINED ) || look_1_0.between?( NEW, UPLUS ) || look_1_0.between?( OBJECT, FALSE ) || look_1_0.between?( WITH, PLUS ) || look_1_0.between?( ID, DOC ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 14:5: statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_IN_program_43 )\n statement1 = statement\n @state.following.pop\n\n @adaptor.add_child( root_0, statement1.tree )\n\n\n else\n match_count_1 > 0 and break\n eee = EarlyExit(1)\n\n\n raise eee\n end\n match_count_1 += 1\n end\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgramReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n source_elements1 = nil\n\n stream_source_elements = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule source_elements\" )\n begin\n # at line 251:3: ( source_elements -> source_elements | -> ^( UNDEFINED ) )\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == GENERAL || look_1_0 == GET || look_1_0 == ARROW || look_1_0 == IF || look_1_0 == REGEX || look_1_0 == INCR || look_1_0 == BREAK || look_1_0 == RETURN || look_1_0 == IS_DEFINED || look_1_0 == LBRACE || look_1_0 == LBRACK || look_1_0.between?( SEMI, CONST ) || look_1_0.between?( SET, LET ) || look_1_0 == DDOC || look_1_0.between?( DECR, LPAREN ) || look_1_0 == DELETE || look_1_0.between?( DGENERAL, DO ) || look_1_0 == THROW || look_1_0 == TILDE || look_1_0 == TRUE || look_1_0 == TRY || look_1_0.between?( TYPEOF, NEW ) || look_1_0.between?( EACH, UNDEFINED ) || look_1_0.between?( NULL, UNLESS ) || look_1_0 == UNTIL || look_1_0 == FALSE || look_1_0 == VAR || look_1_0.between?( VOID, FOR ) || look_1_0 == WHILE || look_1_0.between?( WITH, YIELD ) || look_1_0.between?( IS_UNDEFINED, DOC ) || look_1_0.between?( T__148, T__150 ) )\n alt_1 = 1\n elsif ( look_1_0 == EOF )\n alt_1 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 1, 0 )\n end\n case alt_1\n when 1\n # at line 251:5: source_elements\n @state.following.push( TOKENS_FOLLOWING_source_elements_IN_program_1733 )\n source_elements1 = source_elements\n @state.following.pop\n if @state.backtracking == 0\n stream_source_elements.add( source_elements1.tree )\n end\n # AST Rewrite\n # elements: source_elements\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 251:21: -> source_elements\n @adaptor.add_child( root_0, stream_source_elements.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 252:21: \n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 252:21: -> ^( UNDEFINED )\n # at line 252:24: ^( UNDEFINED )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( UNDEFINED, \"UNDEFINED\" ), root_1 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "def search_context\n builder = Builder.new(view_context)\n\n builder.with_snippet(@snippet) if @snippet.present?\n @snippets.each(&builder.method(:with_snippet)) if @snippets.present?\n builder.with_project(@project) if @project.present? && @project.persisted?\n builder.with_group(@group) if @group.present? && @group.persisted?\n builder.with_ref(@ref) if @ref.present?\n\n builder.build!\n end", "def compile\n prep\n client.setup_run_context\n end", "def clone\n rContext = Context.new\n\n rContext.mergeWithContext(self)\n\n return rContext\n end", "def eval(vtable)\n self.class.new(vtable.expand(@value))\n end", "def to_rule\n compiler.visit(to_ast)\n end", "def dynamic_autocomplete_context(readline_input, line_buffer=[])\n # special case indicator when user starts cc with '/' (go from root)\n goes_from_root = readline_input.start_with?('/')\n # Cloning existing active context, as all changes shouldn't be permanent, but temporary for autocomplete\n active_context_copy = @active_context.clone_me\n # Emptying context copy if it goes from root '/'\n active_context_copy.clear if goes_from_root\n # Invalid context is user leftover to be matched; i.e. 'cc /assembly/te' - 'te' is leftover\n invalid_context = \"\"\n\n # Validate and change context; skip step if user's input is empty or it is equal to '/'\n active_context_copy, error_message, invalid_context = prepare_context_change([readline_input], active_context_copy, nil, line_buffer) unless (readline_input.empty? || readline_input == \"/\")\n\n # using extended_context when we want to use autocomplete from other context\n # e.g. we are in assembly/apache context and want to create-component we will use extended context to add\n # component-templates to autocomplete\n extended_candidates, new_context, line_buffer_first = {}, nil, nil\n command_clazz = Context.get_command_class(active_context_copy.last_command_name)\n\n unless (line_buffer.empty? || line_buffer.strip().empty?)\n line_buffer = line_buffer.split(' ')\n line_buffer_last = line_buffer.last\n line_buffer_first = line_buffer.first\n line_buffer_first.gsub!('-','_') unless (line_buffer_first.nil? || line_buffer_first.empty?)\n end\n\n unless command_clazz.nil?\n extended_context = command_clazz.respond_to?(:extended_context) ? command_clazz.extended_context() : {}\n\n unless extended_context.empty?\n extended_context = extended_context[:context] || {}\n extended_context.select!{|k,v| line_buffer.include?(k.to_s)} if extended_context.respond_to?(:select!)\n\n if (extended_context[line_buffer_last] && !line_buffer_first.eql?(line_buffer_last))\n new_context = extended_context[line_buffer_last]\n elsif (extended_context[line_buffer[line_buffer.size-2]] && !line_buffer_first.eql?(extended_context[line_buffer[line_buffer.size-2]]))\n new_context = extended_context[line_buffer[line_buffer.size-2]]\n else\n new_context = extended_context[line_buffer_first.to_sym] unless line_buffer_first.nil? || line_buffer_first.empty?\n end\n\n unless new_context.nil?\n if new_context.is_a?(String)\n active_context_copy.push_new_context(new_context, new_context)\n elsif new_context.is_a?(Hash)\n context_candidates = load_extended_context_commands(new_context, active_context_copy)\n results_filter = (readline_input.match(/\\/$/) && invalid_context.empty?) ? \"\" : readline_input.split(\"/\").last\n results_filter ||= \"\"\n context_candidates = context_candidates.grep( /^#{Regexp.escape(results_filter)}/ )\n return context_candidates\n end\n end\n end\n end\n\n return get_ac_candidates(active_context_copy, readline_input, invalid_context, goes_from_root, line_buffer_first||{})\n end", "def visit_without_hash_context_shift(k, v, parent)\n # Short-circuit for stuff like `where(:author => User.first)`\n # This filthy hack emulates similar behavior in AR PredicateBuilder\n\n if ActiveRecord::Base === v &&\n association = classify(parent).reflect_on_association(k.to_sym)\n return expand_belongs_to(Nodes::Predicate.new(k, :eq, v), parent, association)\n end\n\n case v\n when Nodes::Stub, Symbol\n v = contextualize(parent)[v.to_s]\n when Nodes::KeyPath # If we could visit the endpoint, we wouldn't be here\n v = contextualize(traverse(v, parent))[v.endpoint.to_s]\n end\n\n case k\n when Nodes::Predicate\n visit(k % quote_for_node(k.expr, v), parent)\n when Nodes::Function, Nodes::Literal\n arel_predicate_for(visit(k, parent), quote(v), parent)\n when Nodes::KeyPath\n visit(k % quote_for_node(k.endpoint, v), parent)\n else\n attr_name = k.to_s\n attribute = if !hash_context_shifted? && attr_name.include?('.')\n table_name, attr_name = attr_name.split(/\\./, 2)\n Arel::Table.new(table_name.to_s, :engine => engine)[attr_name.to_s]\n else\n contextualize(parent)[attr_name]\n end\n arel_predicate_for(attribute, v, parent)\n end\n end", "def create_context(resources_dsl, rule_class) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n profile_context_owner = self\n profile_id = @profile_id\n\n # rubocop:disable Lint/NestedMethodDefinition\n Class.new do\n include Inspec::DSL\n include resources_dsl\n\n def initialize(backend, conf, require_loader) # rubocop:disable Lint/NestedMethodDefinition, Lint/DuplicateMethods\n @backend = backend\n @conf = conf\n @require_loader = require_loader\n @skip_profile = false\n end\n\n # Save the toplevel require method to load all ruby dependencies.\n # It is used whenever the `require 'lib'` is not in libraries.\n alias_method :__ruby_require, :require\n\n def require(path)\n rbpath = path + '.rb'\n return __ruby_require(path) if !@require_loader.exists?(rbpath)\n return false if @require_loader.loaded?(rbpath)\n\n # This is equivalent to calling `require 'lib'` with lib on disk.\n # We cannot rely on libraries residing on disk however.\n # TODO: Sandboxing.\n content, path, line = @require_loader.load(rbpath)\n eval(content, TOPLEVEL_BINDING, path, line) # rubocop:disable Lint/Eval\n end\n\n define_method :title do |arg|\n profile_context_owner.set_header(:title, arg)\n end\n\n def to_s\n 'Profile Context Run'\n end\n\n define_method :control do |*args, &block|\n id = args[0]\n opts = args[1] || {}\n register_control(rule_class.new(id, profile_id, opts, &block))\n end\n\n define_method :describe do |*args, &block|\n loc = block_location(block, caller[0])\n id = \"(generated from #{loc} #{SecureRandom.hex})\"\n\n res = nil\n rule = rule_class.new(id, profile_id, {}) do\n res = describe(*args, &block)\n end\n register_control(rule, &block)\n res\n end\n\n define_method :register_control do |control, &block|\n ::Inspec::Rule.set_skip_rule(control, true) if @skip_profile\n\n profile_context_owner.register_rule(control, &block) unless control.nil?\n end\n\n # method for attributes; import attribute handling\n define_method :attribute do |name, options|\n profile_context_owner.register_attribute(name, options)\n end\n\n define_method :skip_control do |id|\n profile_context_owner.unregister_rule(id)\n end\n\n def only_if\n return unless block_given?\n @skip_profile ||= !yield\n end\n\n alias_method :rule, :control\n alias_method :skip_rule, :skip_control\n\n private\n\n def block_location(block, alternate_caller)\n if block.nil?\n alternate_caller[/^(.+:\\d+):in .+$/, 1] || 'unknown'\n else\n path, line = block.source_location\n \"#{File.basename(path)}:#{line}\"\n end\n end\n end\n # rubocop:enable all\n end", "def rule\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 10)\n @rule_stack.push(Scoperule.new)\n return_value = RuleReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n modifier = nil\n arg = nil\n rt = nil\n __DOC_COMMENT39__ = nil\n string_literal40 = nil\n string_literal41 = nil\n string_literal42 = nil\n string_literal43 = nil\n char_literal45 = nil\n string_literal46 = nil\n char_literal51 = nil\n char_literal53 = nil\n id44 = nil\n throws_spec47 = nil\n options_spec48 = nil\n rule_scope_spec49 = nil\n rule_action50 = nil\n alt_list52 = nil\n exception_group54 = nil\n\n tree_for_modifier = nil\n tree_for_arg = nil\n tree_for_rt = nil\n tree_for_DOC_COMMENT39 = nil\n tree_for_string_literal40 = nil\n tree_for_string_literal41 = nil\n tree_for_string_literal42 = nil\n tree_for_string_literal43 = nil\n tree_for_char_literal45 = nil\n tree_for_string_literal46 = nil\n tree_for_char_literal51 = nil\n tree_for_char_literal53 = nil\n stream_DOC_COMMENT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOC_COMMENT\")\n stream_RET = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token RET\")\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__71\")\n stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token BANG\")\n stream_T__76 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__76\")\n stream_T__75 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__75\")\n stream_FRAGMENT = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token FRAGMENT\")\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__78\")\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ARG_ACTION\")\n stream_T__77 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__77\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n stream_throws_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule throws_spec\")\n stream_rule_action = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rule_action\")\n stream_exception_group = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule exception_group\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n stream_rule_scope_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rule_scope_spec\")\n stream_alt_list = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule alt_list\")\n begin\n # at line 159:4: ( DOC_COMMENT )? (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )? id ( '!' )? (arg= ARG_ACTION )? ( 'returns' rt= ARG_ACTION )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* ':' alt_list ';' ( exception_group )?\n # at line 159:4: ( DOC_COMMENT )?\n alt_15 = 2\n look_15_0 = @input.peek(1)\n\n if (look_15_0 == DOC_COMMENT) \n alt_15 = 1\n end\n case alt_15\n when 1\n # at line 159:4: DOC_COMMENT\n __DOC_COMMENT39__ = match(DOC_COMMENT, TOKENS_FOLLOWING_DOC_COMMENT_IN_rule_791) \n if @state.backtracking == 0\n stream_DOC_COMMENT.add(__DOC_COMMENT39__)\n end\n\n end\n # at line 160:3: (modifier= ( 'protected' | 'public' | 'private' | 'fragment' ) )?\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0 == FRAGMENT || look_17_0.between?(T__75, T__77)) \n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 160:5: modifier= ( 'protected' | 'public' | 'private' | 'fragment' )\n # at line 160:14: ( 'protected' | 'public' | 'private' | 'fragment' )\n alt_16 = 4\n case look_16 = @input.peek(1)\n when T__75 then alt_16 = 1\n when T__76 then alt_16 = 2\n when T__77 then alt_16 = 3\n when FRAGMENT then alt_16 = 4\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n nvae = NoViableAlternative(\"\", 16, 0)\n raise nvae\n end\n case alt_16\n when 1\n # at line 160:15: 'protected'\n string_literal40 = match(T__75, TOKENS_FOLLOWING_T__75_IN_rule_801) \n if @state.backtracking == 0\n stream_T__75.add(string_literal40)\n end\n\n when 2\n # at line 160:27: 'public'\n string_literal41 = match(T__76, TOKENS_FOLLOWING_T__76_IN_rule_803) \n if @state.backtracking == 0\n stream_T__76.add(string_literal41)\n end\n\n when 3\n # at line 160:36: 'private'\n string_literal42 = match(T__77, TOKENS_FOLLOWING_T__77_IN_rule_805) \n if @state.backtracking == 0\n stream_T__77.add(string_literal42)\n end\n\n when 4\n # at line 160:46: 'fragment'\n string_literal43 = match(FRAGMENT, TOKENS_FOLLOWING_FRAGMENT_IN_rule_807) \n if @state.backtracking == 0\n stream_FRAGMENT.add(string_literal43)\n end\n\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_rule_815)\n id44 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id44.tree)\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @rule_stack[-1].name = (id44.nil? ? nil : @input.to_s(id44.start,id44.stop)) \n # <-- action\n end\n # at line 162:3: ( '!' )?\n alt_18 = 2\n look_18_0 = @input.peek(1)\n\n if (look_18_0 == BANG) \n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 162:3: '!'\n char_literal45 = match(BANG, TOKENS_FOLLOWING_BANG_IN_rule_821) \n if @state.backtracking == 0\n stream_BANG.add(char_literal45)\n end\n\n end\n # at line 163:3: (arg= ARG_ACTION )?\n alt_19 = 2\n look_19_0 = @input.peek(1)\n\n if (look_19_0 == ARG_ACTION) \n alt_19 = 1\n end\n case alt_19\n when 1\n # at line 163:5: arg= ARG_ACTION\n arg = match(ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_830) \n if @state.backtracking == 0\n stream_ARG_ACTION.add(arg)\n end\n\n end\n # at line 164:3: ( 'returns' rt= ARG_ACTION )?\n alt_20 = 2\n look_20_0 = @input.peek(1)\n\n if (look_20_0 == RET) \n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 164:5: 'returns' rt= ARG_ACTION\n string_literal46 = match(RET, TOKENS_FOLLOWING_RET_IN_rule_839) \n if @state.backtracking == 0\n stream_RET.add(string_literal46)\n end\n rt = match(ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rule_843) \n if @state.backtracking == 0\n stream_ARG_ACTION.add(rt)\n end\n\n end\n # at line 165:3: ( throws_spec )?\n alt_21 = 2\n look_21_0 = @input.peek(1)\n\n if (look_21_0 == T__79) \n alt_21 = 1\n end\n case alt_21\n when 1\n # at line 165:3: throws_spec\n @state.following.push(TOKENS_FOLLOWING_throws_spec_IN_rule_851)\n throws_spec47 = throws_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_throws_spec.add(throws_spec47.tree)\n end\n\n end\n # at line 165:16: ( options_spec )?\n alt_22 = 2\n look_22_0 = @input.peek(1)\n\n if (look_22_0 == OPTIONS) \n alt_22 = 1\n end\n case alt_22\n when 1\n # at line 165:16: options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_rule_854)\n options_spec48 = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(options_spec48.tree)\n end\n\n end\n # at line 165:30: ( rule_scope_spec )?\n alt_23 = 2\n look_23_0 = @input.peek(1)\n\n if (look_23_0 == SCOPE) \n alt_23 = 1\n end\n case alt_23\n when 1\n # at line 165:30: rule_scope_spec\n @state.following.push(TOKENS_FOLLOWING_rule_scope_spec_IN_rule_857)\n rule_scope_spec49 = rule_scope_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_scope_spec.add(rule_scope_spec49.tree)\n end\n\n end\n # at line 165:47: ( rule_action )*\n loop do #loop 24\n alt_24 = 2\n look_24_0 = @input.peek(1)\n\n if (look_24_0 == AT) \n alt_24 = 1\n\n end\n case alt_24\n when 1\n # at line 165:47: rule_action\n @state.following.push(TOKENS_FOLLOWING_rule_action_IN_rule_860)\n rule_action50 = rule_action\n @state.following.pop\n if @state.backtracking == 0\n stream_rule_action.add(rule_action50.tree)\n end\n\n else\n break #loop 24\n end\n end\n char_literal51 = match(T__78, TOKENS_FOLLOWING_T__78_IN_rule_865) \n if @state.backtracking == 0\n stream_T__78.add(char_literal51)\n end\n @state.following.push(TOKENS_FOLLOWING_alt_list_IN_rule_867)\n alt_list52 = alt_list\n @state.following.pop\n if @state.backtracking == 0\n stream_alt_list.add(alt_list52.tree)\n end\n char_literal53 = match(T__71, TOKENS_FOLLOWING_T__71_IN_rule_869) \n if @state.backtracking == 0\n stream_T__71.add(char_literal53)\n end\n # at line 167:3: ( exception_group )?\n alt_25 = 2\n look_25_0 = @input.peek(1)\n\n if (look_25_0.between?(T__84, T__85)) \n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 167:3: exception_group\n @state.following.push(TOKENS_FOLLOWING_exception_group_IN_rule_873)\n exception_group54 = exception_group\n @state.following.pop\n if @state.backtracking == 0\n stream_exception_group.add(exception_group54.tree)\n end\n\n end\n # AST Rewrite\n # elements: options_spec, exception_group, RET, throws_spec, rule_action, rt, arg, id, alt_list, rule_scope_spec\n # token labels: arg, rt\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_arg = token_stream(\"token arg\", arg)\n stream_rt = token_stream(\"token rt\", rt)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 168:6: -> ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n # at line 168:9: ^( RULE id ( ^( ARG[$arg] $arg) )? ( ^( 'returns' $rt) )? ( throws_spec )? ( options_spec )? ( rule_scope_spec )? ( rule_action )* alt_list ( exception_group )? EOR[\\\"EOR\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create_from_type!(RULE, \"RULE\"), root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, modifier ? @adaptor.create!(modifier) : nil)\n # at line 168:68: ( ^( ARG[$arg] $arg) )?\n if stream_arg.has_next?\n # at line 168:68: ^( ARG[$arg] $arg)\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(ARG, arg), root_2)\n\n @adaptor.add_child(root_2, stream_arg.next_node)\n\n @adaptor.add_child(root_1, root_2)\n\n end\n\n stream_arg.reset();\n # at line 168:87: ( ^( 'returns' $rt) )?\n if stream_RET.has_next? || stream_rt.has_next?\n # at line 168:87: ^( 'returns' $rt)\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(stream_RET.next_node, root_2)\n\n @adaptor.add_child(root_2, stream_rt.next_node)\n\n @adaptor.add_child(root_1, root_2)\n\n end\n\n stream_RET.reset();\n stream_rt.reset();\n # at line 169:9: ( throws_spec )?\n if stream_throws_spec.has_next?\n @adaptor.add_child(root_1, stream_throws_spec.next_tree)\n\n end\n\n stream_throws_spec.reset();\n # at line 169:22: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 169:36: ( rule_scope_spec )?\n if stream_rule_scope_spec.has_next?\n @adaptor.add_child(root_1, stream_rule_scope_spec.next_tree)\n\n end\n\n stream_rule_scope_spec.reset();\n # at line 169:53: ( rule_action )*\n while stream_rule_action.has_next?\n @adaptor.add_child(root_1, stream_rule_action.next_tree)\n\n end\n\n stream_rule_action.reset();\n @adaptor.add_child(root_1, stream_alt_list.next_tree)\n # at line 171:9: ( exception_group )?\n if stream_exception_group.has_next?\n @adaptor.add_child(root_1, stream_exception_group.next_tree)\n\n end\n\n stream_exception_group.reset();\n @adaptor.add_child(root_1, @adaptor.create!(EOR, \"EOR\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 10)\n @rule_stack.pop\n\n end\n \n return return_value\n end", "def _prepare_context; end", "def call_3way_vector_op(v_a, v_b, v_c, child_context, &block)\n return yield(v_a, v_b, v_c) unless v_a.is_a?(Array)\n\n v_a.each_with_index.collect do |v1, index|\n v2 = v_b[index]\n v3 = v_c.is_a?(Array) ? v_c[index] : v_c\n if v1.is_a?(Array)\n call_3way_vector_op(v1, v2, v3, child_context, &block)\n else\n yield(v1, v2, v3)\n end\n end\n end", "def new\n @rule = Rule.new\n end", "def lookup_context\n @_lookup_context ||= LookupContextWrapper.new super # rubocop:disable Naming/MemoizedInstanceVariableName, Metrics/LineLength\n end", "def initialize(vm_64, xpath_filter = nil, deploy_id = nil, bridged=true)\n @locking = true\n\n @bridged = bridged\n\n vm = Base64::decode64(vm_64)\n\n xpath_filter ||= XPATH_FILTER\n super(vm, xpath_filter, deploy_id)\n\n @commands = VNMNetwork::Commands.new\n\n rules = {}\n @vm.vm_root.elements.each('TEMPLATE/SECURITY_GROUP_RULE') do |r|\n security_group_rule = {}\n\n r.elements.each do |e|\n key = e.name.downcase.to_sym\n security_group_rule[key] = e.text\n end\n\n id = security_group_rule[:security_group_id]\n\n rules[id] = [] if rules[id].nil?\n rules[id] << security_group_rule\n end\n\n @security_group_rules = rules\n end", "def context\n @context ||= Context.new(self)\n end", "def context_for_eval; end", "def rewrite_template_arg\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n return_value = RewriteTemplateArgReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal193 = nil\n __ACTION194__ = nil\n id192 = nil\n\n tree_for_char_literal193 = nil\n tree_for_ACTION194 = nil\n stream_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LABEL_ASSIGN\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 448:6: id '=' ACTION\n @state.following.push( TOKENS_FOLLOWING_id_IN_rewrite_template_arg_3093 )\n id192 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id192.tree )\n end\n char_literal193 = match( LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_rewrite_template_arg_3095 )\n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add( char_literal193 )\n end\n __ACTION194__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_template_arg_3097 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION194__ )\n end\n # AST Rewrite\n # elements: ACTION, id\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 448:20: -> ^( ARG[$id.start] id ACTION )\n # at line 448:23: ^( ARG[$id.start] id ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( ARG, id192.start ), root_1 )\n\n @adaptor.add_child( root_1, stream_id.next_tree )\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 44 )\n\n end\n \n return return_value\n end", "def compile(*args)\n\t filtered_args, vm = prepare_call(args)\n\t CompiledCall.new(self, filtered_args, vm)\n\tend", "def initialize\n self.context = Context.new\n end", "def normalize(context = nil)\n clone.normalize!(context)\n end", "def vm_parse(parser, input)\n compiler = Parslet::Bytecode::Compiler.new\n program = compiler.compile(parser)\n \n vm = Parslet::Bytecode::VM.new(false)\n vm.run(program, input)\n end", "def new\n @context_rule = ContextRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @context_rule }\n end\n end", "def constructor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n\n\n return_value = ConstructorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_DEF288__ = nil\n __K_INITIALIZE289__ = nil\n __LPAR290__ = nil\n __RPAR292__ = nil\n __LLAIZQ293__ = nil\n __LLADER295__ = nil\n parametros_tipos291 = nil\n bodyexp294 = nil\n\n\n tree_for_K_DEF288 = nil\n tree_for_K_INITIALIZE289 = nil\n tree_for_LPAR290 = nil\n tree_for_RPAR292 = nil\n tree_for_LLAIZQ293 = nil\n tree_for_LLADER295 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 247:4: K_DEF K_INITIALIZE LPAR ( parametros_tipos )? RPAR LLAIZQ bodyexp LLADER\n __K_DEF288__ = match( K_DEF, TOKENS_FOLLOWING_K_DEF_IN_constructor_1218 )\n if @state.backtracking == 0\n tree_for_K_DEF288 = @adaptor.create_with_payload( __K_DEF288__ )\n @adaptor.add_child( root_0, tree_for_K_DEF288 )\n\n end\n\n __K_INITIALIZE289__ = match( K_INITIALIZE, TOKENS_FOLLOWING_K_INITIALIZE_IN_constructor_1220 )\n if @state.backtracking == 0\n tree_for_K_INITIALIZE289 = @adaptor.create_with_payload( __K_INITIALIZE289__ )\n @adaptor.add_child( root_0, tree_for_K_INITIALIZE289 )\n\n end\n\n __LPAR290__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_constructor_1222 )\n if @state.backtracking == 0\n tree_for_LPAR290 = @adaptor.create_with_payload( __LPAR290__ )\n @adaptor.add_child( root_0, tree_for_LPAR290 )\n\n end\n\n # at line 247:28: ( parametros_tipos )?\n alt_39 = 2\n look_39_0 = @input.peek( 1 )\n\n if ( look_39_0 == TIPO )\n alt_39 = 1\n end\n case alt_39\n when 1\n # at line 247:28: parametros_tipos\n @state.following.push( TOKENS_FOLLOWING_parametros_tipos_IN_constructor_1224 )\n parametros_tipos291 = parametros_tipos\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, parametros_tipos291.tree )\n end\n\n\n end\n __RPAR292__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_constructor_1227 )\n if @state.backtracking == 0\n tree_for_RPAR292 = @adaptor.create_with_payload( __RPAR292__ )\n @adaptor.add_child( root_0, tree_for_RPAR292 )\n\n end\n\n __LLAIZQ293__ = match( LLAIZQ, TOKENS_FOLLOWING_LLAIZQ_IN_constructor_1229 )\n if @state.backtracking == 0\n tree_for_LLAIZQ293 = @adaptor.create_with_payload( __LLAIZQ293__ )\n @adaptor.add_child( root_0, tree_for_LLAIZQ293 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_bodyexp_IN_constructor_1231 )\n bodyexp294 = bodyexp\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bodyexp294.tree )\n end\n\n __LLADER295__ = match( LLADER, TOKENS_FOLLOWING_LLADER_IN_constructor_1233 )\n if @state.backtracking == 0\n tree_for_LLADER295 = @adaptor.create_with_payload( __LLADER295__ )\n @adaptor.add_child( root_0, tree_for_LLADER295 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 54 )\n\n\n end\n\n return return_value\n end", "def argument\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n return_value = ArgumentReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n char_literal255 = nil\n property_name256 = nil\n expression257 = nil\n expression258 = nil\n\n tree_for_char_literal255 = nil\n\n begin\n # at line 210:3: ( ^( ':' property_name expression ) | expression )\n alt_34 = 2\n look_34_0 = @input.peek( 1 )\n\n if ( look_34_0 == COLON )\n alt_34 = 1\n elsif ( look_34_0.between?( AMP, AMP_ASGN ) || look_34_0 == POST_DECR || look_34_0.between?( GEQ, AREF ) || look_34_0.between?( GREATER, HAT ) || look_34_0.between?( ARROW, HAT_ASGN ) || look_34_0 == ASGN || look_34_0 == REGEX || look_34_0 == IN || look_34_0 == INCR || look_34_0.between?( INSTANCEOF, RSHIFT3 ) || look_34_0 == RSHIFT3_ASGN || look_34_0 == RSHIFT_ASGN || look_34_0 == LEQ || look_34_0.between?( LESS, SLASH ) || look_34_0 == SLASH_ASGN || look_34_0.between?( STAR, DECR ) || look_34_0 == STAR_ASGN || look_34_0 == LSHIFT || look_34_0.between?( DELETE, THIS ) || look_34_0.between?( MINUS, TILDE ) || look_34_0.between?( MINUS_ASGN, MOD ) || look_34_0.between?( MOD_ASGN, TYPEOF ) || look_34_0.between?( NEQ, UMINUS ) || look_34_0.between?( NEQQ, UNDEFINED ) || look_34_0 == NEW || look_34_0 == NOT || look_34_0.between?( NULL, UPLUS ) || look_34_0 == OBJECT || look_34_0.between?( EQ, OR_ASGN ) || look_34_0 == FALSE || look_34_0 == PIPE || look_34_0 == PIPE_ASGN || look_34_0 == PLUS || look_34_0.between?( ID, DOC ) )\n alt_34 = 2\n else\n raise NoViableAlternative( \"\", 34, 0 )\n end\n case alt_34\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 210:5: ^( ':' property_name expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal255 = match( COLON, TOKENS_FOLLOWING_COLON_IN_argument_1555 )\n\n tree_for_char_literal255 = @adaptor.copy_node( char_literal255 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal255, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_property_name_IN_argument_1557 )\n property_name256 = property_name\n @state.following.pop\n\n @adaptor.add_child( root_1, property_name256.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_argument_1559 )\n expression257 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression257.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 211:5: expression\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_argument_1567 )\n expression258 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression258.tree )\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n end\n \n return return_value\n end", "def compile(source)\n ast = transformer.apply(parser.parse(source))\n ast.compile\n end", "def context\n @context ||= Context.new(self)\n end", "def with\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n with_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 313:7: ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'T' | 't' ) ( 'H' | 'h' )\n if @input.peek( 1 ).between?( T__54, T__55 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__16, T__17 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__36, T__37 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n memoize( __method__, with_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end", "def pa\n return VasmGrammar.new, VasmTransform.new\nend", "def condicion\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n return_value = CondicionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __OP_REL114__ = nil\n valor113 = nil\n valor115 = nil\n\n\n tree_for_OP_REL114 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 123:4: valor OP_REL valor\n @state.following.push( TOKENS_FOLLOWING_valor_IN_condicion_545 )\n valor113 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor113.tree )\n end\n\n __OP_REL114__ = match( OP_REL, TOKENS_FOLLOWING_OP_REL_IN_condicion_547 )\n if @state.backtracking == 0\n tree_for_OP_REL114 = @adaptor.create_with_payload( __OP_REL114__ )\n @adaptor.add_child( root_0, tree_for_OP_REL114 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_condicion_549 )\n valor115 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor115.tree )\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end\n\n return return_value\n end", "def context(context_name)\n rule_sets[context_name]\n end", "def context\n Zuul::Context.new context_type, context_id\n end", "def to_ctx_obj (ctx_content)\n id=ctx_content[\"id\"]\n\n entity_content = ctx_content[\"entity\"][0]\n e = entity(entity_content)\n\n period_content = ctx_content[\"period\"][0]\n p = period(period_content)\n\n s = scenario(ctx_content)\n _context = Context.new(id, e, p, s)\n _context.ns=ctx_content[\"nspace\"]\n _context.nsp=ctx_content[\"nspace_prefix\"]\n return _context\n end", "def new_context(type, proc = nil)\n create_new_context(type)\n\n # run context initializer\n yield if block_given?\n\n # execute user provided block within context\n self.instance_eval(&proc) if proc\n\n restore_old_context\n end", "def initialize(activation_rule = nil)\n @child_contexts = []\n @actions = []\n initialize_activatable(activation_rule)\n end", "def initialize()\n # == Context type parser hash\n # An Hash of row type symbols pointing to an array of conditions to be satisfied.\n #\n # Parsing a row type implies detecting the context in which the tokens of the\n # row will be extracted.\n #\n # To successfully parse a row type (thus defining the current context of the tokenizer),\n # for each type symbol here enlisted, all of its value elements must result true,\n # equal or \"satisfied\", for the type of context to be recognized as \"active\".\n #\n # For instance, for the type :category_header, 3 consecutive lines of the parsed\n # file must satisfy the conditions inside its element array (respectively at\n # index 0, 1 and 2).\n # Whereas, for the type :result_row a single condition is defined as enough.\n #\n # If the condition is a String, the equal operator is used (=).\n # If the condition is a RegExp, the search operator is used (=~).\n #\n # Contexts are served in F.I.F.O. order (first detected, first served), but no skipping is made in\n # case more than one rule is found to be true (That is, one single line may return more than one\n # context of data, if the conditions are loose enough).\n #\n @context_types = { # HEADER CONTEXT(s) def. arrays:\n meeting_header: V3::ContextDetector.new( context_type_meeting_header ),\n category_header: V3::ContextDetector.new( context_type_category_header ),\n relay_header: V3::ContextDetector.new( context_type_relay_header ),\n team_ranking: V3::ContextDetector.new( context_type_team_ranking ),\n\n team_stats: V3::ContextDetector.new( context_type_team_stats ),\n stats: V3::ContextDetector.new( context_type_stats ),\n # DETAIL CONTEXT(s) def. arrays:\n result_row: V3::ContextDetector.new( context_type_result_row ),\n relay_row: V3::ContextDetector.new( context_type_relay_row ),\n ranking_row: V3::ContextDetector.new( context_type_ranking_row ),\n\n stats_details: V3::ContextDetector.new( context_type_stats_details )\n }\n\n # == String tokenizer type hash\n # An Hash of row type symbols pointing to an array of arrays, in which each\n # single element array is a V3::TokenExtractor instance, used to define each token\n # boundary inside the currently parsed row.\n #\n # For each context defined by the row_types array, and for each possible row,\n # an array of conditions must be defined to detect the starting and ending position\n # from which the token must be extracted. (see ++TokenExtractor++ class).\n #\n # Use +nil+ or an empty array to skip token extraction for the current line\n # of context. If the \"starting condition\" applies successfully but the following\n # condition doesn't, the end of line is considered the actual token end boundary.\n #\n @tokenizer_types = {\n meeting_header: [\n # -- Fields to be extracted: :title OR :meeting_dates\n [\n tokenizer_meeting_header_title,\n tokenizer_meeting_header_meeting_dates,\n ],\n # -- Fields to be extracted: :organization OR :title\n [\n tokenizer_meeting_header_organization,\n tokenizer_meeting_header_title\n ],\n # -- Fields to be extracted: :meeting_dates OR :organization\n [\n tokenizer_meeting_header_meeting_dates,\n tokenizer_meeting_header_organization,\n ]\n ],\n\n category_header: [ # 3 row-type conditions => 3 cached rows => the tokenizer list must have 3 elements\n nil,\n # -- Fields to be extracted: :distance, :style, :gender, :category_group, :base_time\n [\n tokenizer_category_header_distance,\n tokenizer_category_header_style,\n tokenizer_category_header_gender,\n tokenizer_category_header_group,\n tokenizer_category_header_base_time\n ],\n nil\n ],\n\n # -- Fields to be extracted: :type, :distance, :style, :gender (can be nil), :category_group, :base_time\n relay_header: [\n nil,\n [\n tokenizer_relay_header_type,\n tokenizer_relay_header_distance,\n tokenizer_relay_header_style,\n tokenizer_category_header_gender,\n tokenizer_relay_header_category_group,\n tokenizer_relay_header_base_time\n ],\n nil\n ],\n\n # -- Fields to be extracted: (nothing, 1 line in cache)\n team_ranking: [\n nil\n ],\n\n # -- Fields to be extracted: (nothing, 1 line in cache)\n team_stats: [\n nil\n ],\n\n # -- Fields to be extracted: (nothing, 1 line in cache)\n stats: [\n nil\n ],\n\n result_row: [ # 1 condition => 1 cached row\n [ # => the tokenizer list must have 1 element (which is 1 array of 2-item arrays)\n tokenizer_result_row_result_position,\n tokenizer_result_row_team_code,\n tokenizer_result_row_swimmer_name,\n tokenizer_result_row_swimmer_year,\n tokenizer_result_row_team_name,\n tokenizer_result_row_result_time,\n tokenizer_result_row_result_score\n ]\n ],\n\n # -- Fields to be extracted: :result_position, :team_name, :result_time, :result_score\n relay_row: [\n [ # => the tokenizer list must have 1 element (which is 1 array of 2-item arrays)\n tokenizer_relay_row_result_position,\n tokenizer_relay_row_team_name,\n tokenizer_relay_row_result_time,\n tokenizer_relay_row_result_score\n ]\n ],\n\n # -- Fields to be extracted: :result_position, :team_code, :team_name, :result_score\n ranking_row: [\n [\n tokenizer_ranking_row_result_position,\n tokenizer_ranking_row_team_code,\n tokenizer_ranking_row_team_name,\n tokenizer_ranking_row_result_score\n ]\n ],\n\n # -- Fields to be extracted: :teams_tot, :teams_presence,\n # :swimmer_tot, :swimmer_presence, :entries_tot, :entries_presence,\n # :disqual_tot, :withdrawals_tot\n stats_details: [\n [ tokenizer_stats_teams_tot ],\n nil,\n [ tokenizer_stats_teams_presence ], nil,\n\n [ tokenizer_stats_swimmers_tot ],\n nil,\n nil,\n nil,\n nil, nil,\n\n [ tokenizer_stats_swimmers_presence ],\n nil,\n nil,\n nil, nil,\n\n [ tokenizer_stats_entries_tot ],\n nil,\n nil, nil,\n\n [ tokenizer_stats_entries_presence ],\n nil, nil,\n\n nil,\n nil,\n [ tokenizer_stats_disqual_tot ],\n [ tokenizer_stats_withdrawals_tot ]\n ]\n }\n\n # == String tokenizer field names Hash\n # An Hash of field names enlisted in arrays, one for each possible row type\n # symbol defined for @tokenizer_types.\n #\n # Note that each field name is supposed to be unique among all the arrays\n # belonging to the same tokenizer type; otherwise, when not null, the last\n # value found will overwrite any other existing key having the same symbol.\n #\n @tokenizer_fields = {\n meeting_header: [ # 3 row-type conditions => 3 cached rows => the tokenizer list must have 3 elements\n [ :title, :meeting_dates ],\n [ :organization, :title ],\n [ :meeting_dates, :organization ]\n ],\n category_header: [ # 3 row-type conditions => 3 cached rows => the tokenizer list must have 3 elements\n nil,\n [ :distance, :style, :gender, :category_group, :base_time ],\n nil\n ],\n relay_header: [\n nil,\n [ :type, :distance, :style, :gender, :category_group, :base_time ],\n nil\n ],\n\n result_row: [ # 1 condition => 1 cached row => the tokenizer list must have 1 element (which is 1 array)\n [\n :result_position,\n :team_code,\n :swimmer_name,\n :swimmer_year,\n :team_name,\n :result_time,\n :result_score\n ]\n ],\n relay_row: [\n [ :result_position, :team_name, :result_time, :result_score ]\n ],\n\n team_ranking: [ # 1 row-type conditions => 1 cached rows => the tokenizer list must have 1 element\n nil\n ],\n ranking_row: [\n [ :result_position, :team_code, :team_name, :result_score ]\n ],\n\n team_stats: [\n nil\n ],\n\n stats: [\n nil\n ],\n\n stats_details: [\n [ :teams_tot ],\n nil,\n [ :teams_presence ], nil,\n\n [ :swimmer_tot ],\n nil,\n nil,\n nil,\n nil, nil,\n\n [ :swimmer_presence ],\n nil,\n nil,\n nil, nil,\n\n [ :entries_tot ],\n nil,\n nil, nil,\n\n [ :entries_presence ],\n nil, nil,\n\n nil,\n nil,\n [ :disqual_tot ],\n [ :withdrawals_tot ]\n ]\n }\n\n # == Context Group Keys Hash\n # This Hash contains as each item value the array of all the key field for\n # a specific context symbol.\n # The field names must be taken from @tokenizer_fields and these will be\n # concatenated together to form the unique key representing a single context\n # data page on the result hash.\n #\n # If no key is defined for a specific context symbol, each entry will be\n # treated as unique and added to the result array of data pages.\n #\n @context_keys = {\n meeting_header: [:title],\n category_header: [:distance, :style, :gender, :category_group],\n relay_header: [:type, :category_group] # (type includes also the gender token)\n }\n # === Internal structure integrity checks: ===\n # Pre-check format type definition:\n raise \"Malformed parser Hash!\" unless (@context_types.size == @tokenizer_types.size) && (@tokenizer_types.size == @tokenizer_fields.size)\n\n @context_types.each { |key, detector|\n raise \"Missing parser Hash key '#{key}'!\" unless ( @tokenizer_types.has_key?(key) && @tokenizer_fields.has_key?(key) )\n raise \"Parser Hash element '#{key}' points to an invalid detector instance!\" unless detector.instance_of?( V3::ContextDetector )\n }\n end", "def context\n unless @instance_context\n @instance_context = NumberContext.new(@version, @params['destination_number'], )\n end\n @instance_context\n end", "def for_in_statement_initialiser_part\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n @InFor_stack.push( @@InFor.new )\n return_value = ForInStatementInitialiserPartReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal170 = nil\n string_literal171 = nil\n declaration_target172 = nil\n member173 = nil\n\n tree_for_string_literal170 = nil\n tree_for_string_literal171 = nil\n\n begin\n # at line 500:3: ( ( 'var' | 'let' ) declaration_target | member )\n alt_35 = 2\n look_35_0 = @input.peek( 1 )\n\n if ( look_35_0 == LET || look_35_0 == VAR )\n alt_35 = 1\n elsif ( look_35_0 == GENERAL || look_35_0 == GET || look_35_0 == ARROW || look_35_0 == REGEX || look_35_0 == LBRACE || look_35_0 == LBRACK || look_35_0 == SET || look_35_0 == DDOC || look_35_0 == LPAREN || look_35_0.between?( DGENERAL, MACRO ) || look_35_0 == THIS || look_35_0 == TRUE || look_35_0.between?( DSTRING, NEW ) || look_35_0 == EACH || look_35_0 == UNDEFINED || look_35_0 == NULL || look_35_0 == FALSE || look_35_0 == FUNCTION || look_35_0.between?( POUND, DOC ) || look_35_0.between?( T__148, T__150 ) )\n alt_35 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 35, 0 )\n end\n case alt_35\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 500:5: ( 'var' | 'let' ) declaration_target\n # at line 500:5: ( 'var' | 'let' )\n alt_34 = 2\n look_34_0 = @input.peek( 1 )\n\n if ( look_34_0 == VAR )\n alt_34 = 1\n elsif ( look_34_0 == LET )\n alt_34 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 34, 0 )\n end\n case alt_34\n when 1\n # at line 500:7: 'var'\n string_literal170 = match( VAR, TOKENS_FOLLOWING_VAR_IN_for_in_statement_initialiser_part_3369 )\n if @state.backtracking == 0\n\n tree_for_string_literal170 = @adaptor.create_with_payload( string_literal170 )\n root_0 = @adaptor.become_root( tree_for_string_literal170, root_0 )\n\n end\n\n when 2\n # at line 500:16: 'let'\n string_literal171 = match( LET, TOKENS_FOLLOWING_LET_IN_for_in_statement_initialiser_part_3374 )\n if @state.backtracking == 0\n\n tree_for_string_literal171 = @adaptor.create_with_payload( string_literal171 )\n root_0 = @adaptor.become_root( tree_for_string_literal171, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_declaration_target_IN_for_in_statement_initialiser_part_3380 )\n declaration_target172 = declaration_target\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, declaration_target172.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 501:5: member\n @state.following.push( TOKENS_FOLLOWING_member_IN_for_in_statement_initialiser_part_3386 )\n member173 = member\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, member173.tree )\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end# syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n @InFor_stack.last.active = false\n \n # <-- action\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n @InFor_stack.pop\n\n end\n \n return return_value\n end", "def at(*args, &block)\n\tRPoint::Contexts::ContextFactory.create_context(*args, &block)\nend", "def mkcompiler source=''\n VishCompiler.new source\nend", "def new_target\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 65 )\n return_value = NewTargetReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n receiver316 = nil\n accessor317 = nil\n\n stream_receiver = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule receiver\" )\n stream_accessor = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule accessor\" )\n begin\n # at line 685:5: ( receiver -> receiver ) ( accessor ->)*\n # at line 685:5: ( receiver -> receiver )\n # at line 685:7: receiver\n @state.following.push( TOKENS_FOLLOWING_receiver_IN_new_target_4861 )\n receiver316 = receiver\n @state.following.pop\n if @state.backtracking == 0\n stream_receiver.add( receiver316.tree )\n end\n # AST Rewrite\n # elements: receiver\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 685:16: -> receiver\n @adaptor.add_child( root_0, stream_receiver.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n # at line 686:5: ( accessor ->)*\n while true # decision 75\n alt_75 = 2\n look_75_0 = @input.peek( 1 )\n\n if ( look_75_0 == LBRACK )\n alt_75 = 1\n elsif ( look_75_0 == DOT )\n alt_75 = 1\n\n end\n case alt_75\n when 1\n # at line 686:7: accessor\n @state.following.push( TOKENS_FOLLOWING_accessor_IN_new_target_4875 )\n accessor317 = accessor\n @state.following.pop\n if @state.backtracking == 0\n stream_accessor.add( accessor317.tree )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 686:16: ->\n @adaptor.add_child( root_0, ( prepend_tree( accessor317.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n else\n break # out of loop for decision 75\n end\n end # loop for decision 75\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 65 )\n\n end\n \n return return_value\n end", "def rewrite_template_arg\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 44)\n return_value = RewriteTemplateArgReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal193 = nil\n __ACTION194__ = nil\n id192 = nil\n\n tree_for_char_literal193 = nil\n tree_for_ACTION194 = nil\n stream_LABEL_ASSIGN = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token LABEL_ASSIGN\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n begin\n # at line 457:6: id '=' ACTION\n @state.following.push(TOKENS_FOLLOWING_id_IN_rewrite_template_arg_3098)\n id192 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id192.tree)\n end\n char_literal193 = match(LABEL_ASSIGN, TOKENS_FOLLOWING_LABEL_ASSIGN_IN_rewrite_template_arg_3100) \n if @state.backtracking == 0\n stream_LABEL_ASSIGN.add(char_literal193)\n end\n __ACTION194__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_template_arg_3102) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION194__)\n end\n # AST Rewrite\n # elements: id, ACTION\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 457:20: -> ^( ARG[$id.start] id ACTION )\n # at line 457:23: ^( ARG[$id.start] id ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(ARG, id192.start), root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 44)\n\n end\n \n return return_value\n end", "def build_compiler\n node_name = nodename(:function)\n fact_values = facts_hash(node_name)\n\n # if we specify a pre_condition, we should ensure that we compile that\n # code into a catalog that is accessible from the scope where the\n # function is called\n Puppet[:code] = pre_cond\n\n node_options = {\n :parameters => fact_values,\n }\n\n stub_facts! fact_values\n\n node = build_node(node_name, node_options)\n\n compiler = Puppet::Parser::Compiler.new(node)\n compiler.compile\n compiler\n end", "def mainContext\n # return Context.find( context )\n return context\n end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__82\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule altpair\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n begin\n # at line 185:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_block_1119 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n # at line 186:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == OPTIONS || look_31_0 == T__78 )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 186:5: (opts= options_spec )? ':'\n # at line 186:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == OPTIONS )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 186:6: opts= options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_block_1128 )\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( opts.tree )\n end\n\n end\n char_literal76 = match( T__78, TOKENS_FOLLOWING_T__78_IN_block_1132 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal76 )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1139 )\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair77.tree )\n end\n # at line 187:11: ( '|' altpair )*\n while true # decision 32\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == T__82 )\n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 187:13: '|' altpair\n char_literal78 = match( T__82, TOKENS_FOLLOWING_T__82_IN_block_1143 )\n if @state.backtracking == 0\n stream_T__82.add( char_literal78 )\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1145 )\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair79.tree )\n end\n\n else\n break # out of loop for decision 32\n end\n end # loop for decision 32\n rp = match( T__83, TOKENS_FOLLOWING_T__83_IN_block_1160 )\n if @state.backtracking == 0\n stream_T__83.add( rp )\n end\n # AST Rewrite\n # elements: altpair, options_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 189:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 189:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( BLOCK, lp, \"BLOCK\" ), root_1 )\n\n # at line 189:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 189:48: ( altpair )+\n stream_altpair.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_altpair.has_next?\n @adaptor.add_child( root_1, stream_altpair.next_tree )\n\n end\n stream_altpair.reset\n @adaptor.add_child( root_1, @adaptor.create( EOB, rp, \"EOB\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end\n \n return return_value\n end", "def compile!(view); end", "def extract_context\n if File.readable?( @file ) then\n file_lines = IO.readlines( @file )\n @line_index = @line_number - 1\n\n start_line = @line_index - @padding\n start_line = 0 if start_line < 0\n\n stop_line = @line_index + @padding\n stop_line = (file_lines.size - 1) if stop_line >= file_lines.size\n\n @context_index = @line_index - start_line\n @context_line_numbers = (start_line+1..stop_line+1).to_a\n @context_lines = file_lines[start_line, @context_line_numbers.size]\n end\n end", "def process(code, context)\n compiler = Verneuil::Compiler.new\n program = compiler.compile(code)\n # p program\n Verneuil::Process.new(program, context)\nend", "def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end", "def context(name, &blk)\n if Shoulda.current_context\n Shoulda.current_context.context(name, &blk)\n else\n context = Shoulda::Context.new(name, self, &blk)\n context.build\n end\n end", "def deep_copy\n rule = map {|r| r.deep_copy } \n Rule.new( rule, @recursivity, @sn_altering, @min_depth )\n end", "def rewrite_template\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 40)\n return_value = RewriteTemplateReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n str = nil\n char_literal177 = nil\n __ACTION180__ = nil\n id175 = nil\n rewrite_template_args176 = nil\n rewrite_template_ref178 = nil\n rewrite_indirect_template_head179 = nil\n\n tree_for_lp = nil\n tree_for_str = nil\n tree_for_char_literal177 = nil\n tree_for_ACTION180 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_DOUBLE_QUOTE_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOUBLE_QUOTE_STRING_LITERAL\")\n stream_DOUBLE_ANGLE_STRING_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token DOUBLE_ANGLE_STRING_LITERAL\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n stream_rewrite_template_args = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_template_args\")\n begin\n # at line 423:2: ( id lp= '(' rewrite_template_args ')' (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str) | rewrite_template_ref | rewrite_indirect_template_head | ACTION )\n alt_81 = 4\n alt_81 = @dfa81.predict(@input)\n case alt_81\n when 1\n # at line 424:3: id lp= '(' rewrite_template_args ')' (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL )\n @state.following.push(TOKENS_FOLLOWING_id_IN_rewrite_template_2910)\n id175 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id175.tree)\n end\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_template_2914) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n @state.following.push(TOKENS_FOLLOWING_rewrite_template_args_IN_rewrite_template_2916)\n rewrite_template_args176 = rewrite_template_args\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_template_args.add(rewrite_template_args176.tree)\n end\n char_literal177 = match(T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_template_2918) \n if @state.backtracking == 0\n stream_T__83.add(char_literal177)\n end\n # at line 425:3: (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL )\n alt_80 = 2\n look_80_0 = @input.peek(1)\n\n if (look_80_0 == DOUBLE_QUOTE_STRING_LITERAL) \n alt_80 = 1\n elsif (look_80_0 == DOUBLE_ANGLE_STRING_LITERAL) \n alt_80 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 80, 0)\n raise nvae\n end\n case alt_80\n when 1\n # at line 425:5: str= DOUBLE_QUOTE_STRING_LITERAL\n str = match(DOUBLE_QUOTE_STRING_LITERAL, TOKENS_FOLLOWING_DOUBLE_QUOTE_STRING_LITERAL_IN_rewrite_template_2926) \n if @state.backtracking == 0\n stream_DOUBLE_QUOTE_STRING_LITERAL.add(str)\n end\n\n when 2\n # at line 425:39: str= DOUBLE_ANGLE_STRING_LITERAL\n str = match(DOUBLE_ANGLE_STRING_LITERAL, TOKENS_FOLLOWING_DOUBLE_ANGLE_STRING_LITERAL_IN_rewrite_template_2932) \n if @state.backtracking == 0\n stream_DOUBLE_ANGLE_STRING_LITERAL.add(str)\n end\n\n end\n # AST Rewrite\n # elements: str, rewrite_template_args, id\n # token labels: str\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_str = token_stream(\"token str\", str)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 426:3: -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str)\n # at line 426:6: ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] id rewrite_template_args $str)\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(TEMPLATE, lp, \"TEMPLATE\"), root_1)\n\n @adaptor.add_child(root_1, stream_id.next_tree)\n @adaptor.add_child(root_1, stream_rewrite_template_args.next_tree)\n @adaptor.add_child(root_1, stream_str.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 429:3: rewrite_template_ref\n @state.following.push(TOKENS_FOLLOWING_rewrite_template_ref_IN_rewrite_template_2959)\n rewrite_template_ref178 = rewrite_template_ref\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_template_ref178.tree)\n end\n\n when 3\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 432:3: rewrite_indirect_template_head\n @state.following.push(TOKENS_FOLLOWING_rewrite_indirect_template_head_IN_rewrite_template_2968)\n rewrite_indirect_template_head179 = rewrite_indirect_template_head\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_indirect_template_head179.tree)\n end\n\n when 4\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 435:3: ACTION\n __ACTION180__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_template_2977)\n if @state.backtracking == 0\n\n tree_for_ACTION180 = @adaptor.create_with_payload!(__ACTION180__)\n @adaptor.add_child(root_0, tree_for_ACTION180)\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 40)\n\n end\n \n return return_value\n end", "def context\n @context ||= ExecJS.compile(source)\n end" ]
[ "0.53235525", "0.49982622", "0.4997215", "0.49315456", "0.4844116", "0.47769764", "0.4776448", "0.47400293", "0.47253358", "0.47084287", "0.4697357", "0.46773002", "0.4675468", "0.4636125", "0.46015665", "0.45941997", "0.4583196", "0.454651", "0.454651", "0.45278874", "0.44864607", "0.44666776", "0.4454422", "0.44508514", "0.4436521", "0.4435621", "0.4409612", "0.43968433", "0.43934", "0.43716353", "0.43647492", "0.43627566", "0.43562496", "0.43537804", "0.4352117", "0.4347512", "0.43443167", "0.43415293", "0.43415293", "0.43247724", "0.4317231", "0.43112275", "0.43074855", "0.43063143", "0.43041438", "0.42986554", "0.42884377", "0.42867047", "0.42800856", "0.42791182", "0.4270629", "0.42610288", "0.42602256", "0.42584345", "0.42571846", "0.4247321", "0.42410994", "0.42173153", "0.421022", "0.42027903", "0.41967756", "0.41963258", "0.41943374", "0.41931924", "0.41757345", "0.41753963", "0.4173285", "0.41732204", "0.41662413", "0.41638047", "0.41513184", "0.4148811", "0.4147657", "0.41395092", "0.4139266", "0.4136288", "0.41313156", "0.4127449", "0.41247728", "0.41187567", "0.411162", "0.4109138", "0.41081905", "0.4095621", "0.4094019", "0.40934417", "0.4091969", "0.40875098", "0.40829524", "0.4082552", "0.40758514", "0.40721902", "0.40656358", "0.40652373", "0.40650192", "0.4061705", "0.4053178", "0.40499932", "0.40478122", "0.40461245", "0.4043752" ]
0.0
-1
token considered a multimatch if contains wildcard
def is_multimatch(s) return s.match(/[*?]/) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_token(token)\n return true\n end", "def scan_for_and(token); end", "def complex_token_matches?(token) # :nodoc:\n Matchers.matchers.any? {|matcher| matcher.matches?(token) }\n end", "def match(keyword); end", "def scan_for_in(token); end", "def scan strOrRegexp\n @in.scan /\\s*/ # Skip whitespace\n @match = @in.scan strOrRegexp\n @last_matched_token = @match if @match # Update last matched only if a token was matched\n end", "def match(tokens, definitions); end", "def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end", "def match(pattern); end", "def scan_for_all(token); end", "def scan_for_all(token); end", "def scan_for_all(token); end", "def scan_for_t(token); end", "def any_wildcard?\n split.any? do |element|\n wildcard? element\n end\n end", "def on_match_pattern(node); end", "def match(*token_types)\n token_types.each do |token_type|\n if check?(token_type)\n advance\n return true\n end\n end\n false\n end", "def nonstrict_match(tokens)\n matchset = MatchSet.new()\n index = 0;\n tokens.each do |token|\n break unless pattern[index]\n tagger_name = pattern[index].to_s\n klass = constantize(tagger_name)\n match = token.has_tag?(klass) \n if match\n matchset << token.get_tag(klass);\n index += 1; \n next; \n else\n next\n end\n end\n\n return false if matchset.size != pattern.size\n return matchset\n end", "def pre_match() end", "def match(input); end", "def submatcher; end", "def submatcher; end", "def match?(text)\n token_pattern.match(text)\n end", "def match_token (exp, token)\n\tputs \"Leaf token received: #{token.value}\"\n\tputs \"\\tExpecting token of type: #{exp}\"\n\n\tif exp == token.type\n\t\tputs \"\\t\\tShiny. Got #{token.type}!\"\n\t\t$cst.add_leaf(token.value, token)\n\t\t\n\t\t# To try to make this auto-managed\n\t\t$index = $index + 1\n\t\t\n\telse\n\t\traise FaultyTokenError.new(exp, token)\n\tend\nend", "def token_pattern\n /\\A#{pattern}\\z/\n end", "def match?(name, literal) true end", "def match token, stream: @stream\n matched = match_specification stream, grammar[token], token\n matched\n end", "def wildcard\n t = string(/(?=[^ ]*\\*)[^ \\)~-][^ ]*/, skip_balanced_parens: true)\n error(\"Invalid tag name: #{t}\") if t.match?(/\\A#{metatag_regex}/)\n space\n AST.wildcard(t)\n end", "def match(regexp); end", "def scan_for_w(token); end", "def match; end", "def match; end", "def match=(_); end", "def match?(*token_types)\n token_types.each do |type|\n if check?(type)\n advance\n return true\n end\n end\n\n return false\n end", "def match?(pattern)\n do_scan pattern, false, false, true\n end", "def scan_for_on(token); end", "def match(token_class)\n if (m = token_class.regexp.match(@input))\n @next_token = token_class.new(m[1])\n @input = @input[m.end(0)..-1]\n return true\n else\n return false\n end\n end", "def on_match_pattern_p(node); end", "def match_tokens\n (1..@buffer.length).each{|n|\n @tokens.each{|k,vs|\n vs.each{|v| # Each value of each token\n # If match\n #puts \"#{@buffer[0..n]} -- #{v}\"\n if @buffer[0..n] == v then\n t = Token.new(k, v, \"#{@line-@buffer.count(\"\\n\")}.#{@pos-@buffer.length}\", nil) # Construct token, compensate for readahead\n @buffer = @buffer[n-1..-1] # Cut from left of buffer\n return t # return token\n end\n }\n }\n }\n return nil\n end", "def matchingCandidates(token)\n candidates(@currentNode, token)\n end", "def matching_the_word_and\n /WRITE ME/\n end", "def scan_for_at(token); end", "def scan_for_quote(token); end", "def match(tokens, definitions)\n token_index = 0\n @pattern.each do |elements|\n was_optional = false\n elements = [elements] unless elements.is_a?(Array)\n\n elements.each_index do |i|\n name = elements[i].to_s\n optional = name[-1, 1] == '?'\n name = name.chop if optional\n\n case elements[i]\n when Symbol\n if tags_match?(name, tokens, token_index)\n token_index += 1\n break\n else\n if optional\n was_optional = true\n next\n elsif i + 1 < elements.count\n next\n else\n return false unless was_optional\n end\n end\n\n when String\n return true if optional && token_index == tokens.size\n\n if definitions.key?(name.to_sym)\n sub_handlers = definitions[name.to_sym]\n else\n raise \"Invalid subset #{name} specified\"\n end\n\n sub_handlers.each do |sub_handler|\n return true if sub_handler.match(tokens[token_index..tokens.size], definitions)\n end\n else\n raise \"Invalid match type: #{elements[i].class}\"\n end\n end\n\n end\n\n return false if token_index != tokens.size\n return true\n end", "def match(p0) end", "def match(p0) end", "def scan_for_slash(token); end", "def matches?(pattern); end", "def matching_exactly_one_word\n /WRITE ME/\n end", "def match(*list)\n @match.concat(makelist(list)) unless list.empty?\n @match\n end", "def scan_for_plus(token); end", "def scan_for_commas(token); end", "def match?(etag)\n\t\t\t\t\twildcard? || self.include?(etag)\n\t\t\t\tend", "def reduce_anything(_production, _range, _tokens, _children)\n wildcard\n end", "def term_multiple?( term )\n #puts \"=====> GenericWork.term_multiple? #{term}\"\n return true if [:keyword, :title, :contributor, :subject, :related_url, :sponsoring_agency, :admin_notes].include? term\n false\n end", "def wildcard_match?(arguments, keyword_arguments)\n definition.wildcard_match?(arguments, keyword_arguments)\n end", "def test_match_regexp\n pattern = /Hello,*/\n value = \"Hello, World\"\n check = Maze::Checks::AssertCheck.new\n check.match pattern, value\n end", "def match(input)\n input \n end", "def submatchers; end", "def match(*template)\r\n return parse(template, MATCH_FAILACTION)\r\n end", "def scan_for_dots(token); end", "def super_match(*args)\n return unless match = match(args.first) \n returning match do |m|\n args[1..-1].each_with_index { |name, index| m.meta_def(name) { self[index+1] } }\n end\n end", "def match?(pattern)\n _scan_headonly(pattern, false, false)\n end", "def matches(tokenstream, *types)\n raise ArgumentError, \"No match types given\" if types.empty?\n raise ArgumentError, \"Only applicable to tokenstreams containing a label\" if tokenstream.label_index.nil?\n match = nil\n apply_to(tokenstream) {|md| match=md.type if md.type;}\n match = :fail if match.nil?\n if types.include? match\n return true\n else\n return false\n end\n end", "def allow_matcher; end", "def stop_if_match; true; end", "def match(input)\n regexp.match(input)\n end", "def matches(_ext); end", "def matches(_ext); end", "def match()\n end", "def match?(name); end", "def matcher; end", "def matcher; end", "def pre_match\n end", "def find_token\n shift_token || find_regex_token || find_string_token\n end", "def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end", "def keyword_match?(input)\n keywords.any? do |keyword_exp|\n parsed = keyword_exp.match(/\\A(?<op>[=^~])?(?<keyword>.*)\\z/)\n\n method = case parsed[:op]\n when \"=\" then :==\n when \"^\" then :start_with?\n when \"~\" then :end_with?\n else :include?\n end\n\n input.downcase.strip.send(method, parsed[:keyword].downcase)\n end\n end", "def is_token? m\n return false if m == nil\n m = m.to_s\n (m =~ /^([a-zA-Z0-9\\-\\.\\_\\~]|\\%[0-9a-fA-F]{2}|[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=\\@])+$/) != nil\n end", "def is_token? m\n return false if m == nil\n m = m.to_s\n (m =~ /^([a-zA-Z0-9\\-\\.\\_\\~]|\\%[0-9a-fA-F]{2}|[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=\\@])+$/) != nil\n end", "def =~ (re)\n re.match(just_cards)\n end", "def split_on_token(*args)\n body, tokens = _extract_token_search_args(args)\n token = find_token(body, *tokens)\n return _split_body_with_raw_token(body, token)\n end", "def scan_for_space(token); end", "def maybe_matcher *pattern\n submatcher = pattern_matcher(*pattern)\n\n lambda do |string, index = 0, counts:|\n found = submatcher.call(string, index, counts: counts)\n\n if match? found\n found\n else\n []\n end\n end\n end", "def matches\n parse\n end", "def multi_line_match(multi_lines)\n (multi_lines.size - 2).downto(0) do |index_start|\n concat_line = multi_lines[index_start .. -1].join(JOINT_FOR_MULTI_LINES)\n return multi_lines[index_start .. -1].join(\"\\n\") if @re =~ concat_line\n end\n\n return nil\n end", "def mult\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n return_value = MultReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal268 = nil\n __SLASH269__ = nil\n __MOD270__ = nil\n unary267 = nil\n unary271 = nil\n\n tree_for_char_literal268 = nil\n tree_for_SLASH269 = nil\n tree_for_MOD270 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 630:5: unary ( ( '*' | SLASH | MOD ) unary )*\n @state.following.push( TOKENS_FOLLOWING_unary_IN_mult_4179 )\n unary267 = unary\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, unary267.tree )\n end\n # at line 630:11: ( ( '*' | SLASH | MOD ) unary )*\n while true # decision 66\n alt_66 = 2\n look_66_0 = @input.peek( 1 )\n\n if ( look_66_0 == SLASH || look_66_0 == STAR || look_66_0 == MOD )\n alt_66 = 1\n\n end\n case alt_66\n when 1\n # at line 630:14: ( '*' | SLASH | MOD ) unary\n # at line 630:14: ( '*' | SLASH | MOD )\n alt_65 = 3\n case look_65 = @input.peek( 1 )\n when STAR then alt_65 = 1\n when SLASH then alt_65 = 2\n when MOD then alt_65 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 65, 0 )\n end\n case alt_65\n when 1\n # at line 630:16: '*'\n char_literal268 = match( STAR, TOKENS_FOLLOWING_STAR_IN_mult_4186 )\n if @state.backtracking == 0\n\n tree_for_char_literal268 = @adaptor.create_with_payload( char_literal268 )\n root_0 = @adaptor.become_root( tree_for_char_literal268, root_0 )\n\n end\n\n when 2\n # at line 630:23: SLASH\n __SLASH269__ = match( SLASH, TOKENS_FOLLOWING_SLASH_IN_mult_4191 )\n if @state.backtracking == 0\n\n tree_for_SLASH269 = @adaptor.create_with_payload( __SLASH269__ )\n root_0 = @adaptor.become_root( tree_for_SLASH269, root_0 )\n\n end\n\n when 3\n # at line 630:32: MOD\n __MOD270__ = match( MOD, TOKENS_FOLLOWING_MOD_IN_mult_4196 )\n if @state.backtracking == 0\n\n tree_for_MOD270 = @adaptor.create_with_payload( __MOD270__ )\n root_0 = @adaptor.become_root( tree_for_MOD270, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_mult_4202 )\n unary271 = unary\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, unary271.tree )\n end\n\n else\n break # out of loop for decision 66\n end\n end # loop for decision 66\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n end\n \n return return_value\n end", "def handle_token(token, &block) # :yields: SQLTree::Token\n if token.kind_of?(SQLTree::Token::Keyword)\n keyword_queue.push(token)\n else\n empty_keyword_queue!(&block)\n block.call(token)\n end\n end", "def match\n true\n end", "def _is_in(token, list)\n return false unless list\n list.include?(token[1])\n end", "def resolve(subject, token, continued: false)\r\n available = context_from(subject)\r\n return Matches.new([], '', token) if available.empty?\r\n if continued\r\n return Matches.execute(available, token, continued: continued)\r\n elsif nested?(token)\r\n drill = denest(available, token)\r\n drill.keep_if{ |e| accept?(e) }\r\n return Matches.new(drill, token, '') unless drill.length != 1\r\n return Matches.new([], '', token)\r\n end\r\n result = available.select{ |e| e.match?(token) }\r\n result = available.select{ |e| e.match?(token, fuzzy: true) } if result.empty?\r\n result.keep_if{ |e| accept? e }\r\n Matches.new(result, (result.empty? ? '' : token), (result.empty? ? token : ''))\r\n end", "def scan_for_colon(token); end", "def textmatch(text, terms)\n terms.all? { |term| text =~ /#{term}/i }\nend", "def scan(pattern); end", "def emit? line\n MATCHER.match line\n end", "def match(tt)\n \ttt = \"#{tt}\"\n tt = tt.to_s.split(',')\n out = Cites.match(tt)\n puts out\n end", "def contains_product?(line) \n line.include?(TOKEN)\n end", "def is?(test_token, test_type = nil)\n return true if test_token === :*\n token == test_token and (test_type ? type?(test_type) : true)\n end", "def match_hash scanner, inspec, token=nil, context={}\n if token.is_a?(Hash)\n token, context = nil, token\n end\n spec = inspec.clone\n # Check for an array to match\n if flag = [ :checklist, # All elements must be matched, but the order is unimportant\n :repeating, # The spec will be matched repeatedly until the end of input\n :or, # The list is taken as an ordered set of alternatives, any of which will match the list\n :orlist, # The item will be repeatedly matched in the form of\n :parenthetical, # Match inside parentheses\n :optional # Failure to match is not a failure\n ].find { |flag| spec.key?(flag) && spec[flag] != true }\n to_match, spec[flag] = spec[flag], true\n elsif to_match = spec[:tag] || spec[:tags] # Special processing for :tag specifier\n # TagSeeker parses a single tag\n # TagsSeeker parses a list of the form \"tag1, tag2 and tag3\" into a set of tags\n klass = spec[:tag] ? TagSeeker : TagsSeeker\n # Important: the :repeating option will have been applied at a higher level\n return klass.match(scanner, lexaur: lexaur, token: token, types: to_match) ||\n Seeker.failed(scanner, token, spec)\n elsif to_match = spec[:regexp]\n to_match = Regexp.new to_match\n else\n to_match = spec.delete :match\n end\n to_match = spec.delete :match if to_match == true # If any of the above appeared as flags, get match from the :match value\n # We've extracted the specification to be matched into 'to_match', and use what's left as context for matching\n match = match_specification scanner, to_match, token, spec\n return match if match.success?\n token ||= match.token\n # If not successful, reconcile the spec that was just answered with the provided context\n if (really_enclose = context[:enclose]) == :non_empty\n really_enclose = match.children&.all?(:hard_fail?)\n end\n really_enclose ||= match.enclose? && (match.tail_stream != match.head_stream)\n return Seeker.failed(match.head_stream,\n match.tail_stream,\n token,\n enclose: (really_enclose ? true : false),\n optional: ((context[:optional] || match.soft_fail?) ? true : false))\n end", "def key_matcher(pattern, options); end", "def glob!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = GLOB\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 42:5: ( '?' | '*' )+\n # at file 42:5: ( '?' | '*' )+\n match_count_12 = 0\n while true\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == 0x2a || look_12_0 == 0x3f )\n alt_12 = 1\n\n end\n case alt_12\n when 1\n # at line \n if @input.peek(1) == 0x2a || @input.peek(1) == 0x3f\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_12 > 0 and break\n eee = EarlyExit(12)\n\n\n raise eee\n end\n match_count_12 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end", "def wildcard?\n @wildcard\n end" ]
[ "0.68923086", "0.64468676", "0.64329445", "0.63277537", "0.6297915", "0.6271185", "0.6249036", "0.61375755", "0.6063721", "0.6050664", "0.6050664", "0.6050664", "0.6042717", "0.6012632", "0.5965908", "0.59550667", "0.5942342", "0.59106565", "0.5900349", "0.58793414", "0.58793414", "0.58746094", "0.58637923", "0.58394", "0.58232284", "0.582301", "0.5753147", "0.5714671", "0.5686829", "0.5660929", "0.5660929", "0.564124", "0.5640004", "0.5627147", "0.5607757", "0.5605354", "0.560418", "0.552291", "0.55125326", "0.55107224", "0.5509107", "0.54942286", "0.5487408", "0.54851043", "0.54851043", "0.54791266", "0.545617", "0.5448328", "0.54473686", "0.54341805", "0.54239535", "0.5389153", "0.53847027", "0.5383136", "0.5383126", "0.53823113", "0.5375009", "0.53250736", "0.53213495", "0.5316974", "0.5304295", "0.52978575", "0.5286069", "0.52857286", "0.52790475", "0.5278396", "0.5273626", "0.5273626", "0.52625257", "0.526202", "0.5256167", "0.5256167", "0.52472144", "0.52311873", "0.5225443", "0.5220213", "0.5217673", "0.5217673", "0.5202484", "0.5197425", "0.5188872", "0.5186611", "0.5184905", "0.51815313", "0.51814705", "0.51770425", "0.5168253", "0.51646745", "0.51605856", "0.51599973", "0.51472116", "0.5139791", "0.5133862", "0.5132051", "0.51276755", "0.51271504", "0.5113765", "0.5105851", "0.5103744", "0.5102814" ]
0.65559316
1
return next def to complete (don't go further than last)
def next() idx = @curridx idx += 1 unless full? return @defs[idx] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next() end", "def next() end", "def next!() end", "def has_next?; end", "def next()\n \n end", "def next()\n \n end", "def next_result()\n #This is a stub, used for indexing\n end", "def get_next\n\t\t\n\tend", "def get_next_entry; end", "def next_f\n raise \"implement in subclass\"\n end", "def next\n end", "def next\n end", "def has_next()\n \n end", "def has_next()\n \n end", "def intend_next\n intend_with :first, :next\n end", "def intend_next\n intend_with :first, :next\n end", "def next\n after.first\n end", "def next\r\n next_values[0]\r\n end", "def next?\n not_finished?\n end", "def get_next()\n\t\t\treturn @next\n\t\tend", "def next\n @next && @next.value\n end", "def next\n @next||=after.first\n end", "def next\n\t\tend", "def next\n raise NotImplementedError\n end", "def next\n raise NotImplementedError\n end", "def next?()\n !end?\n end", "def next\n @next\n end", "def next\n @proc.call(@value)\n ensure\n @value = @value.next\n end", "def next\n\t\t# Use up all of the extras\n\t\treturn @extras.pop if !@extras.empty?\n\t\t# Then track the last freeid used (which should always be the max)\n\t\treturn (@last+=1)-1\n\tend", "def next\n catch :done do\n while !(info = progress)\n # do nothing - waiting for token\n end\n return info # got token\n end\n return nil # got end of sequence\n end", "def next\n head = If.new(left, HeadCallable.new(left), ReturnNull.new)\n .result\n .call\n @left = If.new(left, TailCallable.new(left), ReturnNull.new)\n .result\n .call\n head\n end", "def next(pointer); end", "def next(pointer); end", "def next\n @idx += 1\n if @seq[@idx].nil? then\n \tbegin\n \t\tfirst = 0\n \t\tlast = 1\n \t\tfor i in 0..(@idx-2)\n \t\t\tf = first + last\n \t\t\tfirst = last\n \t\t\tlast = f\n \t\tend\n \tend\n @seq[@idx] = f\n return f\n else\n return @seq[@idx]\n end\n end", "def next_element; end", "def has_next\n\t\tend", "def next\n if !block_given?\n return @j_del.java_method(:next, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling next()\"\n end", "def next\n last? ? nil : locate + 1\n end", "def next\n (successors.length == 1) ? successors.first : nil\n end", "def next_l\n raise \"implement in subclass\"\n end", "def crawlNext(&blk)\r\n if @toCrawl.empty?\r\n return false\r\n end\r\n crawlThis=@toCrawl.pop()\r\n crawlOne(crawlThis,&blk)\r\n return true\r\n end", "def next_token; end", "def next\n if self.last?\n first_in_section\n else lower_item\n end\n end", "def next\n raise NotImplemetedError\n end", "def complete?; end", "def first() end", "def first?; end", "def next\n @stmt.step\n end", "def call\n advance until done?\n end", "def next!\n rotate!.first\n end", "def do_until(&blk)\n s = self.ensure_enum\n Enumerator.new do |out|\n until s.empty?\n break if blk.call(s.peek)\n out.yield s.next\n end\n end\n end", "def next_work\n name,fasta,qual,comments=@@fastq_file.next_seq\n\n if !name.nil?\n return name,fasta,qual,comments\n else\n return nil\n end\n\n end", "def next\n token = next_token\n token = next_token while token&.empty?\n token\n end", "def first; end", "def first; end", "def each # And define each on top of next\n loop {yield self.next }\n end", "def generate_next\n @block.call(@so_far)\n end", "def next\n next? ? @current + 1 : nil\n end", "def next\n if @lambdas.size > 0\n @lambdas.shift.call(lambda { self.next })\n else\n @running = false\n end\n end", "def has_next?\n !self.last?\n end", "def advance; end", "def advance; end", "def advance; end", "def next?\n !@continuation.nil?\n end", "def get_next_present\n if last_turn?\n @game.detect {|f| !f[:final] }\n else\n @game.detect {|f| !f[:finished] }\n end\n end", "def next\n self.offset(1)\n end", "def next\n last? ? nil : @collection[index + 1]\n end", "def full_next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] : 0)\n end", "def next\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) < master_files_sorted.length\n return master_files_sorted[master_files_sorted.find_index(self)+1]\n else\n return nil\n end\n end", "def succ() end", "def succ() end", "def succ() end", "def calc_next_run\n nil\n end", "def calc_next_run\n nil\n end", "def next_tasks\n\t\tincomplete_tasks.select{ |t| !t.blocked? }\n\tend", "def next_incomplete_step\n FORM_STEPS_TO_DB_ATTRS.each do |step, db_attr|\n return step unless self.send(\"completed_step_#{db_attr}\".to_sym)\n end\n\n return nil\n end", "def next\n block.instructions[index+1] || (block.next ? block.next.instructions.first : nil)\n end", "def each # And define each on top of next\n loop { yield self.next }\n end", "def select_next\n raise NotImplementedError.new \n end", "def next2(t) \n @start1 = t \n return @start1 \n end", "def next?\n raise NotImplementedError\n end", "def next?\n raise NotImplementedError\n end", "def next( insn )\n # TODO\n end", "def next\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) < master_files_sorted.length\n return master_files_sorted[master_files_sorted.find_index(self)+1]\n else\n return nil\n end\n end", "def each\n# And define each on top of next\nloop { yield self.next }\nend", "def each\n# And define each on top of next\nloop { yield self.next }\nend", "def next\n return callcc { |@ret| parse_doc } unless @parse_started\n # set up a return continuation which will be called when something\n # was parsed successfully\n return callcc { |@ret| @cc.call } if @cc\n nil\n end", "def add_next ret\n return if @next.nil?\n return if ret.include? @next\n ret << @next\n @next.reachable ret\n end", "def iterator?() end", "def succ(result); end", "def next\n\t\tself + 1\n\tend", "def next\n if @state == :start && @scanner.eos?\n return nil\n else\n scan_next_token\n end\n end", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def get_Next()\n \t return @outputs[\"Next\"]\n \tend", "def first\n each do |cb|\n return cb\n end\n end", "def first\n each do |cb|\n return cb\n end\n end" ]
[ "0.74768484", "0.74768484", "0.7379265", "0.70723504", "0.68927306", "0.68927306", "0.67546225", "0.66774076", "0.66750246", "0.66490746", "0.65657824", "0.65657824", "0.6539902", "0.6539902", "0.6524198", "0.6524198", "0.6492237", "0.6468065", "0.6451682", "0.64160174", "0.6310552", "0.6297478", "0.62913764", "0.62808913", "0.62808913", "0.62545097", "0.6234846", "0.61993825", "0.6192102", "0.6162493", "0.61432076", "0.6131998", "0.6131998", "0.60961634", "0.6066968", "0.60607535", "0.6041296", "0.603784", "0.6030836", "0.60206217", "0.60141975", "0.59793246", "0.59728503", "0.5947189", "0.5947143", "0.593957", "0.59266275", "0.5908685", "0.59026927", "0.58932775", "0.5880053", "0.58776367", "0.5871326", "0.58712095", "0.58712095", "0.58700943", "0.5868561", "0.5838763", "0.5834769", "0.5833447", "0.5805925", "0.5805925", "0.5805925", "0.580569", "0.5801879", "0.5800323", "0.5800257", "0.5787704", "0.5783608", "0.57794064", "0.57794064", "0.57794064", "0.57585114", "0.57585114", "0.57557636", "0.574931", "0.574726", "0.5746498", "0.57461727", "0.57443553", "0.5742166", "0.5742166", "0.5723511", "0.57217157", "0.5715471", "0.5715471", "0.5702126", "0.56759715", "0.5669518", "0.5659705", "0.56492317", "0.56445986", "0.56440085", "0.56440085", "0.56440085", "0.56440085", "0.56440085", "0.56440085", "0.56413186", "0.56413186" ]
0.6022716
39
Build a coll structure that matches conditions in a Hash
def make_coll_filters(values) coll = Xmms::Collection.universe unless values.empty? values.each do |field, val| matchop = make_coll_operator(field, val) matchop.operands << coll coll = matchop end end return coll end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def criteria_from_hash(condition) # :nodoc:\n h = {}\n condition.each { |k,v|\n h[k] = case v\n when Array\n {:$in => k == 'id' || k == '_id' ? v.collect{ |val| val.to_oid} : v} # if id, can't pass in string; must be ObjectId\n when Range\n {:$gte => v.first, :$lte => v.last}\n else\n v\n end\n }\n h\n end", "def build\n criteria_fields.inject({}) do |criteria_hash, field|\n value = field_value field \n set_criteria(criteria_hash, field, value) unless skip?(field, value)\n criteria_hash\n end\n end", "def gen_conditions\n\t conditions = {}\n\t\tsearch_fields = [:title, :genre, :year, :directors, :actors]\n\t\tsearch_fields.each do |sf|\n\t\t conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == \"\"\n\t\tend\n\t\t(conditions.empty?) ? nil : conditions\n\tend", "def gen_conditions\n\t conditions = {}\n\t\tsearch_fields = [:title, :genre, :year, :directors, :actors]\n\t\tsearch_fields.each do |sf|\n\t\t conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == \"\"\n\t\tend\n\t\t(conditions.empty?) ? nil : conditions\n\tend", "def conditions_hash\n params[\"conditions\"].grep(HashWithIndifferentAccess).reduce(:merge).merge(clr_hash)\n rescue\n Rails.logger.error(\"**** S3 policy generation error, invalid params ***\")\n return nil\n end", "def build_condition_clauses(conditions, aggregations)\n {}.tap do |clauses|\n aggregations.each do |agg|\n clauses.merge!(agg.to_query) if agg.selections?\n end\n conditions.each_pair do |name, condition|\n next if condition.name == :keywords\n merge_clause(clauses, condition.to_query) unless condition.blank?\n end\n end\n end", "def gen_conditions\n\t conditions = {}\n\t\tsearch_fields = [:title, :genre, :year, :id]\n\t\tsearch_fields.each do |sf|\n\t\t conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == \"\"\n\t\tend\n\t\t(conditions.empty?) ? nil : conditions\n\tend", "def conditions_from_constraints\n hash_conditions = {}\n conditions = [hash_conditions]\n active_scaffold_constraints.each do |k, v|\n column = active_scaffold_config.columns[k]\n if column\n # Assume this is a multi-level association constraint.\n # example:\n # data model: Park -> Den -> Bear\n # constraint: :den => {:park => 5}\n if params_hash? v\n far_association = column.association.klass.reflect_on_association(v.keys.first)\n field = far_association.klass.primary_key\n table = far_association.table_name\n\n active_scaffold_references.concat([{k => far_association.name}]) # e.g. {:den => :park}\n hash_conditions.deep_merge!(table => {field => v.values.first})\n\n # association column constraint\n elsif column.association\n join_from_association_constraint(column)\n hash_conditions.deep_merge!(condition_from_association_constraint(column.association, v))\n\n # regular column constraints\n elsif column.searchable? && params[column.name] != v\n active_scaffold_references.concat column.references if column.includes.present?\n conditions << [column.search_sql.collect { |search_sql| \"#{search_sql} = ?\" }.join(' OR '), *([v] * column.search_sql.size)]\n end\n # unknown-to-activescaffold-but-real-database-column constraint\n elsif active_scaffold_config._columns_hash[k.to_s] && params[column.name] != v\n hash_conditions.deep_merge!(k => v)\n else\n raise ActiveScaffold::MalformedConstraint, constraint_error(active_scaffold_config.model, k), caller\n end\n end\n conditions.reject(&:blank?)\n end", "def by_keys(conditions)\n if conditions.size > 1\n find_by_multiple_conditions(conditions) || []\n else\n find_by_one_condition(conditions.first) || []\n end\n end", "def qualified_candidates (collection)\n match=[]\n \n collection.each do |x|\n if years_of_experience(x[:years_of_experience]) && github_points(x[:github_points]) && knowledge(x[:languages]) && applied_time(x[:date_applied]) && old_enough(x[:age])\n match << (x)\n end\n end\n\n match\nend", "def makeConditions #:doc:\n @condition_string = \"\"\n @condition_values = Hash.new\n i = 0\n \n # if search is from spesific devices\n if @device_ids.size > 0\n @device_ids.uniq!\n firstdevid = true\n @device_ids.each do |id|\n if firstdevid\n @condition_string += \"(devices.id in (\"\n firstdevid = false\n else\n @condition_string += \", \"\n end\n @condition_string += \":cond#{i}\"\n @condition_values.merge!({\"cond#{i}\".intern => id})\n i += 1\n end\n @condition_string += \"))\"\n if not @conditions.empty? or @locationdata.size == 3\n @condition_string += \" AND \"\n end\n end\n \n # take each condition and combine them\n firstcond = true\n @conditions.each do |keyword, values|\n condition = \"(\"\n statement = @condition_rules[keyword]\n \n # combine values\n firstvalue = true\n values.each do |value|\n condition_part = statement.gsub(\"?\") do |s|\n new = \":cond#{i}\"\n # bind the value\n @condition_values.merge!({\"cond#{i}\".intern => value})\n \n # do some special processing if the keyword is type and there's 2 \"?\"'s in the statement\n if keyword == \"type\" and statement.count(\"?\") == 2\n value = value[0..-2].insert(1, \".\")\n end\n i += 1\n new\n end\n \n if not firstvalue\n condition += \" OR \"\n end\n condition += condition_part\n \n firstvalue = false\n end\n \n condition += \")\"\n \n # append condition_string with the condition\n if not firstcond\n @condition_string += \" AND \"\n end\n @condition_string += condition\n firstcond = false\n end\n \n # add distance-search to conditions\n if @locationdata.size == 3\n statement = \"(\" + @condition_rules[\"distance\"] + \")\"\n j = 0\n statement.gsub!(\"?\") do |s|\n j += 1\n new = \":cond#{i}\"\n # bind the value\n if j == 1\n @condition_values.merge!({\"cond#{i}\".intern => @locationdata[\"lat\"]})\n elsif j == 3\n @condition_values.merge!({\"cond#{i}\".intern => @locationdata[\"lon\"]})\n elsif j == 5\n @condition_values.merge!({\"cond#{i}\".intern => (@locationdata[\"distance\"].to_f / @@kms_per_degree) **2})\n else\n i += 1\n end\n new\n end\n \n if not @conditions.empty?\n @condition_string += \" AND \"\n end\n @condition_string += statement\n end\n end", "def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = params.dup\n\n query_params.reject! do |k, v|\n !model_fields.keys.include?(k.to_sym) &&\n !model_relationships.keys.include?(k.to_sym) &&\n !(k.to_sym == :search)\n end\n\n query_params.compact.each do |key, value|\n filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym] || key\n conditions << send(\"build_#{filter_type}_conditions\", key, value)\n end\n end\n end", "def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = params.dup\n\n query_params.reject! do |k, v|\n !model_fields.keys.include?(k.to_sym) &&\n !model_relationships.keys.include?(k.to_sym) &&\n !(k.to_sym == :search)\n end\n\n query_params.compact.each do |key, value|\n filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym] || key\n conditions << send(\"build_#{filter_type}_conditions\", key, value)\n end\n end\n end", "def build_predicates(structure)\n construct_condition(structure, true)\n end", "def parse_conditions(definition, query_key, query_value)\n if query_value.blank? || query_value.size < 1\n msg = \"filter hash must have at least 1 entry, got '#{query_value.size}'\"\n fail Clearly::Query::QueryArgumentError.new(msg, {hash: query_value})\n end\n\n logical_operators = Clearly::Query::Compose::Conditions::OPERATORS_LOGICAL\n mapped_fields = definition.field_mappings.keys\n standard_fields = definition.all_fields - mapped_fields\n conditions = []\n\n if logical_operators.include?(query_key)\n # first deal with logical operators\n condition = parse_logical_operator(definition, query_key, query_value)\n conditions.push(condition)\n\n elsif standard_fields.include?(query_key)\n # then cater for standard fields\n field_conditions = parse_standard_field(definition, query_key, query_value)\n conditions.push(*field_conditions)\n\n elsif OPERATOR_ALL_TEXT == query_key\n # build conditions for all text fields combined with or\n field_condition = parse_all_text_fields(definition, query_value)\n conditions.push(field_condition)\n\n elsif mapped_fields.include?(query_key)\n # then deal with mapped fields\n field_conditions = parse_mapped_field(definition, query_key, query_value)\n conditions.push(*field_conditions)\n\n elsif @table_names.any? { |tn| query_key.to_s.downcase.start_with?(tn) }\n # finally deal with fields from other tables\n field_conditions = parse_custom(definition, query_key, query_value)\n conditions.push(field_conditions)\n\n else\n fail Clearly::Query::QueryArgumentError.new(\"unrecognised operator or field '#{query_key}'\")\n end\n\n conditions\n end", "def build_has_many_conditions(key, value)\n [\"#{key}.id = ?\", value]\n end", "def build_has_many_conditions(key, value)\n [\"#{key}.id = ?\", value]\n end", "def create_conditions(conditions)\n\n conditions.map { |item| create_condition item }\n\n end", "def get_criteria\n parameters = params[:analysis] ? params[:analysis] : params\n criteria = { name: parameters[:name] }\n criteria[:collection] = parameters[:collection] if parameters[:collection].present?\n if parameters[:date_from].present?\n criteria[:attribute] = :date\n criteria[:value] = date_from..date_to\n return criteria\n end\n [:size, :color, :fabric].each do |attr|\n if parameters[attr].present?\n criteria[:attribute] = \"pieces.#{attr}\"\n criteria[:value] = parameters[attr]\n return criteria\n end\n end\n criteria\n end", "def initialize_wheres\n @@wheres = {}\n DEFAULT_WHERES.each do |where|\n add(*where)\n end\n end", "def build_hash_condition(column, value)\n case @condition_options[:hash_style]\n when \"equality\"\n # We want an equality condition. Directly use value.\n [{ column => value }]\n when \"range\"\n # We want a range condition. Wrap value in a range.\n [{ column => value..value }]\n when \"subset\"\n # We want a subset condition. Wrap value in an array.\n [{ column => [value] }]\n else\n raise \"Condition option hash style '#{@condition_options[:hash_style]}' not supported.\"\n end\n end", "def format_conditions_hash(attrs)\n # Store values in the order they are placed in the conditions array/string\n values = []\n\n parse_hash = Proc.new do |hash, klass|\n hash.map do |attr, value|\n if value.is_a?(Hash)\n parse_hash.call(value, (klass || self).reflect_on_association(attr.to_sym).klass)\n else\n values << value\n \"#{(klass || self).table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}\"\n end #if value.is_a?(Hash)\n end.flatten.join(' AND ')\n end #do |hash|\n\n conditions = parse_hash.call(attrs)\n \n return [conditions, *values]\n end", "def compiled_conditions(conditions = merged_conditions)\n conditions.inject({}) do |compiled,(k,v)|\n compiled.merge k => Regexp.new(v)\n end\n end", "def conditions_to_fields(conditions)\n conditions.inject({}) do |fields, (key, value)|\n if value.is_a?(Dynamoid::Document) && klass.attributes.keys.include?(\"#{key}_ids\".to_sym)\n fields.merge(\"#{key}_ids\".to_sym => Set[value.id])\n else\n fields.merge(key => value)\n end\n end\n end", "def search_field_conditions_as_hash\n [\n { :value => I18n.t(\"and\"), :key => \"and\"},\n { :value => I18n.t(\"or\"), :key => \"or\"},\n { :value => I18n.t(\"exclude\"), :key => \"exclude\"}\n ]\n end", "def get_filter_conditions(filters, applied_filters)\n return {} if applied_filters.empty?\n filter_conditions = {}\n applied_filters.each do |applied_filter_key, applied_filter_values|\n applied_filter_details = array_item_by_key_value(filters, :name, applied_filter_key)\n case applied_filter_details[:es_type]\n when 'keyword'\n filter_conditions[applied_filter_details[:name]] = { terms: { applied_filter_details[:options][:field] => applied_filter_values } }\n when 'bool'\n filter_conditions[applied_filter_details[:name]] = { term: { applied_filter_details[:options][:field] => applied_filter_values } }\n when 'integer'\n if applied_filter_details[:options][:field].is_a? Array\n filter_conditions[applied_filter_details[:options][:field][0]] = { range: { applied_filter_details[:options][:field][0] => { gte: applied_filter_values[0] } } }\n filter_conditions[applied_filter_details[:options][:field][1]] = { range: { applied_filter_details[:options][:field][1] => { lte: applied_filter_values[1] } } }\n else\n filter_conditions[applied_filter_details[:name]] = { range: { applied_filter_details[:name] => { gte: applied_filter_values[0], lte: applied_filter_values[1] } } }\n end\n when 'datetime'\n min = Time.parse(\"#{Time.parse(applied_filter_values[0]).strftime('%Y/%m/%d %H:%M:%S')} #{\"UTC\"}\").utc.strftime('%Y%m%dT%H%M%S%z')\n max = Time.parse(\"#{Time.parse(applied_filter_values[1]).strftime('%Y/%m/%d %H:%M:%S')} #{\"UTC\"}\").utc.strftime('%Y%m%dT%H%M%S%z')\n filter_conditions[applied_filter_details[:name]] = { range: { applied_filter_details[:name] => { gte: min, lte: max } } }\n end\n end\n filter_conditions\n end", "def expand_hash_conditions_for_aggregates(attrs) # :nodoc:\n conditions = super\n enums.each do |name, reflection|\n if conditions.key?(name)\n value = conditions.delete(name)\n elsif conditions.key?((string_name = name.to_s))\n value = conditions.delete(string_name)\n else\n next\n end\n if value.is_a?(Array)\n id = value.map { |el| reflection.id(el) }\n else\n id = reflection.id(value)\n end\n conditions[reflection.id_name] = id\n end\n conditions\n end", "def build_conditions(conditions)\n conditions = [\"1=1\"] if conditions.blank?\n unless self.claim_id.blank?\n conditions[0] += \" and id = ?\"\n conditions << self.claim_id\n end\n unless self.organisation_id.blank?\n conditions[0] += \" and organisation_id = ?\"\n conditions << self.organisation_id\n end\n unless self.date_service_start.blank?\n conditions[0] += \" and date_service >= ?\"\n conditions << self.date_service_start\n end\n unless self.date_service_end.blank?\n conditions[0] += \" and date_service <= ?\"\n conditions << self.date_service_end\n end\n unless self.invoice_date_start.blank?\n conditions[0] += \" and invoice_date >= ?\"\n conditions << self.invoice_date_start\n end\n unless self.invoice_date_end.blank?\n conditions[0] += \" and invoice_date <= ?\"\n conditions << self.invoice_date_end\n end\n unless self.programme_id.blank?\n conditions[0] += \" and programme_id = ?\"\n conditions << self.programme_id\n end\n unless self.fee_schedule_id.blank?\n conditions[0] += \" and fee_schedule_id = ?\"\n conditions << self.fee_schedule_id\n end\n unless self.claim_status_id.blank?\n conditions[0] += \" and claim_status_id = ?\"\n conditions << self.claim_status_id\n end\n unless self.invoice_no.blank?\n conditions[0] += \" and invoice_no = ?\"\n conditions << self.invoice_no\n end\n if self.zero_value == 1 \n conditions[0] += \" and amount = 0\"\n end\n conditions\n end", "def hash_to_condition(table, hash)\n conditions = hash.map do |attr, value|\n if value.is_a?(Array) && value.size > 1\n table[attr].in(value)\n elsif value.is_a?(Array)\n table[attr].eq(value[0])\n else\n table[attr].eq(value)\n end\n end\n\n conditions.reduce { |memo, cond| memo.and(cond) }\n end", "def create_query!(cond, keys, invert = false)\n keys.map { |key|\n values = cond.delete(key)\n values = values.is_a?(Array) ? values.uniq: [values]\n create_query_op(key, values, invert)\n }.inject(invert ? :| : :&)\n end", "def make_query data_set\n if data_set.has_key?(:new_old)\n query={:case_n => data_set[:case_n],:cd_type=>data_set[:cd_type], :new_old=>data_set[:new_old]}\n elsif data_set.has_key?(:tile)\n query={:case_n => data_set[:case_n],:cd_type=>data_set[:cd_type], :tile=>data_set[:tile]}\n else\n query={:case_n => data_set[:case_n],:cd_type=>data_set[:cd_type]}\n end\n query\nend", "def conditions\n object[:conditions].deep_transform_keys { |k| k.to_s.camelize(:lower) }\n end", "def create_query!(cond, keys, invert = false)\n keys.map { |key|\n values = cond.delete(key)\n values = [values] unless values.is_a?(Array)\n values.map { |value| create_query_op(key, value, invert) }.inject(&:|)\n }.inject(invert ? :| : :&)\n end", "def conditions\n @generated_conditions.collect { |_, cond| cond }\n end", "def build_conditions(params)\n\n conditions, joins = merge_conditions, []\n\n query_params = params.dup\n %w(action controller).each { |param| query_params.delete(param) }\n\n # Remove from params those with empty string.\n query_params.delete_if { |k, v| v.empty? }\n\n # If a search is performed.\n if query_params[:search]\n query = ActiveRecord::Base.connection.quote_string(query_params[:search].downcase)\n search = []\n typus_search_fields.each do |key, value|\n _query = case value\n when \"=\" then query\n when \"^\" then \"#{query}%\"\n when \"@\" then \"%#{query}%\"\n end\n search << \"#{key} LIKE '#{_query}'\"\n end\n conditions = merge_conditions(conditions, search.join(\" OR \"))\n end\n\n query_params.each do |key, value|\n\n filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym]\n\n case filter_type\n when :boolean\n condition = { key => (value == 'true') ? true : false }\n conditions = merge_conditions(conditions, condition)\n when :datetime\n interval = case value\n when 'today' then Time.new.midnight..Time.new.midnight.tomorrow\n when 'last_few_days' then 3.days.ago.midnight..Time.new.midnight.tomorrow\n when 'last_7_days' then 6.days.ago.midnight..Time.new.midnight.tomorrow\n when 'last_30_days' then Time.new.midnight.prev_month..Time.new.midnight.tomorrow\n end\n condition = [\"#{key} BETWEEN ? AND ?\", interval.first.to_s(:db), interval.last.to_s(:db)]\n conditions = merge_conditions(conditions, condition)\n when :date\n if value.is_a?(Hash)\n date_format = Date::DATE_FORMATS[typus_date_format(key)]\n\n begin\n unless value[\"from\"].blank?\n date_from = Date.strptime(value[\"from\"], date_format)\n conditions = merge_conditions(conditions, [\"#{key} >= ?\", date_from])\n end\n\n unless value[\"to\"].blank?\n date_to = Date.strptime(value[\"to\"], date_format)\n conditions = merge_conditions(conditions, [\"#{key} <= ?\", date_to])\n end\n rescue\n end\n else\n # TODO: Improve and test filters.\n interval = case value\n when 'today' then nil\n when 'last_few_days' then 3.days.ago.to_date..Date.tomorrow\n when 'last_7_days' then 6.days.ago.midnight..Date.tomorrow\n when 'last_30_days' then (Date.today << 1)..Date.tomorrow\n end\n if interval\n condition = [\"#{key} BETWEEN ? AND ?\", interval.first, interval.last]\n elsif value == 'today'\n condition = [\"#{key} = ?\", Date.today]\n end\n conditions = merge_conditions(conditions, condition)\n end\n when :integer, :string\n condition = { key => value }\n conditions = merge_conditions(conditions, condition)\n when :has_and_belongs_to_many\n condition = { key => { :id => value } }\n conditions = merge_conditions(conditions, condition)\n joins << key.to_sym\n end\n\n end\n\n return conditions, joins\n\n end", "def check_conditions\n\t\tclauses = Array.new\n\t\tparty_list.each do |uid, hash|\n\t\t\tcond = hash[:condition]\n\t\t\tif cond[:cond_type] != COND_NONE && cond[:cond_met] == COND_MET\n\t\t\t\tclauses.push({ operands: false, value: uid })\n\t\t\telsif cond[:cond_type] == COND_NUM_ATTENDING\n\t\t\t\tclauses.push({ operands: cond[:num_users], value: uid })\n\n\t\t\telsif cond[:cond_type] == COND_USER_ATTENDING_ANY\n\n\t\t\t\toper = Array.new\n\t\t\t\tcond[:id_list].each { |id| oper.push(id)}\n\t\t\t\t#cond[:user_list].each { |key, value| oper.push(value[:uid]) }\n\t\t\t\tclauses.push({ operands: oper, value: uid })\n\n\t\t\telsif cond[:cond_type] == COND_USER_ATTENDING_ALL\n\t\t\t\t#cond[:user_list].each do |count, table|\n\t\t\t\tcond[:id_list].each do |id|\n\t\t\t\t\tclauses.push({ operands: [id], value: uid})\n\t\t\t\t\t#clauses.push({ operands: [table[:uid]], value: uid })\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif hash[:status] == STATUS_ATTENDING\n\t\t\t\t\tclauses.push({ operands: false, value: uid})\n\t\t\t\telse\n\t\t\t\t\tclauses.push({ operands: true, value: uid})\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tresult = Event.compute_horn_formula(clauses)\n\n\t\tresult.each do |uid, value|\n\t\t\tif party_list[uid][:condition][:cond_met] == COND_NOT_MET && party_list[uid][:condition][:cond_type] != COND_NONE\n\t\t\t\tcomplete_condition(uid, Condition.create_from_hash(party_list[uid][:condition])) if !value\n\t\t\tend\n\t\tend\n\n\tend", "def conditions(conditions={})\n @options[:conditions].merge!(conditions) if conditions.kind_of?(Hash)\n end", "def conditions_for_collection\n if params[:id]\n ['(projects.user_id = (?) OR EXISTS (SELECT 1 FROM security_settings where security_settings.project_id = projects.id AND ' + \n 'security_settings.user_id = ? AND security_settings.level > 0))', current_user.id, current_user.id]\n else\n ['(projects.user_id = (?) OR EXISTS (SELECT 1 FROM security_settings where security_settings.project_id = projects.id AND ' + \n 'security_settings.user_id = ? AND security_settings.level > 0)) AND (projects.id = ?)', current_user.id, current_user.id, current_project_id]\n end\n end", "def build_criteria(more=[], less=[], local={})\n # TODO: This build_criteria treats \"more\" differently than the\n # ObjectBase one. Sort it out! (This way is better)\n names = [:region, :zone, :environment, :role].compact\n names -= [*less].flatten.uniq.compact\n values = names.collect do |n|\n local[n.to_sym] || @@global.send(n.to_sym)\n end\n names.zip(values) + more\n end", "def make_conditions(params, model)\n search_string = params[SEARCH_KEY]\n filter_string = params[FILTER_KEY]\n if search_string && filter_string\n error 400, convert(body_for(:invalid_params, [FILTER_KEY]))\n elsif search_string\n words = search_string.downcase.split(\" \")\n { :_keywords => { '$all' => words } }\n elsif filter_string\n begin\n unsafe = QS_FILTER.parse(filter_string)\n sanitize(unsafe, model)\n rescue QueryStringFilter::ParseError\n error 400, convert(body_for(:invalid_filter, filter_string))\n end\n else\n {}\n end\n end", "def build_collection(c_hsh)\n title = c_hsh['title']\n desc = c_hsh['desc']\n col = Collection.new(title: title, description: desc, creator: Array(user_key))\n col.apply_depositor_metadata(user_key)\n\n # Build all the works in the collection\n works_info = Array(c_hsh['works'])\n c_works = works_info.map{|w| build_work(w)}\n\n # Add each work to the collection\n c_works.each{|cw| col.members << cw}\n\n col.save!\n end", "def add_criteria\n crit = []\n yield crit\n @match_criteria ||= []\n @match_criteria += crit\n end", "def [](*args)\n filtered = @conditions\n args.each do |filter|\n type = valid_operator?(filter) ? nil : :key\n filtered = filter_conditions(filtered) do |op, key, value|\n (match, type) = match_triple(filter, type, op, key, value)\n match\n end\n end\n self.class.new(filtered)\n end", "def conditions(queue)\n conditions = Hash.new\n\n if queue.class_names.any? or queue.exclude_classes.any?\n conditions[:record_class_name] = Hash.new\n conditions[:record_class_name]['$in'] = queue.class_names if queue.class_names.any?\n conditions[:record_class_name]['$nin'] = queue.exclude_classes if queue.exclude_classes.any?\n end\n\n conditions\n end", "def conditions\n return @conditions if @conditions\n return if objects.blank?\n \n conditions_hash = {}\n objects.each do |object|\n if object.class < Searchgasm::Conditions::Base\n relationship_conditions = object.conditions\n next if relationship_conditions.blank?\n conditions_hash[object.relationship_name.to_sym] = relationship_conditions\n else\n next unless object.explicitly_set_value?\n conditions_hash[object.name.to_sym] = object.value\n end\n end\n conditions_hash\n end", "def conditions(model, hash)\n validate_model(model)\n validate_hash(hash)\n\n definition = select_definition_from_model(model)\n cleaned_query_hash = Clearly::Query::Cleaner.new.do(hash)\n\n # default combiner is :and\n parse_conditions(definition, :and, cleaned_query_hash)\n end", "def conditions_for(fields=[])\n predicate = []\n values = []\n fields.each do |field|\n predicate << \"lower(#{field.to_s}) like ?\"\n values << \"'%' + @search_key.downcase + '%'\"\n end\n eval(\"[\\\"#{predicate.join(' OR ')}\\\", #{values.join(',')}]\")\n end", "def filter(filter)\n results = Config::ObjectList.new\n filter.each do |field, match_value|\n field = field.is_a?(Symbol) ? field.to_s : field\n match_value = match_value.is_a?(Symbol) ? match_value.to_s : match_value\n if match_value.is_a?(String) && match_value =~ /^!/\n operator = :not_equal\n match_value = match_value.sub(/^!/, '')\n else\n operator = :equal\n end\n each do |name, config|\n value = config[field]\n if value.is_a? Array\n if operator == :equal && value.include?(match_value)\n results[name] = config\n elsif operator == :not_equal && !value.include?(match_value)\n results[name] = config\n end\n else\n if operator == :equal && value == match_value\n results[name] = config\n elsif operator == :not_equal && value != match_value\n results[name] = config\n end\n end\n end\n end\n results\n end", "def conditions\n @conditions ||= []\n end", "def conditions_from_params\n @conditions_from_params ||= begin\n conditions = [{}]\n params.except(:controller, :action, :page, :sort, :sort_direction, :format, :id).each do |key, value|\n distinct = true if key.match?(/!$/)\n column = active_scaffold_config._columns_hash[key.to_s[0..(distinct ? -2 : -1)]]\n next unless column\n key = column.name.to_sym\n not_string = %i[string text].exclude?(column.type)\n next if active_scaffold_constraints[key]\n next if nested? && nested.param_name == key\n\n range = %i[date datetime integer decimal float bigint].include?(column.type) && value.is_a?(String) && value.scan('..').size == 1\n value = value.split('..') if range\n value =\n if value.is_a?(Array)\n value.map { |v| v == '' && not_string ? nil : ActiveScaffold::Core.column_type_cast(v, column) }\n elsif value == '' && (not_string || column.null)\n ActiveScaffold::Core.column_type_cast(column.default, column)\n else\n ActiveScaffold::Core.column_type_cast(value, column)\n end\n value = Range.new(*value) if range\n if distinct\n conditions << active_scaffold_config.model.arel_table[key].not_eq(value)\n else\n conditions[0][key] = value\n end\n end\n conditions\n end\n end", "def init_conditions\n @conditions =\n [\n $game_switches[Yuki::Sw::Pokedex], # Pokedex\n $actors.any?, # Party\n !$bag.locked, # Bag\n true, # Trainer card\n true, # Options\n !$game_system.save_disabled, # Save\n true\n ]\n end", "def obligation(attr_validator, hash = nil)\n hash = (hash || @conditions_hash).clone\n hash.each do |attr, value|\n if value.is_a?(Hash)\n hash[attr] = obligation(attr_validator, value)\n elsif value.is_a?(Array) && value.length == 2\n hash[attr] = [value[0], attr_validator.evaluate(value[1])]\n else\n raise AuthorizationError, 'Wrong conditions hash format'\n end\n end\n hash\n end", "def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end", "def to_conditions(params={})\n # Create an object to store named parameter conditions\n conditioner = OpenStruct.new\n conditioner.or = []\n conditioner.and = []\n conditioner.parameters = {}\n \n if @start_date && @end_date\n conditioner.and << \" CAST(start_date AS DATE) >= :start_date AND CAST(start_date AS DATE) <= :end_date\"\n conditioner.parameters[:start_date] = @start_date.to_s(:db)\n conditioner.parameters[:end_date] = @end_date.to_s(:db)\n end\n statement = conditioner.or.join(' OR ')\n statement += \" AND \" if !conditioner.or.empty? and !conditioner.and.empty?\n statement += conditioner.and.join(' AND ')\n return [statement, conditioner.parameters]\n end", "def build_conditions!(options = {}, &block)\n conditions = @reflection.klass.build_conditions!(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end", "def conditions\n @@conditions ||= []\n end", "def loose_match_criteria\n match_criteria = Proc.new do |dict_entry, tag_entry|\n same_headword = (dict_entry.headword_trad == tag_entry.headword_trad) || (dict_entry.headword_simp == tag_entry.headword_simp)\n end\n return match_criteria\n end", "def build_scoped_search_conditions(search_string) \n if search_string.nil? || search_string.strip.blank?\n return {:conditions => nil}\n else \n query_fields = {}\n self.scoped_search_fields.each do |field| \n field_name = connection.quote_table_name(table_name) + \".\" + connection.quote_column_name(field)\n query_fields[field_name] = self.columns_hash[field.to_s].type\n end\n \n assoc_models_to_include = []\n self.scoped_search_assoc_groupings.each do |group|\n assoc_models_to_include << group[0]\n group[1].each do |group_field|\n field_name = connection.quote_table_name(group[0].to_s.pluralize) + \".\" + connection.quote_column_name(group_field)\n query_fields[field_name] = self.reflections[group[0]].klass.columns_hash[group_field.to_s].type\n end\n end\n \n search_conditions = QueryLanguageParser.parse(search_string) \n conditions = QueryConditionsBuilder.build_query(search_conditions, query_fields) \n \n retVal = {:conditions => conditions}\n retVal[:include] = assoc_models_to_include unless assoc_models_to_include.empty?\n\n return retVal\n end\n end", "def conditions_to_fields(conditions)\n\t\t\t\tconditions.inject({}) do |fields, (key, value)|\n\t\t\t\t\tif key.to_s == 'id'\n\t\t\t\t\t\tfields.merge('_key' => value)\n\t\t\t\t\telse\n\t\t\t\t\t\tfields.merge(key => value)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def conditions\n [[]]\n end", "def build_from_params(params)\n if params[:fields] || params[:f]\n self.filters = {}\n add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v])\n else\n available_filters.keys.each do |field|\n add_short_filter(field, params[field]) if params[field]\n end\n end\n self.group_by = params[:group_by] || (params[:query] && params[:query][:group_by])\n self.column_names = params[:c] || (params[:query] && params[:query][:column_names])\n self\n end", "def add_conditions_from_array(conditions)\n if conditions.length == 2 && conditions[1].class == Hash\n add_conditions_from_hash_array(conditions)\n else\n add_conditions_from_string_array(conditions)\n end\n end", "def conditions_hash(response_set)\n hash = {}\n self.dependency_conditions.each{|dc| hash.merge!(dc.to_hash(response_set))}\n return hash\n end", "def criterion_list searchable_attr = {}, formats ={}, criteria = {}\n\n searchable_attr.each{|attr|\n criterion_key = attr_2_criterion_sym(attr)\n #operator_key = attr_2_operator(attr)\n if params[criterion_key] then\n if not params[criterion_key].blank? then\n if criterion_key.to_s.ends_with?('_date') || criterion_key.to_s.ends_with?('_at') then\n # This is a bit shakey: duck programming at its \"best\" providing you know ath all date attributes must end with \"_date\"\n #criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?t($DF + \"default\") : t(formats[criterion_key])))\n criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?$DATE_TRANSFER_FORMAT : t(formats[criterion_key])))\n else\n criteria[attr] =params[criterion_key]\n end\n #else\n \n \n end # not blank\n end \n }\n return criteria\n end", "def filter_by_associations_conditions_expression(obj)\n ds = filter_by_associations_conditions_dataset.where(filter_by_associations_conditions_subquery_conditions(obj))\n {filter_by_associations_conditions_key=>ds}\n end", "def conditions2include(conditions, original = true)\n nest = false\n new_include = *(conditions.inject([]) do |m, (k, v)|\n if v.is_a?(Hash)\n temp_v, includes_hash = conditions2include(v, false)\n nest = true\n m << (includes_hash ? {k => temp_v} : k)\n end\n m\n end)\n return original ? new_include : [new_include, nest]\n end", "def eager_loading_predicate_condition(keys)\n {predicate_key=>keys}\n end", "def collect_map_rule(map_mod, out_hash)\n out_hash[:maps] ||= []\n if map_mod[:simple_value]\n out_hash[:maps] << [map_mod[:simple_value].to_i, :<=, 1]\n return\n end\n\n collect_complex_map_rule(map_mod, out_hash)\n end", "def define_conditions(params, ptype, version_id)\n condition_array = []\n condition_array[0] = 'blank'\n select_conditions = []\n \n case ptype\n when 'id' #list of ids entered\n id_list = create_array_from_text_area(params[:oligo_ids], 'integer')\n select_conditions.push('id IN (?)')\n condition_array.push(id_list)\n \n when 'gl' #gene list entered (as array from drop-down)\n gene_list = params[:oligo_design][:gene_code]\n select_conditions.push('gene_code IN (?)')\n condition_array.push(gene_list)\n \n when 'gt' #gene list entered (as text)\n gene_list = create_array_from_text_area(params[:genes])\n select_conditions.push('gene_code IN (?)')\n condition_array.push(gene_list)\n \n when 'p' #project entered, without entering specific genes, so get all genes for project\n gene_list = ProjectGene.genelist(params[:project], nil)\n select_conditions.push('gene_code IN (?)')\n condition_array.push(gene_list)\n end\n \n if params[:enzyme] && !param_blank?(params[:enzyme][:enzyme_code])\n select_conditions.push('enzyme_code IN (?)')\n condition_array.push(enzyme_add_gapfill(params[:enzyme][:enzyme_code]))\n end\n \n select_conditions.push('version_id = ?')\n condition_array.push(version_id)\n condition_array[0] = select_conditions.join(' AND ')\n return condition_array \n end", "def build_conditions(options = {}, &block)\n conditions = @reflection.klass.build_conditions(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end", "def initialize_container_conditions_collection(relation)\n query = ContainerCondition.where(\n :container_entity_type => relation.model.name,\n :container_entity_id => relation, # nested SELECT. TODO: compare to a JOIN.\n )\n @inv_collections[[:container_conditions_for, relation.model.name]] =\n ::ManagerRefresh::InventoryCollection.new(\n :model_class => ContainerCondition,\n :arel => query,\n :manager_ref => [:container_entity, :name],\n )\n end", "def build_where_query(options)\n query_keys = {}\n options.each do |k,v|\n # as expected by DynamoDB\n typed_key = k.to_s\n query_keys[typed_key] = dyno_typed_key(key: typed_key, val: v)\n end\n {\n table_name: self.table_name,\n attributes_to_get: attribute_names,\n key: query_keys\n }\n end", "def define\n predicates = Object.new\n @conditions.each {|k, v| predicates.class.send(:define_method, \"#{k}?\") { v } }\n yield RuleMapper.new(self), @conditions, @context\n end", "def normalize_params(params)\n # filters\n conditions = params[:filter] && convert_filters(params[:filter])\n \n normalized_conditions = {}\n conditions && conditions.each_pair do |k, v|\n normalized_conditions.merge!(k.gsub(\"__\", \"_\") => v)\n end\n \n {:conditions => normalized_conditions}\n end", "def generateCompareMmr_s (list)\r\n hash = Hash.new\r\n list.each{|value|\r\n val = value.split('_')\r\n key = val[0]+\"_\"+val[1]+\"_\"+val[2]\r\n if hash[key]\r\n hash[key] = hash[key]+\"$(\"+'\"'+\"select[name='\"+value+\"'\"+\"]\"+'\"'+\").val() == \"+'\"'+'\"'+\"||\"\r\n else\r\n hash[key] = \"$(\"+'\"'+\"select[name='\"+value+\"'\"+\"]\"+'\"'+\").val() == \"+'\"'+'\"'+\"||\"\r\n end\r\n }\r\n return hash\r\n end", "def where_hash_from_params(params, parameter_names)\n where_hash = {}\n parameter_names.each do |parameter_name|\n en = params[\"#{parameter_name}_equals\".to_sym]\n ln = params[\"#{parameter_name}_like\".to_sym]\n rn = params[\"#{parameter_name}_rlike\".to_sym]\n\n [en, ln, rn].each do |val|\n where_hash[parameter_name] = val unless val.blank?\n end\n end\n \n return where_hash\n end", "def initialize(constraints = {})\n self.where constraints\n end", "def build_search(records, search)\n records = records.where(name: search.name) if search.name.present?\n records = records.where(profession: search.profession) if search.profession.present?\n records = records.where(grade: search.grade) if search.grade.present?\n\n records\n end", "def conditions_for_collection\n selector = case session[:travel_filter]\n when 'arrivals' then ['travels.arrival AND travels.date >= (?)', Date::today]\n when 'departures' then ['travels.arrival = ? AND travels.date >= (?)', false, Date::today]\n when 'all_dates' then TRUE\n when 'current' then ['travels.date >= (?)', Date::today]\n else ['travels.date >= (?)', Date::today] # This will include nil case where filter has not been set for session\n end\n return selector\n end", "def collection_one\n {\n 'Projects' => [{\n 'ShortName' => 'AA',\n 'LongName' => 'ARCATLAS',\n 'Campaigns' => ['test 1a Campaign', 'test 1b Campaign'],\n 'StartDate' => '2015-07-01T00:00:00Z',\n 'EndDate' => '2015-12-25T00:00:00Z'\n }, {\n 'ShortName' => 'EUDASM',\n 'LongName' => 'European Digital Archive of Soil Maps',\n 'Campaigns' => ['test 2a Campaign', 'test 2b Campaign'],\n 'StartDate' => '2015-07-01T00:00:00Z',\n 'EndDate' => '2015-12-25T00:00:00Z'\n }],\n 'MetadataSpecification' => {\n 'Name' => 'UMM-C',\n 'URL' => 'https://cdn.earthdata.nasa.gov/umm/collection/v1.17.3',\n 'Version' => '1.17.3'\n },\n 'Platforms' => [{\n 'Type' => 'Jet',\n 'ShortName' => 'A340-600',\n 'LongName' => 'Airbus A340-600',\n 'Characteristics' => [{\n 'Name' => 'test 1 PC Name',\n 'Description' => 'test 1 PC Description',\n 'Value' => 'test 1 PC Value',\n 'Unit' => 'test 1 PC Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2 PC Name',\n 'Description' => 'test 2 PC Description',\n 'Value' => 'test 2 PC Value',\n 'Unit' => 'test 2 PC Unit',\n 'DataType' => 'STRING'\n }],\n 'Instruments' => [{\n 'ShortName' => 'ATM',\n 'LongName' => 'Airborne Topographic Mapper',\n 'Characteristics' => [{\n 'Name' => 'test 1 PI Name',\n 'Description' => 'test 1 PI Description',\n 'Value' => 'test 1 PI Value',\n 'Unit' => 'test 1 PI Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2 PI Name',\n 'Description' => 'test 2 PI Description',\n 'Value' => 'test 2 PI Value',\n 'Unit' => 'test 2 PI Unit',\n 'DataType' => 'STRING'\n }],\n 'Technique' => 'test 1 PI Technique',\n 'NumberOfInstruments' => 234,\n 'ComposedOf' => [{\n 'ShortName' => 'ADS',\n 'LongName' => 'Automated DNA Sequencer',\n 'Technique' => 'test 1 PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test 1 PS Name',\n 'Description' => 'test 1 PS Description',\n 'Value' => 'test 1 PS Value',\n 'Unit' => 'test 1 PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2 PS Name',\n 'Description' => 'test 2 PS Description',\n 'Value' => 'test 2 PS Value',\n 'Unit' => 'test 2 PS Unit',\n 'DataType' => 'STRING'\n }]\n }, {\n 'ShortName' => 'SMAP L-BAND RADIOMETER',\n 'LongName' => 'SMAP L-Band Radiometer',\n 'Technique' => 'test 1b PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test 1b PS Name',\n 'Description' => 'test 1b PS Description',\n 'Value' => 'test 1b PS Value',\n 'Unit' => 'test 1b PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2b PS Name',\n 'Description' => 'test 2b PS Description',\n 'Value' => 'test 2b PS Value',\n 'Unit' => 'test 2b PS Unit',\n 'DataType' => 'STRING'\n }]\n }],\n 'OperationalModes' => ['test 1a Op', 'test 1b Op']\n }, {\n 'ShortName' => 'LVIS',\n 'LongName' => 'Land, Vegetation, and Ice Sensor',\n 'Characteristics' => [{\n 'Name' => 'test 1d PI Name',\n 'Description' => 'test 1d PI Description',\n 'Value' => 'test 1d PI Value',\n 'Unit' => 'test 1d PI Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2d PI Name',\n 'Description' => 'test 2d PI Description',\n 'Value' => 'test 2d PI Value',\n 'Unit' => 'test 2d PI Unit',\n 'DataType' => 'STRING'\n }],\n 'Technique' => 'test 1d PI Technique',\n 'NumberOfInstruments' => 345,\n 'ComposedOf' => [{\n 'ShortName' => 'ADS',\n 'LongName' => 'Automated DNA Sequencer',\n 'Technique' => 'test 1d PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test 1d PS Name',\n 'Description' => 'test 1d PS Description',\n 'Value' => 'test 1d PS Value',\n 'Unit' => 'test 1d PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2d PS Name',\n 'Description' => 'test 2d PS Description',\n 'Value' => 'test 2d PS Value',\n 'Unit' => 'test 2d PS Unit',\n 'DataType' => 'STRING'\n }]\n }, {\n 'ShortName' => 'SMAP L-BAND RADIOMETER',\n 'LongName' => 'SMAP L-Band Radiometer',\n 'Technique' => 'test 1db PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test 1db PS Name',\n 'Description' => 'test 1db PS Description',\n 'Value' => 'test 1db PS Value',\n 'Unit' => 'test 1db PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test 2db PS Name',\n 'Description' => 'test 2db PS Description',\n 'Value' => 'test 2db PS Value',\n 'Unit' => 'test 2db PS Unit',\n 'DataType' => 'STRING'\n }]\n }],\n 'OperationalModes' => ['test 1da Op', 'test 1db Op']\n }]\n }, {\n 'Type' => 'Earth Observation Satellites',\n 'ShortName' => 'SMAP',\n 'LongName' => 'Soil Moisture Active and Passive Observatory',\n 'Characteristics' => [{\n 'Name' => 'test a1 PC Name',\n 'Description' => 'test a1 PC Description',\n 'Value' => 'test a1 PC Value',\n 'Unit' => 'test a1 PC Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2 PC Name',\n 'Description' => 'test a2 PC Description',\n 'Value' => 'test a2 PC Value',\n 'Unit' => 'test a2 PC Unit',\n 'DataType' => 'STRING'\n }],\n 'Instruments' => [{\n 'ShortName' => 'ADS',\n 'LongName' => 'Automated DNA Sequencer',\n 'Characteristics' => [{\n 'Name' => 'test a1 PI Name',\n 'Description' => 'test a1 PI Description',\n 'Value' => 'test a1 PI Value',\n 'Unit' => 'test a1 PI Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2 PI Name',\n 'Description' => 'test a2 PI Description',\n 'Value' => 'test a2 PI Value',\n 'Unit' => 'test a2 PI Unit',\n 'DataType' => 'STRING'\n }],\n 'Technique' => 'test a1 PI Technique',\n 'NumberOfInstruments' => 456,\n 'ComposedOf' => [{\n 'ShortName' => 'ADS',\n 'LongName' => 'Automated DNA Sequencer',\n 'Technique' => 'test a1 PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test a1 PS Name',\n 'Description' => 'test a1 PS Description',\n 'Value' => 'test a1 PS Value',\n 'Unit' => 'test a1 PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2 PS Name',\n 'Description' => 'test a2 PS Description',\n 'Value' => 'test a2 PS Value',\n 'Unit' => 'test a2 PS Unit',\n 'DataType' => 'STRING'\n }]\n }, {\n 'ShortName' => 'SMAP L-BAND RADIOMETER',\n 'LongName' => 'SMAP L-Band Radiometer',\n 'Technique' => 'test a1b PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test a1b PS Name',\n 'Description' => 'test a1b PS Description',\n 'Value' => 'test a1b PS Value',\n 'Unit' => 'test a1b PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2b PS Name',\n 'Description' => 'test a2b PS Description',\n 'Value' => 'test a2b PS Value',\n 'Unit' => 'test a2b PS Unit',\n 'DataType' => 'STRING'\n }]\n }],\n 'OperationalModes' => ['test a1a Op', 'test a1b Op']\n }, {\n 'ShortName' => 'SMAP L-BAND RADIOMETER',\n 'LongName' => 'SMAP L-Band Radiometer',\n 'Characteristics' => [{\n 'Name' => 'test a1d PI Name',\n 'Description' => 'test a1d PI Description',\n 'Value' => 'test a1d PI Value',\n 'Unit' => 'test a1d PI Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2d PI Name',\n 'Description' => 'test a2d PI Description',\n 'Value' => 'test a2d PI Value',\n 'Unit' => 'test a2d PI Unit',\n 'DataType' => 'STRING'\n }],\n 'Technique' => 'test a1d PI Technique',\n 'NumberOfInstruments' => 567,\n 'ComposedOf' => [{\n 'ShortName' => 'ADS',\n 'LongName' => 'Automated DNA Sequencer',\n 'Technique' => 'test a1d PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test a1d PS Name',\n 'Description' => 'test a1d PS Description',\n 'Value' => 'test a1d PS Value',\n 'Unit' => 'test a1d PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2d PS Name',\n 'Description' => 'test a2d PS Description',\n 'Value' => 'test a2d PS Value',\n 'Unit' => 'test a2d PS Unit',\n 'DataType' => 'STRING'\n }]\n }, {\n 'ShortName' => 'SMAP L-BAND RADIOMETER',\n 'LongName' => 'SMAP L-Band Radiometer',\n 'Technique' => 'test a1db PS Technique',\n 'Characteristics' => [{\n 'Name' => 'test a1db PS Name',\n 'Description' => 'test a1db PS Description',\n 'Value' => 'test a1db PS Value',\n 'Unit' => 'test a1db PS Unit',\n 'DataType' => 'STRING'\n }, {\n 'Name' => 'test a2db PS Name',\n 'Description' => 'test a2db PS Description',\n 'Value' => 'test a2db PS Value',\n 'Unit' => 'test a2db PS Unit',\n 'DataType' => 'STRING'\n }]\n }],\n 'OperationalModes' => ['test a1da Op', 'test a1db Op']\n }]\n }],\n 'Abstract' => 'This is a long description of the collection',\n 'VersionDescription' => 'Version 1 Description',\n 'Purpose' => 'This is the purpose field',\n 'DataLanguage' => 'eng',\n 'DataDates' => [{\n 'Type' => 'CREATE',\n 'Date' => '2015-07-01T00:00:00Z'\n }, {\n 'Type' => 'UPDATE',\n 'Date' => '2015-07-05T00:00:00Z'\n }],\n 'DataCenters' => [{\n 'Roles' => ['ARCHIVER'],\n 'ShortName' => 'AARHUS-HYDRO',\n 'LongName' => 'Hydrogeophysics Group, Aarhus University ', # controlled keywords source has extra space at the end\n 'ContactInformation' => {\n 'ServiceHours' => '9-6, M-F',\n 'ContactInstruction' => 'Email only',\n 'ContactMechanisms' => [{\n 'Type' => 'Email',\n 'Value' => 'example@example.com'\n }, {\n 'Type' => 'Email',\n 'Value' => 'example2@example.com'\n }],\n 'Addresses' => [{\n 'StreetAddresses' => ['300 E Street Southwest', 'Room 203', 'Address line 3'],\n 'City' => 'Washington',\n 'StateProvince' => 'DC',\n 'PostalCode' => '20546',\n 'Country' => 'United States'\n }, {\n 'StreetAddresses' => ['8800 Greenbelt Road'],\n 'City' => 'Greenbelt',\n 'StateProvince' => 'MD',\n 'PostalCode' => '20771',\n 'Country' => 'United States'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'DataCenterURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/'\n }, {\n 'Description' => 'Related URL 2 Description',\n 'URLContentType' => 'DataCenterURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/2'\n }]\n }\n }, {\n 'Roles' => ['ORIGINATOR', 'DISTRIBUTOR'],\n 'ShortName' => 'ESA/ED',\n 'LongName' => 'Educational Office, Ecological Society of America',\n 'ContactInformation' => {\n 'ServiceHours' => '10-2, M-W',\n 'ContactInstruction' => 'Email only',\n 'ContactMechanisms' => [{\n 'Type' => 'Email',\n 'Value' => 'example@example.com'\n }, {\n 'Type' => 'Email',\n 'Value' => 'example2@example.com'\n }],\n 'Addresses' => [{\n 'StreetAddresses' => ['300 E Street Southwest', 'Room 203', 'Address line 3'],\n 'City' => 'Washington',\n 'StateProvince' => 'DC',\n 'PostalCode' => '20546',\n 'Country' => 'United States'\n }, {\n 'StreetAddresses' => ['8800 Greenbelt Road'],\n 'City' => 'Greenbelt',\n 'StateProvince' => 'MD',\n 'PostalCode' => '20771',\n 'Country' => 'United States'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'DataCenterURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/'\n }]\n },\n 'ContactPersons' => [{\n 'Roles' => ['Investigator', 'Metadata Author'],\n 'FirstName' => 'First Name 3',\n 'MiddleName' => 'Middle Name 3',\n 'LastName' => 'Last Name 3',\n 'ContactInformation' => {\n 'ServiceHours' => '1-4, M-W',\n 'ContactInstruction' => 'Email only',\n 'ContactMechanisms' => [{\n 'Type' => 'Email',\n 'Value' => 'example5@example.com'\n }, {\n 'Type' => 'Email',\n 'Value' => 'example6@example.com'\n }],\n 'Addresses' => [{\n 'StreetAddresses' => ['300 E Street Southwest', 'Room 203', 'Address line 3'],\n 'City' => 'Washington',\n 'StateProvince' => 'DC',\n 'PostalCode' => '20546',\n 'Country' => 'United States'\n }, {\n 'StreetAddresses' => ['8800 Greenbelt Road'],\n 'City' => 'Greenbelt',\n 'StateProvince' => 'MD',\n 'PostalCode' => '20771',\n 'Country' => 'United States'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'DataContactURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/'\n }]\n }\n }],\n 'ContactGroups' => [{\n 'Roles' => ['User Services'],\n 'GroupName' => 'Group Name 2',\n 'ContactInformation' => {\n 'ServiceHours' => '9-5, M-F',\n 'ContactInstruction' => 'Email only',\n 'ContactMechanisms' => [{\n 'Type' => 'Email',\n 'Value' => 'example7@example.com'\n }, {\n 'Type' => 'Email',\n 'Value' => 'example8@example.com'\n }],\n 'Addresses' => [{\n 'StreetAddresses' => ['300 E Street Southwest', 'Room 203', 'Address line 3'],\n 'City' => 'Washington',\n 'StateProvince' => 'DC',\n 'PostalCode' => '20546',\n 'Country' => 'United States'\n }, {\n 'StreetAddresses' => ['8800 Greenbelt Road'],\n 'City' => 'Greenbelt',\n 'StateProvince' => 'MD',\n 'PostalCode' => '20771',\n 'Country' => 'United States'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'DataContactURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/'\n }]\n }\n }]\n }],\n 'ContactPersons' => [{\n 'Roles' => ['Science Contact', 'Technical Contact'],\n 'FirstName' => 'First Name',\n 'MiddleName' => 'Middle Name',\n 'LastName' => 'Last Name',\n 'NonDataCenterAffiliation' => 'Famous University',\n 'ContactInformation' => {\n 'ServiceHours' => '10-2, M-W',\n 'ContactInstruction' => 'Email only',\n 'ContactMechanisms' => [{\n 'Type' => 'Email',\n 'Value' => 'example1@example.com'\n }, {\n 'Type' => 'Email',\n 'Value' => 'example2@example.com'\n }],\n 'Addresses' => [{\n 'StreetAddresses' => ['300 E Street Southwest', 'Room 203', 'Address line 3'],\n 'City' => 'Washington',\n 'StateProvince' => 'DC',\n 'PostalCode' => '20546',\n 'Country' => 'United States'\n }, {\n 'StreetAddresses' => ['8800 Greenbelt Road'],\n 'City' => 'Greenbelt',\n 'StateProvince' => 'MD',\n 'PostalCode' => '20771',\n 'Country' => 'United States'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'DataContactURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/'\n }, {\n 'Description' => 'Related URL 2 Description',\n 'URLContentType' => 'DataContactURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/2'\n }]\n }\n }],\n 'ContactGroups' => [{\n 'Roles' => ['User Services', 'Science Software Development'],\n 'GroupName' => 'Group Name',\n 'NonDataCenterAffiliation' => 'Famous University',\n 'ContactInformation' => {\n 'ServiceHours' => '9-5, M-F',\n 'ContactInstruction' => 'Email only',\n 'ContactMechanisms' => [{\n 'Type' => 'Email',\n 'Value' => 'example3@example.com'\n }, {\n 'Type' => 'Email',\n 'Value' => 'example4@example.com'\n }],\n 'Addresses' => [{\n 'StreetAddresses' => ['300 E Street Southwest', 'Room 203', 'Address line 3'],\n 'City' => 'Washington',\n 'StateProvince' => 'DC',\n 'PostalCode' => '20546',\n 'Country' => 'United States'\n }, {\n 'StreetAddresses' => ['8800 Greenbelt Road'],\n 'City' => 'Greenbelt',\n 'StateProvince' => 'MD',\n 'PostalCode' => '20771',\n 'Country' => 'United States'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'DataContactURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/'\n }, {\n 'Description' => 'Related URL 2 Description',\n 'URLContentType' => 'DataContactURL',\n 'Type' => 'HOME PAGE',\n 'URL' => 'http://example.com/2'\n }]\n }\n }],\n 'ProcessingLevel' => {\n 'Id' => '1A',\n 'ProcessingLevelDescription' => 'Level 1 Description'\n },\n 'CollectionCitations' => [{\n 'Version' => 'v1',\n 'Title' => 'Citation title',\n 'Creator' => 'Citation creator',\n 'Editor' => 'Citation editor',\n 'SeriesName' => 'Citation series name',\n 'ReleaseDate' => '2015-07-01T00:00:00Z',\n 'ReleasePlace' => 'Citation release place',\n 'Publisher' => 'Citation publisher',\n 'IssueIdentification' => 'Citation issue identification',\n 'DataPresentationForm' => 'Citation data presentation form',\n 'OtherCitationDetails' => 'Citation other details',\n 'OnlineResource' => {\n 'Linkage' => 'http://example.com',\n 'Description' => 'Example Description',\n 'Name' => 'Example related URL Title 1'\n }\n }, {\n 'Version' => 'v2',\n 'Title' => 'Citation title 1',\n 'Creator' => 'Citation creator 1',\n 'OnlineResource' => {\n 'Linkage' => 'http://example2.com',\n 'Description' => 'Example 2 Description',\n 'Name' => 'Example 2 related URL Title'\n }\n }],\n 'DOI' => {\n 'DOI' => 'Citation DOI',\n 'Authority' => 'Citation DOI Authority'\n },\n 'AssociatedDOIs' => [{\n 'DOI' => 'Associated DOI',\n 'Title' => 'Associated DOI Title',\n 'Authority' => 'Associated DOI Authority'\n }],\n 'StandardProduct' => false,\n 'CollectionProgress' => 'ACTIVE',\n 'Quality' => 'Metadata quality summary',\n 'UseConstraints' => {\n 'Description' => 'These are some use constraints',\n 'FreeAndOpenData' => true,\n 'LicenseURL' => {\n 'Linkage' => 'http://example.com'\n }\n },\n 'AccessConstraints' => {\n 'Value' => 42,\n 'Description' => 'Access constraint description'\n },\n 'MetadataAssociations' => [{\n 'Type' => 'SCIENCE ASSOCIATED',\n 'EntryId' => '12345',\n 'Description' => 'Metadata association description',\n 'Version' => '23'\n }, {\n 'Type' => 'LARGER CITATION WORKS',\n 'EntryId' => '123abc'\n }],\n 'PublicationReferences' => [{\n 'Title' => 'Publication reference title',\n 'Publisher' => 'Publication reference publisher',\n 'DOI' => {\n 'DOI' => 'Publication reference DOI',\n 'Authority' => 'Publication reference authority'\n },\n 'Author' => 'Publication reference author',\n 'PublicationDate' => '2015-07-01T00:00:00Z',\n 'Series' => 'Publication reference series',\n 'Edition' => 'Publication reference edition',\n 'Volume' => 'Publication reference volume',\n 'Issue' => 'Publication reference issue',\n 'ReportNumber' => 'Publication reference report number',\n 'PublicationPlace' => 'Publication reference publication place',\n 'Pages' => 'Publication reference pages',\n 'ISBN' => '1234567890123',\n 'OtherReferenceDetails' => 'Publication reference details',\n 'OnlineResource' => {\n 'Linkage' => 'http://example.com',\n 'Description' => 'Example Description',\n 'Name' => 'Example URL Title'\n }\n }, {\n 'Title' => 'Publication reference title 1',\n 'ISBN' => '9876543210987'\n }],\n 'ScienceKeywords' => [{\n 'Category' => 'EARTH SCIENCE',\n 'Topic' => 'ATMOSPHERE',\n 'Term' => 'ATMOSPHERIC TEMPERATURE',\n 'VariableLevel1' => 'SURFACE TEMPERATURE',\n 'VariableLevel2' => 'MAXIMUM/MINIMUM TEMPERATURE',\n 'VariableLevel3' => '24 HOUR MAXIMUM TEMPERATURE'\n }, {\n 'Category' => 'EARTH SCIENCE',\n 'Topic' => 'SOLID EARTH',\n 'Term' => 'ROCKS/MINERALS/CRYSTALS',\n 'VariableLevel1' => 'SEDIMENTARY ROCKS',\n 'VariableLevel2' => 'SEDIMENTARY ROCK PHYSICAL/OPTICAL PROPERTIES',\n 'VariableLevel3' => 'LUMINESCENCE'\n }],\n 'AncillaryKeywords' => ['Ancillary keyword 1', 'Ancillary keyword 2'],\n 'AdditionalAttributes' => [{\n 'Name' => 'Attribute 1',\n 'Description' => 'Description',\n 'DataType' => 'INT',\n 'MeasurementResolution' => 'Measurement Resolution',\n 'ParameterRangeBegin' => '1',\n 'ParameterRangeEnd' => '5',\n 'ParameterUnitsOfMeasure' => 'Parameter Units Of Measure',\n 'ParameterValueAccuracy' => 'Parameter Value Accuracy',\n 'ValueAccuracyExplanation' => 'Value Accuracy Explanation',\n 'Group' => 'Group',\n 'UpdateDate' => '2015-09-14T00:00:00Z'\n }, {\n 'Name' => 'Attribute 2',\n 'Description' => 'Description 2',\n 'DataType' => 'STRING'\n }],\n 'RelatedUrls' => [{\n 'Description' => 'Related URL 1 Description',\n 'URLContentType' => 'CollectionURL',\n 'Type' => 'DATA SET LANDING PAGE',\n 'URL' => 'http://example.com/'\n }, {\n 'Description' => 'Related URL 2 Description',\n 'URLContentType' => 'DistributionURL',\n 'Type' => 'GET DATA',\n 'Subtype' => 'Earthdata Search',\n 'URL' => 'https://search.earthdata.nasa.gov/',\n 'GetData' => {\n 'Format' => 'JPEG',\n 'MimeType' => 'Not provided',\n 'Size' => 42,\n 'Unit' => 'KB',\n 'Fees' => '0',\n 'Checksum' => 'sdfgfgksghafgsdvbasf'\n }\n }, {\n 'Description' => 'Related URL 3 Description',\n 'URLContentType' => 'DistributionURL',\n 'Type' => 'USE SERVICE API',\n 'Subtype' => 'OPENDAP DATA',\n 'URL' => 'https://example.com/',\n 'GetService' => {\n 'Format' => 'ascii',\n 'MimeType' => 'Not provided',\n 'Protocol' => 'HTTPS',\n 'FullName' => 'Earthdata Search',\n 'DataID' => 'data_id',\n 'DataType' => 'data type',\n 'URI' => ['uri']\n }\n }, {\n 'Description' => 'This is data citation policy',\n 'URLContentType' => 'PublicationURL',\n 'Type' => 'VIEW RELATED INFORMATION',\n 'Subtype' => 'DATA CITATION POLICY',\n 'URL' => 'https://example.com/data-citation-policy'\n }, {\n 'Description' => 'This is general documentation',\n 'URLContentType' => 'PublicationURL',\n 'Type' => 'VIEW RELATED INFORMATION',\n 'Subtype' => 'GENERAL DOCUMENTATION',\n 'URL' => 'https://example.com/documentation-1'\n }, {\n 'Description' => 'This is how-to documentation',\n 'URLContentType' => 'PublicationURL',\n 'Type' => 'VIEW RELATED INFORMATION',\n 'Subtype' => 'HOW-TO',\n 'URL' => 'https://example.com/documentation-2'\n }, {\n 'Description' => 'This is anomalies documentation',\n 'URLContentType' => 'PublicationURL',\n 'Type' => 'VIEW RELATED INFORMATION',\n 'Subtype' => 'ANOMALIES',\n 'URL' => 'https://example.com/documentation-3'\n }],\n 'MetadataLanguage' => 'eng',\n 'MetadataDates' => [{\n 'Type' => 'CREATE',\n 'Date' => '2010-12-25T00:00:00Z'\n }, {\n 'Type' => 'UPDATE',\n 'Date' => '2010-12-30T00:00:00Z'\n }],\n 'DirectoryNames' => [{\n 'ShortName' => 'Short Directory 1',\n 'LongName' => 'Long Directory 1'\n }, {\n 'ShortName' => 'Short Directory 2',\n 'LongName' => 'Long Directory 2'\n }],\n 'SpatialExtent' => {\n 'SpatialCoverageType' => 'HORIZONTAL',\n 'GranuleSpatialRepresentation' => 'CARTESIAN',\n 'HorizontalSpatialDomain' => {\n 'ZoneIdentifier' => 'Zone ID',\n 'Geometry' => {\n 'CoordinateSystem' => 'CARTESIAN',\n 'BoundingRectangles' => [{\n 'WestBoundingCoordinate' => -180.0,\n 'NorthBoundingCoordinate' => 90.0,\n 'EastBoundingCoordinate' => 180.0,\n 'SouthBoundingCoordinate' => -90.0\n }, {\n 'WestBoundingCoordinate' => -96.9284587,\n 'NorthBoundingCoordinate' => 58.968602,\n 'EastBoundingCoordinate' => -56.9284587,\n 'SouthBoundingCoordinate' => 18.968602\n }]\n },\n 'ResolutionAndCoordinateSystem': {\n 'Description': 'ResolutionAndCoordinateSystem Description',\n 'GeodeticModel': {\n 'HorizontalDatumName': 'HorizontalDatumName Text',\n 'EllipsoidName': 'EllipsoidName Text',\n 'SemiMajorAxis': 1.0,\n 'DenominatorOfFlatteningRatio': 1.0\n },\n 'HorizontalDataResolution': {\n 'VariesResolution': 'Varies',\n 'PointResolution': 'Point',\n 'NonGriddedResolutions': [{\n 'XDimension': 1,\n 'YDimension': 2,\n 'Unit': 'Meters',\n 'ViewingAngleType': 'At Nadir',\n 'ScanDirection': 'Cross Track'\n }],\n 'NonGriddedRangeResolutions': [{\n 'MinimumXDimension': 3,\n 'MinimumYDimension': 4,\n 'MaximumXDimension': 5,\n 'MaximumYDimension': 6,\n 'Unit': 'Meters',\n 'ViewingAngleType': 'At Nadir',\n 'ScanDirection': 'Cross Track'\n }],\n 'GriddedResolutions': [{\n 'XDimension': 7,\n 'Unit': 'Meters'\n }, {\n 'YDimension': 8,\n 'Unit': 'Decimal Degrees'\n }],\n 'GriddedRangeResolutions': [{\n 'MinimumXDimension': 9,\n 'MaximumXDimension': 10,\n 'Unit': 'Meters'\n }],\n 'GenericResolutions': [{\n 'XDimension': 11,\n 'Unit': 'Decimal Degrees'\n }]\n },\n },\n },\n },\n 'TilingIdentificationSystems' => [{\n 'TilingIdentificationSystemName' => 'MISR',\n 'Coordinate1' => {\n 'MinimumValue' => -50, 'MaximumValue' => 50\n },\n 'Coordinate2' => {\n 'MinimumValue' => -30, 'MaximumValue' => 30\n }\n }, {\n 'TilingIdentificationSystemName' => 'MODIS Tile EASE',\n 'Coordinate1' => {\n 'MinimumValue' => -25, 'MaximumValue' => 25\n },\n 'Coordinate2' => {\n 'MinimumValue' => -15, 'MaximumValue' => 15\n }\n }],\n 'SpatialInformation' => {\n 'SpatialCoverageType' => 'VERTICAL',\n 'VerticalCoordinateSystem' => {\n 'AltitudeSystemDefinition' => {\n 'DatumName' => 'Datum',\n 'DistanceUnits' => 'HectoPascals',\n 'Resolutions' => [1.0, 2.0, 3.0]\n },\n 'DepthSystemDefinition' => {\n 'DatumName' => 'Datum 2',\n 'DistanceUnits' => 'Fathoms',\n 'Resolutions' => [12.0, 22.0, 32.0]\n }\n }\n },\n 'LocationKeywords' => [{\n 'Category' => 'GEOGRAPHIC REGION',\n 'Type' => 'ARCTIC'\n }, {\n 'Category' => 'OCEAN',\n 'Type' => 'ATLANTIC OCEAN'\n }],\n 'TemporalExtents' => [{\n 'PrecisionOfSeconds' => 1,\n 'EndsAtPresentFlag' => false,\n 'SingleDateTimes' => ['2015-07-01T00:00:00Z', '2015-12-25T00:00:00Z']\n }, {\n 'PrecisionOfSeconds' => 10,\n 'EndsAtPresentFlag' => false,\n 'RangeDateTimes' => [{\n 'BeginningDateTime' => '2014-07-01T00:00:00Z',\n 'EndingDateTime' => '2014-08-01T00:00:00Z'\n }, {\n 'BeginningDateTime' => '2015-07-01T00:00:00Z',\n 'EndingDateTime' => '2015-08-01T00:00:00Z'\n }]\n }, {\n 'PrecisionOfSeconds' => 30,\n 'EndsAtPresentFlag' => false,\n 'PeriodicDateTimes' => [{\n 'Name' => 'test 1 Periodic Extent',\n 'StartDate' => '2015-07-01T00:00:00Z',\n 'EndDate' => '2015-08-01T00:00:00Z',\n 'DurationUnit' => 'DAY',\n 'DurationValue' => 5,\n 'PeriodCycleDurationUnit' => 'DAY',\n 'PeriodCycleDurationValue' => 1\n }, {\n 'Name' => 'test 2 Periodic Extent',\n 'StartDate' => '2016-07-01T00:00:00Z',\n 'EndDate' => '2016-08-01T00:00:00Z',\n 'DurationUnit' => 'MONTH',\n 'DurationValue' => 4,\n 'PeriodCycleDurationUnit' => 'MONTH',\n 'PeriodCycleDurationValue' => 2\n }]\n }],\n 'TemporalKeywords' => ['Monthly Climatology', 'Weekly Climatology'],\n 'PaleoTemporalCoverages' => [{\n 'StartDate' => '50 Ga',\n 'EndDate' => '25 Ga',\n 'ChronostratigraphicUnits' => [{\n 'Eon' => 'test 1 Eon',\n 'Era' => 'test 1 Era',\n 'Epoch' => 'test 1 Epoch',\n 'Stage' => 'test 1 Stage',\n 'DetailedClassification' => 'test 1 Detailed Classification',\n 'Period' => 'test 1 Period'\n }, {\n 'Eon' => 'test 2 Eon',\n 'Era' => 'test 2 Era',\n 'Epoch' => 'test 2 Epoch',\n 'Stage' => 'test 2 Stage',\n 'DetailedClassification' => 'test 2 Detailed Classification',\n 'Period' => 'test 2 Period'\n }, {\n 'Eon' => 'test 3 Eon text 1'\n }]\n }],\n 'ISOTopicCategories' => %w[farming climatologyMeteorologyAtmosphere health],\n 'ArchiveAndDistributionInformation' => {\n 'FileArchiveInformation' => [\n {\n 'Format' => 'kml',\n 'FormatType' => 'Native',\n 'FormatDescription' => 'A format description',\n 'AverageFileSize' => 2,\n 'AverageFileSizeUnit' => 'MB',\n 'TotalCollectionFileSize' => 25,\n 'TotalCollectionFileSizeUnit' => 'GB',\n 'Description' => 'A file archive information description'\n },\n {\n 'Format' => 'jpeg',\n 'FormatType' => 'Supported',\n 'FormatDescription' => 'A format description',\n 'AverageFileSize' => 3,\n 'AverageFileSizeUnit' => 'MB',\n 'TotalCollectionFileSize' => 99,\n 'TotalCollectionFileSizeUnit' => 'TB',\n 'Description' => 'Another file archive information description'\n }\n ],\n 'FileDistributionInformation' => [\n {\n 'Format' => 'tiff',\n 'FormatType' => 'Native',\n 'FormatDescription' => 'A format description',\n 'Media' => [\n 'disc', 'file', 'online'\n ],\n 'AverageFileSize' => 2,\n 'AverageFileSizeUnit' => 'KB',\n 'TotalCollectionFileSize' => 10,\n 'TotalCollectionFileSizeUnit' => 'TB',\n 'Description' => 'File distribution information description',\n 'Fees' => '$2,900'\n }\n ]\n },\n 'DirectDistributionInformation' => {\n 'Region' => 'us-east-2',\n 'S3BucketAndObjectPrefixNames' => [\n 'prefix-1',\n 'prefix-2',\n 'prefix-3'\n ],\n 'S3CredentialsAPIEndpoint' => 'https://link.com',\n 'S3CredentialsAPIDocumentationURL' => 'https://amazon.com'\n }\n }\nend", "def find_collection_elements_with(*key_vals)\n self.collection.select do |elem|\n key_vals.all? do |kv|\n k, v = kv.first\n return unless elem.respond_to?(k.to_sym)\n elem.send(k.to_sym) == v\n end\n end\n end", "def build_collection_objects_ori\n ce_a1 = ''\n ce_m1 = ''\n ce1 = CollectingEvent.find(1)\n # here we store the attributes of stuff we want to find later\n build_objects = {}\n i = 1 # accounting for headers\n # identifier namespace\n # header0 = csv.headers[0] # should be 'collection_object_identifier_namespace_short_name'\n # header1 = csv.headers[1] # should be 'collection_object_identifier_identifier'\n header5 = csv.headers[5] # should be 'collecting_event_identifier_namespace_short_name'\n header6 = csv.headers[6] # should be 'collecting_event_identifier_identifier'\n header7 = csv.headers[7] # should be 'collecting_event_identifier_type'\n csv.each do |row|\n parse_result = BatchLoad::RowParse.new\n # creation of the possible-objects list\n parse_result.objects[:otu] = []\n parse_result.objects[:co] = []\n parse_result.objects[:td] = []\n parse_result.objects[:ce] = []\n parse_result.objects[:gr] = []\n parse_result.objects[:ce_id] = []\n # attach the results to the row\n @processed_rows.merge!(i => parse_result)\n\n # hot-wire the project into the row\n row['project_id'] = @project_id.to_s if row['project_id'].blank?\n\n co_list = BatchLoad::ColumnResolver.collection_object_by_identifier(row)\n otu_list = BatchLoad::ColumnResolver.otu(row)\n if co_list.no_matches? # no namespace to search!\n parse_result.parse_errors.push('No CollectionObject found with the specified identifier.')\n next\n end\n co = co_list.item # there can be only one\n unless co.collecting_event.nil? # if it exists\n parse_result.parse_errors.push('The specified CollectionObject already has a CollectingEvent.')\n next\n end\n parse_result.objects[:co].push(co)\n otu = otu_list.item if otu_list.resolvable?\n otu = Otu.new(name: row['otu_name']) if otu.blank?\n parse_result.objects[:otu].push(otu)\n long = row['longitude'] # longitude\n lat = row['latitude'] # latitude\n method = row['method']\n error = (row['error'].to_s + ' ' + row['georeference_error_units'].to_s).strip\n ce_namespace = row[header5]\n ns_ce = Namespace.where(short_name: ce_namespace).first\n parse_result.parse_errors.push[\"No available namespace '#{ce_namespace}'.\"] if ns_ce.nil?\n\n begin # processing the TaxonDetermination\n td_attributes = {otu: otu,\n biological_collection_object: co}\n td_match = Digest::SHA256.digest(td_attributes.to_s)\n td = build_objects[td_match]\n td = TaxonDetermination.find_by(td_attributes) if td.nil?\n td = TaxonDetermination.new(td_attributes) if td.nil?\n parse_result.objects[:td].push(td)\n build_objects.merge!(td_match => td)\n end\n\n begin # processing Identifier\n ce_id_attributes = {namespace: ns_ce,\n identifier_object_type: 'CollectingEvent',\n project_id: @project_id,\n type: 'Identifier::' + row[header7],\n identifier: row[header6]}\n ce_id_match = Digest::SHA256.digest(ce_id_attributes.to_s)\n ce_id = build_objects[ce_id_match]\n ce_id = Identifier.find_by(ce_id_attributes) if ce_id.nil?\n ce_id = Identifier.new(ce_id_attributes) if ce_id.nil?\n parse_result.objects[:ce_id].push(ce_id)\n build_objects.merge!(ce_id_match => ce_id) # whichever way we came by it, save the item in our stash\n end\n\n co.collecting_event = ce\n i += 1\n end\n @total_lines = i - 1\n end", "def full_conditions\n if @variable\n conditions.merge({@variable => @value})\n else\n conditions\n end\n end", "def to_list\n\t\t# Binder.collection.group(key: :owner, cond: {}, initial: {count: 0}, reduce: \"function(doc,prev) {prev.count += +1;}\")\n\t\t# <query>.selector inserted into conditions field\n\t\trange = Range.new(grouphash['range'].first.to_i,grouphash['range'].last.to_i)\n\t\traw = kollection.titleize.constantize.collection.group(\t:key => grouphash['groupvals']['key'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:cond => grouphash['groupvals']['cond'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:initial => grouphash['groupvals']['initial'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:reduce => grouphash['groupvals']['reduce'])\n\t\traw = raw.map{ |f| { f['owner'] => f['count'].to_i } }\n\t\traw = raw.reject{ |f| range.cover?(f.first[1]) }\n\t\traw.map{ |f| f.first[0] }\n\tend", "def do_calc_action_if\n # A quick return if this is not a hash or it is empty\n return true unless action_conf.is_a?(Hash) && action_conf.first\n\n # Final result for all selections\n final_res = true\n\n self.action_conf = action_conf.symbolize_keys\n\n # Simple conditions to always return\n # never: true\n # always: true\n return false if action_conf[:never]\n return true if action_conf[:always]\n\n # calculate that all the following sets of conditions are true:\n # (:all conditions) AND (:not_all conditions) AND (:any conditions) AND (:not_any conditions)\n #\n # selection_type=all|any|not_all|not_any:\n # table_name:\n # condition: string|reference_condition\n # selection_type:\n # table_name: ...\n\n action_conf.each do |condition_type, condition_config_array|\n # If the condition definition is not an array, make it one\n condition_config_array = [condition_config_array] unless condition_config_array.is_a? Array\n\n # Provide the option of configuring as a list of conditions, such as:\n # not_any:\n # - addresses: ...\n # - addresses: ...\n #\n # ...or...\n #\n # not_any:\n # addresses: ...\n # player_contacts: ....\n #\n # all of which must meet the condition type\n #\n # Nesting is allowed, which is handled appropriately\n\n # Save the original key, representing the condition type, such as :not_all_fields_must_match\n orig_cond_type = condition_type\n\n # If the condition_type key is not a selection type, use the original condition_type\n # value since it represents a table name or other reference item\n condition_type = is_selection_type(condition_type) || condition_type\n\n # Initialize the loop result, as true for all, not_any, since they AND results,\n # not_all and any OR results, so must be initialized to false\n loop_res = condition_type.in?(%i[all not_any])\n orig_loop_res = loop_res\n\n # For each condition config definition, run the main tests\n condition_config_array.each do |condition_config|\n @condition_config = condition_config\n\n # Check if the first key is a selection type. If it is, wrap it in a\n # {this: original hash} to make it easier to process consistently\n @condition_config = { this: @condition_config } if is_selection_type(@condition_config.first.first)\n\n # Calculate the base query and conditions to use later\n calc_base_query condition_type\n\n #### :all ####\n if condition_type == :all\n cond_res = true\n res_q = true\n # equivalent of (cond1 AND cond2 AND cond3 ...)\n # These conditions are easy to handle as a standard query\n # @this_val_where check allows a return_value definition to be used alone without other conditions\n unless @condition_values.empty? && @extra_conditions.empty? && !@this_val_where\n gen_condition_scope @condition_values, @extra_conditions\n calc_return_types\n res_q = calc_nested_query_conditions\n merge_failures(condition_type => @condition_config) unless res_q\n end\n\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q &&= calc_non_query_condition(table, field_name, expected_val)\n merge_failures(condition_type => { table => { field_name => expected_val } }) unless res_q\n end\n end\n\n cond_res &&= !!res_q\n loop_res &&= cond_res\n\n #### :not_all ####\n elsif condition_type == :not_all\n cond_res = true\n res_q = true\n # equivalent of NOT(cond1 AND cond2 AND cond3 ...)\n unless @condition_values.empty? && @extra_conditions.empty?\n gen_condition_scope @condition_values, @extra_conditions\n calc_return_types\n res_q = calc_nested_query_conditions\n end\n\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q &&= calc_non_query_condition(table, field_name, expected_val)\n end\n end\n\n cond_res &&= !res_q\n\n # Not all matches - return all possible items that failed\n merge_failures(condition_type => @condition_values) unless cond_res\n merge_failures(condition_type => @non_query_conditions) unless cond_res\n\n loop_res ||= cond_res\n\n #### :any ####\n elsif condition_type == :any\n\n unless @extra_conditions.empty?\n raise FphsException, '@extra_conditions not supported with any / not_any conditions'\n end\n\n cond_res = false\n res_q = false\n # equivalent of (cond1 OR cond2 OR cond3 ...)\n\n if @condition_values.empty?\n # Reset the previous condition_scope, since it could be carrying unwanted joins from an all, not_any condition\n @condition_scope = nil\n reset_scope = nil\n else\n\n @condition_values.each do |table, fields|\n fields.each do |field_name, expected_val|\n gen_condition_scope({ table => { field_name => expected_val } }, @extra_conditions, 'OR')\n calc_return_types\n res_q = !@condition_scope.empty?\n\n break if res_q\n end\n break if res_q\n end\n\n reset_scope = @base_query.order(id: :desc).limit(1)\n end\n\n # Reset the condition scope, since gen_condition_scope will have messed with it\n @condition_scope = reset_scope\n res_q ||= calc_nested_query_conditions return_first_false: false unless res_q || @condition_scope.nil?\n\n # If no matches - return all possible items that failed\n merge_failures(condition_type => @condition_values) unless res_q\n\n unless res_q\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q ||= calc_non_query_condition(table, field_name, expected_val)\n break if res_q\n end\n end\n end\n\n merge_failures(condition_type => @non_query_conditions) unless res_q\n\n cond_res = res_q\n loop_res ||= cond_res\n\n #### :not_any ####\n elsif condition_type == :not_any\n\n unless @extra_conditions.empty?\n raise FphsException, '@extra_conditions not supported with any / not_any conditions'\n end\n\n cond_res = true\n # equivalent of NOT(cond1 OR cond2 OR cond3 ...)\n # also equivalent to (NOT(cond1) AND NOT(cond2) AND NOT(cond3))\n\n if @condition_values.empty?\n # Reset the previous condition_scope, since it could be carrying unwanted joins from an all, not_any condition\n @condition_scope = nil\n reset_scope = nil\n else\n\n @condition_values.each do |table, fields|\n fields.each do |field_name, expected_val|\n gen_condition_scope({ table => { field_name => expected_val } }, @extra_conditions, 'OR')\n calc_return_types\n res_q = !@condition_scope.empty?\n merge_failures(condition_type => { table => { field_name => expected_val } }) if res_q\n cond_res &&= !res_q\n break unless cond_res && !return_failures\n end\n break unless cond_res && !return_failures\n end\n\n reset_scope = @base_query.order(id: :desc).limit(1)\n end\n\n # Reset the condition scope, since gen_condition_scope will have messed with it\n @condition_scope = reset_scope\n if cond_res && !@condition_scope.nil?\n res_q = calc_nested_query_conditions return_first_false: false\n cond_res &&= !res_q\n end\n\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q = !calc_non_query_condition(table, field_name, expected_val)\n merge_failures(condition_type => { table => { field_name => expected_val } }) unless res_q\n cond_res &&= res_q\n end\n end\n\n loop_res &&= cond_res\n else\n raise FphsException, \"Incorrect condition type specified when calculating action if: #{condition_type}\"\n end\n\n log_results orig_cond_type, condition_type, loop_res, cond_res, orig_loop_res\n\n # We can end the loop, unless the last result was a success\n break unless loop_res\n end\n\n final_res &&= loop_res\n break unless final_res\n end\n\n # Return the final result\n !!final_res\n end", "def exp_conditions_search_fields\n flds = experimental_conditions.collect do |ec|\n [ec.measured_item.title,\n ec.substances.collect do |sub|\n #FIXME: this makes the assumption that the synonym.substance appears like a Compound\n sub = sub.substance if sub.is_a?(Synonym)\n [sub.title] |\n (sub.respond_to?(:synonyms) ? sub.synonyms.collect { |syn| syn.title } : []) |\n (sub.respond_to?(:mappings) ? sub.mappings.collect { |mapping| [\"CHEBI:#{mapping.chebi_id}\", mapping.chebi_id, mapping.sabiork_id.to_s, mapping.kegg_id] } : [])\n end\n ]\n end\n flds.flatten.uniq\n end", "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def filter_hash(hash, filter, debug = false)\n fail 'Hash argument is not a Hash!' unless hash.is_a? Hash\n\n filtered_hash = {}\n select_logic = case filter\n when String then 'k.nil? ? false : k[Regexp.new(filter)] && k.length == filter.length'\n when (Fixnum || Integer || Float || Numeric) then \"k[Regexp.new('#{filter}')]\"\n when Regexp then 'k[filter]'\n when Symbol then\n 'k == filter'\n when NilClass then true # Return all specs if a filter is set to nil (i.e. user doesn't care about this filter)\n else true\n end\n filtered_hash = hash.select do |k, v|\n # binding.pry if filter == 'SubSection A'\n [TrueClass, FalseClass].include?(select_logic.class) ? select_logic : eval(select_logic)\n end\n filtered_hash\n end", "def conditions\n [@clause, current_id, *@clause_args]\n end", "def association_filter_key_expression(keys, meths, obj)\n vals = if obj.is_a?(Sequel::Dataset)\n {(keys.length == 1 ? keys.first : keys)=>obj.select(*meths).exclude(Sequel::SQL::BooleanExpression.from_value_pairs(meths.zip([]), :OR))}\n else\n vals = Array(obj).reject{|o| !meths.all?{|m| o.get_column_value(m)}}\n return SQL::Constants::FALSE if vals.empty?\n if obj.is_a?(Array)\n if keys.length == 1\n meth = meths.first\n {keys.first=>vals.map{|o| o.get_column_value(meth)}}\n else\n {keys=>vals.map{|o| meths.map{|m| o.get_column_value(m)}}}\n end \n else\n keys.zip(meths.map{|k| obj.get_column_value(k)})\n end\n end\n SQL::BooleanExpression.from_value_pairs(vals)\n end", "def condition_properties\n properties = Set.new\n\n each_comparison do |comparison|\n properties << comparison.subject if comparison.subject.kind_of?(Property)\n end\n\n properties\n end", "def conditions_to_fields(conditions)\n conditions.inject({}) do |fields, (key, value)|\n fields.merge(key => value)\n end\n end", "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", "def criteria_selection(books_list, selection_criteria)\n books_keys = books_list.keys\n counter = 0\n selected_items = {}\n\n loop do\n break if counter == books_keys.size\n\n current_key = books_keys[counter]\n current_value = books_list[current_key]\n\n if current_value == selection_criteria\n selected_items[current_key] = current_value # the current key of the\n # selected items is assigned to the current value\n end\n counter += 1\n end\n\n selected_items\nend", "def keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n uniqueArray = []; techCount = 0; booking = 0\n aggregateCursor.each do |doc|\n techCount += 1\n uniqueArray << doc[:_id][:customers]\n end\n uniqueArray = uniqueArray.uniq\n keyArray << 'techPenetration'; valueArray << ScalarCalculators.calculateRatio(techCount, uniqueArray.size).to_f\n\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def construct_owner_conditions(table = aliased_table, reflection = @reflection)\n construct_owner_attributes(reflection).map do |attr, value|\n table[attr].eq(value)\n end\n end", "def select_columns_by_kv h, k, v, columns = nil, method_name = :filter_by_kv\n filtered = method(method_name).call h, k, v\n columns && filtered.map {|h1| columns.map {|c| [c, h1[c]] }.to_h} || (!columns) && filtered\n end", "def compute_criteria_to_check\n if params[:hour]\n hours = [params[:hour]]\n require_all = true\n else\n hours = (0...24).to_a\n require_all = channel.update_frequency == DataProviderChannel::UPDATES_HOURLY\n end\n options_list = hours.map do |hour|\n prefix = basename_prefix(\n :channel_name => channel.name,\n :date => params[:date], :hour => hour\n )\n {:date => params[:date], :hour => hour, :prefix => prefix}\n end\n [options_list, require_all]\n end", "def build_map( view_name, class_constraint=nil )\n constraints = []\n if view_name\n constraints << \"doc['#{view_name}']\"\n emit_key = \"doc['#{view_name}']\"\n else\n emit_key = \"doc['_id']\"\n end\n\n if class_constraint.class == Class\n constraints << \"doc['class_'] == '#{class_constraint}'\"\n elsif class_constraint.class == String\n constraints << class_constraint\n end\n\n \"function(doc) {\n if (#{constraints.join(' && ')}){\n emit( #{emit_key}, 1 );\n }\n }\"\n end", "def conditions\n mass_conditions.clone.merge(@conditions)\n end" ]
[ "0.65586853", "0.5975154", "0.5974988", "0.5974988", "0.59626555", "0.5905237", "0.5857997", "0.5810057", "0.579916", "0.5777743", "0.5742093", "0.5718929", "0.5718929", "0.5700071", "0.5673351", "0.5665763", "0.5665763", "0.562318", "0.55832344", "0.55558103", "0.5538823", "0.5525505", "0.5483456", "0.54251945", "0.5415299", "0.5407178", "0.5391114", "0.53910214", "0.53848773", "0.5382709", "0.53735155", "0.53708166", "0.53562623", "0.5328423", "0.5321219", "0.531122", "0.52989745", "0.5292708", "0.5291992", "0.525654", "0.5227039", "0.5226827", "0.5217216", "0.5188768", "0.51873", "0.5167196", "0.51641065", "0.51573133", "0.5152194", "0.51477087", "0.51390725", "0.51263934", "0.50955826", "0.50945175", "0.50939566", "0.50739765", "0.50671506", "0.5066583", "0.5056886", "0.5005761", "0.50028497", "0.5000924", "0.500086", "0.5000216", "0.4993332", "0.49873173", "0.4981696", "0.4977091", "0.497515", "0.49714053", "0.49656793", "0.4963321", "0.49496946", "0.49474233", "0.49271637", "0.49265575", "0.49137902", "0.49135187", "0.49048516", "0.49028987", "0.48977387", "0.48940697", "0.4882212", "0.48760346", "0.48759526", "0.48711848", "0.48690474", "0.48594698", "0.48584202", "0.485282", "0.4847058", "0.48466638", "0.48447436", "0.48431122", "0.48345885", "0.48275024", "0.4826062", "0.4813109", "0.4809422", "0.48085856" ]
0.62219423
1
Autoguess whether it should be an exact or partial match
def make_coll_operator(field, value) if value.match(/[*?]/) type = Xmms::Collection::TYPE_MATCH else type = Xmms::Collection::TYPE_EQUALS end op = Xmms::Collection.new(type) op.attributes["field"] = field op.attributes["value"] = value.gsub(/\*/, '%').gsub(/\?/, '_') return op end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exact_match?\n !partial_match?\n end", "def exact_match?\n search_settings = @settings['search']\n matching = search_settings.fetch('matching', 'pattern').normalize_matching\n matching == :exact\n end", "def found_exact?\n @found_exact\n end", "def case_insensitive_match; end", "def exact?\n @exact\n end", "def exact_match\n @solr_data[:exact_match]\n end", "def match_query(query); end", "def partial_match?\n @json['results'][0]['partial_match'] == true\n end", "def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end", "def exact_match?(name1:, name2:)\n return false unless name1.present? && name2.present?\n\n a = name_without_alias(name: name1.downcase)\n b = name_without_alias(name: name2.downcase)\n a == b\n end", "def exact_flag_match_required?\n @require_exact_flag_match\n end", "def case_insensitive_match=(_arg0); end", "def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend", "def exact_match?\r\n warning.nil?\r\n end", "def exact_match?\r\n warning.nil?\r\n end", "def match?(name); end", "def exact_match_string\n @matches.nil? ? nil : @matches[0]\n end", "def exact_match?(arguments, keyword_arguments)\n definition.exact_match?(arguments, keyword_arguments)\n end", "def exactize pattern\r\n pattern.include?(':') ? \"exact:#{pattern}\" : pattern\r\n end", "def article_match? (query, article_title)\n found = false\n return true if query.empty?\n temp_article = article_title.downcase\n query.each do |kw|\n pattern = Regexp.new /.*#{kw.downcase}.*/\n found = true if temp_article =~ pattern\n end\n found\nend", "def match\n true\n end", "def matched?(str)\r\n # puts \">>> #{self.matcher.source}\"\r\n # puts \">>> #{str}\"\r\n return false if (!self.implicit && str[0] != \"!\")\r\n if (self.matcher =~ str) != nil\r\n $bot.last_match = $~\r\n $log.info(\"/#{self.matcher.source}/ matched #{str}\")\r\n return true\r\n end\r\n false\r\n end", "def match(keyword); end", "def accept?(fuzz_match)\n\t\t\t\ttrue\n\t\t\tend", "def match(input); end", "def matched?( other = nil )\n return full? if other.nil?\n matches.include? other\n end", "def normalize_matching(default = :pattern)\n case self\n when /^f/i\n :fuzzy\n when /^p/i\n :pattern\n when /^e/i\n :exact\n else\n default.is_a?(Symbol) ? default : default.normalize_matching\n end\n end", "def test_strict_match_criteria\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")\n cedict_entry = CEdictEntry.new\n cedict_entry.parse_line(\"工作 工作 [gong1 zuo4] /job/work/construction/task/CL:個|个[ge4],份[fen4],項|项[xiang4]/\")\n \n result = entry.default_match_criteria.call(cedict_entry,entry)\n assert(true,result)\n end", "def case_exact\n return @case_exact\n end", "def pre_match() end", "def match?(name, literal) true end", "def match; end", "def match; end", "def match?\n false\n end", "def fnmatch?(matcher); end", "def maybe_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 1\nend", "def matches_specs(text)\n text = text.downcase\n matches = false\n\n # some of Terri's terms were redundant so I removed them\n matches = true if text =~ /\\bsid|pakistan[.]* rendition|apartheid|apart[.]* regime|apart[.]* state|palestin[.]*/\n matches = true if text =~ /israel/ and text =~ /human rights violations/\n\n matches\nend", "def try_exact_match(review)\n possible_titles = review.ars_titles.collect(&:title)\n exact_match = false\n possible_titles.each do |possible_title|\n puts \"TRYING #{possible_title} for exact match\"\n \n # TODO: self here instead of class?\n if GiantLookup.new.is_title? possible_title\n return GiantLookup.new.find_games_by_title(possible_title).first\n end\n end\n \n # nothing found, oh well\n return nil\n end", "def set_partial_name_match\n return if waypoints.length == 0\n #Only need to compute partial name match if new or a name has changed.\n return unless self.id.nil? || self.name_changed? || self.alternate_names_changed?\n #For each place look for trimmed name inside the places full names\n Place.find_by_radius(averageLatitude, averageLongitude, 70).each do |place|\n next if place == self\n trimmed_names.each do |trimmed| #Look for trimmed names in neighbour places names\n\tplace.raw_names.each do |name|\n\t if name.match(trimmed)\n\t self.partial_name_match = false\n\t return\n\t end\n\tend\n end\n end\n self.partial_name_match = true\n end", "def match?(given_names); end", "def delegate_to_search_pattern\n /(?:_equals|_contains|_gte|_lte)\\z/\n end", "def matches?(*)\n # by default nothing matches\n nil\n end", "def matches?(pattern); end", "def default_match_criteria\n match_criteria = Proc.new do |dict_entry, tag_entry|\n same_headword = (dict_entry.headword_trad == tag_entry.headword_trad) || (dict_entry.headword_simp == tag_entry.headword_simp)\n if same_headword\n # Now process the pinyin and see if we match\n tag_pinyin = tag_entry.pinyin.gsub(\" \",\"\")\n dict_pinyin = dict_entry.pinyin.gsub(\" \",\"\")\n if dict_entry.meaning_txt.downcase.index(\"surname\")\n same_pinyin = (dict_pinyin == tag_pinyin)\n else\n same_pinyin = (dict_pinyin.downcase == tag_pinyin.downcase)\n end\n \n # If we didn't match right away, also check for the funny tone changes \n if (same_pinyin == false and (tag_pinyin.index(\"yi2\") or tag_pinyin.index(\"bu2\")))\n same_pinyin = (dict_pinyin.downcase == tag_pinyin.downcase.gsub(\"yi2\",\"yi1\").gsub(\"bu2\",\"bu4\"))\n end\n \n # The return keyword will F everything up!\n (same_headword and same_pinyin)\n else\n false\n end\n end\n return match_criteria\n end", "def stop_if_match; true; end", "def first_letter_match\n @query[0] == @reference[0]\n end", "def exact_match(user_word)\n @loader.arr.each do |word|\n return word if word == user_word\n end\n end", "def allow_matcher; end", "def exact_match(guess)\n\t\t\t# keeps track of which indices have been matched\n\t\t\t@indices = [0,1,2,3]\n\t\t\t# creates array of the matching indices in guess and @code\n\t\t\t@indices.delete_if {|i| guess[i] == @code[i] }\n\t\t\t# returns number of exact matches\n\t\t\t4 - @indices.length\n\t\tend", "def matching_exactly_one_word\n /WRITE ME/\n end", "def match_to_regex(match, type=:fuzzy)\n match.downcase!\n if type == :exact\n /^#{match}$/\n else\n /#{match}/\n end\n end", "def match?(str)\n query = query_obj(str)\n tag_query = query[:tag]\n class_query = query[:classes]\n prop_query = query[:properties]\n\n (tag_query.blank? || match_tag?( tag_query )) &&\n (class_query.blank? || match_class?( class_query )) &&\n (prop_query.blank? || match_prop?( prop_query ))\n end", "def calculate_match_probability\n # two heuristics: \n # 1 is are their multiple words in term_text? if so, mark as probable\n # if not, does it match the anchor regexp? if so, mark as probable\n # else, mark as improbable\n \n # multiple words?\n anchor_regexp = \"(featuring|plus|the|presents|with|plus|and|\\,|\\&|[()]|\\/|\\:|\\-|^|$)\"\n nix_regexp = \"parking|\\svs\\.?\\s\" \n if artist_name=~/#{nix_regexp}/i\n self.match_probability=\"unlikely\"\n return nil\n end\n text=term_text.strip\n if text[\" \"]\n self.match_probability=\"likely\"\n return \"multpl\"\n end\n if artist_name=~/#{anchor_regexp}\\s*#{text}\\s*#{anchor_regexp}/i\n self.match_probability=\"likely\"\n return \"regexp\"\n end\n# if artist_name=~/#{anchor_regexp}\\s+?#{text}\\s+?#{anchor_regexp}/i\n# match_probability=\"likely\"\n# return \"regexp\"\n# end\n self.match_probability=\"unlikely\"\n return nil\n end", "def exact_match?(new_model, crucial_params, match_params)\n all_params = crucial_params.merge(match_params)\n # logger.info \"all_params: #{all_params}\"\n matches = new_model.class.where(all_params)\n return false unless matches.any?\n if matches.count > 1\n logger.warn 'Multiple exact matches found for the scraped new model. Something is wrong'\n logger.info \"#{matches.count} matches found for #{new_model.class} with params #{all_params}\"\n end\n if new_model.class == SimpleEvent\n logger.info \"exact match found for params #{all_params.keys}, moving to next item\"\n end\n true\n end", "def matcher; end", "def matcher; end", "def perfect_match\n query = @query.downcase.as_wiki_link\n page = all_pages.detect { |name| name.downcase == query }\n SearchResult.new(page, 1) if page\n end", "def partial_matches_for(input_string)\n # [\"aardvark\", \"apple\"]\n @word_list.select do |word|\n word.start_with?(input_string)\n end\n end", "def probable_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 2\nend", "def fuzzy_match\n return unless @keywords.any?\n\n @matches = fuzz_ball.load.find @keywords.join(\" \"), @options[:limit]\n @query = Ydl::Videos\n return if @matches.empty?\n\n # @matches.map! do |match|\n # match.push (match[1]/match[2].to_f * 100).to_i\n # end if @matches.any?\n\n @query = Ydl::Videos.with_pk_in(@matches.map(&:first))\n end", "def name_search # :nologin: :norobots:\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) and\n (name = Name.safe_find(pattern))\n redirect_to(:action => 'show_name', :id => name.id)\n else\n query = create_query(:Name, :pattern_search, :pattern => pattern)\n @suggest_alternate_spellings = pattern\n show_selected_names(query)\n end\n end", "def post_match() end", "def match_a_b?(string)\n if /b/.match(string)\n puts \"we have a match\"\n else \n puts \"no match at all\"\n end\nend", "def matches? (search)\n if (search.nil? || search == \"\")\n return true\n end\n search = search.gsub(/[^0-9a-z ]/i, '').downcase\n searches = search.split(' ')\n \n searches.each do |word|\n word += ' '\n title = self.title.nil? ? ' ' : self.title.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n description = self.description.nil? ? ' ' : self.description.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n venue_name = self.venue.name.nil? ? ' ' : self.venue.name.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n if !(title.include?(word) || description.include?(word) || venue_name.include?(word))\n return false\n end\n end\n\n return true\n end", "def match(input)\n input \n end", "def test_match_case_sensitive_within_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"1234MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with within.\")\r\n\tend", "def matching_the_word_and\n /WRITE ME/\n end", "def partial_match?(date2)\n self.class::partial_match?(self, date2)\n end", "def matches_requirement?(query, option, requirement); end", "def check(input, short_form)\n return false unless input.match short_form\n x = Regexp.last_match\n @match_data = binding\n true\n end", "def fuzzy_match( input, match_against )\n [*match_against].each_with_index do |targ, idx|\n if input =~ /^#{targ}$/i\n return idx\n elsif input.slice(0..5) =~ /^#{targ.slice(0..5)}/i\n return idx\n end\n end\n return nil\n\n end", "def test_truthy_finds(tests, method, options = {})\n tests.each do |test|\n matches = Ramparts.send(method, test[:text], options)\n test[:matches].each_with_index do |match_string, index|\n if matches[index].nil? || matches[index][:value].casecmp(match_string) != 0\n got_result = matches[index].nil? ? 'NIL' : matches[index][:value]\n raise \"Expected: #{match_string}\\nGot: #{got_result}\\nBlock '#{test[:text]}'\\nResult: #{matches}\"\n end\n end\n end\nend", "def fuzzy_match_cutoff\n 0.3\n end", "def match(pattern); end", "def fuzzy_match( query )\n return self.keywords.fuzzy_match(query)\n end", "def exact?\n return false unless @requirements.size == 1\n @requirements[0][0] == \"=\"\n end", "def matches?(value, context); end", "def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end", "def is_correct?\n self.match.final_result == selected_result\n end", "def partial_word? word = ''\n is? :partial_word, word\n end", "def matched_by_basic_range?(range)\n if range.kind_of?(Composition)\n s = range.composition\n elsif range.respond_to?(:to_str)\n s = range.to_str.downcase\n return true if s == WILDCARD\n else\n return false\n end\n\n composition == s ||\n composition.index(s + HYPHEN) == 0\n end", "def match(p0) end", "def match(p0) end", "def substring?(long_string, short_string)\n\n long_string.match(short_string) != nil\n\nend", "def specified? description, fuzzy: false\n words = description.split(SPLIT_REGEXP)\n return false if words.empty?\n matches = 0\n available = keywords\n words.each { |w|\n if fuzzy\n available.each { |k|\n if k.gsub(/[^a-z0-9]/, '').start_with?(w.downcase.gsub(/[^a-z0-9]/, ''))\n matches +=1\n break\n end\n }\n else\n matches +=1 if available.include?(w.downcase)\n end\n }\n matches == words.length\n end", "def include?(searchstring, substring)\n\nend", "def matches(filter)\n return true unless filter\n filter = filter.downcase\n @title.downcase.include?(filter) ||\n @id.downcase.include?(filter) ||\n !(@aliases.select { |a| a.downcase.include?(filter) }.empty?) ||\n @path.downcase.include?(filter)\n end", "def loose_match_criteria\n match_criteria = Proc.new do |dict_entry, tag_entry|\n same_headword = (dict_entry.headword_trad == tag_entry.headword_trad) || (dict_entry.headword_simp == tag_entry.headword_simp)\n end\n return match_criteria\n end", "def match?(instance)\n match_id?(instance) || match_percentage?(instance) || match_groups?(instance)\n end", "def match_text_exact(match_string, reject = false)\n text = match_string.downcase || \"\"\n proc = Proc.new { |entry|\n title, summary, content = cleaned_content(entry)\n title.include?(text) ||\n summary.include?(text) ||\n content.include?(text)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def match!\n clear!\n tighten_search_area\n @benchmark = Benchmark.measure do\n send(strategy_method)\n end\n save_match_file if highlight_match\n return has_match?\n end", "def matches?(ref_name)\n return false if @ref_name_or_pattern.blank?\n\n exact_match?(ref_name) || wildcard_match?(ref_name)\n end", "def is_match(s, p)\n\treturn true if s == p\n\treturn true if s == \"*\" || p == \"*\"\n\tif s.length == p.length\n\t\tbooleans = []\n\t\ti = 0\n\t\twhile s.length > i\n\t\t\tbooleans << (s[i] == \"?\" || p[i] == \"?\" || s[i] == p[i])\n\t\t\ti += 1\n\t\tend\n\t\tbooleans.each do |statement|\n\t\t\treturn true if statement\n\t\tend\n\tend\n\tfalse\nend", "def matching_greeting_exactly\n /WRITE ME/\n end", "def loose_match?(unit)\n return false if @type != unit.type\n return false if custom? && @custom_name.casecmp(unit.custom_name) != 0\n true\n end", "def matching?(word_to_match)\n anagram?(word_to_match) && !words_the_same?(word_to_match)\n end", "def matches_title?(q)\n search_regexp = /(\\b|[\\/\\._-])#{Regexp.escape(q)}/\n\n @result[:title].downcase =~ search_regexp ||\n # Break CamelCase words into their individual components and search\n @result[:title].gsub(/([a-z\\d])([A-Z])/,'\\1 \\2').downcase =~ search_regexp\n end", "def test_match_case_sensitive_distance_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 11\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,4),\"incorrect match on content with distance.\")\r\n\tend", "def matches?(field, value)\n\t\tdown_field = field.downcase\n\t\tdown_val = value.downcase\n approx = false\n\n if down_val.start_with?('~')\n approx = true\n down_val = down_val[1..-1]\n end\n\n\t\tif @fields[0].eql?(down_field)\n\t\t\t@name.eql?(down_val) || @name.start_with?(down_val) || @name.include?(down_val)\n\t\telsif @data.has_key?(down_field)\n\t\t\t@data[down_field].include?(down_val) || approx ? @data[down_field].include_similar?(down_val) : false\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def update!(**args)\n @exact_match = args[:exact_match] if args.key?(:exact_match)\n end", "def address_matches(spec, address)\n (0..3).all? { |i| spec[i]=='*' || spec[i]==address[i] }\nend" ]
[ "0.7785559", "0.7454499", "0.6808945", "0.67950094", "0.6765556", "0.66734785", "0.66085404", "0.6597184", "0.659228", "0.6591718", "0.65492135", "0.64697164", "0.6404342", "0.63704276", "0.63704276", "0.6336196", "0.6333557", "0.6329857", "0.62806696", "0.6248664", "0.6239668", "0.61852854", "0.6182915", "0.6161752", "0.61268806", "0.6126776", "0.6125902", "0.61195946", "0.6091441", "0.6082227", "0.60762155", "0.60739547", "0.60739547", "0.6068252", "0.60556865", "0.60553396", "0.6044567", "0.60429823", "0.60354686", "0.60077906", "0.6004704", "0.5998462", "0.59801733", "0.597754", "0.5961724", "0.5957394", "0.5956637", "0.59134746", "0.5904488", "0.5899217", "0.5897417", "0.5873968", "0.58723843", "0.5870671", "0.58570725", "0.58570725", "0.5846954", "0.5843567", "0.5837295", "0.58343023", "0.5832936", "0.5821926", "0.58168906", "0.5814912", "0.5810795", "0.58005387", "0.57943326", "0.57929057", "0.5792335", "0.57799345", "0.5775686", "0.5774281", "0.57739145", "0.5764241", "0.5761484", "0.57611096", "0.57592636", "0.57514083", "0.5749822", "0.5729823", "0.5722795", "0.57206523", "0.57206523", "0.5704018", "0.5700974", "0.56965625", "0.56803334", "0.56655985", "0.5657011", "0.5652886", "0.5651469", "0.5649755", "0.56491774", "0.5649171", "0.5646509", "0.5645529", "0.5637282", "0.5636864", "0.563606", "0.56328845", "0.5626771" ]
0.0
-1
PUT /comments/1.xml PUT /comments/1.json
def update @comment = Comment.find(params[:id]) respond_to do |format| if @comment.update_attributes(params[:comment]) format.xml { head :ok } format.json { head :ok } else format.xml { render :xml => @comment.errors, :status => :unprocessable_entity } format.json { render :json => @comment.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end", "def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end", "def comments_put(resource, comment)\n merged_options = options.merge({ resource: resource, comment: comment })\n response = RestClient.post endpoint(\"/comments/put\"), merged_options\n parse_response(response)\n end", "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end", "def update\n @comment_node = CommentNode.find(params[:id])\n\n respond_to do |format|\n if @comment_node.update_attributes(params[:comment_node])\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = @item.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.update(params[:id],params[:comment]))\n end", "def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end", "def update\n\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n\n end\n\n\n end", "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, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.updated\") }\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", "def update\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update_attributes(comment_params)\n render json: @comment, status: :ok\n else\n render json: {error: \"Not found\"}, status: :not_found\n end\n end", "def update\n @comment = @task.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(sprint_task_comments_path(@sprint,@task)) }\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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n respond_to do |wants|\n if @comment.update_attributes(params[:comment])\n wants.html { redirect_to(@comment) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n if @comment.update(comment_params)\n render json: {status: \"success\", data: {comment: @comment}}, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n @meta[:title] = \"Comment from #{@comment.author}\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(location_comments_path(@comment.location)) }\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", "def update\n=begin @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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\n create\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@story) }\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", "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.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", "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.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", "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.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", "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.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", "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.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", "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.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", "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.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", "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.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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@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", "def update\n @comment.update_attributes(params[:comment])\n respond_with(@comment, location: redirect_to_index)\n end", "def update\n @comment = @network.comments.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to([:admin, @network, :comments]) }\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", "def update\n comment = Comment.find(params[:id])\n if comment.update(params_comment)\n render json: comment, status: 200\n else\n render json: comment.errors, status: 422\n end\n\n end", "def update\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@comment, :notice => 'Sitio actualizado correctamente.') }\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", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n render json: @comment, serializer: CommentSerializer\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end", "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.generic_item, :notice => t('notice.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", "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", "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", "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", "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", "def update\n @comment = Comment.find(params[:id])\n authorize @comment\n if @comment.update(comment_params)\n render 'api/v1/comments/show', status: :success\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end", "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: t(\"actions.updated\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\"))}\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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to comment_url(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors.to_xml }\n end\n end\n end", "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", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n # @comment = Comment.find(params[:id])\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to comment_url(@entry,@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", "def update_comment(id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/update_comment\", :comment_id => id,\n :comment => comment, :attachments => attachments\n end", "def update\n @comment.update(comment_params)\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(admin_comments_url) }\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", "def update\n if @comment.update(comment_params)\n render json: {status: 'Comment was successfully updated.'}, status: :201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |wants|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n wants.html { redirect_to pretty_post_url(@comment.post) + \"#comment_#{@comment.id}\" }\n wants.xml { head :ok }\n else\n wants.html { render :action => 'edit' }\n wants.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to project_sprint_user_story_comments_path, 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", "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 => @comment, :status => 200} }\n else\n format.html { render :edit }\n format.json { render :json => {:comment => @comment, :status => 400 } }\n end\n end\n end", "def update\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n if @comment1.update_attributes(params[:comment1])\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @comment.update_attributes(params[:comment])\n\t\t\t\tflash[:notice] = 'Comment was successfully updated.'\n\t\t\t\tformat.html { redirect_to(post_path(@post)) }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @comment.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\r\n @eventcomment = Eventcomment.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @eventcomment.update_attributes(params[:eventcomment])\r\n format.html { redirect_to event_path(params[:id]), notice: 'Eventcomment was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @eventcomment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update_comment\n @comment = Comment.find(params[:id])\n @comment.update(params[:comment])\n redirect \"/comments/#{@comment.id}\"\n end", "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.blog}\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", "def update\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n #@comment.create_activity :update, owner: current_user\n format.html { redirect_to postings_path, 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", "def update(key, cookie, update, comment, params={})\n cookie_header = { 'Cookie' => cookie }\n comment_header = {\n 'Opt' => '\"http://openlibrary.org/dev/docs/api\"; ns=42',\n '42-comment' => comment\n }\n params.merge!(cookie_header)\n params.merge!(comment_header)\n params.merge!(content_type: :json, accept: :json)\n update_url = \"#{API_URL}#{key}\"\n\n response = RestClient.put(update_url, update, params, &HANDLE_REST_CLIENT_RESPONSE)\n parse(response)\n end", "def update_comment(resource_id, comment_id, params)\n http.put(\"#{comment_endpoint(resource_id)}/#{comment_id}\", body: params) do |response|\n Rexpense::Entities::Comment.new response.parsed_body\n end\n end", "def update(comment)\n response = ODPS.conn.put do |req|\n req.url \"projects/#{self.name}\"\n req.headers['Content-Type'] = 'application/xml'\n req.body = serialize [String, nil, 'Name', @name],\n [String, nil, 'Comment', comment]\n end\n # Update project object's +comment+ attribute\n if response.status == 200\n self.comment = comment\n end\n end", "def update\n\n if @comment.update(comment_params)\n\n render json: @comment,status: :ok\n\n else\n\n render json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "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), 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", "def update\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(edit_admin_post_comment_path(@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", "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", "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", "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", "def update\n @comment = @computer.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@computer) }\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", "def edit\n respond_with @comment\n end", "def update\n\t respond_to do |format|\n\t if @comment.update(comment_params)\n\t format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n\t format.json { head :no_content }\n\t else\n\t format.html { render action: 'comment' }\n\t format.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "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: 'Note was successfully updated.' }\n format.js { head :ok }\n else\n format.html { render action: \"edit\" }\n format.js { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "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 :show, status: :ok, \tº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", "def update\n @comment = current_user.comments.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", "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 :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", "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 :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", "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 :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", "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 :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", "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 :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", "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 :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" ]
[ "0.6638866", "0.65790904", "0.64167476", "0.64138556", "0.6344143", "0.63400936", "0.6307433", "0.6296865", "0.6282935", "0.6265966", "0.6259213", "0.6230647", "0.6226569", "0.6203838", "0.6201508", "0.6183913", "0.6177102", "0.6169761", "0.6163214", "0.6159252", "0.61578304", "0.61578304", "0.61578304", "0.61578304", "0.61578304", "0.61578304", "0.61578304", "0.61578304", "0.61534935", "0.61534935", "0.61534935", "0.61534935", "0.61534935", "0.6152862", "0.6147866", "0.61265576", "0.61246765", "0.612072", "0.612072", "0.61007595", "0.6100162", "0.6090498", "0.6090498", "0.6087151", "0.6087151", "0.6078813", "0.60698587", "0.6066706", "0.60430795", "0.60366935", "0.6031103", "0.60300165", "0.60255975", "0.6009307", "0.6009307", "0.6009307", "0.6009307", "0.6009307", "0.6009307", "0.6009307", "0.6009307", "0.6009307", "0.60052663", "0.60052663", "0.6004056", "0.59895426", "0.598287", "0.5977332", "0.597186", "0.5959586", "0.59402966", "0.59382343", "0.5913033", "0.590803", "0.59076166", "0.5897857", "0.58903295", "0.58839864", "0.58791834", "0.5876274", "0.58705264", "0.5870524", "0.586969", "0.5868895", "0.5867297", "0.585354", "0.585354", "0.585354", "0.58530515", "0.5852294", "0.5848708", "0.58439004", "0.584125", "0.5815919", "0.58127934", "0.58127934", "0.58127934", "0.58127934", "0.58127934", "0.58127934" ]
0.70375973
0
DELETE /comments/1.xml DELETE /comments/1.json
def destroy @comment = Comment.find(params[:id]) @comment.destroy respond_to do |format| format.xml { head :ok } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "def delete_comments\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(comments_url) }\n wants.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(comment_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to_commentable(@comment, false) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n head :no_content\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy!\n head :no_content\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(backdrafts_url) }\n format.xml { head :ok }\n end\n end", "def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_url(@post), :notice => \"Comment was removed\") }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def test_delete_comment\n\n comments = Comment.getAll()\n\n for comment in comments\n\n result = Comment.deleteComment(comment.commentId)\n\n assert_equal true, result\n \n end\n\n end", "def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment_node = CommentNode.find(params[:id])\n @comment_node.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_nodes_url }\n format.json { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n puts \">>>> Destroying a comment <<<<\"\n @comment = Comment.find(params[:id])\n puts \"found comment>>> #{@comment}\"\n @article = @comment.article\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_path(@article)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end", "def destroy\n @comment = @network.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n flash[:notice] = 'Comment destroyed.'\n format.html { redirect_to([:admin, @network,:comments]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @visit_comment.destroy\n respond_to do |format|\n format.html { redirect_to visit_comments_url, notice: 'Comentario eliminado con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article_comment = ArticleComment.find(params[:id])\n @article_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n flash[:notice] = \"Comment destroyed\"\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to project_sprint_user_story_comments_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n\t\tpost = @comment.post\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to pretty_post_url(post) + '#comments' }\n wants.xml { head :ok }\n end\n end", "def destroy\n @comment = @task.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(sprint_task_comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:comment_id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comentario eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end", "def destroy_comment\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n flash[:notice] = 'Comment was successfully deleted.'\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"posts\", :action => \"show\", :id => @comment.post_id, :notice => 'Comment deleted.') }\n format.xml { head :ok }\n end\n end", "def deleteComments(delete_ids, cookies)\n delete_ids.each do |delete_id|\n hmac = getHMACFromDeleteConfirmationPage(delete_id, cookies)\n payloadString = \"id=\" + delete_id + \"&hmac=\" + hmac + \"&d=Yes&goto=\"\n response = RestClient::Request.new({\n method: :post,\n url: 'https://news.ycombinator.com/xdelete',\n cookies: cookies,\n payload: payloadString,\n }).execute do |response, request, result|\n case response.code\n when 401..500\n raise \"UNABLE TO DELETE COMMENTS\"\n else\n puts \"Deleting comment: \" + delete_id\n end\n end\n end\nend", "def destroy\n @comment1.destroy\n respond_to do |format|\n format.html { redirect_to comment1s_url, notice: 'Comment1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @comment14.destroy\n respond_to do |format|\n format.html { redirect_to comment14s_url, notice: 'Comment14 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_comment1\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n k comment.destroy\n end\n }\n redirect_to requirements_path\n end", "def bulk_delete_comments\n comment_ids_string = params[:ids]\n comment_ids = eval(comment_ids_string)\n\n comment_ids.each do |id|\n comment = Comment.find(id.to_i)\n if !comment.nil?\n comment.destroy\n\n end\n\n end\n\n head :no_content\n\n end", "def destroy\n @doi.updates.each do |update|\n update.destroy\n end\n @doi.comments.each do |comment|\n comment.destroy\n end\n @doi.destroy\n respond_to do |format|\n format.html { redirect_to dois_url }\n format.json { head :no_content }\n end\n end", "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", "def destroy\n @comment = Comment.destroy(params[:id])\n end", "def destroy\n @comment = Comment.destroy(params[:id])\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, :notice => t('successfully_deleted')}\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(site_comments_path(@comment.site_id)) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @comment = Comment.find(params[:id])\r\n @comment.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(@comment.wall) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_url(@comment.post_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_blog_post_comments_url(@comment.post.blog, @comment.post)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to post_path(@comment.post) }\n format.json { head :no_content }\n end\n end", "def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n if super_user?\n @comment = Comment.find(params[:id])\n @comment.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n puts \"Inside destroy. Comment id is \"+params[:id].to_s\n #puts \"Post id is \"+params[:postid].to_s\n @comment = Comment.find(params[:id])\n @comment.destroy\n @posts = Post.find_by_id(params[:postid])\n\n respond_to do |format|\n format.html { redirect_to @posts }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_comment = SystemComment.find(params[:id])\n @system_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(system_comments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @comments = @photo.comments.all\n @comments.each do |cmt|\n cmt.destroy\n end\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@comment.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(post_path(@post)) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "def delete_comment\n @comment=Comment.find(params[:comment_id])\n @comment.destroy\n end", "def destroy\n @comment = @posting.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n #@comment.create_activity :destroy, owner: current_user\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7157358", "0.7105928", "0.70865405", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7073765", "0.7057617", "0.70268226", "0.70266134", "0.70258164", "0.6991692", "0.69799936", "0.69799936", "0.6959262", "0.69280964", "0.69260335", "0.69194305", "0.6905068", "0.6857403", "0.68516135", "0.6843716", "0.6789765", "0.67792886", "0.6778963", "0.67655116", "0.67604077", "0.6753156", "0.6750977", "0.67456496", "0.6739621", "0.6739621", "0.6739621", "0.67326427", "0.67321134", "0.6726068", "0.66972584", "0.6695172", "0.66943246", "0.66825056", "0.6680716", "0.6676807", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.66763705", "0.6667727", "0.6666041", "0.6666041", "0.6666041", "0.6665723", "0.66101587", "0.6608634", "0.6607142", "0.6602017", "0.66006815", "0.66004837", "0.6595641", "0.65881777", "0.65839726", "0.657972", "0.65762436", "0.65762436", "0.65735745", "0.65712255", "0.6566814", "0.6552424", "0.654875", "0.65464795", "0.65427023", "0.653983", "0.65363926", "0.65264314", "0.65194213", "0.65077513", "0.65015507", "0.65005386", "0.6495257", "0.6489096", "0.64828634" ]
0.7394572
0
POST /comments/exists.xml POST /comments/exists.json
def exists @record = Record.new comment = Comment.find_by_app_id_and_authorId(params[:app_id], params[:authorId], :select => :id) if comment.nil? @record.exists = false else @record.id = comment.id @record.exists = true end respond_to do |format| format.xml {render :xml => @record} format.json {render :json => @record} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_comment_creation?\n request.post? && request.request_parameters['comment'].present?\n end", "def exists?\n json['exists']\n end", "def has_comments?\n comments.size > 0\n end", "def has_comments?\n @comments_count > 0\n end", "def are_there_comments?\n @comments.size > 0\n end", "def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end", "def has_comments?\n !comments.blank?\n end", "def create\n comment = Comment.new(create_params)\n comment.post = @post\n if comment.save\n render json: comment, status: 200\n else\n render json: comment.errors, status: 403\n end\n\n end", "def has_comments? # rubocop:disable Naming/PredicateName\n !comments.empty?\n end", "def create\n #if @user && @user.posts.include(@post)\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end", "def create\n comment = Comment.new(params[:comment])\n @entry.comments << comment if comment.valid?\n respond_with(comment, location: redirect_to_index)\n end", "def does_title_exist(title_no)\n\n response = rest_get_call($SYSTEM_OF_RECORD_API_DOMAIN + '/titles/' + title_no)\n\n if (response.code == '404') then\n return false\n else\n return true\n end\n\nend", "def ci_exists?(id)\n p __method__ if @debug == true\n xml = RestClient.get \"#{@base_url}/exists/#{id}\", {:accept => :xml, :content_type => :xml }\n return true if XmlSimple.xml_in(xml) == \"true\"\n return false\n end", "def exists!\n @exists = true\n end", "def update\n if @comment.update_attributes(comment_params)\n render json: @comment, status: :ok\n else\n render json: {error: \"Not found\"}, status: :not_found\n end\n end", "def create\n @comment = @post.comments.new(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\n end", "def check\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 1})\n\t\telsif request.method == \"POST\"\n\t\t\tif params.has_key?('data') and params[:data].class == Array\n\t\t\t\tdocs = params[:data]\n\t\t\t\tresp = []\n\t\t\t\tcreated = []\n\t\t\t\tstatus = 0\n\t\t\t\terrors = \"\"\n\t\t\t\tdocs.each do |d|\n\t\t\t\t\tc = OldContent.find_by(api_id: d[\"api\"])\n\t\t\t\t\ttest = c\n\t\t\t\t\tif c\n\t\t\t\t\t\tif d[\"commentCount\"].to_i > c.comments\n\t\t\t\t\t\t\thash = c.attributes\n\t\t\t\t\t\t\thash[:dif] = d[\"commentCount\"].to_i - c.comments\n\t\t\t\t\t\t\tresp.push(hash)\n\t\t\t\t\t\telsif d[\"commentCount\"].to_i < c.comments\n\t\t\t\t\t\t\t# means someone deleted something\n\t\t\t\t\t\t\tc.update_attributes(comments: d[\"commentCount\"].to_i)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tc = OldContent.new(\n\t\t\t\t\t\t\tapi_id: d[\"api\"], \n\t\t\t\t\t\t\tcomments: d[\"commentCount\"].to_i, \n\t\t\t\t\t\t\tlink: d[\"doc\"],\n\t\t\t\t\t\t\tcommentsUrl: d[\"commentsUrl\"],\n\t\t\t\t\t\t\ttitle: d[\"title\"]\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif c.valid?\n\t\t\t\t\t\t\tc.save\n\t\t\t\t\t\t\tcreated.push(c)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstatus = 1\n\t\t\t\t\t\t\terrors = \"#{c.errors.full_messages}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif status == 0\n\t\t\t\t\trespond({ status: 0, newComments: resp, created: created })\n\t\t\t\telse\n\t\t\t\t\trespond({ status: 1, error: errors })\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trespond({ status: 1, error: \"Request needs data property with content attributes. Data must be an array.\" })\n\t\t\tend\n\t\tend\n\tend", "def create\n comment = Comment.new(comment_params)\n\n post = Post.find(params[:comment][:post_id])\n post.data[\"comments\"] = post.data[\"comments\"] + 1\n\n if comment.save && post.save\n render json: {\n status: \"success\",\n data: {\n comment: comment.as_json(include: {\n user: {\n only: [:id, :name, :avatar]\n }\n }),\n comments: post.data[\"comments\"]\n }\n }, status: :ok\n else\n render json: comment.errors, status: 404\n end\n end", "def created?\n @data[:status_code] == '201'\n end", "def exists\n @record = Record.new\n app = App.find_by_packageName(params[:packageName], :select => :id)\n \n if app.nil?\n @record.exists = false\n else\n @record.id = app.id\n @record.exists = true\n end\n \n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def create\n @comment = Comment.new(comment_params)\n respond_to do |format|\n if @comment.save\n format.json {\n render json: {status:0, msg:\"success\"} \n }\n else\n \tformat.json { \n render json: {status:-1, msg:\"failed\"} \n }\n end\n end\n end", "def comments; rest_query(:comment); end", "def test_01_comment_on_post_as_unregistered_user\n published_post = Post.published.first\n post :create, {:post_id => published_post.id }\n assert_not_nil assigns['post']\n comment = assigns['comment']\n assert_not_nil comment\n assert comment.errors['user_name']\n assert comment.errors['user_email']\n assert comment.errors['body']\n\n # now a successful comment\n post :create, {:post_id => published_post.id,\n :comment => {\n :user_name => 'El Rug',\n :user_email => 'elurg@example.com',\n :body => 'Very nice. Whatever.'\n }}\n \n assert_not_nil assigns['post']\n comment = assigns['comment']\n assert comment.errors.empty?\n assert_equal false, comment.published?\n end", "def can_be_commented?\n hash.key?('comments_url') && hash.key?('comments_count')\n end", "def comment_exists_when_rejected\n return if accepted || comment.present?\n\n errors.add(:comment, \"can't be blank when accepted is false\")\n end", "def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def comments?\n comments.present?\n end", "def exists\n @deleted = false\n @exists = true\n end", "def create\n json_create_and_sanitize(comment_params, Comment)\n end", "def find_rejected_comments(response)\n decision_ids = Array.new\n post_ids = Array.new\n response['data'].each do |item|\n if item['attributes']['status'] == 'Reject'\n # Get sourceId of post from included section of JSON object\n sourceId = response['included'].find {|i| i['id'] == item['attributes']['commentId']}['attributes']['sourceId']\n decision_ids << item['id']\n post_ids << sourceId\n end\n end\n if decision_ids.any?\n confirm_decisions decision_ids\n reject_posts post_ids\n else\n puts 'No new decisions found.'\n end\n end", "def check_exists\n filename = params[\"file\"]\n if !valid_filename(filename, nil)\n Rails.logger.warn(\"check_exists: Invalid filename received (#{filename})\")\n render :json => {error: \"Invalid filename\"}, status: 400\n return\n end\n\n full_filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + filename\n exist = File.exist?(full_filename)\n render :json => {exist: exist}\n end", "def exists?\n begin \n CouchSpring.get uri\n true\n rescue\n false\n end \n end", "def create\n @comment = Comment.new(params[:comment])\n @comment.save\n respond_with(@post, @comment)\n end", "def find_comments\n assert_not_nil @rdigg.stories.find_comments(\"7987660\")\n end", "def destroy\n if @comment.nil?\n render json: {error: \"Not found\"}, status: :not_found\n else\n @comment.destroy\n render json: @comment, status: :ok\n\n end\n end", "def exists?\n request :head\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def show\n render json: @comment, status: :ok\n\n end", "def test_exists_with_nil_arg\n assert_equal false, Topic.exists?(nil)\n assert_equal true, Topic.exists?\n\n assert_equal false, Topic.first.replies.exists?(nil)\n assert_equal true, Topic.first.replies.exists?\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(params[:comment])\n @comment.researcher = logged_in_researcher\n\n if @comment.save\n respond_to do |format|\n format.html { redirect_to post_path(@post), :notice => \"Comment was successfully added.\" }\n format.xml { render :xml => @comment, :status => :created, :location => @comment}\n format.json { render :json=> @comment, :status => :created, :location => @comment}\n end\n else\n respond_to do |format|\n format.html { redirect_to post_path(@post), :alert => \"Failed to add comment: #{@comment.errors.full_messages.join(', ')}\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json=> @comment.errors, :status => :unprocessable_entity }\n end \n end\n end", "def check(params={})\n call 'comment-check', params\n end", "def comment_check(options = {})\n !@@valid_responses.include?(call_akismet('comment-check', options))\n end", "def can_create_comment?(post); true; end", "def comments\n client.get(\"/#{id}/comments\")\n end", "def test_story_has_id\n Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal true, json.first.has_key?(\"id\")\n end", "def create\n post = Post.find(params[:post_id])\n @comment = post.comments.new(comment_params)\n if @comment.save\n render json: {\n data: @comment\n }\n else\n render json: {\n errors: @comment.errors\n }\n end\n end", "def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end", "def exists\n @record = Record.new\n visual = Visual.find_by_app_id_and_image_file_name(params[:app_id], params[:filename], :select => :id)\n \n if visual.nil?\n @record.exists = false\n else\n @record.id = visual.id\n @record.exists = true\n end\n\n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end", "def exists? purl_path\n record = get(purl_path)\n return nil if record.nil?\n return record[\"purlId\"].to_s if record[\"status\"] == 1\n return nil\n end", "def supports_comments_in_create?\n false\n end", "def supports_comments_in_create?\n false\n end", "def create\n @comment = @noticia.comments.create(comment_params)\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def exists\n\t\tres = {}\n\t\tif User.find_by_token(params[:token])\n\t\t\tres[:status] = \"1\"\n\t\telse\n\t\t\tres[:status] = \"0\"\n\t\tend\n\t\trender json: res\n\tend", "def test_duplicate_user\n data = { 'email' => 'ace@base.se', 'password' => 'open1234' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n json_data = JSON last_response.body\n assert json_data['errors'].present?\n end", "def create\n @comment = create_comment\n\n respond_to do |format|\n if @comment.save!\n @post.touch && @comment.ancestors.each(&:touch)\n\n broadcast_new_post @comment\n dom_id = \"/#H#{@comment.id}\"\n\n format.html { redirect_to post_path(@post.root)+dom_id, notice: 'Post was successfully created.' }\n # format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to post_path(@post.root), notice: 'Error: Comment was not made.' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::RecordInvalid => e\n redirect_to post_path(@post.root), notice: e.message\n end", "def comment #create comment\n comment = Comment.new\n if comment.create_comment(params[:body], params[:video_id])#calling create_comment method of Comment model\n respond_with do |format|\n format.json {render :json => {:success => true, :message => \"comment successfully posted\"}}\n end\n else\n respond_with do |format|\n format.json {render :json => {:success => false}}\n end\n end\n end", "def pending?\n response = rpc(action: :pending_exists, param_name: :hash)\n !response.empty? && response[:exists] == '1'\n end", "def destroy\n if @comment.destroy\n #format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' }\n render json: {\"ok\": \"ok\"}, status: :ok\n else\n render json: {\"error\": \"not found\"}, status: :unprocessable_entity\n end\n end", "def boolean_from_response(method, path, options = {})\n request(method, path, options)\n @last_response.status == 204\n rescue Gocdkit::NotFound\n false\n end", "def is_it_for_sure?\n @comments.any? do |comment|\n comment['version'] == @spec.version and comment['works_for_me']\n end\n end", "def exists?\n false\n end", "def exists?\n false\n end", "def check_exists\n @unscraped = Unscraped.check_exists(unscraped_params)\n\n if @unscraped\n respond_to do |format|\n format.html { redirect_to @unscraped }\n #format.json { render json: @unscraped }\n format.json { render :show, location: @unscraped }\n end\n else\n respond_to do |format|\n format.html { render :nothing => true, :status => 200, :content_type => 'text/html' }\n format.json { render json: {}, :status => 200, :content_type => 'application/json' }\n end\n end\n end", "def exists?\n true\n end", "def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end", "def destroy\n @comment.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(comments_url) }\n wants.xml { head :ok }\n end\n end", "def xxx_test_toggle_comment_delete\n login_as :quentin\n assert_difference Comment, :visible_count, -1 do\n xhr :post, :toggle_comment_delete, :id => 1\n assert_response :success\n assert_template 'toggle_comment_delete'\n end\n assert_equal 1, assigns['comment'].id\n end", "def create\n @commentable = find_commentable\n @comment = @commentable.comments.build(params[:comment]) do |comment|\n comment.access = current_access\n end\n if @comment.save\n flash.now[:notice] = t('comment.added')\n Rails.logger.info @comment.inspect\n @counter = @commentable.comments.count\n respond_with @comment\n else\n Rails.logger.info @comment.errors.messages\n flash.now[:error] = t('comment.added.error')\n end\n end", "def exists?; end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def exist?\n @created\n end", "def test_delete_comment\n\n comments = Comment.getAll()\n\n for comment in comments\n\n result = Comment.deleteComment(comment.commentId)\n\n assert_equal true, result\n \n end\n\n end", "def destroy\n comment = Comment.find(params[:id])\n if comment.destroy\n render json: {destroyed: true}\n end\n end", "def test_function_create_comment_unsuccessfully\n data = {\n user_id: \"wrong_id\",\n post_id: 1,\n content: \"This is a comment\"\n }\n comment = V1::Comment.create_comment(data)\n actual = comment[:meta][:code]\n expected = 1001\n puts this_method_name + \" - \" +assert_equal(expected, actual).to_s\n end", "def rude_comment\n @res.write GO_AWAY_COMMENT\n @res.status = 404\n end", "def show\n @comments = Recipe.find(params[:recipe_id]).comments.all\n @comment = Recipe.find(params[:recipe_id]).comments.find(params[:id]) \n if @comment \n respond_to do |f|\n f.html {render :index}\n f.json {render json: @comment}\n end\n else\n @comments\n respond_to do |f|\n f.html {render :index}\n f.json {render json: @comments}\n end\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def create\n @contact_detail = ContactDetail.new(contact_detail_params)\n @contact_details = ContactDetail.all\n respond_to do |format|\n if @contact_detail.save\n @contact_detail = ContactDetail.new\n format.js { @flag = true }\n else\n flash.now[:alert] = 'About Already Exist.'\n format.js { @flag = false }\n end\n end\n end", "def create\n @comment_node = CommentNode.new(params[:comment_node])\n\n respond_to do |format|\n if @comment_node.save\n format.html { redirect_to @comment_node, :notice => 'Comment node was successfully created.' }\n format.json { render :json => @comment_node, :status => :created, :location => @comment_node }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment_node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n res = self.class.post('/', body: attrs)\n res.created?\n end", "def create\n @comment = Comment.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.json { render :show, status: :created, location: @comment }\n else\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_duplicate_comments\n return unless event_type == 'comment' and event_action == 'created'\n if Activity.where(event_type: 'comment', event_action: 'created', user_id: user_id, repo: repo, :commented_on.lte => commented_on, :commented_on.gte => commented_on - 1.hour, description: description).count > 0\n errors.add(:description, 'Duplicate comment for the same repository by the same user')\n end\n end", "def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\n end", "def duplicate?\n c = Comment.find_by_trip_id_and_user_id_and_body(trip, user, body)\n # Give self the id for REST routing purposes.\n self.id = c.id unless c.nil?\n not c.nil?\n end", "def create\n @comment = Post.find(params[:post_id]).comments.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 post_comments_url(@comment.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", "def create\n @comment = Comment.new(params[:comment])\n rel = Neo4j::Rails::Relationship.new(:commentsOn, @comment, @position)\n\n respond_to do |format|\n if @comment.save and rel.save\n format.html { redirect_to @position, notice: 'Comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { redirect_to @position, error: 'Failed to create comment.' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts params.to_json\n @post = Post.find(params[:comment][:post_id])\n @comment = @post.comments.build(comment_params)\n if @comment.save\n redirect_to root_path\n end\n end", "def exists? force: false\n return resource_exists? if force\n # If we have a value, return it\n return @exists unless @exists.nil?\n # Always true if we have a gapi_json object\n return true if resource?\n resource_exists?\n end", "def create_comments\n end", "def create_comments\n end", "def create_comments\n end", "def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\n end\n end", "def check_info\n connection = Connection.where(group_id: params[:group_id], contact_id: params[:contact_id]).first\n json_details = if connection.present?\n {\n status: true,\n delete_connection_url: connection_path(connection),\n connection_id: connection\n }\n else\n { status: false }\n end\n render json: json_details\n end", "def assert_found(response)\n assert response[\"found\"] || response[\"exists\"], \"document was not found\"\n end", "def create\n @blogpost = Blogpost.find(params[:blogpost_id])\n\n @comment = @blogpost.comments.create(comment_params)\n render json: @comment\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def xml_post?\n post? && post_format == :xml\n end", "def create\n comment = Comment.new(:content => params[:content],\n :user_id => current_user.id,\n :image => avatar_url(current_user),\n :commentable => list,\n :cid => params[:cid])\n status = comment.save ? 201 : 400\n\n unless current_user == list.user\n Notification.new_comment(list.user, current_user, list)\n mentions = get_mentions(params[:content])\n Notification.new_mention(mentions, current_user, list) unless mentions.empty?\n end\n\n head status\n end", "def find_comment_replies\n assert_not_nil @rdigg.stories.find_comment_replies(\"7987660\", \"65434\")\n end" ]
[ "0.5792246", "0.57162917", "0.55497015", "0.5435844", "0.5434988", "0.5340666", "0.5332262", "0.524309", "0.52049863", "0.51598275", "0.51364136", "0.5106553", "0.5103431", "0.5102602", "0.5095069", "0.50949126", "0.5088419", "0.5084685", "0.50700164", "0.50699264", "0.5059865", "0.50430924", "0.50371885", "0.50326556", "0.50324404", "0.5030592", "0.5013397", "0.5006204", "0.49812523", "0.49762505", "0.49747226", "0.49483487", "0.49351987", "0.49235305", "0.49158052", "0.4905038", "0.49024615", "0.49001315", "0.48986742", "0.48967233", "0.48945826", "0.4894234", "0.4892743", "0.48798686", "0.48740056", "0.4866625", "0.4864325", "0.48640695", "0.4863816", "0.48575938", "0.48575938", "0.4845306", "0.48452047", "0.4844794", "0.48220837", "0.48138356", "0.4812448", "0.48076436", "0.47919574", "0.47814685", "0.4777745", "0.4777745", "0.47775143", "0.47745362", "0.47689748", "0.47688743", "0.47685567", "0.4764259", "0.47627768", "0.47597492", "0.4759686", "0.47576654", "0.47517812", "0.47479072", "0.4747415", "0.47435102", "0.47387335", "0.47387335", "0.47383448", "0.473304", "0.473284", "0.47319314", "0.47310317", "0.4728064", "0.47264355", "0.47239387", "0.47166157", "0.47111693", "0.47099724", "0.47057083", "0.47057083", "0.47057083", "0.4703029", "0.4701599", "0.47015893", "0.46987846", "0.46968657", "0.46938577", "0.46922702", "0.46876624" ]
0.66348433
0
just output some text without a log level
def text(msg="", nested=false) @last_msg = "" @last_lvl = nil msg = "\n#{msg}\n \n" unless nested if msg.include?("\n") msg.split("\n").each do |line| text(line, true) end return end message = colorize(msg, :white, :black, true) blocks = colorize(" ", :black, :white) puts "#{blocks} #{message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg(text)\n print text if VERBOSE\n STDOUT.flush\nend", "def msg(text, level = :info)\n case level\n when :warn\n puts \"\\e[31m#{text}\\e[0m\"\n else\n puts \"\\e[33m#{text}\\e[0m\"\n end\nend", "def msg(text, level = :info)\n case level\n when :warn\n puts \"\\e[31m#{text}\\e[0m\"\n else\n puts \"\\e[33m#{text}\\e[0m\"\n end\nend", "def puts(msg)\n @out.puts msg unless @silent\n end", "def silent(text)\n GitPusshuTen::Log.silent(text)\n end", "def message(msg)\n $stdout.puts(msg) unless $options['quiet']\nend", "def trace(text = \"\")\n puts text\n end", "def out(msg)\n puts \"#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")} #{msg}\" if DEBUG_OUTPUT\nend", "def log(text)\n puts text\n end", "def display(text)\n @log ||= Logger.new(STDERR)\n @log.info text\n end", "def display(text)\n @log ||= Logger.new(STDERR)\n @log.info text\n end", "def standard(text)\n GitPusshuTen::Log.standard(text)\n end", "def say(*par)\n return unless self[:verbose]\n\n super(*par)\n end", "def logger_output; end", "def print message=nil\n log(:info, message) unless Qcmd.silent?\n end", "def log(level, msg)\n puts \"#{level}, #{@org} Customization: #{msg}\"\n end", "def print_status(msg)\n puts \"\" if verbose_mode?\n puts \"#{color('----->', 32)} #{msg}\"\n end", "def say(text, level = DEFAULT_LOG_LEVEL)\n puts text if @loud\n logger.add level, \"HARE: #{text}\"\n end", "def print_none(msg)\n tag = ' '\n print_formatted(tag,msg)\n end", "def log(msg)\n puts msg if @verbose\n end", "def log(msg)\n puts msg if @verbose\n end", "def msg(message)\n puts message unless nagios_mode?\n end", "def write_no_newline(text)\n print(sanitize(text))\n end", "def log!(msg)\n log_info(msg)\n puts(msg)\nend", "def verbose_print(text)\n @output += %(#{text}\\n)\n puts text if @verbose\n end", "def log_stuff\r\n log.info(\"TestLogger is here to log stuff.\")\r\n log.warn(\"TestLogger is finishged logging. Be careful.\")\r\n end", "def output(msg,level=0)\n if level < 2 && !@debug\n return\n elsif level < 1 && !@verbose\n return\n end\n color = $default\n case level\n when 0\n color = $info\n when 1\n color = $warn\n when 2\n color = $error\n when 3\n color = $success\n else\n color = $default\n end\n\n $stderr.printf(\"%s%s%s\\n\" % [color, msg, $default])\n end", "def plain_output(message, color)\n if @options['without-color']\n puts message\n else\n puts Colorize.send(color, message)\n end\n end", "def render(*)\n if (logger = WebConsole.logger) && logger.respond_to?(:silence)\n WebConsole.logger.silence { super }\n else\n super\n end\n end", "def log(msg)\n puts msg unless ENV['TEST']\n end", "def output(message)\n return if disabled\n if Device.simulator?\n puts(message)\n else\n NSLog(message)\n end\n message\n end", "def log(text, level = :standard)\n # protect against bad input\n return unless LOG_LEVELS.has_key?(level)\n\n # output when the log level we are requesting\n puts text if LOG_LEVELS[log_level] >= LOG_LEVELS[level]\n end", "def log(text)\n puts \"[#{Time.now}] \\e[0;30mCaller: #{caller[0][/`(.*)'/,1]} \\e[0m| #{text}\"\n end", "def log(msg, flag = false)\r\n puts msg if flag\r\nend", "def user_message(msg, level=0, type=\"info\")\n if not(quiet_mode?)\n message(type, :green, \" \"*level + msg)\n end\n end", "def __trace_impl(*args, **opt, &block)\n opt[:no_log] = true unless opt.key?(:no_log)\n __output_impl(*args, **opt, &block)\nend", "def discreet_output(&block)\n ll = self.logger.level\n self.logger.level = Capistrano::Logger::INFO \n yield\n self.logger.level = ll\nend", "def log!(message)\n log message if very_verbose\n end", "def log!(message)\n log message if very_verbose\n end", "def log(line)\n puts line unless RUBYMOTION_ENV == \"test\"\n end", "def info message; write INFO, message, caller[0] unless level > @level end", "def log(*args)\n if args.size == 1\n say args.first.to_s unless options.quiet?\n else\n args << (self.behavior == :invoke ? :green : :red)\n say_status *args\n end\n end", "def log level, message; write level, message, caller[0] unless level > @level end", "def output_log(log)\n puts \"\\e[32m#{log}\\e[m\\s\"\nend", "def log(*args)\n if args.size == 1\n say args.first.to_s unless options.quiet?\n else\n args << (behavior == :invoke ? :green : :red)\n say_status(*args)\n end\n end", "def log(msg)\n print \" \" if $trace && $verbose\n puts msg if $verbose\n end", "def log_output(color: false)\n return unless defined? @log_device\n if color\n @log_device.string\n else\n ANSI.unansi(@log_device.string)\n end\n end", "def log(msg)\n puts msg\n end", "def KLDALog(text)\n $logFile.puts(\"======[KLDA Log] \" + text.to_s + \"======\\n\")\n end", "def verbose_logging; end", "def log(message)\n STDOUT.puts message\nend", "def puts_warning(msg)\n $stdout.puts \"\\e[33m[WARNING] #{msg}\\e[0m\" if Calamum::Config[:debug]\nend", "def log_without_running\n log\n end", "def say(message)\n puts green(message) if self.verbose \n end", "def msg_nocr(msg)\n @output.write(msg)\n end", "def puts_info(msg)\n $stdout.puts \"\\e[32m[INFO] #{msg}\\e[0m\" if Calamum::Config[:debug]\nend", "def log(*args) # :doc:\n if args.size == 1\n say args.first.to_s unless options.quiet?\n else\n args << (behavior == :invoke ? :green : :red)\n say_status(*args)\n end\n end", "def output_specific_warnings\n tracer_warnings = self.get_specific_warnings\n unless tracer_warnings.count == 0\n puts ''\n puts tracer_warnings\n end\n end", "def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend", "def info_msg(msg)\n @log.puts(msg)\n puts msg\nend", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def verbose text\n message(text) if @options[:verbose]\n end", "def verbose text\n message(text) if @options[:verbose]\n end", "def puts(description)\n $stdout.puts \"#{log_prefix}#{description.chomp}\" unless silent\n end", "def log(str, log_type = :info)\n str = \"- ERROR - #{str}\" if log_type == :error\n puts str\nend", "def lputs(msg)\n logger = RAILS_DEFAULT_LOGGER\n logger.info msg\n puts msg\nend", "def log(msg)\n print \" \" if $trace && $verbose\n $stderr.puts msg if $verbose\n end", "def log(text, level = :info)\n puts text if @verbose\n\n return unless logger\n logger.send(level, text)\n end", "def message(msg)\n STDOUT.puts msg\n end", "def print_verbose(msg)\n puts msg if (@verbose) \n STDOUT.flush\n end", "def print_line(msg='')\n end", "def without_stderr; end", "def log_write(msg)\n puts msg\n end", "def pretty_print(msg)\n if logger.level == Logger::IMPORTANT\n errors\n print '✔'+ msg.green + \"\\n\\r\"\n else\n puts '✔'+ msg.green\n end\nend", "def info_msg(msg=\"\")\n puts(msg)\n @file.puts(msg)\n end", "def disable_stdout\n stdoutoutputter = Log4r::Outputter[\"#{@name.to_s}-stdout\"]\n stdoutoutputter.level = Log4r::OFF\n end", "def warn message\n super message if @verbosity > 1\n end", "def message text\n $stderr.puts text\n end", "def message text\n $stderr.puts text\n end", "def report(message)\n puts message unless quiet? #or trial?\n end", "def log(msg)\n puts(msg) if @info_values['enable_debug_logging'] == \"Yes\"\n end", "def log(msg)\n puts msg if $verbose\nend", "def info(log)\n output.puts log if log_level <= INFO\n end", "def log(message)\n return unless @verbose\n $stderr.puts \"# #{message}\"\n end", "def warning text\n print_red(\"WARNING: #{text}\") \n end", "def warning text\n print_red(\"WARNING: #{text}\") \n end", "def output_me(level, print_and_log_me)\n\n print_and_log_me = \"52m_update_maps.rb:\" + print_and_log_me\n puts print_and_log_me\n\n if level == \"debug\"\n logger.debug(print_and_log_me)\n end\n if level == \"info\"\n logger.info(print_and_log_me)\n end\n if level == \"error\"\n logger.error(print_and_log_me)\n end\nend", "def output_me(level, print_and_log_me)\n\n print_and_log_me = \"52m_update_maps.rb:\" + print_and_log_me\n puts print_and_log_me\n\n if level == \"debug\"\n logger.debug(print_and_log_me)\n end\n if level == \"info\"\n logger.info(print_and_log_me)\n end\n if level == \"error\"\n logger.error(print_and_log_me)\n end\nend", "def print(msg='')\n end", "def colorize_logging; end", "def log(phrase)\n puts \"INFO: \" + phrase\nend", "def logs message\n puts \"#{Time.now}: #{message}\"\n end", "def print(msg = '')\n clear_line\n print_no_newline(msg)\n end", "def write(text = '')\n puts(sanitize(text))\n end", "def log(text=\"\", new_line=true)\n super(DO_LOGGER_FORMAT % [user, name, text], new_line)\n end", "def print_status(msg = '')\n $stderr.puts \"[*] #{msg}\"\n end" ]
[ "0.6813319", "0.6683644", "0.6683644", "0.66649836", "0.66440284", "0.644009", "0.6405595", "0.6405077", "0.6398349", "0.63620424", "0.63620424", "0.6341639", "0.62857836", "0.6270678", "0.6256809", "0.6243691", "0.6238183", "0.62277544", "0.62089753", "0.6197892", "0.6197892", "0.61631566", "0.614542", "0.61314386", "0.61293286", "0.6115161", "0.6114708", "0.61051", "0.6093816", "0.6092438", "0.60775393", "0.60739", "0.60687506", "0.606262", "0.6037683", "0.6036671", "0.6032704", "0.60320747", "0.60320747", "0.6021089", "0.599447", "0.59924424", "0.599104", "0.5987623", "0.59729165", "0.59691447", "0.5960642", "0.59570324", "0.59528327", "0.5951964", "0.59464115", "0.593746", "0.5931497", "0.5929744", "0.5926856", "0.590047", "0.5900307", "0.58970416", "0.5896364", "0.5892098", "0.58833456", "0.58833456", "0.58833456", "0.58833456", "0.58833456", "0.58833456", "0.58762467", "0.58762467", "0.5861347", "0.5859284", "0.58591837", "0.58574045", "0.58560467", "0.585463", "0.5852488", "0.58493626", "0.5845593", "0.5839355", "0.5834091", "0.5832743", "0.5831887", "0.5830277", "0.5829936", "0.5829936", "0.58293706", "0.58284223", "0.5827616", "0.58103997", "0.5810315", "0.5808635", "0.5808635", "0.58061963", "0.58061963", "0.58017325", "0.5799107", "0.5798255", "0.5796846", "0.57967496", "0.57882714", "0.57882184", "0.5783655" ]
0.0
-1
append to a prevous message
def append(msg="") print "\r#{ONE_UP}#{ERASE}" fmt_msg("#{@last_msg} #{msg.to_s.strip}", @last_lvl) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(message)\n @messages.unshift(message)\n end", "def msg_add(c)\n\t@msg_buf << c\n end", "def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].hadjustment.upper\n puts @glade['scrolledwindow1'].hadjustment.lower\n @talk.buffer.insert @talk.buffer.end_iter,\"#{name || @contact.name}: \", @nickname_tag\n @talk.buffer.insert @talk.buffer.end_iter, \"#{text}\\n\"\n end", "def add_msg(msg, type = nil)\n ##### local message event\n puts msg\n $stdout.flush\n end", "def << message\n message.each_line do |line|\n @ui.info(line, :new_line => false)\n end\n end", "def prepend!\n return if description.empty?\n\n message = open(commit_message_file).read\n open(commit_message_file, 'w') do |f|\n f.puts \"#{description} #{message}\"\n end\n end", "def add_effect_message(msg)\n @effect_results.push(msg)\n end", "def append_buffer(buffer, hash)\n if hash['message'] != nil\n buffer['message'] << \" #{hash['message'].gsub(\"\\n\", ' ')}\"\n end\n end", "def pre_process(message)\n end", "def add_text_part!\n part = Mail::Part.new\n part.body = @existing_text_part || premailer.to_plain_text\n part.content_type = \"text/plain; charset=#{@msg_charset}\"\n message.text_part = part\n end", "def add_message room_name, message\n unless @@room_data[room_name]['messages'].include? message\n messages = @@room_data[room_name]['messages']\n messages.push message\n @@room_data[room_name]['messages'] = messages[-500,500] if messages.length > 500\n end\n \n return if room_name != @room\n scroll_down = @log.scroll_top >= @log.scroll_max - 10\n @log.append do\n flow do\n para strong(message['user']['name'] || message ['user']['id']), ': ', message['message']\n end\n end\n \n while @log.contents.length > 500\n @log.contents.first.remove\n end\n \n @log.scroll_top = @log.scroll_max\n end", "def add_message_send message\n @drb_messages_sent += 1\n\n msg = message.message\n argc = message.argument_count\n\n source = message.source\n destination = message.destination\n\n @last_peer_send[source][destination] = message.timestamp\n @last_sent_message[source][destination] = msg, argc, message.allocations\n end", "def write text=\"\"\n\t\t@message.text = @msg = text.to_s\n\tend", "def append(text); end", "def add_message(name, message)\n\t\tend", "def append(message, truncate = nil, timestamp = nil)\n @log << message.to_s\n end", "def append(appended_text = '')\n @text << ' ' << appended_text\n end", "def append_details(message, details)\n return message unless details && message\n message + \" -- #{details.to_json}\"\n end", "def rubicante_message\n #@mSocket.puts \"PRIVMSG #{@mChannel} : I respect men like you. Men with...courage. \" + \n #\" But you are a slave to your emotions, and so will never know true strength.\" + \n #\" Such is the curse of men.\"\n @mSocket.puts \"Long ago in a distant land, I, Aku, the shape-shifting Master of Darkness, unleashed an unspeakable evil...\"\n end", "def msg(message)\n output[:messages] << message\n end", "def update_message(data); end", "def update_message(data); end", "def speechAppend(speaker)\n\tprng = Random.new\n\tnum = prng.rand(5)\n\tif num ==0\n\t\tmessage = \"then \"+speaker+\" said \"\n\telsif num == 1\n\t\tmessage = \"and \"+speaker+\" was like\"\n\telsif num == 2\n\t\tmessage = \"so \"+speaker+\" replied \"\n\telsif num == 3\n\t\tmessage = \" and \"+speaker+\" whispered \"\n\telse\n\t\tmessage = \". \"+speaker+\" pondered this, and said \"\n\tend\n\treturn message\nend", "def notice(msg)\n @notices << msg\n blah @notices.last\n end", "def msg(message)\n output[:messages] << message\n end", "def keep message\n @messages << message\n end", "def add(att, msg)\n fetch(att){self[att] = []} << msg\n end", "def <<(message)\n submit_message message\n self\n end", "def quoteAppend(speaker,quotedSpeaker)\n\tmessage = \"then \"+speaker+\" quoted \"+quotedSpeaker+\" saying: \"\n\treturn message\nend", "def user_message_begin(msg)\n user_message(msg, 0, \">>>\")\n end", "def make_message message\n prefix = \"#{@file_name}:\".dup\n\n tk = peek_tk\n prefix << \"#{tk[:line_no]}:#{tk[:char_no]}:\" if tk\n\n \"#{prefix} #{message}\"\n end", "def add_processing_message(level, severity, text)\n @process_log.add_processing_message(level, severity, text)\n end", "def notice_extra_data(message, duration, key)\n return unless builder\n segment = builder.current_segment\n if segment\n if key != :sql\n segment[key] = self.class.truncate_message(message)\n else\n # message is expected to have been pre-truncated by notice_sql\n segment[key] = message\n end\n append_backtrace(segment, duration)\n end\n end", "def append_message(mailbox, message, flags, date=nil)\n #raise ReadOnlyMailbox.new(mailbox) if @read_only\n @lock.synchronize do\n\n begin\n if(message =~ /^(From - ... ... .+?[0-9]{4}\\n)/ && date.nil?)\n timestr = $1\n message.gsub(/^#{timestr}/, '')\n timestr.chomp\n begin\n date = Time.parse(timestr)\n rescue\n date = Time.now\n end\n end\n imap.append(mailbox, message, flags, date)\n Logger.info(\"New message added to #{mailbox}\")\n rescue Object => boom\n Logger.warn(\"Failed to transer message to #{mailbox}: #{boom}\")\n end\n end\n end", "def push msg\n end", "def my_msg(msg = nil, put_msg = false)\n Rails.logger.info { \"#{self.class}: #{msg}\" }\n @msg << msg if put_msg\n true\n end", "def add_message_reaction(data); end", "def add_message(mesg, log_employee)\n subject \"From: #{mesg.sent_by.name}, Resume: #{mesg.resume.name}\"\n recipients [ mesg.sent_to.email ]\n from [ log_employee.email ]\n reply_to [ \"recruitment-no-reply@mirafra.com\" ]\n sent_on Time.now\n content_type 'text/html'\n body :emp_from => mesg.sent_by,\n :emp_to => mesg.sent_to,\n :mesg => mesg\n end", "def booked\n $messages << payload\n end", "def append_record_to_messages(op, meta, header, record, msgs)\n case op\n when UPDATE_OP, UPSERT_OP\n if meta.has_key?(ID_FIELD)\n header[UPDATE_OP] = meta\n msgs << @dump_proc.call(header) << BODY_DELIMITER\n msgs << @dump_proc.call(update_body(record, op)) << BODY_DELIMITER\n return true\n end\n when CREATE_OP\n if meta.has_key?(ID_FIELD)\n header[CREATE_OP] = meta\n msgs << @dump_proc.call(header) << BODY_DELIMITER\n msgs << @dump_proc.call(record) << BODY_DELIMITER\n return true\n end\n when INDEX_OP\n header[INDEX_OP] = meta\n msgs << @dump_proc.call(header) << BODY_DELIMITER\n msgs << @dump_proc.call(record) << BODY_DELIMITER\n return true\n end\n return false\n end", "def write( message )\n\t\t\t@array << message\n\t\tend", "def write( message )\n\t\t\t@array << message\n\t\tend", "def write( message )\n\t\t\t@array << message\n\t\tend", "def inline!\n capture_existing_message_parts\n reset_message_body!\n\n add_text_part!\n add_html_part!\n add_attachments!\n\n message\n end", "def on_pre_msg(msg)\n\n on_message(true, msg)\n end", "def write_trailing_message(obj)\n if writer_for(obj).pending?\n continuation, new_message = obj.message.split(\"\\n\", 2)\n trailing = writer_for(obj).trailing!\n output << \"%s%s\\n\" % [trailing, continuation]\n new_message\n else\n obj.message\n end\n end", "def message(options)\n @sent_messages << options[:text]\n end", "def write(msg)\n if msg.end_with?(\"\\n\")\n @progress_bar.clear\n if @current_line.nil?\n # New messages to be displayed\n @stream << msg\n else\n # Ending previous line\n @stream << (@current_line + msg)\n @current_line = nil\n end\n @progress_bar.refresh(force: true) unless @progress_bar.stopped?\n elsif @current_line.nil?\n # Beginning new line\n @current_line = msg\n else\n # Continuing current line\n @current_line << msg\n end\n end", "def write_message(obj)\n semaphore.synchronize do\n new_message = write_trailing_message(obj)\n if new_message\n obj = obj.dup\n obj.message = new_message.chomp\n inject_headers!(obj)\n writer_for(obj).trailing = obj.trailing\n output << obj.message + \"\\n\"\n output.flush\n end\n end\n end", "def process_msgs\n end", "def message_buffer; end", "def send_other_kafka_message\n Rimless.message(data: { 'id' => 'id' }, topic: :test, schema: :include)\nend", "def normal(msg)\n print \"#{@yel} -> #{msg}...#{@ncl}\"\n print \"\\r\"\n @lastMsg = msg\n end", "def print(msg)\n @last_message = msg.chomp\n @messages.push @last_message\n end", "def add_metadata(msg)\n return {:timestamp=>Time.now.utc.strftime('%FT%T.%3NZ'),\n :msg=>msg,\n :ip=>@ip,\n :pid=>@pid}\n end", "def send_string label, message\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end", "def append(mailbox, message, flags=nil, date_time=nil)\n args = [to_utf7(mailbox)]\n args << flags if flags\n args << date_time if date_time\n args << Net::IMAP::Literal.new(message)\n tagged_response(\"APPEND\", *args)\n end", "def write(msg)\n prep_write\n puts \"#-------> @[ #{@file_handle.pos} ] B[ #{@buffer_size} ] in #{@complete_path} <---------#\\n#{msg}\" if verbose\n add_to_buffer(msg)\n flush_if_buffer_full\n end", "def extra(msg)\n %(<span class=\"extra\">#{msg}</span>)\n end", "def add_rcpt( email )\n RESPONSE[\"ADDRCPT\"] + email + \"\\0\"\n end", "def string_append(string)\n \t\tstring + \" appended\"\n \tend", "def enqueue_message(message); end", "def encode_body(buffer)\n buffer << prior_action_ids.to_msgpack\n end", "def add_msg(msg, sender)\n\n @chatters.each do |chatter_id, chatter|\n if chatter_id != sender.id\n chatter.client_socket.puts \"#{sender.id} said: #{msg}\"\n end\n end\n\n end", "def add_message(message,opts={})\n # Append the message to @messages\n (@messages ||= []) << message\n end", "def append(new_data)\n end", "def net_message(message)\n @messages << message\n # Remove last element from messages history\n if messages.length > @history_length\n messages.shift\n messages.pop\n end\n end", "def append_story_note(message,story_id=nil)\n if (story_id ||= :infer) == :infer\n story_id = extract_story_id_from(message)\n end\n return false unless story_id\n send_story_note!(\"[#{prepend_text}] #{message}\",story_id)\n true\n end", "def add_participant(participant)\n messages.each do |message|\n Mailboxer::ReceiptBuilder.new({\n :notification => message,\n :receiver => participant,\n :updated_at => message.updated_at,\n :created_at => message.created_at\n }).build.save\n end\n end", "def add_tx_string(text)\n @m.synchronize do\n @message=@message+text\n end\n return @message\n end", "def event_display_line(msg, room)\n msg.replace(\"#{Time.now.strftime(@var[:timestamp])}#{msg}\") if msg\nend", "def add_processing_message(level, severity, text)\n \n # See if we are bumping the level up or down\n if @log_level < level\n while @log_level < level\n @process_log << \"<ul>\"\n @log_level += 1\n end\n elsif @log_level > level\n while @log_level > level\n @process_log << \"</ul>\"\n @log_level -= 1\n end\n end\n @log_level = level\n \n # Log Level 1 is a special case for top-level information. \n # All other levels are subordinate to some larger piece (e.g. MileageUpdate processing)\n if level == 1\n @process_log << \"<p class='text-#{severity}'>#{text}</p>\" \n else\n @process_log << \"<li><p class='text-#{severity}'>#{text}</p></li>\"\n end\n end", "def create_message(data); end", "def create_message(data); end", "def add_to_base(msg)\n add(:base, msg)\n end", "def reply(code, message)\n if message.is_a?(Array)\n last = message.pop # remove last element\n lines = message.map {|param| \"#{code}-#{param}\\r\\n\"}\n write lines.join + \"#{code} #{last}\\r\\n\"\n else\n write \"#{code} #{message}\\r\\n\"\n end\n end", "def stream(message)\n @messages = @messages.to_s + message\n end", "def send_el_msg(pid, msg)\n buffer = $b.clone\n buffer[:type] = \"ELECTION\"\n buffer[:msg] = msg\n\n # najdu dalsi aktivni proces\n succ = next_pid(pid)\n while($processes[succ][:active] != true)\n succ = next_pid(succ)\n end\n\n $processes[succ][:buffer] = buffer\nend", "def attack(msg)\n puts \"\\n\\ntrudy esta conectado y va atacar!\\n\\n\" \n msg += \"MensajeTocado!\"\n end", "def write(msg)\n\t\tinfo(msg)\n\tend", "def user_message_end(msg)\n user_message(msg, 0, \"<<<\")\n end", "def publish message, root\n puts \"message: #{message.inspect}\"\n puts \"text: #{message['text']}\"\n @messages.shift if @messages.size == @@MAX_MESSAGES \n @messages << { 'head' => '?', 'text' => message[ 'text' ] }\n\n root[ @@CHAT_CHANNEL ] = @messages\n\n [ true, 200 ]\n end", "def part(c, r='')\n @socket << \"PART #{c} :#{r}\"\n end", "def append_error(msg)\n @errors.empty? ? @errors = msg : @errors << \"\\n\" + msg + \" \"\n end", "def add_rcpt( email )\n RESPONSE[:addrcpt] + email + \"\\0\"\n end", "def publish data, attributes = {}\n @messages << [data, attributes]\n end", "def add_to_base(msg)\n add(:base, msg)\n end", "def add_to_base(msg)\n add(:base, msg)\n end", "def add_to_base(msg)\n add(:base, msg)\n end", "def message( message )\n\tend", "def recevoirMessage(message)\r\n\t\t@lstMessages[message.id] = message\r\n\tend", "def complete_message\n complete_message = \"\"\n complete_message << \"#{header}\\n\" unless header.blank?\n complete_message << message\n complete_message << \"\\n#{footer}\" unless footer.blank?\n complete_message\n end", "def msg(message)\n end", "def print(message)\n\t\ttime = Time.now\n\n\t\t@duration += (time - @lastMessageTime)\n\n\t\t@lastMessageTime = time\n\n\t\t@message = message\n\n\tend", "def puts(msg)\n @buffer << \"#{msg}\\n\"\n end", "def message(message) end", "def send_message m\n @mutex.synchronize do\n @sinks.each { |sink| sink << m }\n @buf << m\n @buf = @buf[[(@buf.length - @keep_lines), 0].max .. -1]\n m\n end\n end", "def message(text)\n @text_queue.push text\n end", "def append_section()\n result = super()\n return true if result == TPL_OK\n raise get_message(result)\n end", "def add message\n @events[message.sequence] = message\n end" ]
[ "0.63109297", "0.6144306", "0.60070115", "0.5981558", "0.58327645", "0.5831893", "0.58218914", "0.57724637", "0.5697555", "0.56834626", "0.5627022", "0.562596", "0.56242305", "0.5615866", "0.5614353", "0.56110567", "0.5573142", "0.55587715", "0.55578226", "0.55426", "0.55383617", "0.55383617", "0.55375564", "0.5530611", "0.551384", "0.5504252", "0.54960114", "0.5495047", "0.54929316", "0.54860705", "0.54525435", "0.5439926", "0.54298514", "0.5426572", "0.53986496", "0.53939223", "0.5386139", "0.5369141", "0.5365197", "0.53615737", "0.5359756", "0.5359756", "0.5359756", "0.5357143", "0.5355066", "0.5354614", "0.53495634", "0.5341407", "0.53393465", "0.53378785", "0.53235155", "0.53225183", "0.5306275", "0.5288938", "0.5278389", "0.5275472", "0.52662295", "0.5265341", "0.5264706", "0.5253791", "0.5252685", "0.5248593", "0.5247074", "0.5231837", "0.52307254", "0.52306265", "0.5227464", "0.5219646", "0.5209944", "0.5209185", "0.52083856", "0.5206799", "0.5203333", "0.5203333", "0.5195782", "0.5189006", "0.51765555", "0.51765007", "0.51694727", "0.5169424", "0.51665765", "0.51536286", "0.51477176", "0.51467687", "0.51422924", "0.51352566", "0.5133949", "0.5133949", "0.5133949", "0.5132217", "0.51261765", "0.5123311", "0.51153344", "0.51150256", "0.5109346", "0.51067156", "0.51026434", "0.50921637", "0.50894684", "0.5084209" ]
0.6338534
0
PUBLIC METHODS RecipHeading gives the heading for the recipient
def recip_heading identity.name.titleize.pluralize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading\n self.class.heading\n end", "def heading\n render_citation(@document)\n end", "def heading(title = @title, opts={})\n \n heading = @renderer.heading(title, opts)\n \n puts \"[Cutlist.heading]: #{heading}\" if $cutlister_debug\n \n heading\n \n end", "def header\n\t\tleft = bounds.left - 40\n right = bounds.right + 40\n full_width = bounds.width + 80\n bounding_box [left, bounds.top + 35], width: full_width, height: 60 do \n font \"Helvetica\"\n fill_color \"000000\"\n text @wo.requester.facility.name, align: :center, size: 20, style: :bold\n fill_color \"555555\"\n text \"Work Order \" + @wo.id.to_s, align: :center, size: 14, inline_format: :true, style: :bold\n\t\tend\n end", "def heading\n @invoice.project.account.account_setting.logo_file_name ? move_down(220) : move_down(100)\n\n formatted_text([\n { :text => \"Invoice\",\n :color => \"111111\",\n :size => 35,\n :style => [:bold]\n },\n { :text => \" #{@invoice.invoice_number}\",\n :color => \"999999\",\n :size => 35,\n :style => [:bold]\n }\n ])\n move_down 20\n end", "def heading_level\n self.get_heading_level\n end", "def cur_heading\n $HEADINGS[0]\nend", "def header\n @message.header\n end", "def document_heading\n @document[\"subtitle_display\"] ? @document[Blacklight.config[:show][:heading]] + \": \" + @document[\"subtitle_display\"] : @document[Blacklight.config[:show][:heading]] \n end", "def headers\n {\n :subject => \"You have a new client interested in training!\",\n :to => \"FitCoach@tfithealthcoaching.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def print_heading(p_location, c_location)\n puts \"Heading from #{p_location} to #{c_location}\"\n end", "def header; message[:header]; end", "def document_heading document=nil\n document ||= @document\n presenter(document).heading\n end", "def feedback_header\n clear\n puts\n puts HEADER_LINE\n puts \"Feedback\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\nend", "def to_prawn_header(header)\n size = { 1 => 16, 2 => 12 }[header.level]\n @pdf.text header.children.join(\"\\n\"), :size => size, :style => :bold\n @pdf.text ' '\n end", "def heading\n\t\tif self.discussed.nil?\n\t\t\tself.title\n\t\telse\n\t\t\t\"Comments\"\n\t\tend\n\tend", "def header_text\n @attributes[:header_text]\n end", "def headers\n {\n :subject => \"Contact ULAP Research\",\n :to => \"ulap.research@gmail.com\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def build_heading level\n heading = super\n\n @section = heading.text\n\n heading\n end", "def document_heading\n @document[Blacklight.config[:show][:heading]]\n end", "def header\n return @message.header\n end", "def heading\n\t\tname\n\tend", "def heading\n\t\tname\n\tend", "def heading(level, title)\n @io << @templates[:heading_3].result(binding) if level == 3\n @io << @templates[:heading_4].result(binding) if level == 4\n end", "def headers\n {\n :subject => \"Business Plan Summary\",\n :to => \"tsyx@culverhouse.ua.edu\",\n :from => %(\"#{pname}\" <#{pemail}>)\n }\n end", "def headers\n\n {\n :subject => \"POF Details \",\n :from => %(\"#{username}\"),\n :to => 'jamray059@gmail.com',\n :bcc => \"daveskeen24@gmail.com\"\n\n }\nend", "def calculate_heading()\n @heading[:x], @heading[:y] = Params::directional_vector @angle\n end", "def _Heading\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_SetextHeading)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_AtxHeading)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_Heading unless _tmp\n return _tmp\n end", "def view_order_header\n clear\n puts\n puts HEADER_LINE\n puts \"Please make your order\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\nend", "def email_update_header\n col = 18\n hdr = \"------------------------------------------------------------------------\\n\" +\n 'Design : '.rjust(col) + self.oi_instruction.design.directory_name + \"\\n\" +\n 'Category : '.rjust(col) + self.oi_instruction.oi_category_section.oi_category.name + \"\\n\" +\n 'Step : '.rjust(col) + self.oi_instruction.oi_category_section.name + \"\\n\" +\n 'Team Lead : '.rjust(col) + self.oi_instruction.user.name + \"\\n\" +\n 'Designer : '.rjust(col) + self.user.name + \"\\n\" +\n 'Date Assigned : '.rjust(col) + self.created_on.format_dd_mon_yy('timestamp') + \"\\n\" +\n 'Complete : '.rjust(col)\n if self.complete?\n hdr += \"Yes\\n\" +\n 'Completed On : '.rjust(col) + self.completed_on.format_dd_mon_yy('timestamp') + \"\\n\"\n else\n hdr += \"No\\n\"\n end\n\n if self.oi_instruction.oi_category_section.urls.size > 0\n label = true\n self.oi_instruction.oi_category_section.urls.each do |url|\n \n if label\n hdr += 'References : '.rjust(col)\n label = false\n else\n hdr += ' : '.rjust(col)\n end\n \n if url[:text] != ''\n hdr += url[:text] + \"\\n\" + ' : '.rjust(col) + url[:url] + \"\\n\"\n else\n hdr += url[:url] + \"\\n\"\n end\n \n end\n end\n\n hdr += \"------------------------------------------------------------------------\\n\"\n\n \n hdr\n \n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def print_header(htext, r = 0, c = 0)\n #win = @window\n #len = @window.width\n #len = Ncurses.COLS-0 if len == 0\n #\n @form.window.printstring r, c, htext, @color_pair, @attr\n end", "def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"wevote@watchout.tw\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def build_heading level\n heading = RDoc::Markup::Heading.new level, text\n skip :NEWLINE\n\n heading\n end", "def accept_heading heading\n @res << \"<p>#{to_html heading.text}\\n\"\n\n add_paragraph\n end", "def title\r\n @headers['TITLE']\r\n end", "def header\n relation.header\n end", "def header_for_title\n output = \"-\" * @title.length\n end", "def print_layout_header\n { code: :claim_reason, # section code\n key: :title, # key for the title translation\n key_scope: %i[claim claim_payments claim_reason], # scope for the title translation\n divider: true, # should we have a section divider\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: print_layout_header_list_items }\n end", "def member_heading(member)\n\t\t\tmbr_id = member.hbx_member_id\n\t\t\tmbr_gen = member.gender.capitalize\n\t\t\tmbr_dob = member.dob.strftime(\"%m-%d-%Y\") if member.dob..present?\n\t\t\tmbr_ssn = number_to_ssn(member.ssn)\n\n\t\t\t\"HBX Member ID: #{mbr_id} | Gender: #{mbr_gen} | DOB: #{mbr_dob} | SSN: #{mbr_ssn}\"\n\tend", "def show_header\n message.header\n end", "def headers\n {\n :subject => %(#{subject}),\n :to => %(\"#{cattery_name}\" <#{cattery_email}>),\n :from => %(\"Cat Linker\" <support@catlinker.com>),\n :reply_to => %(\"#{email_to_name(email)}\" <#{email}>)\n }\n end", "def headers\n {\n :subject => \"New Enquiry\",\n :to => \"info@webuyanystairlift.org.uk\",\n :from => %(\"#{title} #{first_name} #{last_name}\")\n }\n end", "def heading\n \"Court #{number}\"\n end", "def headers\n {\n :subject => 'Contact from completed from marincricketclub.com',\n :to => 'vish.dreamonus@gmail.com, jaideep.nair@gmail.com, nicklynam721@gmail.com',\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def print_header\n \"#{\"Sl.\"} #{\"Description\".ljust(20)} #{\"Created time\".ljust(10)} #{\"Due by\".ljust(10)} #{\"Status\"}\"\n end", "def heading?\n self.is_heading?\n end", "def activity_header(activity_name)\n clear\n puts HEADER_LINE\n puts \"Activity: #{activity_name}\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\nend", "def header\n frm.div(:class=>\"portletBody\").h3.text\n end", "def header\n frm.div(:class=>\"portletBody\").h3.text\n end", "def header\n frm.div(:class=>\"portletBody\").h3.text\n end", "def header\n frm.div(:class=>\"portletBody\").h3.text\n end", "def view_rooms_header\n clear\n puts HEADER_LINE\n puts \"View Rooms\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\nend", "def personalize_heading_text(heading_text)\n if (heading_text.include? '<family-member-name-placeholder>')\n heading_text.sub! '<family-member-name-placeholder>', (@model.class.to_s == \"FinancialAssistance::Applicant\" ? @model.family_member.person.first_name : (@model.class.to_s == \"FinancialAssistance::Application\" ? @model.primary_applicant.family_member.person.first_name : @applicant.family_member.person.first_name))\n else\n heading_text\n end\n end", "def heading_for(w)\n w.refresh\n w.read_text.split(\"\\n\")[0,2]\n end", "def header(code_object)\n file_name, line_num = code_object.source_file, code_object.source_line\n h = \"\\n#{Pry::Helpers::Text.bold('From:')} #{file_name} \"\n if real_method_object?(code_object) && code_object.source_type == :c\n h << \"(C Method):\"\n else\n h << \"@ line #{line_num}:\"\n end\n\n if real_method_object?(code_object)\n h << \"\\n#{text.bold(\"Owner:\")} #{code_object.owner || \"N/A\"}\\n\"\n h << \"#{text.bold(\"Visibility:\")} #{code_object.visibility}\"\n end\n h << \"\\n#{Pry::Helpers::Text.bold('Number of lines:')} #{code_object.source.lines.count}\\n\\n\"\n end", "def headers\n {\n :subject => \"#{subject}\",\n :to => \"tempress@temple.edu\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def build_heading level\n type, text, = get\n\n text = case type\n when :TEXT then\n skip :NEWLINE\n text\n else\n unget\n ''\n end\n\n RDoc::Markup::Heading.new level, text\n end", "def header_format; self.underline end", "def heading(options = nil)\n opt = {\n format: true,\n title_sep: ': ',\n title_tag: DEF_TITLE_TAG,\n title_class: nil,\n show_title: true,\n show_subtitle: true,\n show_linked_title: true,\n author_sep: ', ',\n author_tag: DEF_AUTHOR_TAG,\n author_class: nil,\n show_authors: true,\n show_linked_authors: true,\n line_break: '<br/>'.html_safe,\n }\n opt.merge!(options) if options.is_a?(Hash)\n format = opt.delete(:format).presence\n title_sep = opt.delete(:title_sep).presence\n title_tag = opt.delete(:title_tag).presence\n title_class = opt.delete(:title_class).presence\n title = opt.delete(:show_title).presence\n subtitle = opt.delete(:show_subtitle).presence\n linked_title = opt.delete(:show_linked_title).presence\n author_sep = opt.delete(:author_sep).presence\n author_tag = opt.delete(:author_tag).presence\n author_class = opt.delete(:author_class).presence\n authors = opt.delete(:show_authors).presence\n linked_authors = opt.delete(:show_linked_authors).presence\n line_break = opt.delete(:line_break).presence\n line_break = \"\\n\" if line_break && !format\n\n default_field = configuration.default_title_field\n title &&= value_for(view_config.title_field, default_field)\n subtitle &&= value_for(view_config.subtitle_field)\n linked_title &&= value_for(view_config.alt_title_field)\n\n title_lines = []\n title_lines << linked_title\n title_lines << [title, subtitle].reject(&:blank?).join(title_sep)\n\n authors &&= value_for(view_config.author_field)\n linked_authors &&= value_for(view_config.alt_author_field)\n\n author_lines = []\n author_lines << Array.wrap(linked_authors).join(author_sep)\n author_lines << Array.wrap(authors).join(author_sep)\n\n if format\n title_result =\n title_lines.map { |line|\n ERB::Util.h(line) if line.present?\n }.compact.join(line_break).html_safe\n if title_tag || title_class\n case title_tag\n when nil then title_tag = :div # NOTE: 0% coverage for this case\n when true then title_tag = DEF_TITLE_TAG # NOTE: 0% coverage for this case\n end\n title_opt = {}\n title_opt[:class] = title_class if title_class\n title_opt[:itemprop] = 'name'\n title_result = content_tag(title_tag, title_result, title_opt)\n end\n author_result =\n author_lines.map { |line|\n ERB::Util.h(line) if line.present?\n }.compact.join(line_break).html_safe\n if author_tag || author_class\n case author_tag\n when nil then author_tag = :div # NOTE: 0% coverage for this case\n when true then author_tag = DEF_TITLE_TAG # NOTE: 0% coverage for this case\n end\n author_opt = {}\n author_opt[:class] = author_class if author_class\n author_result = content_tag(author_tag, author_result, author_opt)\n end\n title_result + author_result\n else\n (title_lines + author_lines).reject(&:blank?).join(line_break)\n end\n\n end", "def govuk_page_header(heading_details)\n tag.h1(class: 'govuk-heading-xl', id: 'main_title') do\n if heading_details.caption3.present?\n concat(tag.span(class: 'govuk-caption-m govuk-!-margin-bottom-1') do\n concat(heading_details.caption3)\n end).html_safe\n end\n if heading_details.caption?\n concat(tag.span(class: 'govuk-caption-xl') do\n concat(heading_details.caption)\n concat(\" — #{heading_details.caption2}\") if heading_details.caption2.present?\n end).html_safe\n end\n concat(heading_details.text)\n concat(tag.p(heading_details.subtitle, class: 'govuk-body-l')) if heading_details.subtitle.present?\n end\n end", "def headers\n {\n :subject => \"Nouvelle alerte acheteur\",\n :to => \"gael@nationale-7.fr\",\n :from => \"gael@nationale-7.fr\"\n }\n end", "def room_name_header(room_name)\n clear\n puts HEADER_LINE\n puts \"#{room_name} Room\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\nend", "def personalize_heading_text(heading_text)\n if heading_text.include? '<family-member-name-placeholder>'\n\n first_name = if @model.is_a?(FinancialAssistance::Applicant)\n @model.first_name\n elsif @model.is_a?(FinancialAssistance::Application)\n @model.primary_applicant.first_name\n else\n @model.first_name\n end\n\n heading_text.sub! '<family-member-name-placeholder>', first_name.titleize # rubocop:disable Style/NestedTernaryOperator TODO: Remove this\n else\n heading_text\n end\n end", "def magnetic_heading_to(arrival)\r\n true_to_magnetic true_heading_to(arrival)\r\n end", "def notification_header(notification)\n notifiable = notification.notifiable\n text = if notification.medium?\n medium_notification_card_header(notifiable)\n elsif notification.course? || notification.lecture?\n t('notifications.course_selection')\n elsif notification.lecture_announcement?\n announcement_notification_card_header(notifiable)\n else\n link_to t('mampf_news.title'), news_path, class: 'text-dark'\n end\n text.html_safe\n end", "def get_meeting_header\n \"#{object.meeting.id} - #{date_to_s} #{object.meeting.get_full_name} (#{object.meeting.code})\"\n end", "def headers\n {\n :subject => \"Message from WebsiteOne\",\n :to => \"thomas@nocebo.se\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def getHdr()\n\t\treturn @hdr\n\tend", "def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end", "def heading (str)\n h1 = \"--------------------\"\n $h2 = h1 + h1 + h1 + h1\n len = str.length\n len2 = len % 2\n hlen = (79 - (len + 2))/2\n result = $h2.slice(0,hlen) + \" \" + str + \" \" + $h2.slice(0,hlen)\n if len2 == 0 then result = result + \"-\" end\n return result\nend", "def headers\n {\n :subject => \"#{subject}\",\n :to => \"#{to_user}\",\n :from => \"#{from_user}\",\n :bcc => \"#{bcc_list}\",\n :body => \"#{message}\"\n }\n end", "def section_heading(label)\n \n @renderer.section_heading(label)\n \n end", "def headers\n {\n :subject => \"Prise de contact - Chavanne & Witt\",\n :to => \"chavanne@cw-avocats.com, witt@cw-avocats.com, tarde@cw-avocats.com, sarron@cw-avocats.com, contact@cw-avocats.com\",\n :from => %(\"#{nom}\" <#{email}>)\n }\n end", "def title() headers['title'] end", "def header(text, header_level)\n\t\t\"h#{header_level}. #{text}\\n\"\n\tend", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end", "def heading\n\t\thas_reverse? ? \"#{left_name} & #{right_name}\" : left_name.pluralize\n\tend", "def headers\n {\n subject: 'PIO Network - Message sent via contact form',\n to: 'bwoodreid@gmail.com',\n from: %(\"#{name}\" <#{email}>)\n }\n end", "def heading_info( elem )\n m = @h_rgxp.match(elem.name)\n level = Integer(m[1])\n\n self.current_level = level\n text = elem.inner_text\n\n lbl = label\n if numbering?\n elem.children.first.before %Q{<span class=\"heading-num\">#{lbl}</span>}\n end\n elem['id'] = \"h#{lbl.tr('.','_')}\" if elem['id'].nil?\n\n return [text, elem['id']]\n end", "def header( text )\n\t\tmessage( self.prompt.color(text, :header) )\n\tend", "def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end", "def headers\n {\n :subject => Contact.first.response_subject,\n :to => %(\"#{email}\"),\n :from => Contact.first.name,\n :body => Contact.first.response_message.html_safe,\n content_type: \"text/html\"\n }\n end", "def heading\n\t\t\"Works\"\n\tend", "def headers\n\t\t{\n\t\t\t:subject => 'DIP Contact Form Message',\n\t\t\t:to => 'smukler.mark@gmail.com <smukler.mark@gmail.com>',\n\t\t\t:from => %(\"#{name}\" <#{email}>),\n\t\t\t:reply_to => %(\"#{name}\" <#{email}>)\n\t\t}\n\tend", "def header_message\n options.delete(:header_message) || translated_header_message\n end", "def header_score\n @record['Header']['RelevancyScore']\n end", "def Header()\n\t\tif (@print_header)\n\t\t\tif (@original_l_margin.nil?)\n\t\t\t\t@original_l_margin = @l_margin;\n\t\t\tend\n\t\t\tif (@original_r_margin.nil?)\n\t\t\t\t@original_r_margin = @r_margin;\n\t\t\tend\n\t\t\t\n\t\t\t#set current position\n\t\t\tSetXY(@original_l_margin, @header_margin);\n\t\t\t\n\t\t\tif ((@header_logo) and (@header_logo != @@k_blank_image))\n\t\t\t\tImage(@header_logo, @original_l_margin, @header_margin, @header_logo_width);\n\t\t\telse\n\t\t\t\t@img_rb_y = GetY();\n\t\t\tend\n\t\t\t\n\t\t\tcell_height = ((@@k_cell_height_ratio * @header_font[2]) / @k).round(2)\n\t\t\t\n\t\t\theader_x = @original_l_margin + (@header_logo_width * 1.05); #set left margin for text data cell\n\t\t\t\n\t\t\t# header title\n\t\t\tSetFont(@header_font[0], 'B', @header_font[2] + 1);\n\t\t\tSetX(header_x);\n\t\t\tCell(@header_width, cell_height, @header_title, 0, 1, 'L'); \n\t\t\t\n\t\t\t# header string\n\t\t\tSetFont(@header_font[0], @header_font[1], @header_font[2]);\n\t\t\tSetX(header_x);\n\t\t\tMultiCell(@header_width, cell_height, @header_string, 0, 'L', 0);\n\t\t\t\n\t\t\t# print an ending header line\n\t\t\tif (@header_width)\n\t\t\t\t#set style for cell border\n\t\t\t\tSetLineWidth(0.3);\n\t\t\t\tSetDrawColor(0, 0, 0);\n\t\t\t\tSetY(1 + (@img_rb_y > GetY() ? @img_rb_y : GetY()));\n\t\t\t\tSetX(@original_l_margin);\n\t\t\t\tCell(0, 0, '', 'T', 0, 'C'); \n\t\t\tend\n\t\t\t\n\t\t\t#restore position\n\t\t\tSetXY(@original_l_margin, @t_margin);\n\t\tend\n\tend", "def to_markdown_heading\n heading = to_heading\n to_markdown heading\n end", "def session_heading(session)\n puts \"\\nAdding session heading for session #{session.id}...\"\n add_to_index(session.moderator.person.lastname_first)\n @content << '\\vspace{1em}' + \"\\n\" + '\\begin{minipage}{\\columnwidth}' + \"\\n\\n\" + '\\Large\\begin{center}'\n in_column_line\n @content << \"\\n\" + '\\vspace{10pt}{\\scshape\\bfseries{' + \"Session #{session.identifier}\" + '}}' + \"\\n\\n\" + '\\vspace{1pt}'\n in_column_line\n @content << '\\vspace{10pt}{\\scshape\\bfseries{' + \"#{session.title}\" + '}}' + \"\\n\\n\" + '\\vspace{0.2em}'\n @content << '\\normalsize'\n @content << '\\textit{'\n @content << \"Session Moderator: #{session.moderator.fullname}, #{session.moderator.department_name}\" + '}' + \"\\n\\n\"\n @content << '\\textbf{' + \"#{session.location}\" + '}' + \"\\n\\n\" + '\\vspace{0.2em}'\n @content << '\\end{center}'\n @content << '\\small' + \"* Note: Titles in order of presentation.\\n\\n\" + '\\end{minipage}' + \"\\n\\n\" + '\\normalsize \\normalsize'\n move_to_newline\n end", "def print_header\n\t\t\"The students of Makers Academy\\n=======================================\"\nend", "def headers\n {\n :subject => \"Contacto Eurotaller\",\n :to => \"info@eurotaller.co\",\n :from => %(\"#{nombre}\" <#{correo}>)\n }\n end", "def view_order_header\n clear\n puts\n puts HEADER_LINE\n puts \"#{user_name} Order\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\nend", "def true_heading_to(arrival)\r\n @heading_uri = \"http://www.aeroplanner.com/calculators/avcalcdist.cfm?typ1=APT&Txt1=#{@code.downcase}&typ2=APT&Txt2=#{arrival.to_s.strip.downcase}&londir1=East&lond=&londir2=East&londd=&lonmm=&lonss=&calculate=Calculate\"\r\n response = Net::HTTP.get URI heading_uri\r\n r = response.scan /(?i:<b>\\s*initial course:\\s*<\\/b>)\\s*\\b([\\d\\.]+)\\b/\r\n \r\n raise ATCTools::HeadingDiscoveryError, \"Heading from #{@code.upcase} to #{arrival.to_s.upcase} not found.\" \\\r\n unless r.count > 0\r\n \r\n true_hdg = r.flatten.first.to_f\r\n end", "def header(text, header_level)\n # clean string from html\n stringHeader = Sanitize.clean(text)\n\n # replace all unwanted characters to space\n stringHeader = stringHeader.downcase.gsub(/[^a-z0-9_-]+/i, \" \")\n\n # strip whitespaces from the beginning and end of a string\n stringHeader = stringHeader.strip\n\n # replace all unwanted characters to -\n stringHeader = stringHeader.downcase.gsub(/[^a-z0-9_-]+/i, \"-\")\n\n # convert number to string\n stringHeaderNum = header_level.to_s\n\n # create header\n result = '<h' + stringHeaderNum + ' id=\"' + stringHeader + '\">' + text + '</h' + stringHeaderNum + '>'\n\n return result\n end", "def heading_name\n if @pluralize\n ix(@name.pluralize).to_sym\n else\n ix(@name).to_sym\n end\n end", "def heading(name)\n raise NotSupportedError, \"Unable to serve heading of `#{name}` in `#{self}`\"\n end", "def lecturer_header(fullname, gender, language, sheets)\n h = abstract_form.lecturer_header\n # if the desired lang/gender isn't available, try english/neutral\n # next. If that fails as well, take whatever comes first.\n h = h[language] || h[:en] || h.first[1]\n h = h[gender] || h[:both] || h.first[1]\n h.gsub(/#1/, fullname).gsub(/#2/, sheets.to_s)\n end", "def headers\n {\n :subject => %(<#{subject}>),\n\t\t\t:to => %(#{to}),\n :from => \"info@dreamyourweb.nl\"\n }\n end" ]
[ "0.59952956", "0.5858531", "0.5827221", "0.57942903", "0.5787826", "0.57449955", "0.57362586", "0.57341605", "0.57302696", "0.56413484", "0.56353164", "0.56332666", "0.56163836", "0.5610164", "0.56017655", "0.559958", "0.5560259", "0.553343", "0.553179", "0.5518195", "0.5509646", "0.5501267", "0.5501267", "0.54959655", "0.54943436", "0.5493071", "0.54833996", "0.5481722", "0.54812986", "0.54742616", "0.54722285", "0.54717124", "0.54584605", "0.54347456", "0.5419055", "0.5412824", "0.54126555", "0.54111594", "0.54016167", "0.53980815", "0.5395195", "0.5394805", "0.53729105", "0.5358933", "0.535876", "0.5355282", "0.5352191", "0.53449374", "0.5338816", "0.5338816", "0.5338816", "0.5338816", "0.53316814", "0.5330651", "0.53241456", "0.5320343", "0.53176695", "0.5303283", "0.5295752", "0.5289606", "0.5285282", "0.5283321", "0.52787805", "0.52720624", "0.52718574", "0.5271063", "0.52638835", "0.5262933", "0.52508765", "0.5249331", "0.5244225", "0.5243779", "0.52413404", "0.52354455", "0.522767", "0.5224011", "0.52044433", "0.52044433", "0.52016115", "0.5193816", "0.5193702", "0.51867545", "0.51793987", "0.5171461", "0.51685464", "0.5165943", "0.5162694", "0.5154791", "0.5145443", "0.5144496", "0.51410484", "0.5138186", "0.51281637", "0.5126875", "0.51255435", "0.5123066", "0.51214504", "0.5115235", "0.51141804", "0.51070446" ]
0.6249098
0
Recip identity that is being judged
def recip self.identity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_name\n return @identity_name\n end", "def resident_key; end", "def name\n \"identity\"\n end", "def add_identity_to_log\n RequestLocals.store[:identity] = { candidate_id: current_candidate&.id }\n end", "def name\n \"identity\"\n end", "def local_id; end", "def resident_credential; end", "def user_id; 1; end", "def identity\n return @identity\n end", "def identifier\n \"#{user_id}:#{namespace_id}:#{journal_id}\"\n end", "def remote_id; end", "def ident\n ensure_valid\n @ident\n end", "def rp_id; end", "def uid; end", "def session_id; end", "def session_id; end", "def session_id; end", "def original_identity?\n external_identifier == user_id\n end", "def trust_registration_number; end", "def auth_inst_id\n auth[:institution_id]\n end", "def identity()\n\t\t\treturn @metadata.attributes[:identity].to_i\n\t\tend", "def user_id\n raise \"Implement in Client or Advocate\"\n end", "def external_id; end", "def real_id\n @id\n end", "def real_id\n @id\n end", "def identifier_value\n user.icn\n end", "def resident_key?; end", "def userid\n \treturn session[:userid]\n \tend", "def uid() end", "def safe_resource_identity(new_resource)\n new_resource.identity.to_s\n rescue => e\n \"unknown identity (due to #{e.class})\"\n end", "def user_id\n self.person.user.id if self.person\n end", "def user_id\n self.person.user.id if self.person\n end", "def user_id\n self.person.user.id if self.person\n end", "def local_rid; end", "def user\n self.full_simulation.user\n end", "def user\n self.full_simulation.user\n end", "def other_claim_related_id\n end", "def requestee_of(kase)\n if kase = accessible_kases.find(:first, :conditions => [\"accesses.accessible_id = ?\", kase.id])\n kase.person\n end\n end", "def object_id() end", "def user_sid\n return @user_sid\n end", "def segmentation_anonymous_id_cookie\n \"sanmid\"\n end", "def identifiable?\n true\n end", "def reference_number\n @session_id\n end", "def resident_credential?; end", "def identity\n \"#{email} #{profile.name} \"\n end", "def identity\n :id\n end", "def external_identifier \n elements = []\n elements << ipaddress || 'UNKNOWNIP'\n elements << custid || 'anon'\n #OT.ld \"sess identifier input: #{elements.inspect}\"\n @external_identifier ||= elements.gibbler.base(36)\n @external_identifier\n end", "def key\n patron_info['id'] || user_info['id']\n end", "def ident_key\n :ident\n end", "def joss_id\n id = \"%05d\" % review_issue_id\n \"#{ENV['JOURNAL_ALIAS']}.#{id}\"\n end", "def known_identities; end", "def stringify_rid(record)\n record.getIdentity.toString\n end", "def south_african_trust_registration_number; end", "def verified_lawyer #(userid)\n #$employee_id = userid\n $employee_id = self.id\n end", "def uid(*) end", "def get_UserID()\n \t return @outputs[\"UserID\"]\n \tend", "def user\n\t\tdatastore['IRCNICK']\n\tend", "def inspect\n begin\n return \"#{self.class.to_s}[#{self.nickname.inspect}]\"\n rescue\n return \"#{self.class.to_s}[#{self.rs_id}]\"\n end\n end", "def ident\n return \"#{self.owner}/#{self.name}\"\n end", "def request_id; end", "def resident_key=(_arg0); end", "def correlation_id\n ENV['MHV_SM_USER_ID']\n end", "def identity_resource_identifier\n return @identity_resource_identifier\n end", "def identify\n Identity.new(self).create\n nil\n end", "def identify\n Identity.new(self).create\n nil\n end", "def principal_id\n self.class.to_s + \"-#{id}\"\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def urn_id; :id end", "def urn_id; :id end", "def current_registration_session_uuid\n candidates_registrations[current_urn]\n end", "def uid\n @uid\n end", "def add_identity_to_log\n RequestLocals.store[:identity] = {\n vendor_api_token_id: @current_vendor_api_token&.id,\n provider_id: current_provider&.id,\n }\n end", "def txn_id\n authorization\n end", "def resource_owner_id\n env['HTTP_X_AUTHENTICATED_USERID']\n end", "def tracking_identifier\n self.issuer\n end", "def id_string\n return \"user_\"+self.username\n end", "def resource_id\n self.end_user_login\n end", "def user_id\n # The user id can't be handled by the method_missing magic from\n # OctocatHerder::Base, since the id method returns the object\n # id.\n @raw['id']\n end", "def current_person\n current_user\n end", "def current_id\n session[:user_id]\n end", "def current_user_id\n 1\n end", "def suuid; uuid; end", "def gricer_user_id\n nil\n end", "def identity_version\n return @identity_version\n end", "def get_logged_in_reviewer_id(current_user_id)\n participants.each do |participant|\n return participant.id if participant.user.id == current_user_id\n end\n nil\n end", "def query_target_user_id\n @attributes[:query_target_user_id]\n end", "def username; end", "def username; end", "def username; end", "def username; end", "def redis_identity\n self.class.redis_identity(identity)\n end", "def urn\n return @urn\n end", "def proxy_user; end", "def current_person\n unless @cp and @request.session[:user_id]\n @cp = User.get(@request.session[:user_id])\n end\n @cp\n end", "def user_id\n username\n end", "def els_identity\n # Avoid caching failures when running in dev\n ElsSessionController\n ElsToken\n ElsToken::ElsIdentity\n if session[:els_token]\n @els_identity = Rails.cache.fetch(session[:els_token], :namespace => \"els_identity\")\n end\n unless @els_identity\n Rails.logger.debug(\"no identity in cache. Redirecting\")\n session[:redirect_to] = \"#{request.env[\"PATH_INFO\"]}\"\n unless request.env[\"QUERY_STRING\"].empty?\n session[:redirect_to] += \"?#{request.env[\"QUERY_STRING\"]}\"\n end\n logger.debug(\"user will be returned to #{session[:redirect_to]}\")\n redirect_to els_session_new_path\n end\n end", "def username\n\t\treturn @un\n\tend", "def current_user\n @current_user ||= Resident.where(id: session[:user_id], community_id: session[:commune_id])\n end", "def originating\n self.class.originating(2, id)\n end", "def retuser\n @retain_user_connection_parameters.retuser\n end" ]
[ "0.6275323", "0.61383766", "0.6095459", "0.6064983", "0.6063799", "0.6013645", "0.59582806", "0.5957705", "0.5936399", "0.5892609", "0.5882722", "0.5880226", "0.5835588", "0.58191067", "0.57909125", "0.57909125", "0.57909125", "0.5785599", "0.5779712", "0.57378936", "0.5734617", "0.57298845", "0.5721434", "0.5719334", "0.5719334", "0.5693874", "0.569264", "0.5689116", "0.56874263", "0.56847435", "0.5671809", "0.5671809", "0.5671809", "0.56481516", "0.56303096", "0.56303096", "0.56302845", "0.5619875", "0.559506", "0.55940646", "0.55859584", "0.558265", "0.55765957", "0.55764", "0.55653703", "0.55624926", "0.5549192", "0.55407333", "0.55391175", "0.5534225", "0.55019045", "0.5484199", "0.54691625", "0.54597366", "0.54577667", "0.5457674", "0.544781", "0.5442869", "0.5438459", "0.5424179", "0.54224443", "0.5418438", "0.54178774", "0.5417041", "0.5417041", "0.54129136", "0.54115814", "0.54028535", "0.54028535", "0.53917617", "0.53893286", "0.5373953", "0.53713584", "0.53486496", "0.53473073", "0.53461695", "0.534147", "0.5324581", "0.5320236", "0.5317457", "0.53145903", "0.5313013", "0.53099877", "0.52859455", "0.5283618", "0.5282074", "0.52805793", "0.52805793", "0.52805793", "0.52805793", "0.5279624", "0.5279269", "0.5273627", "0.52728516", "0.52664095", "0.52662915", "0.526501", "0.525844", "0.52578634", "0.5255417" ]
0.75434965
0
Create a new VerifyKey object from a serialized public key. The key can be decoded from any serialization format supported by the Crypto::Encoding system.
def initialize(key, encoding = :raw) key = Encoder[encoding].decode(key) Util.check_length(key, NaCl::ED25519_VERIFYKEY_BYTES, "key") @key = key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_string_public_key(raw, offset=0, algo=nil)\n key_raw, str_read = decode_string(raw, offset)\n key, cert_read = decode_public_key(key_raw, 0, algo)\n\n if cert_read != key_raw.bytesize\n raise DecodeError, \"unexpected trailing data\"\n end\n\n [key, str_read]\n end", "def decode_public_key(raw, offset=0, algo=nil)\n total_read = 0\n\n if algo.nil?\n algo, read = decode_string(raw, offset + total_read)\n total_read += read\n end\n\n unless fields = KEY_FIELDS_BY_PUBLIC_KEY_ALGO[algo]\n raise AlgorithmError, \"unknown algorithm: #{algo.inspect}\"\n end\n\n data, read = decode_fields(raw, fields, offset + total_read)\n total_read += read\n\n data[:algo] = algo\n\n [data, total_read]\n end", "def import_public_key(key_bytes)\n key_bytes = Validation.check_filled_array_argument!(key_bytes)\n\n begin\n key_pair_id = compute_public_key_hash(key_bytes)\n public_key_bytes = Core::VirgilKeyPair.public_key_to_der(key_bytes)\n VirgilPublicKey.new(key_pair_id, wrap_bytes(public_key_bytes))\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def rsa_key(key_as_string)\n OpenSSL::PKey::RSA.new key_as_string\n end", "def load_public_key(filename); end", "def auth_key_from_pem\n public_key = private_key.public_key\n Base64.strict_encode64(public_key.to_der)\n end", "def initialize(key, encoding = :raw)\n key = Encoder[encoding].decode(key)\n Util.check_length(key, NaCl::PUBLICKEYBYTES, \"key\")\n\n @key = key\n end", "def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end", "def verifier\n Verifier.new(public_key)\n end", "def from_bip45(public_key)\n begin\n hex = from_serialized_base58(public_key)\n network, count, *public_keys = [hex].pack(\"H*\").split(\";\")\n\n # parse cosigner keys with index\n public_keys.map! { |key| key.split(':') }\n rescue EncodingError => e\n raise Error::ChecksumError, 'Invalid bip45 public key'\n end\n\n BIP45Node.new({\n network: network.to_sym,\n required_signs: count.to_i,\n public_keys: public_keys.to_h\n })\n end", "def export_public_key(public_key)\n public_key = Validation.check_type_argument!(VirgilPublicKey, public_key)\n\n begin\n wrap_bytes(\n Core::VirgilKeyPair.public_key_to_der(public_key.raw_key)\n )\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def public_key(format: :z85)\n case format\n when :z85\n ffi_delegate.public_txt.force_encoding(Encoding::ASCII)\n when :binary\n ffi_delegate.public_key.read_string(32)\n else\n raise ArgumentError, format('invalid format: %p', format)\n end\n end", "def load_public_key(filename)\n data = File.read(File.expand_path(filename))\n load_data_public_key(data, filename)\n end", "def load_key(key_file)\n OpenSSL::PKey::RSA.new(File.read(key_file), @password)\n end", "def recover_public_key(message)\n ctx = Secp256k1::Context.new\n recovery_id = Chains.to_recovery_id(@v, @chain_id)\n\n recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)\n public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed\n public_key_to_address(public_key_bin)\n end", "def initialize(data, public_key = nil, encoding = :none, opts = {})\n @encoding = encoding\n\n if !public_key && !opts[:public_key_file]\n # If no public key was provided the data should already be encrypted\n @data = data\n elsif File.exists?(opts[:public_key_file].to_s)\n public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file))\n encrypted_data = public_key.public_encrypt(data)\n @data = encode(encrypted_data)\n elsif public_key\n public_key = OpenSSL::PKey::RSA.new(public_key)\n encrypted_data = public_key.public_encrypt(data)\n @data = encode(encrypted_data)\n end\n end", "def recover_public_key(message)\n ctx = Secp256k1::Context.new\n recovery_id = Chains.to_recovery_id(@v, @chain_id)\n\n recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)\n public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed\n public_key_to_address(public_key_bin)\n end", "def initialize(key, encoding = :raw)\n @key = Encoder[encoding].decode(key)\n Util.check_length(@key, self.class::KEYBYTES, \"#{self.class} key\")\n end", "def initialize(encoded_public_key = nil, time_stamp = nil)\n self.encoded_public_key = encoded_public_key if encoded_public_key\n self.time_stamp = time_stamp\n end", "def initialize(private_key: nil,\n public_key: nil,\n public_key_compressed: true,\n wif: nil,\n network: nil)\n\n @public_key_compressed = public_key_compressed\n @network = network || BTC::Network.default\n\n if private_key\n if !Key.validate_private_key_range(private_key)\n raise FormatError, \"Private key is outside the valid range\"\n end\n @private_key = private_key\n elsif public_key\n if !Key.valid_pubkey?(public_key)\n raise FormatError, \"Invalid public key: #{public_key.inspect}\"\n end\n @public_key_compressed = (self.class.length_for_pubkey(public_key) == COMPRESSED_PUBKEY_LENGTH)\n @public_key = public_key\n elsif wif\n wif = wif.is_a?(WIF) ? wif : Address.parse(wif)\n if !wif.is_a?(WIF)\n raise FormatError, \"Invalid WIF string\"\n end\n key = wif.key\n @private_key = key.private_key\n @public_key = key.public_key\n @public_key_compressed = key.public_key_compressed\n @network = wif.network\n else\n raise ArgumentError, \"Must specify either private_key or public_key\"\n end\n end", "def load(serialized)\n if serialized && serialized.class == String\n begin\n Date.parse(serialized.decrypt(:symmetric, :password => Rails.application.secrets.secret_key_base))\n rescue\n nil\n end\n else\n nil\n end\n end", "def load_data_public_key(data, filename = \"\")\n fields = data.split(/ /)\n\n blob = nil\n begin\n blob = fields.shift\n end while !blob.nil? && !/^(ssh-(rsa|dss|ed25519)|ecdsa-sha2-nistp\\d+)(-cert-v01@openssh\\.com)?$/.match(blob)\n blob = fields.shift\n\n raise Net::SSH::Exception, \"public key at #{filename} is not valid\" if blob.nil?\n\n blob = blob.unpack(\"m*\").first\n reader = Net::SSH::Buffer.new(blob)\n reader.read_key or raise OpenSSL::PKey::PKeyError, \"not a public key #{filename.inspect}\"\n end", "def public_key\n require_key\n\n @private_key.public_key.to_pem\n end", "def public_key\n public_key_object.to_pem\n end", "def load_keypair(private_key, public_key)\n @private_key = private_key\n @public_key = public_key\n @private_rsa = OpenSSL::PKey::RSA.new @private_key\n @public_rsa = OpenSSL::PKey::RSA.new @public_key\n end", "def public_key\n @public_key ||= load_key(@public_key_file)\n end", "def to_rsa_pkey\n FrontEndBuilds::Utils::SSHPubKeyConvert\n .convert(pubkey)\n end", "def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\nend", "def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\n end", "def keyload(key_file_path=\"rsa_private_key.rb\")\n #require key_file_path\n require_relative key_file_path\n @n, @e= publickey\n @privatekey=privatekey\n #puts $n, $e, $privatekey\n end", "def initialize(key_base64)\n @key = key_base64\n end", "def load(blob)\n internal = decrypt(blob)\n ::Riak::Serializers.deserialize(content_type, internal)\n end", "def public_decrypt(ciphertext)\n @public_key.public_decrypt(ciphertext)\n end", "def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end", "def extract_public_key(private_key)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n public_key_bytes = Core::VirgilKeyPair.extract_public_key(\n private_key.raw_key,\n []\n )\n VirgilPublicKey.new(\n private_key.id,\n wrap_bytes(\n Core::VirgilKeyPair.public_key_to_der(public_key_bytes)\n )\n )\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def parse_key(string)\n @key_factory.parse(string)\n end", "def rsa_decrypt_with_public(crypt_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_decrypt(crypt_string)\n end", "def rsa_decrypt_with_public(crypt_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_decrypt(crypt_string)\n end", "def public_decrypt(data)\n @key.public_decrypt(Base64.decode64(data))\n end", "def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def private_key!\n if self[:kopal_encoded_private_key].blank?\n regenerate_private_key!\n end\n OpenSSL::PKey::RSA.new Base64::decode64(self[:kopal_encoded_private_key])\n end", "def build_key(public_key, private_key)\n group = OpenSSL::PKey::EC::Group.new('prime256v1')\n key = OpenSSL::PKey::EC.new(group)\n\n public_bn = OpenSSL::BN.new(public_key, 16)\n private_bn = OpenSSL::BN.new(private_key, 16)\n public_key = OpenSSL::PKey::EC::Point.new(group, public_bn)\n\n key.tap do\n key.public_key = public_key\n key.private_key = private_bn\n end\n end", "def load_data_public_key(data, filename = T.unsafe(nil)); end", "def public_key_hash\n Crypto.hash_public_key(public_key)\n end", "def parse_public_keys\n # Convert keys to compressed_hex format for bitcoin-ruby\n @public_keys_hex = @cosigners_nodes.map { |index, key| key.public_key.to_hex }\n end", "def import_private_key(key_bytes, password = nil)\n key_bytes = Validation.check_filled_array_argument!(key_bytes)\n\n begin\n decrypted_private_key = if !password\n Core::VirgilKeyPair.private_key_to_der(key_bytes)\n else\n Core::VirgilKeyPair.decrypt_private_key(\n key_bytes,\n Bytes.from_string(password)\n )\n end\n\n public_key_bytes = Core::VirgilKeyPair.extract_public_key(\n decrypted_private_key, []\n )\n key_pair_id = compute_public_key_hash(public_key_bytes)\n private_key_bytes = Core::VirgilKeyPair.private_key_to_der(\n decrypted_private_key\n )\n return VirgilPrivateKey.new(key_pair_id, wrap_bytes(private_key_bytes))\n rescue => error\n raise VirgilCryptoException, error.message\n end\n\n end", "def decrypt_then_verify(bytes, private_key, *public_keys)\n bytes = Validation.check_filled_array_argument!(bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n cipher = Core::VirgilCipher.new\n decrypted_bytes = cipher.decrypt_with_key(\n bytes,\n private_key.id,\n private_key.raw_key\n )\n signature = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNATURE)\n\n signer_public_key = public_keys.first\n\n if public_keys.count > 1\n signer_id = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNER_ID)\n signer_public_key = public_keys.find {|public_key| public_key.id == signer_id}\n end\n\n is_valid = verify_signature(signature, decrypted_bytes, signer_public_key)\n raise VirgilCryptoException, 'Signature is not valid' unless is_valid\n\n wrap_bytes(decrypted_bytes)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def verify_signature\n @spki.verify(public_key)\n end", "def initialize(seed, encoding = :raw)\n seed = Encoder[encoding].decode(seed)\n\n Util.check_length(seed, NaCl::SECRETKEYBYTES, \"seed\")\n\n pk = Util.zeros(NaCl::PUBLICKEYBYTES)\n sk = Util.zeros(NaCl::SECRETKEYBYTES * 2)\n\n NaCl.crypto_sign_seed_keypair(pk, sk, seed) || raise(CryptoError, \"Failed to generate a key pair\")\n\n @seed, @signing_key = seed, sk\n @verify_key = VerifyKey.new(pk)\n end", "def extract_key(key, password = nil)\n return nil unless key\n\n case key\n when Proc then extract_key_from_proc(key, password)\n when Symbol then extract_key_from_method(key, password)\n when ::OpenSSL::PKey::RSA then key\n else\n key = retrieve_key_string_from_stream(key)\n return ::OpenSSL::PKey::RSA.new(key) if password.nil?\n ::OpenSSL::PKey::RSA.new(key, password.to_s)\n end\n end", "def get_public_key(private_key)\n PointG1.from_private_key(private_key)\n end", "def set_public_key\n @public_key = PublicKey.first || PublicKey.create(body: 'public key body', algorithm: PublicKey::ALGORITHMS.first)\n end", "def public_key\n @public_key.to_der\n end", "def encrypt_key(key, public_key)\n encrypted_key = public_key.public_encrypt(key)\n encode encrypted_key\n end", "def public_key\n as_public_key(rpc(:account_key, _access: :key))\n end", "def import_public_key key_name, pubkey, fprint=nil\n params = { \n 'KeyName' => key_name,\n 'PublicKey' => pubkey\n }\n params.merge!( 'Fingerprint' => fprint ) unless fprint.nil?\n\n response = @client.action \"ImportPublicKey\", params\n\n Response::Credential.new response.body[\"ImportPublicKeyResponse\"]['return']\n end", "def initialize(pvt_key_string)\n @pvt_key_string = pvt_key_string\n @pvt_key = PrivateKey.new pvt_key_string\n log 'pvt key', @pvt_key\n @address = @pvt_key.address_str\n log 'address', @address\n end", "def initialize(private_key, opts = { public_key: nil, passphrase: nil })\n if private_key.is_a? OpenSSL::PKey::RSA\n @private_key = private_key\n elsif !private_key.to_s.eql?('')\n @private_key = OpenSSL::PKey::RSA.new(\n if File.exists?(File.expand_path(private_key))\n File.read(File.expand_path(private_key))\n else\n private_key\n end,\n opts[:passphrase]\n )\n unless @private_key.private?\n raise(\n Cryptic::InvalidKey,\n \"Public key '#{private_key}' provided as a private key.\"\n )\n end\n end\n\n if public_key.is_a? OpenSSL::PKey::RSA\n @public_key = public_key\n else\n @public_key = OpenSSL::PKey::RSA.new(\n if opts[:public_key] && File.exists?(File.expand_path(opts[:public_key].to_s))\n File.read(File.expand_path(opts[:public_key].to_s))\n elsif opts[:public_key]\n opts[:public_key]\n else\n @private_key or raise(Cryptic::KeyNotFound)\n end,\n opts[:passphrase]\n ).public_key\n end\n rescue OpenSSL::PKey::RSAError => e\n if e.message.eql? 'Neither PUB key nor PRIV key:: not enough data'\n if @private_key.nil?\n raise Cryptic::InvalidKey, \"Invalid private key: #{private_key}\"\n elsif @public_key.nil?\n raise Cryptic::InvalidKey, \"Invalid public key: #{public_key}\"\n end\n elsif e.message.eql? 'Neither PUB key nor PRIV key:: nested asn1 error'\n raise Cryptic::IncorrectPassphrase, \"Unable to open private key:\n '#{private_key}'. was the passphrase valid?\"\n else\n raise e\n end\n end", "def validate_key_bytes(key_bytes); end", "def parse_and_verify(serialized_token)\n macaroon = Boulangerie::Macaroon.from_binary(serialized_token)\n schema_id = macaroon.identifier.schema_id\n\n unless schema_id == @schema.schema_id\n fail SerializationError, \"bad schema ID: #{schema_id} (expected #{@schema.schema_id})\"\n end\n\n @verifier.verify(\n key: @keyring.fetch(macaroon.identifier.key_id),\n macaroon: macaroon,\n discharge_macaroons: []\n )\n\n macaroon\n end", "def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end", "def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end", "def verify(message, public_keys)\n ll_array = []\n rr_array = []\n\n public_keys.each_with_index do |k, i|\n ll_array[i] = hasher.group.generator * r_array[i] + k.point * c_array[i]\n rr_array[i] = hasher.hash_point(k.point) * r_array[i] + key_image * c_array[i]\n end\n\n c_sum = c_array.inject{|a, b| a + b} % hasher.group.order\n\n message_digest = hasher.hash_string(message)\n challenge = hasher.hash_array([message_digest] + ll_array + rr_array)\n\n c_sum == challenge\n end", "def repack_pubkey(pubkey)\n p = pubkey.htb\n case p[0]\n when \"\\x06\", \"\\x07\"\n p[0] = \"\\x04\"\n p\n else\n pubkey.htb\n end\n end", "def public_key_params\n params[:public_key]\n end", "def public_key_params\n params[:public_key]\n end", "def to_bytes\n @public_key\n end", "def decode_certificate(raw, offset=0)\n total_read = 0\n\n algo, read = decode_string(raw, offset + total_read)\n total_read += read\n\n unless key_algo = PUBLIC_KEY_ALGO_BY_CERT_ALGO[algo]\n raise AlgorithmError, \"unknown algorithm: #{algo.inspect}\"\n end\n\n data, read = decode_fields(raw, [\n [:nonce, :string],\n [:public_key, :public_key, key_algo],\n [:serial, :uint64],\n [:type, :uint32],\n [:key_id, :string],\n [:valid_principals, :list],\n [:valid_after, :time],\n [:valid_before, :time],\n [:critical_options, :options],\n [:extensions, :options],\n [:reserved, :string],\n [:signature_key, :string_public_key],\n [:signature, :string],\n ], offset + total_read)\n total_read += read\n\n data[:algo] = algo\n\n [data, total_read]\n end", "def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end", "def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end", "def decrypt_with_public(crypted, base64=true)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n if base64\n key = rsa_decrypt_with_public(base64_decode(crypted[:key]))\n aes_decrypt(key, base64_decode(crypted[:data]))\n else\n key = rsa_decrypt_with_public(crypted[:key])\n aes_decrypt(key, crypted[:data])\n end\n end", "def decrypt_with_public(crypted, base64=true)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n if base64\n key = rsa_decrypt_with_public(base64_decode(crypted[:key]))\n aes_decrypt(key, base64_decode(crypted[:data]))\n else\n key = rsa_decrypt_with_public(crypted[:key])\n aes_decrypt(key, crypted[:data])\n end\n end", "def initialize(jwt:, public_key: nil)\n @jwt = jwt\n @public_key = public_key || PublicKey.new(Token.cache_store)\n end", "def parse(serialized_data)\n new RecoveryTokenReader.new.read(serialized_data)\n rescue IOError => e\n message = e.message\n if serialized_data =~ BASE64_CHARACTERS\n message = \"#{message}: did you forget to Base64.strict_decode64 this value?\"\n end\n raise RecoveryTokenSerializationError, message\n end", "def retrieve_key_string_from_stream(stream)\n return stream.read if stream.respond_to?(:read)\n return File.read(stream) if stream.to_s !~ /^-+BEGIN .* KEY-+$/\n stream\n end", "def load_pubkey\n #filter line data\n load_raw_line([:key_data,:key_type,:note]) \n \n # sanitize old raw line\n self.raw_line = self.gen_raw_line\n end", "def public_key\n @data_public_key ||= load_public_key\n end", "def initialize(seed)\n Ed25519.validate_key_bytes(seed)\n\n @seed = seed\n @keypair = Ed25519.provider.create_keypair(seed)\n @verify_key = VerifyKey.new(@keypair[32, 32])\n end", "def public_key_file=(file)\n @public_key_file = file and load_public_key\n end", "def public_key_file=(file)\n @public_key_file = file and load_public_key\n end", "def decode_key(key)\n return nil if key.nil?\n\n config = self.class.config\n unless config[:key_configured]\n raise 'No key config given - if you are not decoding keys, please use '\\\n '`key_config plain: true`'\n end\n\n if config[:key_field]\n self.class.decoder.decode_key(key, config[:key_field])\n elsif config[:key_schema]\n self.class.key_decoder.decode(key, schema: config[:key_schema])\n else # no encoding\n key\n end\n end", "def initialize\n key_pair = ECDSA.generate_key_pair\n self.private_key, self.public_key = key_pair.values_at(:private_key, :public_key)\n end", "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end", "def from_simple_key(key)\n key\n end", "def export_public_key\n public_key = context.crypto.extract_public_key(private_key)\n VirgilBuffer.from_bytes(context.crypto.export_public_key(public_key))\n end", "def verify_signature\n @req.verify(public_key)\n end", "def public_key_data\n @public_key\n end", "def read_key(type, key=nil, passphrase=nil)\n return key if key.nil?\n\n raise \"Could not find key #{key}\" unless File.exist?(key)\n\n if type == :public\n return OpenSSL::PKey::RSA.new(File.read(key))\n elsif type == :private\n return OpenSSL::PKey::RSA.new(File.read(key), passphrase)\n else\n raise \"Can only load :public or :private keys\"\n end\n end", "def public_key_params\n params.require(:public_key).permit(:body, :algorithm)\n end", "def transcend_public_key\n connection = Faraday.new() do |conn|\n conn.request :authorization, 'Bearer', $TRANSCEND_API_KEY\n conn.method :get\n end\n response = connection.get($PUBLIC_KEY_URL)\n OpenSSL::PKey.read(response.body)\nend", "def set_ssl_public_key_in_session\n if encryption_required?\n key = OpenSSL::PKey::RSA.new(session[:key] || 1024)\n @public_modulus = key.public_key.n.to_s(16)\n @public_exponent = key.public_key.e.to_s(16)\n session[:key] = key.to_pem\n end\n end", "def gen_ec_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::EC.new key_content, priv_key_password\n\n # Get curve type (prime256v1...)\n group = ::OpenSSL::PKey::EC::Group.new(key.group.curve_name)\n # Get Generator point & public point (priv * generator)\n generator = group.generator\n pub_point = generator.mul(key.private_key)\n key.public_key = pub_point\n\n # Public Key in pem\n public_key = ::OpenSSL::PKey::EC.new\n public_key.group = group\n public_key.public_key = pub_point\n public_key.to_pem\n end", "def load_key_string(key_string)\n Rnp.new.tap do |rnp|\n rnp.load_keys(\n format: \"GPG\",\n input: Rnp::Input.from_string(key_string),\n public_keys: true,\n secret_keys: true,\n )\n end\n end", "def pubek\r\n Tem::Key.new_from_ssl_key endorsement_cert.public_key\r\n end", "def load(data)\n code, hash = MessagePack.unpack(data)\n CODE_TO_CLASS[code].new(decode_hash(hash).symbolize_keys)\n rescue MessagePack::UnpackError => e\n _log.warn { \"Failed to decode message\" }\n _log_exception(e)\n Models::Message::Garbled.new\n end", "def initialize(key)\n @id = case key\n when Kademlia::DataKey then key.to_bin\n when String\n case key.size\n # If it's in the right format\n when Size then key\n # If it's hex\n when Size * 2 then [key].pack('H*')\n end\n when Integer\n @int_val = key\n [\"%0#{Size}d\" % key.to_s(16)].pack('H*')\n end\n\n raise ArgumentError, \"#{key} is not a valid key.\" if @id.nil?\n end" ]
[ "0.6504492", "0.62602264", "0.624494", "0.61753273", "0.61753273", "0.60851914", "0.59883815", "0.5981428", "0.59378034", "0.5935695", "0.5795585", "0.57435924", "0.5743569", "0.5738093", "0.5731519", "0.561222", "0.55782306", "0.5526932", "0.5524965", "0.5497712", "0.5456731", "0.5441211", "0.5420124", "0.5395653", "0.5359995", "0.53380203", "0.5321299", "0.5278115", "0.52544767", "0.5239893", "0.5228569", "0.52191705", "0.5206566", "0.52034336", "0.5201903", "0.5200912", "0.51578194", "0.5153732", "0.5151461", "0.5151461", "0.513994", "0.51116693", "0.5043889", "0.5043889", "0.5042671", "0.5036932", "0.5032995", "0.50315475", "0.5016837", "0.50100255", "0.4993786", "0.49927297", "0.49835214", "0.49691758", "0.49522677", "0.49503735", "0.49469224", "0.49329087", "0.49305874", "0.49247757", "0.49207792", "0.4905256", "0.49050578", "0.48992032", "0.48968923", "0.48727906", "0.48478475", "0.48415098", "0.48380324", "0.48380324", "0.48377118", "0.48185095", "0.48071784", "0.48071784", "0.48026553", "0.48026553", "0.4781377", "0.47580776", "0.47577605", "0.4752132", "0.47265568", "0.47244185", "0.47186777", "0.47166947", "0.47144356", "0.47125024", "0.47119063", "0.4709525", "0.470932", "0.4705013", "0.4689573", "0.46885192", "0.46866032", "0.46798483", "0.4659062", "0.46492195", "0.46472195", "0.46429664", "0.46342346", "0.46242055" ]
0.5490012
20
Create a new VerifyKey object from a serialized public key. The key can be decoded from any serialization format supported by the Crypto::Encoding system. You can remember the argument ordering by "verify message with signature" It's like a legal document, with the signature at the end.
def verify(message, signature, signature_encoding = :raw) signature = Encoder[signature_encoding].decode(signature) Util.check_length(signature, signature_bytes, "signature") sig_and_msg = signature + message buffer = Util.zeros(sig_and_msg.bytesize) buffer_len = Util.zeros(FFI::Type::LONG_LONG.size) NaCl.crypto_sign_ed25519_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_string_public_key(raw, offset=0, algo=nil)\n key_raw, str_read = decode_string(raw, offset)\n key, cert_read = decode_public_key(key_raw, 0, algo)\n\n if cert_read != key_raw.bytesize\n raise DecodeError, \"unexpected trailing data\"\n end\n\n [key, str_read]\n end", "def decode_public_key(raw, offset=0, algo=nil)\n total_read = 0\n\n if algo.nil?\n algo, read = decode_string(raw, offset + total_read)\n total_read += read\n end\n\n unless fields = KEY_FIELDS_BY_PUBLIC_KEY_ALGO[algo]\n raise AlgorithmError, \"unknown algorithm: #{algo.inspect}\"\n end\n\n data, read = decode_fields(raw, fields, offset + total_read)\n total_read += read\n\n data[:algo] = algo\n\n [data, total_read]\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def import_public_key(key_bytes)\n key_bytes = Validation.check_filled_array_argument!(key_bytes)\n\n begin\n key_pair_id = compute_public_key_hash(key_bytes)\n public_key_bytes = Core::VirgilKeyPair.public_key_to_der(key_bytes)\n VirgilPublicKey.new(key_pair_id, wrap_bytes(public_key_bytes))\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def rsa_key(key_as_string)\n OpenSSL::PKey::RSA.new key_as_string\n end", "def load_public_key(filename); end", "def verifier\n Verifier.new(public_key)\n end", "def public_key(format: :z85)\n case format\n when :z85\n ffi_delegate.public_txt.force_encoding(Encoding::ASCII)\n when :binary\n ffi_delegate.public_key.read_string(32)\n else\n raise ArgumentError, format('invalid format: %p', format)\n end\n end", "def auth_key_from_pem\n public_key = private_key.public_key\n Base64.strict_encode64(public_key.to_der)\n end", "def recover_public_key(message)\n ctx = Secp256k1::Context.new\n recovery_id = Chains.to_recovery_id(@v, @chain_id)\n\n recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)\n public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed\n public_key_to_address(public_key_bin)\n end", "def from_bip45(public_key)\n begin\n hex = from_serialized_base58(public_key)\n network, count, *public_keys = [hex].pack(\"H*\").split(\";\")\n\n # parse cosigner keys with index\n public_keys.map! { |key| key.split(':') }\n rescue EncodingError => e\n raise Error::ChecksumError, 'Invalid bip45 public key'\n end\n\n BIP45Node.new({\n network: network.to_sym,\n required_signs: count.to_i,\n public_keys: public_keys.to_h\n })\n end", "def recover_public_key(message)\n ctx = Secp256k1::Context.new\n recovery_id = Chains.to_recovery_id(@v, @chain_id)\n\n recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)\n public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed\n public_key_to_address(public_key_bin)\n end", "def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end", "def load_public_key(filename)\n data = File.read(File.expand_path(filename))\n load_data_public_key(data, filename)\n end", "def initialize(key, encoding = :raw)\n key = Encoder[encoding].decode(key)\n Util.check_length(key, NaCl::PUBLICKEYBYTES, \"key\")\n\n @key = key\n end", "def export_public_key(public_key)\n public_key = Validation.check_type_argument!(VirgilPublicKey, public_key)\n\n begin\n wrap_bytes(\n Core::VirgilKeyPair.public_key_to_der(public_key.raw_key)\n )\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def verify_signature\n @spki.verify(public_key)\n end", "def initialize(encoded_public_key = nil, time_stamp = nil)\n self.encoded_public_key = encoded_public_key if encoded_public_key\n self.time_stamp = time_stamp\n end", "def initialize(data, public_key = nil, encoding = :none, opts = {})\n @encoding = encoding\n\n if !public_key && !opts[:public_key_file]\n # If no public key was provided the data should already be encrypted\n @data = data\n elsif File.exists?(opts[:public_key_file].to_s)\n public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file))\n encrypted_data = public_key.public_encrypt(data)\n @data = encode(encrypted_data)\n elsif public_key\n public_key = OpenSSL::PKey::RSA.new(public_key)\n encrypted_data = public_key.public_encrypt(data)\n @data = encode(encrypted_data)\n end\n end", "def load_key(key_file)\n OpenSSL::PKey::RSA.new(File.read(key_file), @password)\n end", "def initialize(private_key: nil,\n public_key: nil,\n public_key_compressed: true,\n wif: nil,\n network: nil)\n\n @public_key_compressed = public_key_compressed\n @network = network || BTC::Network.default\n\n if private_key\n if !Key.validate_private_key_range(private_key)\n raise FormatError, \"Private key is outside the valid range\"\n end\n @private_key = private_key\n elsif public_key\n if !Key.valid_pubkey?(public_key)\n raise FormatError, \"Invalid public key: #{public_key.inspect}\"\n end\n @public_key_compressed = (self.class.length_for_pubkey(public_key) == COMPRESSED_PUBKEY_LENGTH)\n @public_key = public_key\n elsif wif\n wif = wif.is_a?(WIF) ? wif : Address.parse(wif)\n if !wif.is_a?(WIF)\n raise FormatError, \"Invalid WIF string\"\n end\n key = wif.key\n @private_key = key.private_key\n @public_key = key.public_key\n @public_key_compressed = key.public_key_compressed\n @network = wif.network\n else\n raise ArgumentError, \"Must specify either private_key or public_key\"\n end\n end", "def load_data_public_key(data, filename = \"\")\n fields = data.split(/ /)\n\n blob = nil\n begin\n blob = fields.shift\n end while !blob.nil? && !/^(ssh-(rsa|dss|ed25519)|ecdsa-sha2-nistp\\d+)(-cert-v01@openssh\\.com)?$/.match(blob)\n blob = fields.shift\n\n raise Net::SSH::Exception, \"public key at #{filename} is not valid\" if blob.nil?\n\n blob = blob.unpack(\"m*\").first\n reader = Net::SSH::Buffer.new(blob)\n reader.read_key or raise OpenSSL::PKey::PKeyError, \"not a public key #{filename.inspect}\"\n end", "def verify(message, public_keys)\n ll_array = []\n rr_array = []\n\n public_keys.each_with_index do |k, i|\n ll_array[i] = hasher.group.generator * r_array[i] + k.point * c_array[i]\n rr_array[i] = hasher.hash_point(k.point) * r_array[i] + key_image * c_array[i]\n end\n\n c_sum = c_array.inject{|a, b| a + b} % hasher.group.order\n\n message_digest = hasher.hash_string(message)\n challenge = hasher.hash_array([message_digest] + ll_array + rr_array)\n\n c_sum == challenge\n end", "def verify_signature\n @req.verify(public_key)\n end", "def to_rsa_pkey\n FrontEndBuilds::Utils::SSHPubKeyConvert\n .convert(pubkey)\n end", "def decrypt_then_verify(bytes, private_key, *public_keys)\n bytes = Validation.check_filled_array_argument!(bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n cipher = Core::VirgilCipher.new\n decrypted_bytes = cipher.decrypt_with_key(\n bytes,\n private_key.id,\n private_key.raw_key\n )\n signature = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNATURE)\n\n signer_public_key = public_keys.first\n\n if public_keys.count > 1\n signer_id = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNER_ID)\n signer_public_key = public_keys.find {|public_key| public_key.id == signer_id}\n end\n\n is_valid = verify_signature(signature, decrypted_bytes, signer_public_key)\n raise VirgilCryptoException, 'Signature is not valid' unless is_valid\n\n wrap_bytes(decrypted_bytes)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def public_key\n require_key\n\n @private_key.public_key.to_pem\n end", "def public_key\n public_key_object.to_pem\n end", "def initialize(key, encoding = :raw)\n key = Encoder[encoding].decode(key)\n Util.check_length(key, NaCl::ED25519_VERIFYKEY_BYTES, \"key\")\n\n @key = key\n end", "def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end", "def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\nend", "def load_keypair(private_key, public_key)\n @private_key = private_key\n @public_key = public_key\n @private_rsa = OpenSSL::PKey::RSA.new @private_key\n @public_rsa = OpenSSL::PKey::RSA.new @public_key\n end", "def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\n end", "def initialize(key, encoding = :raw)\n @key = Encoder[encoding].decode(key)\n Util.check_length(@key, self.class::KEYBYTES, \"#{self.class} key\")\n end", "def extract_public_key(private_key)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n public_key_bytes = Core::VirgilKeyPair.extract_public_key(\n private_key.raw_key,\n []\n )\n VirgilPublicKey.new(\n private_key.id,\n wrap_bytes(\n Core::VirgilKeyPair.public_key_to_der(public_key_bytes)\n )\n )\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def public_key_params\n params[:public_key]\n end", "def public_key_params\n params[:public_key]\n end", "def keyload(key_file_path=\"rsa_private_key.rb\")\n #require key_file_path\n require_relative key_file_path\n @n, @e= publickey\n @privatekey=privatekey\n #puts $n, $e, $privatekey\n end", "def verify_signature(public_key, payload, signature, timestamp)\n verify_engine\n timestamped_playload = \"#{timestamp}#{payload}\"\n payload_digest = Digest::SHA256.digest(timestamped_playload)\n decoded_signature = Base64.decode64(signature)\n public_key.dsa_verify_asn1(payload_digest, decoded_signature)\n rescue StandardError\n false\n end", "def public_key\n @public_key ||= load_key(@public_key_file)\n end", "def verify_signature(signature, signed_text, base64_encoded=true)\n sig = base64_encoded ? Base64UrlSafe.decode(signature) : signature\n self.public_key.verify(OpenSSL::Digest::SHA256.new, sig, signed_text)\n end", "def load(serialized)\n if serialized && serialized.class == String\n begin\n Date.parse(serialized.decrypt(:symmetric, :password => Rails.application.secrets.secret_key_base))\n rescue\n nil\n end\n else\n nil\n end\n end", "def verify(signed_message, message, signing_key = admin_key)\n msg_int = rsa.text_to_int(message)\n rsa.verify(signed: signed_message, message: msg_int, key: signing_key)\n end", "def public_decrypt(ciphertext)\n @public_key.public_decrypt(ciphertext)\n end", "def rsa_decrypt_with_public(crypt_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_decrypt(crypt_string)\n end", "def rsa_decrypt_with_public(crypt_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_decrypt(crypt_string)\n end", "def get_public_key(private_key)\n PointG1.from_private_key(private_key)\n end", "def parse_key(string)\n @key_factory.parse(string)\n end", "def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n # OpenSSH compatibility: if a the number of bytes in the signature is less than the number of bytes of the RSA\n # modulus, prepend the signature with zeros.\n # See https://github.com/openssh/openssh-portable/blob/ac383f3a5c6f529a2e8a5bc44af79a08c7da294e/ssh-rsa.c#L531\n difference = n.num_bytes - raw_sig.bytesize\n raw_sig = \"\\0\" * difference + raw_sig if difference.positive?\n\n openssl.verify(digest.new, raw_sig, signed_data)\n end", "def parse_public_keys\n # Convert keys to compressed_hex format for bitcoin-ruby\n @public_keys_hex = @cosigners_nodes.map { |index, key| key.public_key.to_hex }\n end", "def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end", "def import_public_key key_name, pubkey, fprint=nil\n params = { \n 'KeyName' => key_name,\n 'PublicKey' => pubkey\n }\n params.merge!( 'Fingerprint' => fprint ) unless fprint.nil?\n\n response = @client.action \"ImportPublicKey\", params\n\n Response::Credential.new response.body[\"ImportPublicKeyResponse\"]['return']\n end", "def verify(key)\n plaintext = plaintext_sig(body, type, encoding, alg)\n key.public_key.verify(digest, sig, plaintext)\n rescue BadError\n false\n end", "def verify_signature(signature, string, base64=false)\n signature = base64_decode(signature) if base64\n\n @public_key.verify(OpenSSL::Digest.new(\"SHA1\"), signature, string)\n end", "def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end", "def load_data_public_key(data, filename = T.unsafe(nil)); end", "def public_key_hash\n Crypto.hash_public_key(public_key)\n end", "def recover_compact(data, signature, rec, compressed)\n r = ECDSA::Format::IntegerOctetString.decode(signature[1...33])\n s = ECDSA::Format::IntegerOctetString.decode(signature[33..-1])\n ECDSA.recover_public_key(Bitcoin::Secp256k1::GROUP, data, ECDSA::Signature.new(r, s)).each do |p|\n if p.y & 1 == rec\n return Bitcoin::Key.from_point(p, compressed: compressed)\n end\n end\n end", "def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end", "def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end", "def private_key!\n if self[:kopal_encoded_private_key].blank?\n regenerate_private_key!\n end\n OpenSSL::PKey::RSA.new Base64::decode64(self[:kopal_encoded_private_key])\n end", "def public_decrypt(data)\n @key.public_decrypt(Base64.decode64(data))\n end", "def set_public_key\n @public_key = PublicKey.first || PublicKey.create(body: 'public key body', algorithm: PublicKey::ALGORITHMS.first)\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def parse_and_verify(serialized_token)\n macaroon = Boulangerie::Macaroon.from_binary(serialized_token)\n schema_id = macaroon.identifier.schema_id\n\n unless schema_id == @schema.schema_id\n fail SerializationError, \"bad schema ID: #{schema_id} (expected #{@schema.schema_id})\"\n end\n\n @verifier.verify(\n key: @keyring.fetch(macaroon.identifier.key_id),\n macaroon: macaroon,\n discharge_macaroons: []\n )\n\n macaroon\n end", "def build_key(public_key, private_key)\n group = OpenSSL::PKey::EC::Group.new('prime256v1')\n key = OpenSSL::PKey::EC.new(group)\n\n public_bn = OpenSSL::BN.new(public_key, 16)\n private_bn = OpenSSL::BN.new(private_key, 16)\n public_key = OpenSSL::PKey::EC::Point.new(group, public_bn)\n\n key.tap do\n key.public_key = public_key\n key.private_key = private_bn\n end\n end", "def initialize(private_key, opts = { public_key: nil, passphrase: nil })\n if private_key.is_a? OpenSSL::PKey::RSA\n @private_key = private_key\n elsif !private_key.to_s.eql?('')\n @private_key = OpenSSL::PKey::RSA.new(\n if File.exists?(File.expand_path(private_key))\n File.read(File.expand_path(private_key))\n else\n private_key\n end,\n opts[:passphrase]\n )\n unless @private_key.private?\n raise(\n Cryptic::InvalidKey,\n \"Public key '#{private_key}' provided as a private key.\"\n )\n end\n end\n\n if public_key.is_a? OpenSSL::PKey::RSA\n @public_key = public_key\n else\n @public_key = OpenSSL::PKey::RSA.new(\n if opts[:public_key] && File.exists?(File.expand_path(opts[:public_key].to_s))\n File.read(File.expand_path(opts[:public_key].to_s))\n elsif opts[:public_key]\n opts[:public_key]\n else\n @private_key or raise(Cryptic::KeyNotFound)\n end,\n opts[:passphrase]\n ).public_key\n end\n rescue OpenSSL::PKey::RSAError => e\n if e.message.eql? 'Neither PUB key nor PRIV key:: not enough data'\n if @private_key.nil?\n raise Cryptic::InvalidKey, \"Invalid private key: #{private_key}\"\n elsif @public_key.nil?\n raise Cryptic::InvalidKey, \"Invalid public key: #{public_key}\"\n end\n elsif e.message.eql? 'Neither PUB key nor PRIV key:: nested asn1 error'\n raise Cryptic::IncorrectPassphrase, \"Unable to open private key:\n '#{private_key}'. was the passphrase valid?\"\n else\n raise e\n end\n end", "def extract_key(key, password = nil)\n return nil unless key\n\n case key\n when Proc then extract_key_from_proc(key, password)\n when Symbol then extract_key_from_method(key, password)\n when ::OpenSSL::PKey::RSA then key\n else\n key = retrieve_key_string_from_stream(key)\n return ::OpenSSL::PKey::RSA.new(key) if password.nil?\n ::OpenSSL::PKey::RSA.new(key, password.to_s)\n end\n end", "def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end", "def repack_pubkey(pubkey)\n p = pubkey.htb\n case p[0]\n when \"\\x06\", \"\\x07\"\n p[0] = \"\\x04\"\n p\n else\n pubkey.htb\n end\n end", "def verify_signature(signature, bytes, signer_public_key)\n signature = Validation.check_filled_array_argument!(signature)\n bytes = Validation.check_filled_array_argument!(bytes)\n signer_public_key = Validation.check_type_argument!(VirgilPublicKey, signer_public_key)\n\n begin\n native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512)\n signer = Core::VirgilSigner.new(native_algorithm)\n signer.verify(bytes, signature, signer_public_key.raw_key)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n\n end", "def public_key_params\n params.require(:public_key).permit(:body, :algorithm)\n end", "def retrieve_key_string_from_stream(stream)\n return stream.read if stream.respond_to?(:read)\n return File.read(stream) if stream.to_s !~ /^-+BEGIN .* KEY-+$/\n stream\n end", "def rsaes_pkcs_signature(key, input)\n private_key = if BSON::Environment.jruby?\n # JRuby cannot read DER format, we need to convert key into PEM first.\n key_pem = [\n \"-----BEGIN PRIVATE KEY-----\",\n Base64.strict_encode64(Base64.decode64(key)).scan(/.{1,64}/),\n \"-----END PRIVATE KEY-----\",\n ].join(\"\\n\")\n OpenSSL::PKey::RSA.new(key_pem)\n else\n OpenSSL::PKey.read(Base64.decode64(key))\n end\n private_key.sign(OpenSSL::Digest::SHA256.new, input)\n end", "def initialize(seed, encoding = :raw)\n seed = Encoder[encoding].decode(seed)\n\n Util.check_length(seed, NaCl::SECRETKEYBYTES, \"seed\")\n\n pk = Util.zeros(NaCl::PUBLICKEYBYTES)\n sk = Util.zeros(NaCl::SECRETKEYBYTES * 2)\n\n NaCl.crypto_sign_seed_keypair(pk, sk, seed) || raise(CryptoError, \"Failed to generate a key pair\")\n\n @seed, @signing_key = seed, sk\n @verify_key = VerifyKey.new(pk)\n end", "def initialize(key_base64)\n @key = key_base64\n end", "def load_pubkey\n #filter line data\n load_raw_line([:key_data,:key_type,:note]) \n \n # sanitize old raw line\n self.raw_line = self.gen_raw_line\n end", "def verify(message, signature, signature_encoding = :raw)\n signature = Encoder[signature_encoding].decode(signature)\n Util.check_length(signature, NaCl::SIGNATUREBYTES, \"signature\")\n\n sig_and_msg = signature + message\n buffer = Util.zeros(sig_and_msg.bytesize)\n buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)\n\n NaCl.crypto_sign_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)\n end", "def load(blob)\n internal = decrypt(blob)\n ::Riak::Serializers.deserialize(content_type, internal)\n end", "def decode_certificate(raw, offset=0)\n total_read = 0\n\n algo, read = decode_string(raw, offset + total_read)\n total_read += read\n\n unless key_algo = PUBLIC_KEY_ALGO_BY_CERT_ALGO[algo]\n raise AlgorithmError, \"unknown algorithm: #{algo.inspect}\"\n end\n\n data, read = decode_fields(raw, [\n [:nonce, :string],\n [:public_key, :public_key, key_algo],\n [:serial, :uint64],\n [:type, :uint32],\n [:key_id, :string],\n [:valid_principals, :list],\n [:valid_after, :time],\n [:valid_before, :time],\n [:critical_options, :options],\n [:extensions, :options],\n [:reserved, :string],\n [:signature_key, :string_public_key],\n [:signature, :string],\n ], offset + total_read)\n total_read += read\n\n data[:algo] = algo\n\n [data, total_read]\n end", "def validate_key_bytes(key_bytes); end", "def gen_ec_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::EC.new key_content, priv_key_password\n\n # Get curve type (prime256v1...)\n group = ::OpenSSL::PKey::EC::Group.new(key.group.curve_name)\n # Get Generator point & public point (priv * generator)\n generator = group.generator\n pub_point = generator.mul(key.private_key)\n key.public_key = pub_point\n\n # Public Key in pem\n public_key = ::OpenSSL::PKey::EC.new\n public_key.group = group\n public_key.public_key = pub_point\n public_key.to_pem\n end", "def public_key\n @public_key.to_der\n end", "def public_key\n as_public_key(rpc(:account_key, _access: :key))\n end", "def ext_pubkey\n k = ExtPubkey.new\n k.depth = depth\n k.number = number\n k.parent_fingerprint = parent_fingerprint\n k.chain_code = chain_code\n k.pubkey = key.pubkey\n k.ver = priv_ver_to_pub_ver\n k\n end", "def valid_rsa_key(key)\n key['use'] == 'sig' && key['kty'] == 'RSA' && key['kid']\n end", "def encrypt_key(key, public_key)\n encrypted_key = public_key.public_encrypt(key)\n encode encrypted_key\n end", "def public_key_for_push_header\n trim_encode64(curve.public_key.to_bn.to_s(2))\n end", "def import_private_key(key_bytes, password = nil)\n key_bytes = Validation.check_filled_array_argument!(key_bytes)\n\n begin\n decrypted_private_key = if !password\n Core::VirgilKeyPair.private_key_to_der(key_bytes)\n else\n Core::VirgilKeyPair.decrypt_private_key(\n key_bytes,\n Bytes.from_string(password)\n )\n end\n\n public_key_bytes = Core::VirgilKeyPair.extract_public_key(\n decrypted_private_key, []\n )\n key_pair_id = compute_public_key_hash(public_key_bytes)\n private_key_bytes = Core::VirgilKeyPair.private_key_to_der(\n decrypted_private_key\n )\n return VirgilPrivateKey.new(key_pair_id, wrap_bytes(private_key_bytes))\n rescue => error\n raise VirgilCryptoException, error.message\n end\n\n end", "def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\t\treturn nil unless sb1 == sb2\n \t\t\t\t\tcmd\n \t\t\t\trescue NoMethodError\n \t\t\t\t\tputs \"verify exception: #{msg}\"\n \t\t\t\tend\n \t\t\tend", "def valid_xonly_pubkey?(pub_key)\n pubkey = pub_key.htb\n return false unless pubkey.bytesize == X_ONLY_PUBKEY_SIZE\n begin\n ECDSA::Format::PointOctetString.decode(pubkey, ECDSA::Group::Secp256k1)\n rescue Exception\n return false\n end\n true\n end", "def transcend_public_key\n connection = Faraday.new() do |conn|\n conn.request :authorization, 'Bearer', $TRANSCEND_API_KEY\n conn.method :get\n end\n response = connection.get($PUBLIC_KEY_URL)\n OpenSSL::PKey.read(response.body)\nend", "def sign(message, private_key)\n msg_point = BLS.norm_p2h(message)\n msg_point * BLS.normalize_priv_key(private_key)\n end", "def initialize(secret, *signature_key_or_options)\n options = signature_key_or_options.extract_options!\n sign_secret = signature_key_or_options.first\n @secret = secret\n @sign_secret = sign_secret\n @cipher = options[:cipher] || 'aes-256-cbc'\n @verifier = MessageVerifier.new(@sign_secret || @secret, :serializer => NullSerializer)\n @serializer = options[:serializer] || Marshal\nend", "def decrypt_with_public(crypted, base64=true)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n if base64\n key = rsa_decrypt_with_public(base64_decode(crypted[:key]))\n aes_decrypt(key, base64_decode(crypted[:data]))\n else\n key = rsa_decrypt_with_public(crypted[:key])\n aes_decrypt(key, crypted[:data])\n end\n end", "def decrypt_with_public(crypted, base64=true)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n if base64\n key = rsa_decrypt_with_public(base64_decode(crypted[:key]))\n aes_decrypt(key, base64_decode(crypted[:data]))\n else\n key = rsa_decrypt_with_public(crypted[:key])\n aes_decrypt(key, crypted[:data])\n end\n end", "def pubek\r\n Tem::Key.new_from_ssl_key endorsement_cert.public_key\r\n end", "def initialize(pvt_key_string)\n @pvt_key_string = pvt_key_string\n @pvt_key = PrivateKey.new pvt_key_string\n log 'pvt key', @pvt_key\n @address = @pvt_key.address_str\n log 'address', @address\n end" ]
[ "0.6289133", "0.62160313", "0.60343796", "0.60343796", "0.59135723", "0.5823101", "0.57859", "0.57788414", "0.5714868", "0.5700977", "0.56821954", "0.5657602", "0.5643604", "0.56318235", "0.5536536", "0.55265546", "0.54239494", "0.540689", "0.53886396", "0.53656816", "0.53411025", "0.53331697", "0.52608675", "0.52437055", "0.5196857", "0.5174324", "0.51720774", "0.5168213", "0.5122655", "0.51171905", "0.5114591", "0.5092889", "0.5090824", "0.50749207", "0.50741154", "0.50665647", "0.5053528", "0.5053528", "0.5039756", "0.5019817", "0.5011471", "0.50009596", "0.49873102", "0.49827808", "0.49764097", "0.4944152", "0.4944152", "0.4937836", "0.49245912", "0.49181202", "0.49087924", "0.48946136", "0.48899528", "0.48843667", "0.4874478", "0.48703519", "0.48614705", "0.4854503", "0.48473212", "0.4843174", "0.4843174", "0.4840517", "0.4837716", "0.48354405", "0.48320112", "0.48320112", "0.48303705", "0.48295018", "0.4823761", "0.481975", "0.4813642", "0.48122245", "0.48020217", "0.47940725", "0.47648844", "0.47641802", "0.47601873", "0.47358775", "0.4714988", "0.4712087", "0.47117996", "0.4706896", "0.47067887", "0.46651614", "0.46600956", "0.46381605", "0.46347755", "0.46340352", "0.463022", "0.461404", "0.4608478", "0.46059486", "0.4598907", "0.45948732", "0.4590714", "0.45739797", "0.45727327", "0.45727327", "0.45674276", "0.45629257" ]
0.46878222
83
Return the raw key in byte format
def to_bytes; @key; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def to_bytes\n @public_key\n end", "def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end", "def raw_key\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key\n end", "def to_s\n @real_key\n end", "def key_handle\n ::U2F.urlsafe_encode64(key_handle_raw)\n end", "def get(key)\n b = get_as_bytes(key)\n\n return nil if b.nil?\n\n b.pack(\"U*\").strip\n end", "def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend", "def to_s\n key.to_s\n end", "def get_as_bytes(key)\n return nil unless Bindings.valid_secret_key?(key)\n\n p = File.join(@root, key)\n\n return nil unless File.exist?(p) && File.file?(p)\n\n File.read(p, mode: \"rb\").bytes\n end", "def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end", "def ecdh_public_key_bytes; end", "def for_storage\n return Key64.from_bits( @bit_string )\n end", "def to_s\n self.key\n end", "def public_key\n @public_key.to_der\n end", "def get_as_bytes(key)\n return nil unless Bindings.valid_secret_key?(key)\n return nil unless @content.key?(key)\n\n @content[key]\n end", "def get_crypto_key_hex\n return @crypto_key if ! @crypto_key\n @crypto_key.unpack(\"H*\")\n end", "def key_for(key)\n key.is_a?(String) ? key : serialize(key)\n end", "def key_for(key)\n key.is_a?(String) ? key : serialize(key)\n end", "def private_key\n @private_key.to_der\n end", "def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end", "def to_simple_key(key)\n key\n end", "def key_data; end", "def key_data; end", "def public_key\n encode64(curve.public_key.to_bn.to_s(2))\n end", "def inspect\n '#<Kademlia::DataKey:0x' + hex + '>'\n end", "def key\n to_a[0..(num_key_fields-1)].join(\"-\")\n end", "def public_key_for_push_header\n trim_encode64(curve.public_key.to_bn.to_s(2))\n end", "def read_keyblob(type); end", "def public_key(format: :z85)\n case format\n when :z85\n ffi_delegate.public_txt.force_encoding(Encoding::ASCII)\n when :binary\n ffi_delegate.public_key.read_string(32)\n else\n raise ArgumentError, format('invalid format: %p', format)\n end\n end", "def key\n int = @declared_fields['key'].value(java_self)\n int < 256 ? int.chr : int\n end", "def key\n int = @declared_fields['key'].value(java_self)\n int < 256 ? int.chr : int\n end", "def as_string(key)\n with_input_io(key) do |io|\n io.read\n end\n end", "def key\n @key.id2name\n end", "def key_fingerprint\n data.key_fingerprint\n end", "def full_key\n [name, key].join(\"/\")\n end", "def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end", "def read_key; end", "def raw key\n\t\t\tcase key\n\t\t\twhen :name\n\t\t\t\treturn @name\n\t\t\twhen :start_time\n\t\t\t\treturn @start_time\n\t\t\twhen :end_time\n\t\t\t\treturn @end_time\n\t\t\tend\n\t\tend", "def get_master_key(raw = false)\n if @master_key.nil?\n error_handler(ArgumentError, 'The key is not specified!')\n else\n raw ? @master_key : Base64.strict_encode64(@master_key)\n end\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end", "def get key\n deserialize backend.get key.to_s rescue nil\n end", "def public_key\n encode_tz(:edpk, 32)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def private_key\n @key\n end", "def gamebus_key\n decrypt(self[:gamebus_key])\n end", "def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end", "def key_byte\n @i = (@i + 1) % 256\n @j = (@j + @sbox[@i]) % 256\n @sbox[@i], @sbox[@j] = @sbox[@j], @sbox[@i]\n @sbox[(@sbox[@i] + @sbox[@j]) % 256]\n end", "def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\nend", "def private_key\n encode64(curve.private_key.to_s(2))\n end", "def kv_encode(h); h.map {|k,v| k.to_s + \":\" + v.to_s + 10.chr }.join end", "def key_info\n authenticated_post(\"key_info\").body\n end", "def key\n store_as.to_s\n end", "def bits\n Net::SSH::Buffer.from(:key, @key).to_s.split(\"\\001\\000\").last.size * 8\n end", "def bits\n Net::SSH::Buffer.from(:key, @key).to_s.split(\"\\001\\000\").last.size * 8\n end", "def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end", "def key ch\n ch.getbyte(0)\n end", "def public_key\n @priv.public_key\n end", "def public_key_data\n @public_key\n end", "def to_s\n key = self.key.dup\n modifiers = self.modifiers.dup\n if modifiers.include?(\"S\")\n modifiers.delete(\"S\")\n key.upcase!\n end\n\n if modifiers.empty?\n @@key_to_readable[key] ? \"<#{@@key_to_readable[key]}>\" : key\n else\n \"<\" + modifiers.map { |modifier| modifier + \"-\" }.join + (@@key_to_readable[key] || key) + \">\"\n end\n end", "def to_s\n user_key\n end", "def to_s\n user_key\n end", "def key\n @key\n end", "def key\n @key\n end", "def hash(key)\n\t\tascii_keys = [] \n\t\tkey.to_s.each_byte { |el| ascii_keys << el }\n\t\tascii_keys.map { |el| el.to_s }.join('')\n\tend", "def current_key_prefix(search_type)\n Base64.urlsafe_encode64(\"#{search_type.chr}\\0#{@key_id.chr}\")\n end", "def key_field\n 'key'\n end", "def to_key; end", "def get_user_key()\n uri = build_uri('storage/crypto/keys')\n ret = @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n ret_hash = JSON.parse(ret)\n payload = JSON.parse(ret_hash['payload'])\n ciphertxt = Base64.decode64(payload['ciphertext'])\n iv = Base64.decode64(payload['IV'])\n priv_elts = JSON.parse(decrypt_data(ciphertxt, @encryption_key, iv))\n Base64.decode64(priv_elts['default'][0])\n end", "def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\n end", "def auth_key_from_pem\n public_key = private_key.public_key\n Base64.strict_encode64(public_key.to_der)\n end", "def to_bson_key\n to_s.to_bson_key\n end", "def from_simple_key(key)\n key\n end", "def key_name\n data[:key_name]\n end", "def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end", "def key\n @key\n end", "def key\n @key\n end", "def request_key(cntrl)\n check_hash = 0\n cntrl.each_byte do |b|\n check_hash += b\n pp check_hash\n end\n check_hash *= REQUEST_KEY_MAGIC\n pp check_hash\n check_hash %= 65536\n check_hash\n end", "def [](key)\n @raw[utf8(key)]\n end", "def to_base58\n ExtPubkey.encode_base58(to_hex)\n end", "def to_base58\n ExtPubkey.encode_base58(to_hex)\n end", "def private_key\n @priv\n end", "def get_key(id)\n @encryption_io.get_key(id)\n end", "def private_key_16_string\n @mask_1[0..15]\n end", "def key_id\n metadata[\"keyid\"]\n end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end", "def key\n ECDSA.build_key(public_key, private_key)\n end", "def key\n refresh_key unless key_valid?\n @key\n end", "def key(keygap)\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key = Keygap.new.merge(key, keygap)\n @log.debug(\"The private key of @#{@login} reassembled: #{key.to_s.length} chars\")\n key\n end", "def hex_key_to_key(pass_phrase)\n key = pass_phrase.scan(/../).map(&:hex)\n klen = key.size\n _key = []\n\n 4.times do |n|\n j = n*4\n value = (key[j] << 24 ) | (((key[j+1])&0xff) << 16) | (((key[j+2])&0xff) << 8) | ((key[j+3])&0xff)\n _key[n] = value\n end\n _key\n end", "def get_key(address)\n privkey = get_private_key address\n key = Bitcoin::Key.from_base58(privkey)\n key\nend", "def generate_key; end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def serialize\n Base64.encode64(Marshal.dump(self.to_hash)).chop\n end", "def key\n return @key\n end", "def key\n return @key\n end" ]
[ "0.7833033", "0.7480416", "0.72746444", "0.7259334", "0.7242505", "0.7066993", "0.70399505", "0.70025724", "0.69956917", "0.6946423", "0.6918244", "0.6883743", "0.68622625", "0.6799893", "0.6768893", "0.6750338", "0.67335355", "0.6729559", "0.6729559", "0.6728644", "0.6717093", "0.66934115", "0.66508937", "0.66508937", "0.6625405", "0.6617868", "0.65943843", "0.6565739", "0.65348995", "0.65196407", "0.64972234", "0.6496949", "0.64787185", "0.6467091", "0.6457411", "0.6448205", "0.64421207", "0.64393705", "0.6438326", "0.64301974", "0.6396717", "0.63938165", "0.63744336", "0.6372177", "0.63647497", "0.63647497", "0.6330052", "0.6325091", "0.6322089", "0.62896705", "0.62859726", "0.6282887", "0.6277568", "0.62717724", "0.62711126", "0.62621236", "0.62621236", "0.62583303", "0.62548846", "0.625187", "0.62501776", "0.6240451", "0.6233352", "0.6233352", "0.6228723", "0.6228723", "0.62217706", "0.6216676", "0.6209176", "0.6199165", "0.6198095", "0.619099", "0.61796564", "0.6172774", "0.61705", "0.6164196", "0.61568964", "0.61543727", "0.61543727", "0.61503255", "0.6140745", "0.61399245", "0.61399245", "0.61370903", "0.6124409", "0.61233455", "0.61199313", "0.61142087", "0.60971713", "0.6080336", "0.6069767", "0.60553557", "0.60461915", "0.6042155", "0.603929", "0.603906", "0.60341513", "0.60321456", "0.60321456" ]
0.86449236
1
The crypto primitive this VerifyKey class uses for signatures
def primitive; self.class.primitive; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crypto_key\n # Returns singleton object\n EmailEncryptionKey.instance.key\n end", "def get_crypto_key_hex\n return @crypto_key if ! @crypto_key\n @crypto_key.unpack(\"H*\")\n end", "def sign_key; end", "def verify_key; end", "def verify_key; end", "def key_iv\r\n @key_iv\r\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def get_encryption_key\n key_bytes = @sha_size / 8\n if @alg.respond_to?(:preshared_key)\n key = @alg.preshared_key\n unless key.size == key_bytes\n raise Sandal::KeyError, \"The pre-shared content key must be #{@sha_size} bits.\"\n end\n key\n else\n SecureRandom.random_bytes(key_bytes)\n end\n end", "def to_bytes; @key; end", "def to_bytes; @key; end", "def key_fingerprint\n data.key_fingerprint\n end", "def signature_key; end", "def signing_algorithm\n signing_key.is_a?(String) ? \"HS256\" : \"RS256\"\n end", "def signing_key; end", "def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end", "def signature\n Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))\n end", "def pubek\r\n Tem::Key.new_from_ssl_key endorsement_cert.public_key\r\n end", "def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end", "def key_byte\n @i = (@i + 1) % 256\n @j = (@j + @sbox[@i]) % 256\n @sbox[@i], @sbox[@j] = @sbox[@j], @sbox[@i]\n @sbox[(@sbox[@i] + @sbox[@j]) % 256]\n end", "def host_key_verifier; end", "def hmac; end", "def key_from_checksum(password, salt)\n OpenSSL::PKCS5.pbkdf2_hmac(password, salt,\n PBKDF_ITERATIONS, KEY_LENGTH,\n OpenSSL::Digest.new('SHA256'))\n end", "def signed_or_encrypted; end", "def key(length=256,format=:plain)\n key = ::AES::AES.new(\"\").random_key(length)\n case format\n when :base_64\n Base64.encode64(key).chomp\n else\n key\n end\n end", "def get_random_aes_256_gcm_key\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.encrypt\n random_key = cipher.random_key\n random_key_64_string = [random_key].pack(\"m\")\n random_key_64 = random_key_64_string.unpack(\"m\")[0]\n puts \"The base 64-encoded string representation of the randomly-\" \\\n \"generated AES256-GCM key is:\"\n puts random_key_64_string\n puts \"Keep a record of this key string. You will not be able to later \" \\\n \"decrypt the contents of any object that is encrypted with this key \" \\\n \"unless you have this key.\"\n return random_key_64\nend", "def obtain_key(password)\n @key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(password, @encrypt_salt, 300_000, KEYLEN)\n end", "def ecdh_public_key_bytes; end", "def token_encryption_key_id\n return @token_encryption_key_id\n end", "def key(hash160)\n key = Bitcoin::Key.new\n key.priv = hash160\n key\n end", "def key_algorithm\n if @req.public_key.kind_of? OpenSSL::PKey::RSA then\n 'RSA'\n elsif @req.public_key.kind_of? OpenSSL::PKey::DSA then\n 'DSA'\n end\n end", "def key_pem; end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def store_encryption_key_sha\n self.encryption_key_sha = ENCRYPTION_KEY_SHA\n end", "def signing_key\n @signing_key\n end", "def openssl_generate_key(*args,&block)\n keypair = OpenSSL::PKey::RSA.new CaHelper.ca_config['key_size']\n end", "def key\n ECDSA.build_key(public_key, private_key)\n end", "def obtain_iv(passphrase)\n return scramble_passphrase(passphrase)\n end", "def key(password)\n decrypt(@encrypted_key, key_encryption_key(password))\n end", "def derive_key(password, salt, rounds: 50000, prf: \"HMAC_SHA256\", tag: \"default_tag\")\n salt.is_a?(String) and salt = salt.force_encoding('binary')\n tag && tag.is_a?(String) and tag = tag.force_encoding('binary')\n ki = KeyInfo.new(prf, rounds, salt, tag)\n ki.derivePassword(password)\n end", "def key_generator; end", "def key_generator; end", "def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end", "def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end", "def static_key_ecb(message)\n unknown = \"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK\"\n udecoded = Base64.decode64(unknown)\n\n message_appended = message + udecoded\n message_appended = pkcs7_pad(message_appended, 16)\n\n cipher = encrypt_ecb(message_appended, STATIC_KEY)\nend", "def private_key\n @private_key.to_der\n end", "def generate_key\n SecureRandom.hex(32)\nend", "def signature\n subject = self.class.sig_subject([@payload,\n DATA_TYPE,\n ENCODING,\n ALGORITHM])\n @rsa_pkey.sign(DIGEST, subject)\n end", "def for_storage\n return Key64.from_bits( @bit_string )\n end", "def SignerKey(input = nil)\n case input\n when Transaction\n SignerKey.pre_auth_tx(input.hash)\n when /^[0-9A-Za-z+\\/=]{44}$/\n SignerKey.hash_x(Stellar::Convert.from_base64(input))\n when /^[0-9a-f]{64}$/\n SignerKey.hash_x(Stellar::Convert.from_hex(input))\n when /^.{32}$/\n SignerKey.hash_x(input)\n else\n SignerKey.ed25519(KeyPair(input))\n end\n end", "def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end", "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end", "def validate_key_bytes(key_bytes); end", "def auth_key_from_pem\n public_key = private_key.public_key\n Base64.strict_encode64(public_key.to_der)\n end", "def key_algorithm\n if self.rsa?\n :rsa\n elsif self.dsa?\n :dsa\n elsif self.ec?\n :ec\n end\n end", "def generate_key; end", "def find_cipher_key(*args)\n fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2'\n\n ::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)\n end", "def get_key(id)\n @encryption_io.get_key(id)\n end", "def sign(string)\n @key.sign OpenSSL::Digest::SHA256.new, string\n end", "def get_user_key()\n uri = build_uri('storage/crypto/keys')\n ret = @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n ret_hash = JSON.parse(ret)\n payload = JSON.parse(ret_hash['payload'])\n ciphertxt = Base64.decode64(payload['ciphertext'])\n iv = Base64.decode64(payload['IV'])\n priv_elts = JSON.parse(decrypt_data(ciphertxt, @encryption_key, iv))\n Base64.decode64(priv_elts['default'][0])\n end", "def public_key\n encode64(curve.public_key.to_bn.to_s(2))\n end", "def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end", "def generate_key(key_size = T.unsafe(nil)); end", "def private_key\n @key\n end", "def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end", "def token\n Digest::SHA1.hexdigest(self.class.private_certificate.to_der).upcase\n end", "def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end", "def rsaes_pkcs_signature(key, input)\n private_key = if BSON::Environment.jruby?\n # JRuby cannot read DER format, we need to convert key into PEM first.\n key_pem = [\n \"-----BEGIN PRIVATE KEY-----\",\n Base64.strict_encode64(Base64.decode64(key)).scan(/.{1,64}/),\n \"-----END PRIVATE KEY-----\",\n ].join(\"\\n\")\n OpenSSL::PKey::RSA.new(key_pem)\n else\n OpenSSL::PKey.read(Base64.decode64(key))\n end\n private_key.sign(OpenSSL::Digest::SHA256.new, input)\n end", "def pubkey_algorithms; end", "def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end", "def sha256; end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n DH.new(to_der)\n end", "def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end", "def key\n raise 'Not implemented'\n end", "def key\n raise 'Not implemented'\n end", "def cryptor\n key = Rails.application.secrets.secret_key_base.bytes[0..31].pack( \"c\" * 32 )\n ActiveSupport::MessageEncryptor.new(key)\n end", "def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend", "def private_key\n @priv\n end", "def keypair; end", "def keypair; end", "def keypair; end", "def keypair; end", "def keypair; end", "def sha256_fingerprint(key)\n if key.match(/PRIVATE/)\n new(key).sha256_fingerprint\n else\n Base64.encode64(Digest::SHA256.digest(decoded_key(key))).gsub(\"\\n\", \"\")\n end\n end", "def public_key_hash(hex)\n\t\trmd160(sha256(hex))\n\tend", "def private_key\n encode64(curve.private_key.to_s(2))\n end", "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end", "def crypto_provider\n acts_as_authentic_config[:crypto_provider].tap { |provider|\n raise NilCryptoProvider if provider.nil?\n }\n end", "def expected_digest\n OpenSSL::HMAC.digest(HMAC_ALGORITHM, Octokey::Config.hmac_secret, unsigned_buffer.raw)\n end", "def generate_random_key\n SecureRandom.random_bytes(32)\n end", "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "def random_key_gen(key_len = 32, raw = false)\n @master_key = random_bytes key_len\n raw ? @master_key : Base64.strict_encode64(@master_key)\n end", "def signature(key)\n Digest::SHA1.hexdigest(\"#{key}#{Config.secret}\")[0...8]\n end", "def private_key; end", "def private_key; end", "def get_otp_key(id)\n @otp_keys.key?(id) ? decrypt(@otp_keys[id]) : nil\n end", "def signature_key=(_arg0); end", "def vigenere_cipher(string, key_sequence)\n\nend", "def get_auth_key\n raise NotImplementedError\n end", "def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end" ]
[ "0.7052465", "0.6918751", "0.6862655", "0.65664876", "0.65664876", "0.65055305", "0.6505158", "0.6456855", "0.6428397", "0.6428397", "0.64085764", "0.63983417", "0.63579935", "0.63304615", "0.6308838", "0.63013685", "0.6213742", "0.621198", "0.6207232", "0.6174447", "0.61739045", "0.6111599", "0.61097735", "0.60822016", "0.6077981", "0.6067027", "0.6054458", "0.6038573", "0.60307634", "0.6015163", "0.59926", "0.5982403", "0.5943628", "0.5941006", "0.5940346", "0.5938787", "0.59372586", "0.59321874", "0.5927852", "0.5918135", "0.5918135", "0.59110904", "0.5907838", "0.5907082", "0.59018964", "0.59005654", "0.5887459", "0.586882", "0.5861741", "0.5860752", "0.58569646", "0.58466977", "0.58355665", "0.5834214", "0.5822969", "0.58183074", "0.58180267", "0.5816745", "0.58084524", "0.5807422", "0.58072966", "0.58040917", "0.57988846", "0.5794976", "0.57925314", "0.578968", "0.5788785", "0.57869095", "0.57835656", "0.57763314", "0.5773476", "0.5773476", "0.57634085", "0.57593536", "0.57550186", "0.57550186", "0.57507217", "0.57499605", "0.5731673", "0.5730607", "0.5730607", "0.5730607", "0.5730607", "0.5730607", "0.57082725", "0.5705043", "0.57002175", "0.5695477", "0.56912464", "0.56845856", "0.5683757", "0.5677816", "0.5671433", "0.5660937", "0.5660332", "0.5660332", "0.56584054", "0.56560475", "0.5644843", "0.5639878", "0.56318486" ]
0.0
-1
The size of signatures verified by the VerifyKey instance
def signature_bytes; NaCl::ED25519_SIGNATUREBYTES; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n destination.size + private_key.size + signing_key.size\n end", "def size\n keys.size\n end", "def size\n @keys.size\n end", "def size\n self.data.keys.size\n end", "def key_size\n compute_minimal_keys if not @key_length\n @key_length \n end", "def size\n return @hash.length\n end", "def key_size server, key\n server\n .debug(:object, key)\n .scan(/serializedlength:([0-9]+)/)\n .flatten.first.to_i\n end", "def length\n @internal_hash.length\n end", "def size\n key.call(\"LLEN\")\n end", "def size\n @hash.size\n end", "def size\n @hash.size\n end", "def size\n @hash.size\n end", "def length()\n return @i_keys.get_length()\n end", "def length\n keys.length\n end", "def length()\n return self.keys.get_length()\n end", "def key_length\n key.unpack('b*').first.length\n end", "def size\n @hash_array.length\n end", "def size\n @hash_array.length\n end", "def size\n frames.inject(0) do |sum, frame|\n sum += frame.bytesize\n end\n end", "def key_size\n @key_size ||= if (value = @node['keySize'])\n value.to_i\n end\n end", "def length\n hash.keys.length\n end", "def size\n @semaphore.synchronize do\n return @hashed_storage.size\n end\n end", "def size\n to_payload.bytesize\n end", "def hashref_size\n hashptr_size + length_size\n end", "def header_length size\n size.to_s(16).length +\n CHUNK_SIGNATURE_HEADER.length +\n SIGNATURE_LENGTH +\n CLRF.length +\n size +\n CLRF.length\n end", "def hash_size\n hashref_size * num_hashes\n end", "def size\n @store.keys.count { |k| Time.now - @store[k].stamp < @lifetime }\n end", "def size\n\n self.to_h.size\n end", "def size\n data.values.inject(0){|m,v| m+=v.size}\n end", "def size\n @hash_table.keys.length\n end", "def key_len\n @key_len ||= defaults[:key_len]\n end", "def digest_length()\n #This is a stub, used for indexing\n end", "def digest_length()\n #This is a stub, used for indexing\n end", "def digest_length\n decode[:length]\n end", "def size\n\t\tlengths.reduce(&:*)\n\tend", "def size\n return self.body_data.size\n end", "def size\n C.LLVMCountParams(@fun)\n end", "def size\n @certificates.size\n end", "def num_keys\n end", "def raw_size\n valid_blobs.map(&:raw_size).sum\n end", "def size\n @hash.size + @converted.size\n end", "def size\n @data.bytesize\n end", "def iv_len; end", "def certificate_length\n parsed_certificate.to_der.bytesize\n end", "def size\n @events.keys.length\n end", "def size(key)\n @backend.respond_to?(:_size) and return @backend._size(domain, key)\n paths = get_paths(key) or return nil\n paths_size(paths)\n end", "def size\n @references_to_keys_map.count do |_, ref|\n ref.object\n end\n end", "def digest_length\n check_valid\n md.md_size\n end", "def size\n @size.size\n end", "def size; @size end", "def num_bytes\n return @num_bytes\n end", "def size\n self.dna_hash.size\n end", "def size\n self.dna_hash.size\n end", "def size\n @data.size\n end", "def size\n @data.size\n end", "def size\n @data.size\n end", "def size\n return @data.size\n end", "def size\n @gens.size\n end", "def size\n @gens.size\n end", "def size\n return @args[:data].length\n end", "def size\n @mutex.synchronize{_size}\n end", "def hash_byte_size\n return 20\n end", "def verify_signatures?; end", "def size\r\n self.data.length\r\n end", "def length\n size\n end", "def size\n headers[:content_length].to_i\n end", "def size\n @keys.length - 1\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n self.data.length + 4\n end", "def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end", "def size\n @result.size\n end", "def length\n do_num_bytes\n end", "def size\n read.bytesize\n end", "def size\n @size \n end", "def size\n @size \n end", "def size\n @pairs.size\n end", "def size\n length\n end", "def length\n size\n end", "def size\n @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size }\n end", "def size\n @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size }\n end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end", "def size; end" ]
[ "0.727958", "0.6891047", "0.6830876", "0.6752672", "0.6689702", "0.6654646", "0.6632074", "0.6628402", "0.662772", "0.6619703", "0.6619703", "0.6619703", "0.6606119", "0.660124", "0.65387046", "0.6531528", "0.6500893", "0.6500893", "0.64819986", "0.642317", "0.63922256", "0.6391706", "0.6378061", "0.6364223", "0.63326913", "0.6329969", "0.6318724", "0.63151354", "0.63046676", "0.6287027", "0.62817466", "0.62748325", "0.62748325", "0.6264368", "0.62355816", "0.62326175", "0.6205118", "0.6197332", "0.6195381", "0.6178156", "0.61778075", "0.6151913", "0.6151421", "0.6144503", "0.6134557", "0.61235887", "0.6118763", "0.6115593", "0.6114635", "0.61126953", "0.6112605", "0.6100411", "0.6100411", "0.6090803", "0.6090803", "0.6090803", "0.6081896", "0.60782063", "0.60782063", "0.6076286", "0.60744923", "0.60685813", "0.6065198", "0.6052221", "0.60500306", "0.60473806", "0.6040499", "0.6036659", "0.6036659", "0.6036659", "0.6036317", "0.60331607", "0.60329247", "0.6031158", "0.60248727", "0.6021856", "0.6021856", "0.6000531", "0.5996035", "0.5993311", "0.59912056", "0.59912056", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722", "0.597722" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_channel @channel = Channel.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def channel_params params.require(:channel).permit(:channel_id, :channel_description, :channel_status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
render html sourcecode with images
def render(content = 'No template provided') # get Nokogiri object with html source html = Nokogiri::HTML(htmlbody) # pick image tags from source and inject the right images mailskinassets.each do |mailskinasset| html.css('img').each do |image| # do we have the filename of our mailskinasset in the source attribute? if image.attributes['src'].value.to_s.include? mailskinasset.mailskinasset_file_name # replace he whole source with correct url image.attributes['src'].value = mailskinasset.absolute_asset_url.to_s end end end html.to_s.gsub('{yield}', content) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html\r\n return '' unless image?\r\n %(<div>\r\n <a href=\"#{@url}\" target=\"_blank\">\r\n <img src=\"#{@image_url}\">\r\n </a>\r\n </div>)\r\n end", "def render_image\n render_image_iterm2\n end", "def to_erb\n url = @img['src']\n url.sub!(\"/images/\", \"\")\n data_pixel = ''\n\n # resolve special data-pixel-density-2 case\n if @img.to_s.include? 'data-pixel-density-2'\n data_value = @img['data-pixel-density-2']\n data_value.sub!(\"/images/\", \"\")\n data_pixel = \", 'data-pixel-density-2': image_path('#{data_value}')\"\n end\n\n options_str = process_options\n\n if url.include?(\"<%= \") && url.include?(\" %>\")\n url.sub!(\"<%= \", '#{')\n url.sub!(\" %>\", \"}\")\n url_string = \"\\\"#{url.to_s}\\\"\"\n\n \"<%= image_tag(#{url_string}#{options_str}#{data_pixel})%>\"\n else\n \"<%= image_tag('#{url}'#{options_str}#{data_pixel})%>\"\n end\n end", "def transform_src\n CGI.escapeHTML(@src)\n end", "def render_wsd(code, style)\n response = Net::HTTP.post_form(URI.parse(WSD_URL), 'style' => style, 'message' => code)\n if response.body =~ /img: \"(.+)\"/\n url = \"http://www.websequencediagrams.com/#{$1}\"\n \"<img src=\\\"#{url}\\\" />\"\n else\n puts response.body\n html_error(\"Sorry, unable to render sequence diagram at this time.\")\n end\n end", "def image\n lambda do |text|\n begin \n hash = parse_text(text)\n image = find_image(hash)\n src = get_image_src(hash, image)\n\n unless image.nil?\n engine = gen_haml('image.haml')\n engine.render(nil, {:src => src, :id => hash['id'], :class_name => hash['class'], :alt => hash['alt'], :title => hash['title'], :itemprop => hash['itemprop'], :height => hash['height'], :width => hash['width']})\n end\n rescue NoMethodError => e\n Rails.logger.error \"#{e} could not find image with the params: #{text}\"\n end\n end\n end", "def to_html\n \"<img src='#{@url}' height='#{@height}' width='#{width}' />\"\n end", "def image_markup(image)\n render_to_string(\n file: 'bootsy/images/_image',\n formats: [:html],\n locals: { image: image },\n layout: false\n )\n end", "def to_html\n @emoticons.each do |regexp, image|\n @string.gsub!(Regexp.new(\"(^|\\s)(#{regexp})(\\s|$)\"), \" <img src='#{@options[:images_path]}#{@options[:theme]}/#{image}'/> \")\n end\n @options[:extras].each do |regexp, image|\n @string.gsub!(Regexp.new(\"(^|\\s)(#{regexp})(\\s|$)\"), \" <img src='#{@options[:images_path]}extras/#{image}'/> \")\n end\n @string\n end", "def post_process\n @result = @result[:content].first\n raise ::Grafana::ImageCouldNotBeRenderedError, @panel if @result.include?('<html')\n end", "def render_image_iterm2\n return nil unless valid?\n\n # References:\n # https://iterm2.com/documentation-images.html\n # https://iterm2.com/utilities/imgcat\n\n # tmux requires some extra work for unrecognised escape code sequences\n screen = ENV['TERM'].start_with? 'screen'\n prefix = screen ? \"\\ePtmux;\\e\\e]\" : \"\\e]\"\n suffix = screen ? \"\\a\\e\\\\\" : \"\\a\"\n\n png = qrcode.as_png(size: 600)\n png_base64 = Base64.encode64(png.to_s).chomp\n options = 'inline=1'\n \"#{prefix}1337;File=#{options}:#{png_base64}#{suffix}\"\n end", "def embed_code(options={})\n \"<img src=\\\"#{@url}\\\" width=\\\"#{embed_width}\\\"/>\"\n end", "def to_s\n @result_html = ''\n @images_urls.each do |url|\n @result_html += \"<img src=\\\"#{url}\\\"/>\"\n end\n @result_html.html_safe\n end", "def new_image_markup(gallery)\n render_to_string(\n file: 'bootsy/images/_new',\n formats: [:html],\n locals: { gallery: gallery, image: gallery.images.new },\n layout: false\n )\n end", "def build\n html = []\n scripts.each do |script|\n code = File.read(script)\n html << %[<div class=\"file\" id=\"#{script}\"><pre>]\n html << highlight(code)\n html << %[</pre></div>]\n end\n text = html.join(\"\\n\")\n text = interlink(text)\n text = garnish(text)\n text\n end", "def convert_html(text)\n auto_html text do\n html_escape :map => {\n '&' => '&amp;',\n '>' => '&gt;',\n '<' => '&lt;',\n '\"' => '\"'\n }\n image\n youtube :width => 510, :height => 332\n vimeo :width => 510, :height => 332\n link :target => :_blank\n redcarpet :target => :_blank\n end\n end", "def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end", "def render_content(options={})\n layout = ::Liquid::Template.parse(\"{{content}}\").render({\"content\" => page.content})\n result = ::Liquid::Template.parse(layout).render(optional_data(options), :registers => {:controller => controller}).html_safe\n rescue => e\n log_error(e)\n ensure\n return filter_images_urls(result.to_s)\n end", "def compile_images(content)\n content.gsub(/\\[img:(.*):'(.*)'\\]/) { get_image($1, $2) }\n end", "def render(gist_file_key)\n # REFACTOR I'd rather be composing functions.\n @renders_code.render(@downloads_gist.download(gist_file_key))\n rescue => oops\n # I tried to do this with an HTML comment,\n # but a RubyPants filter ate my --> delimeters,\n # so I opted for Javascript comments, instead.\n # Wow.\n StringIO.new.tap { |canvas| canvas.puts \"<script>\", \"/*\", oops.message, oops.backtrace, \"*/\", \"</script>\" }.string\n end", "def image(src, options = {})\n media = extract_media!(options)\n (@images ||= []) << IMAGE.new(src, media, options)\n\n # Do not render anything here!\n return \"\"\n end", "def images; end", "def as_img_tag()\n \"<img src='#{self.encode}' />\"\n end", "def render_code(code)\n code.pegs.each { |peg| render_peg(peg) }\n end", "def auto_image(html)\n return html.gsub(%r{http(s?):[a-z0-9/.\\-_%~/\\=\\?\\:]+(.gif|.jpg|.jpeg|.png|.bmp|.tif|.tiff)(?:\\?[\\w\\=\\.]+)?}i,\n '<img src=\"\\0\"/>')\n end", "def to_html\n render_file(main)\n end", "def image_tag(image)\n raw \"<img src=\\\"/images/\" + image + \"\\\"/>\"\n end", "def image(name, html_options = {})\n %Q{<img src=\"img/#{name}.png\" alt=\"#{name}\" #{%Q{id=\"#{html_options[:id]}\"} if html_options[:id]} #{%Q{class=\"#{html_options[:class]}\"} if html_options[:class]} #{%Q{style=\"#{html_options[:style]}\"} if html_options[:style]}/>}\n end", "def render_page(name=\"out\")\n png_name = name.strip.gsub(/\\W+/, '-')\n path = File.join(Rails::root, \"#{png_name}.png\")\n puts \"Saving image to to #{path}\"\n page.driver.render(path)\n end", "def render\n\n # Load graphics.\n path = Rails.root.join('lib', 'assets', 'letterhead', 'letterhead.png')\n \n # Draw graphics on each page.\n self.repeat(:all) do\n self.image(path, at: [0.25.in, 10.75.in], width: 8.in, height: 1.25.in)\n end\n\n # Call parent render.\n super\n\n end", "def source_type(source)\n return \"<div class='source'><img src='https://www.bungie.net/#{source['icon']}' title='#{source['sourceName']}' class='image'><div class='text'><span class='title'>#{source['sourceName']}</span><span class='desc'>#{source['description']}</span></div></div>\".html_safe\n end", "def show\n respond_to do |format|\n format.html\n format.svg { render :qrcode => @code.url, :level => :l, :unit => 10 }\n format.png { render :qrcode => @code.url }\n format.gif { render :qrcode => @code.url }\n format.jpeg { render :qrcode => @code.url }\n end\n end", "def render_image(image)\n id_attr = image.id ? %( id=\"attachment_#{image.id}\") : \"\"\n lines = []\n lines << %(<figure#{id_attr} class=\"image embedded\">)\n lines << %(<div class=\"img\"><img src=\"#{encode(image.url)}\" alt=\"#{encode(image.alt_text)}\"></div>)\n lines << image.figcaption_html if image.figcaption?\n lines << \"</figure>\"\n lines.join\n end", "def epub_html\n edited_html.gsub('img src=\"http://', 'img src=\"https://')\n end", "def show\n @pretext = CGI::escapeHTML(@memo.text)\n .gsub(RE_URL){ %Q[<a href=\"#{$1}\" target=\"_blank\">#{$1}</a>] }\n .gsub(RE_IMG){ %Q[<div><img src=\"#{$1}\" width=\"#{$2}\" /></div>] }\n .html_safe\n end", "def render_flex_image(img)\r\n img.to_jpg!\r\n send_data(img[img.class.binary_column], :type => 'image/jpeg', :disposition => 'inline')\r\n GC.start\r\n end", "def render(exp)\n renderer.process(exp)\n end", "def image; end", "def fixHtmlImageSrcAndKTs(pdf_tmp_html, pdftmp_dir, bkmkrkeeptogether_stylename, logkey='')\n filecontents = File.read(pdf_tmp_html).gsub(/src=\"images\\//,\"src=\\\"#{pdftmp_dir}/\")\n .gsub(/([a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?\\s\\. \\. \\.)/,\"<span class=\\\"#{bkmkrkeeptogether_stylename}\\\">\\\\0</span>\")\n .gsub(/(\\w{5}[.?!])(<\\/p>)/,\"<span class=\\\"#{bkmkrkeeptogether_stylename}\\\">\\\\1</span>\\\\2\")\n return filecontents\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end", "def process_images\n # Split \"![alt text](url)\" into [\"![alt text](\", \"url\", \")\"]\n # TODO: handle properly escaped values, escaped ) and surrounded by <>\n imgRE = /(!\\[.*?\\]\\()(.+?)(\\))/\n new_content = \"\"\n pos = 0\n source_dir = Pathname.new(@dir)\n out_dir = Pathname.new(\"images\")\n base_url = Pathname.new(\"{{site.baseurl}}\")\n images = []\n while !(i = self.content.index(imgRE, pos)).nil?\n match = self.content.match(imgRE, i)\n url = match[2]\n path = Pathname.new(url)\n # Only replace relative URLs\n next if !path.relative?\n images << path\n new_url = base_url.join(out_dir, source_dir, url).cleanpath.to_s\n # TODO: normalize path to forward-slashes.\n new_image_link = match[1] + new_url + match[3]\n new_content += self.content[pos...i] + new_image_link\n \n pos = i + match[0].length\n end\n # Get any post-URL end content.\n new_content += match.post_match\n self.content = new_content\n\n file_source = Pathname.new(@_pages_dir).join(source_dir)\n # Add images to static files.\n images.each do |path|\n site.static_files << NoteImageFile.new(@site,\n @base,\n file_source.join(path).dirname.to_s,\n path.basename.to_s,\n out_dir.join(source_dir, path).dirname.to_s)\n end\n end", "def image(options = {}, html_options = {})\n html_options[:src] = if options.is_a?(String) then options else self.url_for(options) end\n html_options[:alt] ||= File.basename(html_options[:src], '.*').split('.').first.capitalize\n\n if html_options[:size]\n html_options[:width], html_options[:height] = html_options[:size].split(\"x\")\n html_options.delete :size\n end\n\n tag(\"img\", html_options)\n end", "def render_responsive_images( html )\n\n html.gsub(/<img(?:\\s+(?:data-media-id=\"(\\d+)\")|(?:data-align=\"([a-z]+)\")|(?:.*?))+>/) do |mat|\n\n # if we have neither a media ID or anything, bail\n return \"\" if $1.nil?\n\n # endeavour to load a media\n begin\n\n media = Media.find( $1 )\n render( partial: 'rendered-image.html', locals: { image: media, alignment: $2.downcase.to_sym })\n\n rescue\n\n \"\"\n\n end\n\n end\n\n end", "def sample\n img :src => $imgHostURL + \"/\" + $sampleImg\n end", "def show\n\n #render plain: @myimage\n end", "def image_manipulations(html_doc)\n html_doc.css('img').each do |img|\n # prepare image for lazy loading\n unless img['src'] == LOADING_IMAGE_GIF\n src = UrlNormalizer.normalize_entry_url img['src'], self\n img['src'] = LOADING_IMAGE_GIF\n img['data-src'] = src\n end\n end\n return html_doc\n end", "def render_file(data_filename, image_filename)\n render_data(\n File.read(data_filename).split(\"\\n\").map { |line| line.to_i },\n image_filename\n )\nend", "def render\n render_background\n\n render_heat_maps\n\n render_star\n render_target\n render_hills\n render_walls\n\n render_paths\n end", "def html source=nil\n to_html text(source)\n end", "def html_content\n\t\t\treturn \"\" if content.blank? \n\t\t\tstr = content.gsub(/<(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\#{$1}>\" }\n\t\t\tstr = str.gsub(/<\\/(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\/>\" }\n\t\t\tstr = str.gsub(/\\r\\n/, \"<br/>\") \n\t\t\tstr = str.gsub(/(\\s)/, \"&nbsp;\")\n\t\t\tstr = str.gsub(/\\[bold\\]/, \"<b>\")\n\t\t\tstr = str.gsub(/\\[-bold\\]/, \"</b>\")\n\t\t\tstr = str.gsub(/\\[italic\\]/, \"<i>\")\n\t\t\tstr = str.gsub(/\\[-italic\\]/, \"</i>\")\n\t\t\tstr = str.gsub(/\\[color:(#.{6})\\]/){ |s| \"<span style=\\\"color:#{$1}\\\">\" }\n\t\t\tstr = str.gsub(/\\[-color\\]/, \"</span>\")\n\t\t\tstr = str.gsub(/\\[(\\w+)\\]/) do |s|\n\t\t\t\temotion = EMOTIONS.index($1)\n\t\t\t\temotion.nil? ? \"[#{$1}]\": \"<img src=\\\"/assets/emotions/#{emotion}.gif\\\" />\" \n\t\t\tend\n\t\t\treturn str\n\t\tend", "def content_from(html, url)\n \n def extract_pre_from(html)\n regex = /<pre.*?>.*?<\\/pre>/m\n pre_list = html.scan regex\n html.gsub! regex, 'DUMMY-STRING'\n [pre_list, html]\n end\n\n def add_domain(html, domain)\n html.gsub! /a href=\\\"(\\/.*?\\\")/, \"a href=\\\"#{domain}\\\\1\"\n html.gsub! /img src=\\\"(\\/.*?\\\")/, \"img src=\\\"#{domain}\\\\1\"\n html\n end\n\n def add_pre(html, pre_list)\n pre_list.each do |p|\n html.sub!('DUMMY-STRING', p)\n end\n html\n end\n \n pre_list, replaced = extract_pre_from html\n params = { :tags => %w[div span p a b i pre h1 h2 h3 h4 h5 h6 strong small em\n blockquote ul ol li img],\n :attributes => %w[href src] }\n html = HtmlPress.press Readability::Document.new(replaced, params).content\n domain = domain_of url\n output = add_pre(add_domain(html, domain), pre_list)\n output = sanitize_with_img output\n output.gsub /<img /, \"<img onError=\\\"this.style.display='none';\\\" \"\n \n end", "def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end", "def custom_display_as_html(code, file_url)\n begin\n review_scores = self.scores\n\n #********************Learning Targets******************\n code = code + \"<h2>Learning Targets</h2><hr>\"\n if review_scores[0].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\" \n end\n\n if review_scores[1].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are specific<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are specific<br/>\"\n end\n\n if review_scores[2].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n end\n\n if review_scores[3].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n end\n\n code = code + \"<br/><i>Number of Learning Targets: </i>#{review_scores[4].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/><i>Grade: </i>#{review_scores[5].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/><i>Comment: </i> <dl><dd>#{review_scores[6].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n #*******************Content************************\n code = code + \"<h2>Content</h2><hr>\"\n code = code + \"<i>File:</i>\"\n if file_url.nil?\n code = code + \"File has not been uploaded<br/>\"\n else\n code = code + file_url.to_s + \"<br/>\"\n end\n \n code = code + \"<i>Compliment:</i>\"\n code = code + \"<ul><li>#{review_scores[8].comments.gsub(/\\\"/,'&quot;').to_s}</li><li>#{review_scores[9].comments.gsub(/\\\"/,'&quot;').to_s}</li></ul>\"\n code = code + \"<i>Suggestion:</i>\"\n code = code + \"<ul><li>#{review_scores[10].comments.gsub(/\\\"/,'&quot;').to_s}</li><li>#{review_scores[11].comments.gsub(/\\\"/,'&quot;').to_s}</li></ul>\"\n\n #*******************Sources and Use of Source Material************************\n code = code + \"<h2>Sources and Use of Source Material</h2><hr>\"\n code = code + \"<br/>How many sources are in the references list?: #{review_scores[12].comments.gsub(/\\\"/,'&quot;').to_s}<br/>\"\n code = code + \"<br/>List the range of publication years for all sources, e.g. 1998-2006: <b>#{review_scores[13].comments.gsub(/\\\"/,'&quot;').to_s} - #{review_scores[14].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/><br/>\"\n\n if review_scores[15].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n end\n\n if review_scores[16].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n end\n\n if review_scores[17].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The citations are in APA format<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The citations are in APA format<br/>\"\n end\n\n if review_scores[18].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n end\n\n if review_scores[19].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n end\n\n if review_scores[20].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n end\n\n if review_scores[21].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The sources represent different viewpoints<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The sources represent different viewpoints<br/>\"\n end\n\n code = code + \"<br/><b>What other sources or perspectives might the author want to consider?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[22].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n \n if review_scores[23].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible. <br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible<br/>\"\n end\n\n code = code + \"<br/><b>If not, which one(s) may infringe copyrights, or what areas of text may need citations, revisions or elaboration?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[24].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n code = code + \"<br/>Please make a comment about the sources. Explain how the author can improve the use of sources in the lesson.<br/>\"\n code = code + \"<dl><dd>#{review_scores[25].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd>\"\n\n #*******************Multiple Choice Questions************************\n code = code + \"<h2>Multiple Choice Questions</h2><hr>\"\n if review_scores[26].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n end\n\n if review_scores[27].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n end\n\n if review_scores[28].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n end\n\n if review_scores[29].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions assess the learning target(s)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions assess the learning target(s)<br/>\"\n end\n\n if review_scores[30].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n end\n\n if review_scores[31].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n end\n\n if review_scores[32].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n end\n\n if review_scores[33].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n end\n\n code = code + \"<br/><h3>Questions</h3>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[34].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[35].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[36].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[37].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[38].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[39].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[40].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[41].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[42].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[43].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[44].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[45].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n\n #*******************Rubric************************\n code = code + \"<h2>Rubric</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code +\n \"<div align=\\\"center\\\">The information selected by the author:</div><table class='general'>\n <tr>\n <th>5 - Very Important </th>\n <th>4 - Quite Important </th>\n <th>3 - Some Importance </th>\n <th>2 - Little Importance</th>\n <th>1 - No Importance </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[46].comments == \"1\"\n code = code + \"<li>Is very important for future teachers to know</li>\"\n end\n if review_scores[47].comments == \"1\"\n code = code + \"<li>Is based on researched information</li>\"\n end\n if review_scores[48].comments == \"1\"\n code = code + \"<li>Is highly relevant to current educational practice</li>\"\n end\n if review_scores[49].comments == \"1\"\n code = code + \"<li>Provides an excellent overview and in-depth discussion of key issues</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[50].comments == \"1\"\n code = code + \"<li>Is relevant to future teachers</li>\"\n end\n if review_scores[51].comments == \"1\"\n code = code + \"<li>Is mostly based on researched information</li>\"\n end\n if review_scores[52].comments == \"1\"\n code = code + \"<li>Is applicable to today's schools</li>\"\n end\n if review_scores[53].comments == \"1\"\n code = code + \"<li>Provides a good overview and explores a few key ideas</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[54].comments == \"1\"\n code = code + \"<li>Has useful points but some irrelevant information</li>\"\n end\n if review_scores[55].comments == \"1\"\n code = code + \"<li>Is half research; half the author's opinion</li>\"\n end\n if review_scores[56].comments == \"1\"\n code = code + \"<li>Is partially out-dated or may not reflect current practice</li>\"\n end\n if review_scores[57].comments == \"1\"\n code = code + \"<li>Contains good information but yields an incomplete understanding</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[58].comments == \"1\"\n code = code + \"<li>Has one useful point</li>\"\n end\n if review_scores[59].comments == \"1\"\n code = code + \"<li>Is mostly the author's opinion.</li>\"\n end\n if review_scores[60].comments == \"1\"\n code = code + \"<li>Is mostly irrelevant in today's schools</li>\"\n end\n if review_scores[61].comments == \"1\"\n code = code + \"<li>Focused on unimportant subtopics OR is overly general</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\" \n if review_scores[62].comments == \"1\"\n code = code + \"<li>Is not relevant to future teachers</li>\"\n end\n if review_scores[63].comments == \"1\"\n code = code + \"<li>Is entirely the author's opinion</li>\"\n end\n if review_scores[64].comments == \"1\"\n code = code + \"<li>Is obsolete</li>\"\n end\n if review_scores[65].comments == \"1\"\n code = code + \"<li>Lacks any substantive information</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code +\n \"<div align=\\\"center\\\">To attract and maintain attention, the lesson has:</div><table class='general'>\n <tr>\n <th>5 - Extremely Interesting </th>\n <th>4 - Quite Interesting </th>\n <th>3 - Reasonably Interesting </th>\n <th>2 - Little Interest</th>\n <th>1 - No Interest </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[66].comments == \"1\"\n code = code + \"<li>A sidebar with new information that was motivating to read/view</li>\"\n end\n if review_scores[67].comments == \"1\"\n code = code + \"<li>Many creative, attractive visuals and engaging, interactive elements</li>\"\n end\n if review_scores[68].comments == \"1\"\n code = code + \"<li>Multiple perspectives</li>\"\n end\n if review_scores[69].comments == \"1\"\n code = code + \"<li>Insightful interpretation & analysis throughout</li>\"\n end\n if review_scores[70].comments == \"1\"\n code = code + \"<li>Many compelling examples that support the main points (it \\\"shows\\\" not just \\\"tells\\\")</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[71].comments == \"1\"\n code = code + \"<li>A sidebar that adds something new to the lesson</li>\"\n end\n if review_scores[72].comments == \"1\"\n code = code + \"<li>A few effective visuals or interactive elements</li>\"\n end\n if review_scores[73].comments == \"1\"\n code = code + \"<li>At least one interesting, fresh perspective</li>\"\n end\n if review_scores[74].comments == \"1\"\n code = code + \"<li>Frequent interpretation and analysis</li>\"\n end\n if review_scores[75].comments == \"1\"\n code = code + \"<li>Clearly explained and well supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[76].comments == \"1\"\n code = code + \"<li>A sidebar that repeats what is in the lesson</li>\"\n end\n if review_scores[77].comments == \"1\"\n code = code + \"<li>An effective visual or interactive element</li>\"\n end\n if review_scores[78].comments == \"1\"\n code = code + \"<li>One reasonable (possibly typical) perspective</li>\"\n end\n if review_scores[79].comments == \"1\"\n code = code + \"<li>Some interpretation and analysis</li>\"\n end\n if review_scores[80].comments == \"1\"\n code = code + \"<li>Supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[81].comments == \"1\"\n code = code + \"<li>A quote, link, etc. included as a sidebar, but that is not in a textbox</li>\"\n end\n if review_scores[82].comments == \"1\"\n code = code + \"<li>Visuals or interactive elements that are distracting</li>\"\n end\n if review_scores[83].comments == \"1\"\n code = code + \"<li>Only a biased perspective</li>\"\n end\n if review_scores[84].comments == \"1\"\n code = code + \"<li>Minimal analysis or interpretation</li>\"\n end\n if review_scores[85].comments == \"1\"\n code = code + \"<li>At least one clear and supported point</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[86].comments == \"1\"\n code = code + \"<li>No side bar included</li>\"\n end\n if review_scores[87].comments == \"1\"\n code = code + \"<li>No visuals or interactive elements</li>\"\n end\n if review_scores[88].comments == \"1\"\n code = code + \"<li>No perspective is acknowledged</li>\"\n end\n if review_scores[89].comments == \"1\"\n code = code + \"<li>No analysis or interpretation</li>\"\n end\n if review_scores[90].comments == \"1\"\n code = code + \"<li>No well-supported points</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Credibility</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To demonstrate its credibility the lesson:</div><table class='general'>\n <tr>\n <th>5 - Completely Credible </th>\n <th>4 - Substantial Credibility </th>\n <th>3 - Reasonable Credibility </th>\n <th>2 - Limited Credibility</th>\n <th>1 - Not Credible </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[91].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources in proper APA format</li>\"\n end\n if review_scores[92].comments == \"1\"\n code = code + \"<li>Provides citations for all presented information</li>\"\n end\n if review_scores[93].comments == \"1\"\n code = code + \"<li>Readily identifies bias: both the author's own and others</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[94].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources with few APA errors</li>\"\n end\n if review_scores[95].comments == \"1\"\n code = code + \"<li>Provides citations for most information</li>\"\n end\n if review_scores[96].comments == \"1\"\n code = code + \"<li>Clearly differentiates between opinion and fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[97].comments == \"1\"\n code = code + \"<li>Cites 5 or more reputable sources</li>\"\n end\n if review_scores[98].comments == \"1\"\n code = code + \"<li>Supports some claims with citation</li>\"\n end\n if review_scores[99].comments == \"1\"\n code = code + \"<li>Occasionally states opinion as fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[100].comments == \"1\"\n code = code + \"<li>Cites 4 or more reputable sources</li>\"\n end\n if review_scores[101].comments == \"1\"\n code = code + \"<li>Has several unsupported claims</li>\"\n end\n if review_scores[102].comments == \"1\"\n code = code + \"<li>Routinely states opinion as fact and fails to acknowledge bias</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[103].comments == \"1\"\n code = code + \"<li>Cites 3 or fewer reputable sources</li>\"\n end\n if review_scores[104].comments == \"1\"\n code = code + \"<li>Has mostly unsupported claims</li>\"\n end\n if review_scores[105].comments == \"1\"\n code = code + \"<li>Is very biased and contains almost entirely opinions</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n\n code = code + \"<h3>Pedagogy</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To help guide the reader:</div><table class='general'>\n <tr>\n <th>5 - Superior </th>\n <th>4 - Effective </th>\n <th>3 - Acceptable </th>\n <th>2 - Deficient</th>\n <th>1 - Absent </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[106].comments == \"1\"\n code = code + \"<li>Specific, appropriate, observable learning targets establish the purpose of the lesson</li>\"\n end\n if review_scores[107].comments == \"1\"\n code = code + \"<li>The lesson accomplishes its established goals</li>\"\n end\n if review_scores[108].comments == \"1\"\n code = code + \"<li>Excellent knowledge and application MC questions align with learning targets and assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[109].comments == \"1\"\n code = code + \"<li>Specific and reasonable learning targets are stated</li>\"\n end\n if review_scores[110].comments == \"1\"\n code = code + \"<li>The lesson partially meets its established goals</li>\"\n end\n if review_scores[111].comments == \"1\"\n code = code + \"<li>Well constructed MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[112].comments == \"1\"\n code = code + \"<li>Reasonable learning targets are stated</li>\"\n end\n if review_scores[113].comments == \"1\"\n code = code + \"<li>The content relates to its goals</li>\"\n end\n if review_scores[114].comments == \"1\"\n code = code + \"<li>MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[115].comments == \"1\"\n code = code + \"<li>A learning target is included</li>\"\n end\n if review_scores[116].comments == \"1\"\n code = code + \"<li>Content does not achieve its goal, or goal is unclear</li>\"\n end\n if review_scores[117].comments == \"1\"\n code = code + \"<li>4 questions are included</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[118].comments == \"1\"\n code = code + \"<li>Learning target is missing/ not actually a learning target</li>\"\n end\n if review_scores[119].comments == \"1\"\n code = code + \"<li>Lesson has no goal/ content is unfocused</li>\"\n end\n if review_scores[120].comments == \"1\"\n code = code + \"<li>Questions are missing</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n code = code + \"<h3>Writing Quality</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">The writing:</div><table class='general'>\n <tr>\n <th>5 - Excellently Written </th>\n <th>4 - Well Written </th>\n <th>3 - Reasonably Written </th>\n <th>2 - Fairly Written</th>\n <th>1 - Poorly Written </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[121].comments == \"1\"\n code = code + \"<li>Is focused, organized, and easy to read throughout</li>\"\n end\n if review_scores[122].comments == \"1\"\n code = code + \"<li>Uses rich, descriptive vocabulary and a variety of effective sentence structures</li>\"\n end\n if review_scores[123].comments == \"1\"\n code = code + \"<li>Contains few to no mechanical errors</li>\"\n end\n if review_scores[124].comments == \"1\"\n code = code + \"<li>Has an effective introduction and a conclusion that synthesizes all of the material presented</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[125].comments == \"1\"\n code = code + \"<li>Is organized and flows well</li>\"\n end\n if review_scores[126].comments == \"1\"\n code = code + \"<li>Uses effective vocabulary and sentence structures</li>\"\n end\n if review_scores[127].comments == \"1\"\n code = code + \"<li>Contains a few minor mechanical errors</li>\"\n end\n if review_scores[128].comments == \"1\"\n code = code + \"<li>Has an effective introduction and conclusion based on included information</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[129].comments == \"1\"\n code = code + \"<li>Is mostly organized</li>\"\n end\n if review_scores[130].comments == \"1\"\n code = code + \"<li>Uses properly constructed sentences</li>\"\n end\n if review_scores[131].comments == \"1\"\n code = code + \"<li>Has a few distracting errors</li>\"\n end\n if review_scores[132].comments == \"1\"\n code = code + \"<li>Includes an introduction and a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[133].comments == \"1\"\n code = code + \"<li>Can be difficult to follow</li>\"\n end\n if review_scores[134].comments == \"1\"\n code = code + \"<li>Contains several awkward sentences</li>\"\n end\n if review_scores[135].comments == \"1\"\n code = code + \"<li>Has several distracting errors</li>\"\n end\n if review_scores[136].comments == \"1\"\n code = code + \"<li>Lacks either an introduction or a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[137].comments == \"1\"\n code = code + \"<li>Has minimal organization</li>\"\n end\n if review_scores[138].comments == \"1\"\n code = code + \"<li>Has many poorly constructed sentences</li>\"\n end\n if review_scores[139].comments == \"1\"\n code = code + \"<li>Has many mechanical errors that inhibit comprehension</li>\"\n end\n if review_scores[140].comments == \"1\"\n code = code + \"<li>Has neither a clear introduction nor a conclusion</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n #*******************Ratings************************\n code = code + \"<h2>Ratings</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[141].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[142].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[143].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[144].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Credibility</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[145].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[146].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Pedagogy</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[147].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[148].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Writing Quality</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[149].comments.gsub(/\\\"/,'&quot;').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[150].comments.gsub(/\\\"/,'&quot;').to_s}</dl></dd><br/>\"\n rescue\n code += \"Error \" + $! \n end \n code\nend", "def render(_, _)\n self.class.run(@filename, @source)\n end", "def create_image_object(obj)\n return content_tag(:div, tag(:img, :src => obj.link), :style => \"position:absolute; top: #{obj.y}px; left: #{obj.x}px;\")\n end", "def to_tex\n q_url = \"http://dream.misasa.okayama-u.ac.jp/?q=\"\n basename = File.basename(image.name,\".*\")\n lines = []\n lines << \"\\\\begin{overpic}[width=0.49\\\\textwidth]{#{basename}}\"\n lines << \"\\\\put(1,74){\\\\colorbox{white}{(\\\\sublabel{#{basename}}) \\\\href{#{q_url}#{image.global_id}}{#{basename}}}}\"\n lines << \"%%(\\\\subref{#{basename}}) \\\\nolinkurl{#{basename}}\"\n lines << \"\\\\color{red}\"\n\n surface.surface_images.each do |osurface_image|\n oimage = osurface_image.image\n #image_region\n opixels = oimage.spots.map{|spot| [spot.spot_x, spot.spot_y]}\n worlds = oimage.pixel_pairs_on_world(opixels)\n pixels = image.world_pairs_on_pixel(worlds)\n oimage.spots.each_with_index do |spot, idx|\n length = image.length\n height = image.height\n x = \"%.1f\" % (pixels[idx][0] / length * 100)\n y = \"%.1f\" % (height.to_f / length * 100 - pixels[idx][1] / length * 100)\n line = \"\\\\put(#{x},#{y})\"\n line += \"{\\\\footnotesize \\\\circle{0.7} \\\\href{#{q_url}#{spot.target_uid}}{#{spot.name}}}\"\n line += \" % #{spot.target_uid}\" if spot.target_uid\n line += \" % \\\\vs(#{(\"%.1f\" % worlds[idx][0])}, #{(\"%.1f\" % worlds[idx][1])})\"\n lines << line\n end\n end\n\n width_on_stage = image.transform_length(image.width / image.length * 100)\n scale_length_on_stage = 10 ** (Math::log10(width_on_stage).round - 1)\n scale_length_on_image = image.transform_length(scale_length_on_stage, :world2xy).round\n lines << \"%%scale #{(\"%.0f\" % scale_length_on_stage)}\\ micro meter\"\n lines << \"\\\\put(1,1){\\\\line(1,0){#{(\"%.1f\" % scale_length_on_image)}}}\"\n\n lines << \"\\\\end{overpic}\"\n\n lines.join(\"\\n\")\n end", "def image(full_path, opts = {})\n image_name = template.add_image(full_path)\n output = '<draw:frame text:anchor-type=\"as-char\" '\n opts[:width] && output << %Q(svg:width=\"#{opts[:width]}cm\" )\n opts[:height] && output << %Q(svg:height=\"#{opts[:height]}cm\")\n output << '>'\n output << %Q(<draw:image xlink:href=\"Pictures/#{image_name}\" )\n output <<\n 'xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\"/>'\n output << '</draw:frame>'\n end", "def render\n\n # Skip if page is not letterhead.\n unless self.class::LETTERHEAD_FORMAT == :none\n\n # Determine letterhead properties.\n path = Rails.root.join('lib', 'assets', 'letterhead', \"#{self.class::LETTERHEAD_FORMAT.to_s}.png\")\n x = nil\n y = nil\n width = nil\n height = 1.25\n case self.class::LETTERHEAD_FORMAT\n when :portrait, :portrait_mono\n x = 0.25\n y = 10.75\n width = 8\n when :landscape, :landscape_mono, :packing_list, :packing_list_mono\n x = 0.25\n y = 8.25\n width = 10.5\n end\n\n # Draw graphic on each page.\n self.repeat(:all) do\n self.image(path, at: [x.in, y.in], width: width.in, height: height.in)\n end\n\n end\n\n # Call parent render.\n super\n\n end", "def display_images\n system(\"clear\")\n images_font = TTY::Font.new(:doom)\n images_title = Pastel.new\n puts images_title.cyan.bold(images_font.write(\"IMAGES\", letter_spacing: 2))\n images = []\n CSV.foreach(\"image_manipulation.csv\", headers: true).select { |row| \n images << [row[\"title\"], row[\"description\"], row[\"code snippet\"]]\n }\n image_table = TTY::Table.new([\"Title\",\"Description\",\"Code Snippet\"], images)\n puts image_table.render(:unicode, multiline: true, alignments: [:left, :left], padding:[1,1])\nend", "def render_file(src_file, options)\n render_string File.read(src_file), options\n end", "def embed_image(src, label)\n id = \"img_#{@img_id}\"\n @img_id += 1\n if @io.respond_to?(:path) and File.file?(src)\n out_dir = Pathname.new(File.dirname(File.absolute_path(@io.path)))\n src = Pathname.new(File.absolute_path(src)).relative_path_from(out_dir)\n end\n # removing home dir\n src = URI::encode(src.gsub(\"#{Dir.home}\", ''))\n @builder.span(:class => 'embed') do |pre|\n pre << %{<a href=\"\" onclick=\"img=document.getElementById('#{id}'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false\">#{label}</a><br>&nbsp;\n <img id=\"#{id}\" style=\"display: none\" src=\"#{src}\"/>}\n end\n end", "def render_page(name)\n png_name = name.strip.gsub(/\\W+/, '-')\n path = Rails.root.join('tmp', \"#{png_name}.png\")\n page.driver.render(path)\nend", "def garnish(html)\n template{ html }\n end", "def render(_context)\n @browser_url = @attributes['url']\n render_header + render_contents + render_url + render_footer\n end", "def generate_html\n body = generate_body\n init = Nyaplot.generate_init_code\n path = File.expand_path(\"../templates/static_html.erb\", __FILE__)\n template = File.read(path)\n ERB.new(template).result(binding)\n end", "def make_img_tag(x)\n\n\"<img src='\" + x +\"'/>\"\n\nend", "def html_markup_html(text); end", "def html_markup_textile(text); end", "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", "def render(context)\n file = Tempfile.new('')\n file.write(super)\n file.close # close temp file; flush content\n output = `python #{file.path}`\n file.unlink # Delete temp file\n \"<figure><embed src=\\\"#{output}\\\" /></figure>\"\n end", "def update_image_source(img)\n @content.gsub!(img, \"/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\")\n end", "def to_html \n generator.generate\n end", "def convert_standalone_image(el, indent); end", "def render(no_follow = false)\n sanitize = no_follow ?\n @wiki.history_sanitizer :\n @wiki.sanitizer\n\n data = extract_tex(@data.dup)\n data = extract_code(data)\n data = extract_tags(data)\n begin\n data = GitHub::Markup.render(@name, data)\n if data.nil?\n raise \"There was an error converting #{@name} to HTML.\"\n end\n rescue Object => e\n data = %{<p class=\"gollum-error\">#{e.message}</p>}\n end\n data = process_tags(data)\n data = process_code(data)\n if sanitize || block_given?\n doc = Nokogiri::HTML::DocumentFragment.parse(data)\n doc = sanitize.clean_node!(doc) if sanitize\n yield doc if block_given?\n data = doc_to_html(doc)\n end\n data = process_tex(data)\n data.gsub!(/<p><\\/p>/, '')\n data\n end", "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", "def build_HTML_response(response)\n return \"<img src=\\\"#{response}\\\" alt=\\\"#{options[:title].nil? ? 'Screenshot' : options[:title]}\\\">\" if options[:size].nil?\n\n \"<img src=\\\"#{response}\\\" alt=\\\"#{options[:title].nil? ? 'Screenshot' : options[:title]}\\\" width=\\\"#{options[:size]}%\\\">\"\n end", "def wrap_preview(preview_html)\n output_file_content =<<CONTENT\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"refresh\" content=\"#{@refresh_rate}\">\n <style type=\"text/css\">\n #{IO.read(Resources.expand_path(File.join('css','github.css')))}\n #{IO.read(Resources.expand_path(File.join('css','github2.css')))}\n\n html, .markdown-body {\n overflow: inherit;\n }\n .markdown-body h1 {\n margin-top: 0;\n }\n .readme-content {\n width: #{@preview_width}px;\n }\n\n /* hack in an anchor icon */\n .markdown-body h1:hover a.anchor, .markdown-body h2:hover a.anchor, .markdown-body h3:hover a.anchor, .markdown-body h4:hover a.anchor, .markdown-body h5:hover a.anchor, .markdown-body h6:hover a.anchor {\n padding: 8px 13px;\n margin: 0px 0px 12px -27px;\n background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAdCAIAAADU74AfAAAYHWlDQ1BJQ0MgUHJvZmlsZQAAWAmtWWdYFEuz7pmNwC45ZyTnnCXnnKOoLDmDS0YJIiJJAQmigCgggigYSSIgiCgiSYKiIAoKKCoGQJLcgaPnnO/57v1353lm5t3qt6urq3p6pmoBYL9NCgsLgmkBCA6JINsa6fI6u7jy4qYABDCAgJw8JM/wMB1ra3Pwfx4rYwgbOZ5J7uj6P2n/ewOdl3e4JwCQNdLs4RXuGYzg2wCgmjzDyBEAYHb0CURHhO3gHAQzkhEDEVy5g33/wk072OMv3LfLsbfVQzjTAOAJJBLZFwDiIiLnjfL0RfRQEwDA0od4+Ycg3XgRrOnpR/ICgN0d4UgEB4fu4CwEi3j8S4/vvzCJ5PG3ThLJ92/811yQnsjA+v7hYUGk2N0f/5+X4KBIxF+7BzdyJYQH2pkhd2bEbzGeJAM7BLMi+JSft4n5b3lVWISu7W95q3+EiT2CGRHOiF+kscNvPB8Z6KCDYE5EvhkYarbDR/wEs4Z4WFohmB7BAp7heojvd8aCleL87J1+c8y9vPUNEIysItiZHGr7h+8XHmX3Rx4X56dn+YcfQDLdiTc1ws8gkRG0aw9c5B1ktDPuHkR+NSzCesfOnbH6Q4Isf88FnvUhG+5wduTr3uG7892xzS/Cz94YkSM2o2gjyPY7HGSOKE4ff0MTBCO2oWT8yMZ/5NphQbtrGumLsidH2u74QQDBPt4hDjs+3JFneJH0d3yL+ARVAgwBCZCBN/AAIWAB8AJzoAf0f195EXkIIvMEoSAIOcm8NH9aMO8xQ5i3mFHMNObFHxnS8zcP+AMvBP+l61/9EbkdiAOfEK3eIPzPaGh2tCZaHW2OXLWRUw6tglb909a/2Lj4B/+21RfpK/lbt+5v66MQjVt/eAf9k8l/8O8+Hn/3+G+bDMEs4gHfPwyZWpkFmc0//f+ZMdYAq481xhpiRVFpqFuoHtR91GNUK6oR8KLaUU2oPtS9Hfzbrj+jkBDJjld2PBwOzBAveoPI3V8hf8b7Dy9F/s34rYFajFoR2CK9QkAg0ub/9wiOu1b7/5eWSIThgYwYgHDN/o7Hb7vQQoh3FdG6aA3Ez4iP0cxodiCJVkA8roPWQmKgiEj/ieJ/zkYS+Ox6O2p3LoHgPTKP4AjvmAhkLQG90LBYsr+vXwSvDrJbekvwmoR4SknwysnIKoCdvXeHA8B32909FWIe+EdGCgJARQ4ASt1/ZKHI2qwrQB6Hs//IhJDnjE0VgJu2npHkqL/0oXduGEAJaJCngg1wA34ggnhEDigBdaANDIApsAL2wAUcQNawHwhGLI4GR8BRkAoyQQ4oAOdAGagA1eAauAkaQSu4Dx6CJ2AQjIKXYBq8Ax/BElgBGxAE4SAixACxQTyQICQOyUEqkCZkAJlDtpAL5A75QiFQJHQEOgZlQqehc9BFqAa6ATVD96HH0BD0AnoDLUDfoHUYBRNgRpgLFoKlYRVYBzaD7eH9sC98CI6DU+BTcBFcDl+FG+D78BN4FJ6GP8LLKICiQjGj+FCSKBWUHsoK5YryQZFRCagMVCGqHFWHakHW4jPUNGoRtYbGohnQvGhJJJLGaAe0J/oQOgGdhT6HrkY3oB+gn6HfoJfQvzBEDCdGHKOGMcE4Y3wx0ZhUTCGmCnMH0408z+8wK1gslhkrjFVGVrsLNgB7GJuFLcXWYzuwQ9gZ7DIOh2PDieM0cFY4Ei4Cl4o7i7uKa8cN497hfuKp8Dx4Obwh3hUfgk/GF+Kv4Nvww/g5/AYFLYUghRqFFYUXRSxFNkUlRQvFAMU7ig1KOkphSg1Ke8oAyqOURZR1lN2Uryi/U1FR7aFSpbKh8qdKoiqiuk71iOoN1RqBniBG0CO4ESIJpwiXCR2EF4TvRCJRiKhNdCVGEE8Ra4hdxCniT2oGailqE2ov6kTqYuoG6mHqzzQUNII0OjQHaOJoCmlu0QzQLNJS0ArR6tGSaBNoi2mbacdpl+kY6GTprOiC6bLortA9ppunx9EL0RvQe9Gn0FfQd9HPMKAY+Bn0GDwZjjFUMnQzvGPEMgozmjAGMGYyXmPsZ1xiomdSYHJkimEqZrrHNM2MYhZiNmEOYs5mvsk8xrzOwsWiw+LNks5SxzLMssrKwarN6s2awVrPOsq6zsbLZsAWyJbL1sg2yY5mF2O3YY9mP8/ezb7IwcihzuHJkcFxk2OCE+YU47TlPMxZwdnHuczFzWXEFcZ1lquLa5GbmVubO4A7n7uNe4GHgUeTx58nn6ed5wMvE68ObxBvEe8D3iU+Tj5jvki+i3z9fBt7hPc47EneU79nkp+SX4Xfhz+fv5N/SYBHwELgiECtwIQghaCKoJ/gGcEewVUhYSEnoRNCjULzwqzCJsJxwrXCr0SIIloih0TKRUZEsaIqooGipaKDYrCYopifWLHYgDgsriTuL14qPiSBkVCVCJEolxiXJEjqSEZJ1kq+kWKWMpdKlmqU+iwtIO0qnSvdI/1LRlEmSKZS5qUsvaypbLJsi+w3OTE5T7liuRF5oryhfKJ8k/xXBXEFb4XzCs8VGRQtFE8odipuKSkrkZXqlBaUBZTdlUuUx1UYVaxVslQeqWJUdVUTVVtV19SU1CLUbqp9UZdUD1S/oj6/V3iv997KvTMaezRIGhc1pjV5Nd01L2hOa/FpkbTKtd5q82t7aVdpz+mI6gToXNX5rCujS9a9o7uqp6YXr9ehj9I30s/Q7zegN3AwOGcwZbjH0New1nDJSNHosFGHMcbYzDjXeNyEy8TTpMZkyVTZNN70gRnBzM7snNlbczFzsnmLBWxhapFn8cpS0DLEstEKWJlY5VlNWgtbH7K+a4O1sbYptnlvK2t7xLbHjsHuoN0VuxV7Xfts+5cOIg6RDp2ONI5ujjWOq076Tqedpp2lneOdn7iwu/i7NLniXB1dq1yX9xnsK9j3zk3RLdVtbL/w/pj9jw+wHwg6cO8gzUHSwVvuGHcn9yvumyQrUjlp2cPEo8RjyVPP84znRy9tr3yvBW8N79Pecz4aPqd95n01fPN8F/y0/Ar9Fv31/M/5fw0wDigLWA20CrwcuB3kFFQfjA92D24OoQ8JDHkQyh0aEzoUJh6WGjZ9SO1QwaElshm5KhwK3x/eFMGIfOT2RYpEHo98E6UZVRz1M9ox+lYMXUxITF+sWGx67FycYdylw+jDnoc7j/AdOXrkTbxO/MUEKMEjoTORPzEl8V2SUVL1UcqjgUefJsskn07+cczpWEsKV0pSysxxo+O1qdSp5NTxE+onytLQaf5p/eny6WfTf2V4ZfRmymQWZm5meWb1npQ9WXRy+5TPqf5spezzOdickJyxXK3c6tN0p+NOz+RZ5DXk8+Zn5P8oOFjwuFChsOwM5ZnIM9NF5kVNZwXO5pzdPOd3brRYt7i+hLMkvWS11Kt0+Lz2+boyrrLMsvUL/heeXzS62FAuVF5Yga2Iqnhf6VjZc0nlUk0Ve1Vm1dblkMvT1bbVD2qUa2qucF7JroVrI2sXrrpdHbymf62pTrLuYj1zfeZ1cD3y+ocb7jfGbprd7LylcqvutuDtkjsMdzIaoIbYhqVGv8bpJpemoWbT5s4W9ZY7d6XuXm7lay2+x3Qvu42yLaVtuz2ufbkjrGPxvu/9mc6DnS+7nLtGHtg86O8263700PBhV49OT/sjjUetj9UeN/eq9DY+UXrS0KfYd+ep4tM7/Ur9DQPKA02DqoMtQ3uH2oa1hu8/03/2cMRk5Mmo5ejQmMPY83G38ennXs/nXwS9+DoRNbHxMukV5lXGJO1k4RTnVPlr0df100rT997ov+l7a/f25YznzMfZ8NnNdynvie8L53jmaubl5lsXDBcGP+z78O5j2MeNxdRPdJ9KPot8vv1F+0vfkvPSu6/kr9vfsr6zfb/8Q+FH57L18tRK8MrGasZPtp/VayprPetO63Mb0Zu4zaIt0a2WX2a/Xm0Hb2+Hkcik3W8BFHKFfXwA+HYZyYtcAGAYRL4pqP/KjXYZyOcuhHAQ7AhJQR/hB6hjaDuMNlYYx45npeCh1KCyJAQSc6ibaRbpJOm9GSoYZ5jFWGJZ29lpOJw4K7m+8+zlTeF7yk8nYCt4UuiJCBCVF/MRPyPRK7kqLSJjI5skVys/qggrySrvV8lQbVB7s5eooaLprpWufUPnlR5eX8nA0zDHqMl4yhQyEzA3sgiwzLa6bf3c5qcds728g5VjsNNJ5zqXJ65v9i25re7fOAjcKUlsHpKeOl623gd9vH1Jfnb+ewN4A6HA6aD24Ashx0L9wqwPqZB5w/HhXyLGItuiqqPzYhJig+JcDpsc0YhXTlBKVE3SOWqW7HTMOyXi+PHU/BOVabfSOzL6MseyXp+cO/Up+1vOcu7K6eW85fz1QvQZpiKJs0bnPIsTS4pK6863lz25MHJxony6YqHyRxXqMlO1WI3uFbfa6Kv5127WDdV/vUF3U/6W3e3wOzkNNY0tTfebu1o67t5tvXOvvq2mvaKj9H5BZ0bXkQcB3XYPlXpYe9YeTT8e6H34pKvv/tPW/vqBosHwIb1h4vCzZ8UjPqOKY5ix8fHq51EvtCewEz3I+lJ8NTeZO6U+NfP65LT69Mc3ZW9tZ1Az9bMOs2vv8t9LvG+fs52bnT++IL0w+6H6Y8ii/OLyp/rPnl/ovtxZsl56//XIN5ZvD79n/whZJq34IOtodr17S2p7ezf+/NB1OAAlh5pH38AkYZ1xGnhJCmFKYao9BBmiGrUNjSdtAl0ZfRvDAhMtswoLiTWN7Tb7FCcVlzz3Pp4k3ot87Xte8i8LUgnxCCuKmIi6i8WK50nckOyTmpdBy/LJ7ZV3VYhQzFSqVG5Wear6Vu3HXqwGh6asloV2kE627nW9Qf1PhngjLmM5EwNTBzNP8xCLGMsEq2PWx21SbdPsMuyzHDIcU5xinf1c7F3192m5Ge53PRB9sMD9OqnTo9ez2+uOd4nPYV8nPxl/gv9iwGBgS1BNcHFIdmhyGPmQG1k7nCd8I2I08lpUarRHjEGsTJzAYa4jbPFMCbSJ2MSVpLdHe5NvHCtIiT6+P9X0hH6aeTop42jmpayHJ6dOfc5ezlnNXT79PW8p/1PBYuHnMz/P0p5TLQ4pqSrtPz9TtnDh3cXX5S8qhiofXWqrar3cW/3pCl/t/qsl117UM163vJGG7F5rd6QavBqLm4ZbMHcVWg/eO95W1d7a0Xb/SmdOV/yD6O6kh9k9pY8qHp/vPfUkss/uqWQ/un9i4OZg5lDAsM0zgxGDUZsxj/HI5ykvTkzEv/R5pTfJPrk41fz6xLTzG8m3+LfvZ7pmS98deq89R5gbma9YSPzg/9Fr0e9T8OewL2FLYV/J36K+x/6IXvZfMVqlWb310+DnkzXXtU/rg5uErYnd+IuDB5AZ9Bz2RmFR2Whx9AAmDiuNXcBdwvtRSFOsUfZSlRGiibbUcjTUNCu0L+g66GsY8hjjmXyZbVk0WEXZmNg22ec5hjnbuOq4K3iKeQv58vdk86cKRAmShAyEeYV/ivSJlomFixtL8EnCkgtS49KPZFpkr8gVyScpuCuqKmGVBpQLVJxV2VRfqJWqe+2V08BqTGk2aGVr++no6wrp0eoD/e8Gc4ZjRneNC028TQVNp82KzK0scBZdlsesTKxZrT/YtNnm2fnZqzsQHaYcrzkdcTZ1YXJ57Vq9LxR5/6/tv3cg6aCeO959iFTiEei514vgNeF92eeQr4rvpl+7f1KAdiAI7Ag6GqwXgg7pDj0ephP281At2QV5Z9dEWEX8iCyK2hs1FZ0UwxVzL9Y9jjlu4nDtkWPxzgkiCSuJXUl5R32T9Y+JpbAep0oFqT9OzKQ9Ta/PyMokZSmcxJ2cOHU9OyMnMNfoNP3ph3n78hbz4wp0CnXPpJ3Fn8soni1lOy9XpnpB9aJiuXSFSCXfJbYqusuU1RQ1NMhK0rjqfu1E3bX6Z9c3b4rccr19+s5QI2OTS3NJy3gr5p5om1G7R0fi/fOdbV2vH2w/5OvRe+T7OKv3xpOxvq1+0YF9g2eGpp7JjZwc/Txu97x5gu9lwaT0a+o30bOZ87GfLL+trNnsxP+vGtnOOwGrBEAekmc6nkTOBQByGwEQugsACyUA1kQA7FUBfKIOwEZ1AAo8/vf7AwJogEdyTmbAA0SBApJpmgNXJN+OAelIRnkVtIFhJDvehOghUUgbyQ/DoZNIPtgNzcAQzAfrwl7wCSTLG4bXUfwoC1Qcqho1jsaj1dDB6Ar0Cww9xgzJyLqwEFYbm4TtxGFwprgc3HM8Hz4I30yBo3CiqKZYp7SgvEi5SmVJVU1AEzwIXURBYjrxM7U9dSuS6eTSAtpDtLN0LnQD9Ib09xhUGBoY1Ri7mGyZZpgjWbAshaxCrE1slmzz7GkcshwznGVcHtzi3D95HvIW8HntUeDH8r8UuCWYLRQkbCYiLkoUXRIbFb8rcV4yQcpNWlWGUWZJ9qncFfl0BT9FUyUpZSblbZVPqlNqw+q9e7s1Hmj2aPVrT+jM667oAwMsss/hjfEmFKYEM0ZzPgsFS0urEOt8m1bbd/ZEBwVHF6d45wsuD1zn3Kj2yxxwPHjEvZLU7/HTS8Dbzue4b6vfeoBe4NmgtRDP0OFDhuTWCIXI+mjJmBtxew8PxocmciaNJeenmB9fOZGfLpHRneV9iin7de7TvMmC7SLec6ol5ucPXogtv1A5cVmy5sJVmbrpGxdvH2ikaq5r3d8u3snTbfiovI8wIDK0MpI7LvJi6NX512feDr93X1j7RP/l6jfwQ2ZFdXV7LWO9aWNk8+5Wxa+wbeXd/WOnikyJ1NI4gBBSa9ACFsANqS0kgFxQCZrBAFI32IKYIWnIFPJBKgLlSBXgLYyGhWFzmAyfg7vgLyhOlBnqCKoeNYvUvmzRmehuDITRwBzG3MVsYrWwx7CPcbQ4F9wl3De8Dj4P/55CnSKPYpHSEIn5JpUz1W0kEyYTRoiqxAvUVNQx1HM0LjT9tIa0HXSadO30evS9DHYMk0hmus6UzSzG/ITlECszawObDdt79lgOIkclpzbnLFcutykPNc8k7y2+U3v8+XUFWAU+Ct4TyhH2EdEVFRSjF8dLYCTxUtTS9DJ0snjZNbl5+XGFXsX7SveVe1Veqn5Tp94ro2Gj6a8VoU3W8dN11jPSVzVQMFQxMjI+aJJgetGsx3zJksPKwDoQeafl252xL3DId7zg1O781VVxX5Lb0wPcByPcBzz4PX28Crzv+PT7zvptBDAHygfZB0eFnAvtCPtAZgk3jIiKvBw1EUMbaxGXffh5vFBCfOLMUd9jtCm9qRFp2PQTmeistFMc2V25yXnOBXpn1M+qF6uXqpaJXkSXP6yMquK4fK/Go5bp6mRd9/WBm8t3ZBuPND9ppWnT7yB3Vj1Y6NF9fLNPtr9kcHL4x8jXsbnnMxPzr368ht5QzjC+E5gzXihcVP6S8b1qNWitfyNls2vrx6+13fjDyNNPh1SbJIEmsEGqYvGgEFwHfeADRIHUhiwgMlQEdUAfYGZYH46Aq+AJFB3KBJWC6kBtIZWZOHQLehOjg8nAjGNFsUexkzhNXDkejw/Fj1CoUpRSwkgtZJRKn+ouQZVwn2hNfE+dTMNH00HrRrtCl0MvSf+UIYSRyFjNpMv0ijmWhZuln/UUmwe7LocYJyPnBtckdxPPad5gPvM9MvysAliBNcGvQl+Ev4tsiVGLC0hoS7pLJUmXyjTJPpP7rsCuaKKUrNylSlBzU7+ugUO+Vdt09ujm6TMb1Bm5mtCZDpmfswy1drCVs5twcHXsczZ2ebbPx+3ngWPuECnMY9RL2bvEl8LvaABlYEWwRSgIaySHRnBHdkVHxnod/pxQmRR7dCx5MwU+jk+lPSGfFp4+kumQtXAqLUcq90VeWoF64deimnMHSihLL5cpX7hXrlXRcUm/qrfaumak1v7qYJ1hffMNkZtnbuPvxDdsNqW3CN0dvJfcrtSx0FnywOohuufu4/An4n2z/ecHnYcZnw2PZo+bPt+euPrKanL+deT01tvkWdS75Dl4/tgH9MfExc+fDb/ELpV+Pfkt8rv+99UfV5Ytl1+u+K2srEatLvx0+zmwprdWu05cD1sf3lDcKNr4ummyWb65sWW/de0X6pfzr6vb0LbD9pWd+If7yCP1SuSACLpI+XFqe/u7EAC40wBs5W5vb5Rvb29VIMnGKwA6gv7632WHjEVq9SWvd1Cv2GjSzv3fx/8ACJO/f7b+X80AAAGbaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA1LjEuMiI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjI3PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjI5PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Ck5zsgcAAAEqSURBVEgN7VS7joNADEz4AR6ClpI/gQIJGgqgpqRDfCYFlLzhB2jo4YazsiKrKHe6rK7CBRqvxyPveMV93/eb0JCEqh1il6IYSy8fLx//7sC/vJ6+7+M41jTt/ghVVcMwrOsak/u+jxIIoL2+CP5m56iqyjCMl1QIFUXRNA1VQQP53Ev4xh2laYoGz/OGYWClaZqCIMB5kiQ4RAkEpCAzDgO8omVZoOKCxJBlGek4jvM8A5imSefkAMhMiIEfNqPrOoQkSdq2DWBZFnzfB69o2zYa8jzHXACO4+CbZRmWhCnWdUWKEggARAZ4CjYtgfNmsM2yLGnMp57v5LebgW7XdVEU4cW4rou0bVs8HUVRmChKIIDGTUPpcRdGFQJ4Hz8XvRQ/9/BQEO/jF3oLKusHZ04pAAAAAElFTkSuQmCC')\n no-repeat\n left center;\n }\n .markdown-body h1:hover a.anchor .octicon-link, .markdown-body h2:hover a.anchor .octicon-link, .markdown-body h3:hover a.anchor .octicon-link, .markdown-body h4:hover a.anchor .octicon-link, .markdown-body h5:hover a.anchor .octicon-link, .markdown-body h6:hover a.anchor .octicon-link {\n display: none;\n }\n </style>\n </head>\n <body class=\"markdown-body\" style=\"padding:10px 40px;\">\n <div class=\"readme-content\">\n #{preview_html}\n </div>\n </body>\nCONTENT\n output_file_content\n end", "def transform_images( str, rs )\n\t\t\t@log.debug \" Transforming images %p\" % str\n\n\t\t\t# Handle reference-style labeled images: ![alt text][id]\n\t\t\tstr.\n\t\t\t\tgsub( ReferenceImageRegexp ) {|match|\n\t\t\t\t\twhole, alt, linkid = $1, $2, $3.downcase\n\t\t\t\t\t@log.debug \"Matched %p\" % match\n\t\t\t\t\tres = nil\n\t\t\t\t\talt.gsub!( /\"/, '&quot;' )\n\n\t\t\t\t\t# for shortcut links like ![this][].\n\t\t\t\t\tlinkid = alt.downcase if linkid.empty?\n\n\t\t\t\t\tif rs.urls.key?( linkid )\n\t\t\t\t\t\turl = escape_md( rs.urls[linkid] )\n\t\t\t\t\t\t@log.debug \"Found url '%s' for linkid '%s' \" % [ url, linkid ]\n\n\t\t\t\t\t\t# Build the tag\n\t\t\t\t\t\tresult = %{<img src=\"%s\" alt=\"%s\"} % [ url, alt ]\n\t\t\t\t\t\tif rs.titles.key?( linkid )\n\t\t\t\t\t\t\tresult += %{ title=\"%s\"} % escape_md( rs.titles[linkid] )\n\t\t\t\t\t\tend\n\t\t\t\t\t\tresult += EmptyElementSuffix\n\n\t\t\t\t\telse\n\t\t\t\t\t\tresult = whole\n\t\t\t\t\tend\n\n\t\t\t\t\t@log.debug \"Replacing %p with %p\" % [ match, result ]\n\t\t\t\t\tresult\n\t\t\t\t}.\n\n\t\t\t\t# Inline image style\n\t\t\t\tgsub( InlineImageRegexp ) {|match|\n\t\t\t\t\t@log.debug \"Found inline image %p\" % match\n\t\t\t\t\twhole, alt, title = $1, $2, $5\n\t\t\t\t\turl = escape_md( $3 )\n\t\t\t\t\talt.gsub!( /\"/, '&quot;' )\n\n\t\t\t\t\t# Build the tag\n\t\t\t\t\tresult = %{<img src=\"%s\" alt=\"%s\"} % [ url, alt ]\n\t\t\t\t\tunless title.nil?\n\t\t\t\t\t\ttitle.gsub!( /\"/, '&quot;' )\n\t\t\t\t\t\tresult += %{ title=\"%s\"} % escape_md( title )\n\t\t\t\t\tend\n\t\t\t\t\tresult += EmptyElementSuffix\n\n\t\t\t\t\t@log.debug \"Replacing %p with %p\" % [ match, result ]\n\t\t\t\t\tresult\n\t\t\t\t}\n\t\tend", "def to_iruby\n gif_base64 = Base64.encode64(plot)\n ['text/html', \"<img src=\\\"data:image/gif;base64, #{gif_base64}\\\">\"]\n end", "def c_raw src, options = {}\n self.generate src, options\n end", "def image_tag(src, html_options = {})\n src = \"#{Compass.configuration.images_dir}/#{src}\" unless src =~ /^(https?:|\\/)/\n tag(:img, html_options.merge(:src=>src))\n end", "def convert_img_tags!(log)\n log[:files_open] += 1\n file_marked = false\n @doc.xpath(\"//img\").each do |img|\n file_marked = true\n log[:tags] += 1\n\n original = img.to_html.gsub(\"\\\">\", \"\\\" />\").gsub(\"\\\" >\", \"\\\" />\").delete(\"\\\\\")\n original2 = img.to_html.gsub(\"\\\">\", \"\\\"/>\").gsub(\"\\\" >\", \"\\\" />\").delete(\"\\\\\")\n original3 = img.to_html.gsub(\"\\\">\", \"\\\">\").gsub(\"\\\" >\", \"\\\" />\").delete(\"\\\\\")\n image_tag = RailsImageTag.new(img).to_erb\n\n @content.gsub!(original, image_tag)\n @content.gsub!(original2, image_tag)\n @content.gsub!(original3, image_tag)\n puts image_tag\n end\n\n write_file(log) if file_marked\n end", "def build_web_page(info_hash, id_hash, id_date, id_status)\n image_counter = info_hash.length\n \n File.open('rovers_index.html', 'w') do |file|\n file.puts \"<html>\\n<head>\\n<title>Rovers Nasa!</title>\\n</head>\"\n file.puts \"<body>\\n<section class='container'>\"\n file.puts \"<h1> FOTOGRAFIAS DE LOS ROVERS DE LA NASA CON SUS CARACTERISTICAS</h1>\"\n file.puts\"<ul>\"\n image_counter.times do |i| \n file.puts \"\\t<img src='#{info_hash[i]}'width='250'>\"\n file.puts \"\\n<li><p> ID is: #{id_hash[i]}</p></li>\"\n file.puts \"<li><p>Date in Earth: #{id_date[i]}</p></li>\"\n file.puts \"<li><p> Satelite Status: #{id_status[i]}</p></li>\"\n\n end\n file.puts \"</ul>\\n</section>\\n</body>\\n<html>\"\n end\n end", "def generate_html\n \"<a href='../#{@parent.reference_location}'><img src='../#{@reference_location}' /></a>\"\n end", "def html(include_ocr: false)\n return @html if defined? @html\n\n @html = Henkei.read :html, data, include_ocr: include_ocr\n end", "def output_image\r\n # loop continues through each Row and outputs content\r\n @array.each do |row|\r\n puts row.join\r\n end\r\n end", "def render_gist(gist, file, data)\n script_url = script_url_for gist, file\n html_output_for script_url, data\n end", "def preview\n # generate html according to wiki notation type\n result = ContentFormatter.to_html(params[:content], params[:notation_type])\n respond_to do |format|\n format.html {\n # return html text\n render text: result\n }\n end\n end", "def render_document; end", "def render(path)\n\t\t\tredcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true)\n\t\t\tredcarpet.render(File.read(path))\n\t\tend", "def image(path, options = {})\n o = Hash(options).map { |k, v| \"#{k}='#{v}'\" }.join(' ')\n\n asset_html(path, [IMAGE_CDN.chomp, o].join(' '),\n [IMAGE_LOCAL.chomp, o].join(' '), options)\n end", "def to_html\n w = 400\n h = 300\n id = @url.match(REGEX)[1]\n embed_image = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}&etp=im\"\n embed_3d = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}\"\n <<HTML\n<div class=\"onebox-3dwh\" id=\"#{id}\">\n <iframe src=\"#{embed_image}\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" width=\"#{w}\" height=\"#{h}\" allowfullscreen></iframe>\n <div class=\"onebox-3dwh-circle\" onclick=\"$('##{id} iframe').attr('src', '#{embed_3d}'); $(this).remove()\" />\n</div>\nHTML\n end", "def render r\n end", "def image\n end", "def image\n end", "def render_gist(gist, file, data)\n json = JSON.parse(data)\n\n # get the list of gist files\n files = json[\"files\"]\n\n # our output buffer\n output = \"\"\n\n files.each do |name,info|\n\n # if a file name was provided, only display that file\n if !file.empty? && file != name\n next\n end\n\n # raw gist content\n data = info[\"content\"]\n\n # render markdown ourselves\n if info[\"language\"] == \"Markdown\"\n output << data\n output << \"\\n\\n\"\n else\n script_url = script_url_for(gist, name)\n code = CGI.escapeHTML data\n output << \"<div><script src='#{script_url}'></script>\"\n output << \"<noscript><pre><code>#{code}</code></pre></noscript></div>\"\n end\n end\n CGI.unescapeHTML(output)\n end", "def text_to_html (text, args = {})\n args = { emotes: false, map_headings: 1 }.merge args\n \n html = Moredown.text_to_html(text, args)\n html.gsub!('src=\"media/', 'src=\"/media/')\n html.gsub!(/<pre><code>#! (.*?)\\n([^<]*?)<\\/code><\\/pre>/) { |match| \"<pre><code class=\\\"#{$1.downcase.strip}\\\">#{$2.strip}</code></pre>\" }\n \n html\n end", "def image path, attrs = {}\n Tagz.tag :img, { :src => path }.merge(attrs)\n end", "def to_html; end", "def render\n @result_html = ''\n @result_html += \"<div class=\\\"rs-container #{self.class.name}\\\" id=\\\"#{@id}\\\">\"\n @result_html += render_controls.gsub(\"<option value=\\\"rs-#{@effect}\\\">\",\n \"<option value=\\\"rs-#{@effect}\\\" selected=\\\"selected\\\">\")\n @result_html += \"<div class=\\\"rs-wrapper\\\">\"\n @result_html += \"<div class=\\\"rs-shadow\\\"></div>\"\n @result_html += '<div class=\"rs-images\">'\n @images_urls.each do |url|\n @result_html += \"<img src=\\\"#{url}\\\"/>\"\n end\n @result_html += '</div>'\n @result_html += '<div class=\"rs-cover\">'\n @result_html += '<a class=\"rs-animation-command rs-pause\" href=\"javascript:void(0)\">Play/Pause</a>'\n @result_html += \"<img src=\\\"#{@images_urls.first}\\\"/>\"\n @result_html += '</div>'\n @result_html += '<div class=\"rs-transition\">'\n @result_html += render_flips\n @result_html += render_multi_flips\n @result_html += render_cubes\n @result_html += render_unfolds\n @result_html += '</div>'\n @result_html += '</div>'\n @result_html += render_bullets\n @result_html += '</div>'\n\n @result_html.html_safe\n end" ]
[ "0.66957337", "0.6651247", "0.657971", "0.65756196", "0.65285087", "0.64639246", "0.6457889", "0.6348121", "0.63435423", "0.62210304", "0.62159544", "0.61641395", "0.61073923", "0.6093117", "0.60884786", "0.6087466", "0.60777676", "0.6064418", "0.6046976", "0.6038442", "0.6032726", "0.60305357", "0.6024693", "0.6021601", "0.60178727", "0.6015054", "0.6012956", "0.6009575", "0.60073525", "0.6000963", "0.5994557", "0.5993859", "0.59877104", "0.5972474", "0.5957248", "0.59529555", "0.5952468", "0.59417766", "0.5923836", "0.5912618", "0.5912475", "0.59027827", "0.58926475", "0.5889531", "0.5864303", "0.58568996", "0.5849556", "0.58383924", "0.58353317", "0.58075404", "0.5799659", "0.57947147", "0.5787352", "0.5773211", "0.5751281", "0.57457227", "0.5742634", "0.57413524", "0.5728779", "0.57265645", "0.5721683", "0.5715619", "0.5708057", "0.56944835", "0.5685569", "0.56807256", "0.56805396", "0.567975", "0.5675166", "0.5671254", "0.5666923", "0.56554693", "0.56387895", "0.56320065", "0.5628293", "0.5624992", "0.5621684", "0.5616588", "0.5611823", "0.5609124", "0.5601475", "0.5581436", "0.55775094", "0.5575558", "0.5571284", "0.5569845", "0.55649996", "0.5561368", "0.55598766", "0.5557374", "0.5547241", "0.55406785", "0.55315566", "0.5523698", "0.5523698", "0.5520575", "0.55195737", "0.5516737", "0.55131656", "0.55129254" ]
0.68433565
0
Use callbacks to share common setup or constraints between actions.
def set_country_shop @country_shop = CountryShop.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def country_shop_params params.require(:country_shop).permit(:shop_id, :country_id, :mode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
=> 18 m (5,3) = 5 + m (5,2) ... m (5, 3) = m ( 3, 5) m (5, 3) = m (5,3)
def lucas_sequence(num) return [] if num==0 return [2] if num==1 return [2,1] if num == 2 lucas_sequence(num-1)+ [lucas_sequence(num-1)[-1]+lucas_sequence(num-1)[-2]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end", "def m3; 3 end", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\nend", "def e2w(n, m)\n# n = (n+0.938272)*(n+0.938272) - n*n\n n+m\nend", "def matrix_addition(matrix1, matrix2)\nadded = []\ni = 0\n matrix1.length.times do\n k = 0\n pair = []\n while k < matrix1[0].length\n pair << matrix1[i][k] + matrix2[i][k]\n k += 1\n end\n added << pair\n i += 1\n end\n added\nend", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\n x1, y1 = top_left_coords\n x2, y2 = bottom_right_coords\n sum = 0\n (x1..x2).each do |x|\n (y1..y2).each do |y|\n puts matrix[x][y]\n sum += matrix[x][y]\n end\n end\n sum\n\nend", "def cantor_pairing(n, m)\n (n + m) * (n + m + 1) / 2 + m\nend", "def find_m_and_n sum\n m = 1\n while m < sum do\n n = 1\n while n < m do\n return [m, n] if (2*(m**2) + 2*m*n) == sum\n n += 1\n end\n m += 1\n end\nend", "def matrix_addition(m1, m2)\n rows = m1.length\n cols = m1[0].length\n result = Array.new(rows) { Array.new(cols, 0)}\n (0...rows).each do |row|\n (0...cols).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n \n result\nend", "def cube(num)\n return num * num * num, 70\n #todo this returns 27 70\n 5\nend", "def matrix_addition_reloaded(*matrixes)\n return nil if !(matrixes.all? {|pair| matrixes[0].length == pair.length})\n # return matrixes if matrixes.length < 2\n \n matrixes.inject do |acc, el|\n matrix_addition(acc, el)\n end\n\nend", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n sum = 0\n (top_left_coords[0]..bottom_right_coords[0]).each do |row|\n (top_left_coords[1]..bottom_right_coords[1]).each do |col|\n sum += matrix[row][col]\n end\n end\n\n sum\nend", "def sum(n, m)\n if n > m\n return 0\n else\n return sum(n+1, m) + n\n end\nend", "def problem_nine(sum)\n (1..sum).each do |m|\n (1..sum).each do |n|\n # Thank you, Wikipedia:\n # http://en.wikipedia.org/wiki/Formulas_for_generating_Pythagorean_triples\n a = n ** 2 - m ** 2\n b = 2 * m * n\n c = n ** 2 + m ** 2\n return a, b, c if a + b + c == sum\n end\n end\n end", "def matrix_addition(m1, m2)\n height = m1.length\n width = m1[0].length\n result = Array.new(height) { [0] * width }\n\n (0...height).each do |row|\n (0...width).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n\n result\nend", "def sum\n [@r,@g,@b].inject(:+)\n end", "def matrix_addition_reloaded(*matrices)\n\n length = matrices.first.length\n if (matrices.all? { |ele| ele.length == length})\n else\n return nil\n end\n\n matrices.inject do |acc, ele|\n # p acc\n i = 0\n sum_matrix = []\n while i < acc.length\n row_arr = []\n j = 0\n while j < acc.first.length\n # print acc[i][j]\n sum = acc[i][j]+ele[i][j]\n row_arr << sum\n j+= 1\n end\n sum_matrix << row_arr\n i += 1\n end\n sum_matrix\n end\nend", "def exercise_1113 (matrix)\n end", "def adx(n)\n ; n * MAP_RATIO + M_X;\n end", "def matrix_addition(matrix_1, matrix_2)\n height = matrix_1.length\n width = matrix_1.first.length\n (0...height).map do |col|\n (0...width).map do |row|\n matrix_1[col][row] + matrix_2[col][row]\n end\n end\nend", "def sum_of_cubes(a, b)\n=begin \n sum = 0\n (a..b).each do |n|\n sum += n*n*n\n end\n sum\n=end \n (a..b).reduce(0) { |a, b| a + b ** 3 }\nend", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n ix = top_left_coords[0]\n iy = top_left_coords[1]\n jx = bottom_right_coords[0]\n jy = bottom_right_coords[1]\n result = 0\n i = ix\n while i <= jx\n j = iy\n while j <= jy\n result += matrix[i][j]\n j += 1\n end\n i += 1\n end\n result\nend", "def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n total_sum = 0\n\n (top_left_coords[0]..bottom_right_coords[0]).each do |row_idx|\n (top_left_coords[1]..bottom_right_coords[1]).each do |col_idx|\n total_sum += matrix[row_idx][col_idx]\n end\n end\n\n total_sum\nend", "def sum_of_cubes(a, b)\n (a..b).inject(:*) # {|sum, cube| sum += cube**3}\nend", "def calculate_total_paths(m,n)\n return 1 if m == 1 and n == 1\n paths = []\n for i in (0..m)\n paths << Array.new(0,n)\n end\n\n # initialze borders\n for j in (0...n)\n paths[0][j] = 1\n end\n\n for i in (0...m)\n paths[i][0] = 1\n end\n\n paths[0][0] = 0\n\n for i in (1...m)\n for j in (1...n)\n paths[i][j] = paths[i][j-1] + paths[i-1][j]\n end\n end\n paths[m-1][n-1]\nend", "def new_cube(n)\r\n return n*n*n,70;\r\nend", "def sum_of_cubes\n x = (0..3).map do |n|\n n * n * n\n end.reduce(:+)\n puts x\nend", "def pile_of_cubes(m)\n n = 1\n n^3\n n^3 + (n+1)^3\n n^3 + (n+1)^3 + (n+2)^3\n\n\n # check m against 1^3\n # check m against 1^3 + 2^3\n # check m against 1^3 + 2^3 + 3^3...\n\n\nend", "def ady(n)\n ; n * MAP_RATIO + M_Y;\n end", "def magicalWell(a, b, n)\n (1..n).sum {\n money = a*b \n a += 1\n b += 1\n money\n }\nend", "def matrixElementsSum(matrix)\r\n(0..matrix.length-2).each do |floor_number|\r\n\r\n (0..matrix[floor_number].length-1).each do |column_number|\r\n if matrix[floor_number][column_number] == 0\r\n matrix[floor_number+1].delete_at(column_number)\r\n matrix[floor_number+1].insert(column_number, 0)\r\n end\r\n end\r\n \r\nend\r\n\r\nreturn matrix.flatten.inject(:+)\r\n\r\nend", "def pair_sum(array, k)\nend", "def matrixAddition(a, b)\n n = a.length\n c = Array.new\n 0.upto(n-1) do |x|\n # reinitialize the sum_array otherwise values from previous iteration carry over\n sum_array = Array.new \n 0.upto(n-1) do |y|\n sum_array = sum_array.push(a[x][y] + b[x][y])\n end\n c[x] = sum_array\n end \n return c\nend", "def matrix_addition_reloaded(*matrixs)\n # matrixs.each { |matrix| return nil if matrixs.first.length != matrix.length}\n # first_matrix = matrixs.first\n # matrix_sum = []\n # i = 0\n\n # while matrix_sum.length < first_matrix.length do \n # sum = 0 \n # sum += matrixs[i][i][i]\n # matrix_sum << sum\n\n # end\n # matrix_sum\n\n matrix = matrixs.first\n height = matrix.length\n width = matrix[0].length\n matrix_sum = Array.new(height) { [0] * width}\n\n matrixs.inject(matrix_sum) do |m1, m2|\n return nil if m2.length != height || m2[0].length != width\n matrix_addition(m1, m2)\n\n end\nend", "def unique_paths_iterative(m, n)\n return 0 if m == 0 || n == 0\n\n grid = Array.new(m) { Array.new(n) {0} }\n grid[0][0] = 1\n\n row = 0\n column = 0\n\n while row < m\n while column < n\n # check top\n if row > 0\n grid[row][column] += grid[row - 1][column]\n end\n # check left\n if column > 0\n grid[row][column] += grid[row][column - 1]\n end\n\n column += 1\n end\n column = 0\n row += 1\n end\n\n grid[row - 1][column - 1]\nend", "def sum_of_cubes(a, b)\n total = 0\n (a..b).each{ |x| total += x**3 } \n \n return total \nend", "def sum_of_cubes(a, b)\n numbers = (a..b).to_a\n numbers.map! { |num| num * num * num }\n sum = 0\n numbers.each do |num|\n sum += num\n end\n return sum\nend", "def matrix_addition_reloaded(*arr)\n return nil if !arr.all? { |x| arr[0].length == x.length }\n sum = arr[0]\n 1.upto(arr.length - 1).each do |i|\n sum = matrix_addition(sum, arr[i])\n end\n sum\nend", "def sum_3_5(number) \r\n\tsum3 = 0\r\n\tsum5 = 0\r\n\tsum15 = 0\r\n\t0.step(number-1,3) do |num|\r\n\t\tsum3 += num\r\n\tend\r\n\t0.step(number-1,5) do |num|\r\n\t\tsum5 += num\r\n\tend\r\n\t0.step(number-1,15) do |num|\r\n\t\tsum15 += (num)\r\n\tend\r\n\treturn sum3 + sum5 - sum15\r\nend", "def mine_total(i, j)\n return is_mined(@data[i-1][j-1]) +\n is_mined(@data[i-1][j]) +\n is_mined(@data[i-1][j+1]) +\n is_mined(@data[i][j-1]) +\n is_mined(@data[i][j+1]) +\n is_mined(@data[i+1][j-1]) +\n is_mined(@data[i+1][j]) +\n is_mined(@data[i+1][j+1]);\n end", "def friend_circles(matrix)\nend", "def sim(m, w, h)\n\to = m.map{|x|x.clone}\n\t(1..w-2).each do |x|\n\t\t(1..h-2).each do |y|\n\t\t\tnext if m[y][x] == ?.\n\t\t\toccupied=[-1,0,1].product([-1,0,1]).count{|dx,dy|\n\t\t\t\tif dx != 0 || dy != 0 then\n\t\t\t\t\tpx=x+dx\n\t\t\t\t\tpy=y+dy\n\t\t\t\t\tpx,py=px+dx,py+dy until 'L#'[m[py][px]]\n\t\t\t\t\tm[py][px] == ?#\n\t\t\t\telse\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\t}\n\t\t\to[y][x] = ?# if m[y][x] == ?L && occupied == 0\n\t\t\to[y][x] = ?L if m[y][x] == ?# && occupied >= 5\n\t\tend\n\tend\n\treturn o\nend", "def matrix_addition(matrix1, matrix2)\n new_matrix = Array.new(matrix1.length) { Array.new(matrix1[0].length) }\n\n (0...matrix1.length).each do |i|\n (0...matrix1[i].length).each do |j|\n new_matrix[i][j] = matrix1[i][j] + matrix2[i][j]\n end\n end\n\n new_matrix\nend", "def sum_of_cubes(number)\n\t#Base Case - the simplest form our problem can take.\n\tif number == 1\n\t\treturn 1\n else\n #Reconstruction - here we rebuild!!!\n \tsum = number**3 + sum_of_cubes(number - 1)\n \treturn sum\n\tend\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, x| sum += (x*x*x) }\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, x| sum += (x*x*x) }\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, x| sum += (x*x*x) }\nend", "def sum_region(row1, col1, row2, col2)\n r1,c1 = row1+1, col1+1\n r2,c2 = row2+1, col2+1\n p [\"r1c1\",r1,c1] if @d\n p [\"r2c2\",r2,c2] if @d\n a = @mx[r2][c2]\n l = @mx[r2][c1-1]\n u = @mx[r1-1][c2]\n ul = @mx[r1-1][c1-1]\n a - l - u + ul\n end", "def matrix_addition(matrix_1, matrix_2)\n new_matrix = Array.new(matrix_1.length) {Array.new(matrix_1.first.length)}\n new_matrix.each_with_index do |array, i1|\n array.each_with_index do |el, i2|\n new_matrix[i1][i2] = matrix_1[i1][i2] + matrix_2[i1][i2]\n end\n end\n new_matrix\nend", "def +(mat)\n end", "def cubez(num)\n return num * num * num, 70\n 5\nend", "def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end", "def sum_pair(ints, sum)\nend", "def five(array)\n array.map.inject(:+) *2\nend", "def cube(num)\n return num * num * num, 70\nend", "def matrix_addition_reloaded(*matrices)\n height = matrices[0].size\n width = matrices[0][0].size\n return nil if matrices.select {|m| m.size == height && m[0].size == width}.count != matrices.count\n \n sum = Array.new(height) {|i| Array.new(width, 0)}\n\n (0...height).each do |h|\n (0...width).each do |w|\n matrices.each {|m| sum[h][w] += m[h][w]}\n end\n end\n sum\nend", "def ways(s,m)\n CALLS[0] += 1\n return 1 if s == 0\n return 0 if m == 0\n return 1 if m == 1\n WAYS[[s,m]] ||= ways(s,m-1) + ways(s-m,[s-m,m].min)\nend", "def calculateAdjacent\r\n #Loops through every tile in the grid.\r\n (0..@rows-1).each do |row|\r\n (0..@columns-1).each do |col|\r\n count = getTier(col+1, row+1) + getTier(col+1, row) + getTier(col+1, row-1)\r\n count += getTier(col, row+1) + getTier(col, row-1) + getTier(col-1, row+1)\r\n count += getTier(col-1, row) + getTier(col-1, row-1)\r\n @tile[col][row].adjacent = count #Totals the tier number in the adjacent tiles.\r\n end\r\n end\r\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, element| sum + element**3 }\nend", "def corner_sum(n)\n return 1 if n == 1\n # n*n + n*n - (n-1) + n*n - 2*(n-1) + n*n - 3*(n-1) \n return 4*n*n - 6*(n-1)\nend", "def matrix_addition_reloaded(*matrix) # collapses args into one array - extra outer [] shell \n if matrix_counter(matrix) == false\n return nil\n end\n\n if matrix.length == 1\n return matrix[0]\n end\n\n \n (1...matrix.length).each do |number|\n matrix[0] = matrix_addition(matrix[0], matrix[number])\n end\n\n matrix[0]\nend", "def total\n squares = (1..64).map{|i| square(i)}\n squares.inject(:+)\n end", "def pyramid_sum(base)\n\nend", "def matrix_addition(m1, m2)\n matrix_addition_reloaded(m1, m2)\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) {|sum, x| sum + x*x*x}\nend", "def sum_of_cubes(a, b)\n set = (a..b) {|num| num**3}\n \nend", "def matrixAddition(a, b)\n c = [] << a << b\n c.transpose.map{ |i| i.transpose }.map{ |s|\n s.map{ |p| p.reduce(&:+)}}\nend", "def square_of_sum\n end", "def sum_mults(n, k)\n n = (n - 1) / k\n return k * n * (n + 1) / 2\nend", "def pairs(matrix)\n # calculate concordant #p matrix\n rs=matrix.row_size\n cs=matrix.column_size\n conc=disc=ties_x=ties_y=0\n (0...(rs-1)).each do |x|\n (0...(cs-1)).each do |y|\n ((x+1)...rs).each do |x2|\n ((y+1)...cs).each do |y2|\n # #p sprintf(\"%d:%d,%d:%d\",x,y,x2,y2)\n conc+=matrix[x,y]*matrix[x2,y2]\n end\n end\n end\n end\n (0...(rs-1)).each {|x|\n (1...(cs)).each{|y|\n ((x+1)...rs).each{|x2|\n (0...y).each{|y2|\n # #p sprintf(\"%d:%d,%d:%d\",x,y,x2,y2)\n disc+=matrix[x,y]*matrix[x2,y2]\n }\n }\n }\n }\n (0...(rs-1)).each {|x|\n (0...(cs)).each{|y|\n ((x+1)...(rs)).each{|x2|\n ties_x+=matrix[x,y]*matrix[x2,y]\n }\n }\n }\n (0...rs).each {|x|\n (0...(cs-1)).each{|y|\n ((y+1)...(cs)).each{|y2|\n ties_y+=matrix[x,y]*matrix[x,y2]\n }\n }\n }\n {'P'=>conc,'Q'=>disc,'Y'=>ties_y,'X'=>ties_x}\n end", "def problem_106a\n combin = lambda { |m,h| m.factorial / (h.factorial * (m - h).factorial) }\n max = 20\n\n sum = Array.new(max+1,-1)\n 1.upto(max) do |n|\n 0.upto(n/2) do |k|\n sum[n] += combin.call(n,2*k) * combin.call(2*k - 1, k + 1)\n end\n puts \"#{n} #{sum[n]}\"\n end\n sum[12]\nend", "def mod_puzzle_formula (a, h, w, i)\n return a - (h + (w - (i * 2)))\nend", "def sum_multiples_3_and_5\n return 3 * 333 * 334 / 2 + 5 * 199 * 200 / 2 - 15 * 66 * 67 / 2\nend", "def cmbnation(m)\n factrl(m) / ( factrl(m - 5) * factrl(5) )\nend", "def get_sum_through(target, piece)\n target -= 1\n highest_multiple = target / piece * piece\n sum_chunk = highest_multiple + piece\n quantity = target / piece / 2\n odd = target / piece % 2\n odd_piece = odd * sum_chunk / 2\n\n sum_chunk * quantity + odd_piece\nend", "def matrix_addition(matrix1, matrix2)\n new_matrix = Array.new(matrix1.size) { [] }\n\n matrix1.each_index do |i|\n matrix1[i].each_index do |j|\n new_matrix[i] << matrix1[i][j] + matrix2[i][j]\n end\n end\n new_matrix\nend", "def sim(m, w, h)\n\to = m.map{|x|x.clone}\n\t(1..w-2).each do |x|\n\t\t(1..h-2).each do |y|\n\t\t\tnext if m[y][x] == ?.\n\t\t\toccupied=[-1,0,1].product([-1,0,1]).count{|dx,dy|(dx!=0||dy!=0) && m[y+dy][x+dx]==?#}\n\t\t\to[y][x] = ?# if m[y][x] == ?L && occupied == 0\n\t\t\to[y][x] = ?L if m[y][x] == ?# && occupied >= 4\n\t\tend\n\tend\n\treturn o\nend", "def sum; end", "def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend", "def calc_matrix_q(distance_matrix)\n m = Marshal.load(Marshal.dump(distance_matrix))\n sums = Array.new( distance_matrix.length ) { 0 }\n for i in 1...sums.length\n sums[i] = get_sum(distance_matrix, i)\n end \n const = $r - 2\n for i in 1...distance_matrix.length\n for j in i+1...distance_matrix.length\n m[i][j] = const * distance_matrix[i][j] - sums[i] - sums[j]\n m[j][i] = m[i][j]\n end\n end\n m\nend", "def update_memo(memo, x, y, n, grid)\n add_right = grid[x + n - 1].slice(y, n).reduce(:+)\n add_bottom = (0...n).reduce(0) do |sum, x_offset|\n sum + grid[x + x_offset][y + n - 1]\n end\n memo[x][y] += add_right + add_bottom\nend", "def matrix_addition(matrix_1 , matrix_2)\n i = 0\n sum = []\n\n while sum.length < matrix_1.length\n arr_1 = matrix_1[i]\n arr_2 = matrix_2[i]\n\n sum << matrix_plus(arr_1, arr_2)\n\n i += 1\n\n end\n sum\nend", "def p11\n\tgrid = Matrix[\n\t\t[8,\t2, 22,97,38,15,0, 40,0, 75,4, 5, 7, 78,52,12,50,77,91,8],\n\t\t[49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,4, 56,62,0],\n\t\t[81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,3, 49,13,36,65],\n\t\t[52,70,95,23,4, 60,11,42,69,24,68,56,1, 32,56,71,37,2, 36,91],\n\t\t[22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80],\n\t\t[24,47,32,60,99,3, 45,2, 44,75,33,53,78,36,84,20,35,17,12,50],\n\t\t[32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70],\n\t\t[67,26,20,68,2, 62,12,20,95,63,94,39,63,8, 40,91,66,49,94,21],\n\t\t[24,55,58,5, 66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72],\n\t\t[21,36,23,9, 75,0, 76,44,20,45,35,14,0, 61,33,97,34,31,33,95],\n\t\t[78,17,53,28,22,75,31,67,15,94,3, 80,4, 62,16,14,9, 53,56,92],\n\t\t[16,39,5, 42,96,35,31,47,55,58,88,24,0, 17,54,24,36,29,85,57],\n\t\t[86,56,0, 48,35,71,89,7, 5, 44,44,37,44,60,21,58,51,54,17,58],\n\t\t[19,80,81,68,5, 94,47,69,28,73,92,13,86,52,17,77,4, 89,55,40],\n\t\t[4,\t52,8, 83,97,35,99,16,7, 97,57,32,16,26,26,79,33,27,98,66],\n\t\t[88,36,68,87,57,62,20,72,3, 46,33,67,46,55,12,32,63,93,53,69],\n\t\t[4,\t42,16,73,38,25,39,11,24,94,72,18,8, 46,29,32,40,62,76,36],\n\t\t[20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,4, 36,16],\n\t\t[20,73,35,29,78,31,90,1, 74,31,49,71,48,86,81,16,23,57,5, 54],\n\t\t[1,\t70,54,71,83,51,54,69,16,92,33,48,61,43,52,1, 89,19,67,48]\n\t]\n\tproducts = []\n\t(0...grid.row_count).each do |row|\n\t\t(0...grid.column_count).each do |col|\n\t\t\tright = col + 3 < grid.row_count\n\t\t\tdown = row + 3 < grid.column_count\n\t\t\tleft = col - 3 >= 0\n\t\t\tif right\n\t\t\t\tset = grid.minor(row..row,col..col+3)\n\t\t\t\tproducts << set.reduce(:*)\n\t\t\tend\n\t\t\tif down and right\n\t\t\t\tdiagonal = []\n\t\t\t\t(0..3).each do |x|\n\t\t\t\t\tdiagonal << grid.minor(row+x..row+x,col+x..col+x).component(0,0)\n\t\t\t\tend\n\t\t\t\tproducts << diagonal.reduce(:*)\n\t\t\tend\n\t\t\tif down\n\t\t\t\tset = grid.minor(row..row+3,col..col)\n\t\t\t\tproducts << set.reduce(:*)\n\t\t\tend\n\t\t\tif down and left\n\t\t\t\tdiagonal = []\n\t\t\t\t(0..3).each do |x|\n\t\t\t\t\tdiagonal << grid.minor(row+x..row+x,col-x..col-x).component(0,0)\n\t\t\t\tend\n\t\t\t\tproducts << diagonal.reduce(:*)\n\t\t\tend\n\t\tend\n\tend\n\tproducts.max\nend", "def solution2\n n = 1000\n\n hsh = Hash.new([])\n\n (1..n).each do |x|\n (1..n).each do |y|\n hsh[x**3 + y**3] += [x, y]\n end\n end\n\n hsh.values\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |acc, iter| acc + iter**3 }\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def num_submatrix_sum_target(matrix, target)\n row = matrix.size\n col = matrix[0].size\n (0...row).each do |i|\n (1...col).each do |j|\n matrix[i][j] += matrix[i][j - 1]\n end\n end\n res= 0\n (0...col).each do |i|\n (i...col).each do |j|\n counter = {}\n counter[0] = 1\n curr = 0\n (0...row).each do |k|\n curr += matrix[k][j] - (i > 0 ? matrix[k][i -1] : 0)\n res += counter.fetch(curr - target, 0) #getOrDefault\n counter[curr] = counter.fetch(curr, 0) + 1\n end\n end\n end\n res\nend", "def maxSum(matrix)\n\nend", "def matrix_addition(matrix_a, matrix_b)\n addition = Array.new(matrix_a.length) {Array.new(matrix_a[0].length)}\n\n matrix_a.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n addition[row_i][col_i] = matrix_a[row_i][col_i] + matrix_b[row_i][col_i]\n end\n end\n \n addition\nend", "def mtdarray\n\t10.times do |num|\n\t\tsquare = num + num\n\t\treturn num, square if num > 5\n\tend\nend", "def multisum(number)\n multiply_three = number / 3\n multiply_five = number / 5\n sum = []\n multiply_three.times { |idx| sum << 3 * (idx + 1) }\n multiply_five.times { |idx| sum << 5 * (idx + 1) }\n sum.uniq.inject(:+)\nend", "def cost_of_transformation(magic_square, non_magic_square)\n cost = 0\n (0..2).each do |row|\n (0..2).each do |column|\n magic = magic_square[row][column]\n non_magic = non_magic_square[row][column]\n cost += (non_magic - magic).abs\n end\n end\n return cost\nend", "def solve(n)\n\ttotal = 1\n\t(3...n+1).step(2) do |x|\n\t\t# Upper right corner is x**, the other corners are each x-1 less. Simplify and we've got:\n\t\ttotal += 4*x**2 - 6*x + 6\n\tend\n\treturn total\nend", "def solution(size=5)\n ([1] + (3..size).select(&:odd?).map do |x|\n 4*x**2 - 6*x + 6\n end).reduce(:+)\nend", "def with_matrices\n @m = Matrix.identity 2\n self.math_pow(@n - 1)\n\n #puts \"answer is %d\" % @m.element(0, 0)\n end", "def sum_of_cubes(min, max)\n lower = min - 1\n (((max * (max + 1))/2) ** 2) - (((lower * (lower + 1))/2) ** 2)\nend", "def square_of_sums\n range.reduce(:+)**2\n end", "def totient_phi( m )\n return 1 if m == 1\n ( 1...m ).inject( 0 ) do | sum, item |\n coprime?( m, item ) ? sum + 1 : sum\n end\nend", "def math(b1,b2,goal)\r\n\r\n\t# link to math:\r\n\t# http://www.math.tamu.edu/~dallen/hollywood/diehard/diehard.htm\r\n\t# mp = nq = k\r\n\t# (x)(b1) + (y)(b2) = goal\r\n\r\n\tx = 0\r\n\ty = 0\r\n\tcurrent_total = 0\r\n\r\n\t#determine x and y mathematically\r\n\twhile (current_total != goal) do\r\n\r\n\t\tif current_total < goal\r\n\t\t\tx += 1\r\n\t\telsif current_total > goal\r\n\t\t\ty -= 1\r\n\t\tend\r\n\r\n\t\tcurrent_total = x*b1.size + y*b2.size\r\n\t\tputs \"X: #{x}, Y: #{y}, CT: #{current_total}\"\r\n\r\n\tend\r\n\r\nend", "def multiply_sum_by_3rd_argument\n\n end", "def m1(a,b,c,d)\n return (((a+(M-b)+(M-c))%M)^(d%M))%M # mix/power mod\n end" ]
[ "0.6510017", "0.6298643", "0.62676316", "0.62552345", "0.6077046", "0.6006124", "0.599249", "0.5850871", "0.5847466", "0.58259296", "0.5821434", "0.58129174", "0.58105344", "0.57874334", "0.5766924", "0.5757796", "0.57575923", "0.5744369", "0.5739602", "0.5729575", "0.5714591", "0.57134324", "0.56917846", "0.5679546", "0.5665847", "0.56648874", "0.5658594", "0.5648508", "0.5646126", "0.5638208", "0.5622923", "0.5613334", "0.5613202", "0.55972385", "0.5587835", "0.5578852", "0.5577048", "0.5576977", "0.5575136", "0.5571506", "0.5563631", "0.55635315", "0.55497086", "0.5543757", "0.5539231", "0.5539231", "0.5539231", "0.5535771", "0.5535214", "0.55332416", "0.5530551", "0.55166394", "0.55148166", "0.5509404", "0.54982376", "0.5490007", "0.54817", "0.54690194", "0.54686874", "0.5467152", "0.546198", "0.54610735", "0.54606986", "0.5458426", "0.5455997", "0.5451572", "0.5451531", "0.5443648", "0.54395884", "0.54356265", "0.54319185", "0.54247403", "0.5419162", "0.5408829", "0.5405483", "0.540536", "0.54043514", "0.5401336", "0.53997755", "0.5395734", "0.5390903", "0.53908545", "0.53701454", "0.5369541", "0.53671056", "0.53643465", "0.5361144", "0.53600895", "0.53590506", "0.5342908", "0.534079", "0.5335424", "0.5332218", "0.5328839", "0.53264827", "0.53243417", "0.53174907", "0.53164566", "0.53160506", "0.53156674", "0.53128034" ]
0.0
-1
=> [2, 1, 3, 4, 7, 11, 18, 29]
def isprime?(num) return false if num<2 (2...num).each do |factor| return false if num % factor == 0 end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given\n [6,5,3,1,8,7,2,3]\nend", "def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend", "def series_up(nums) \r\n series = 0 # start the list at the right \r\n list = [] # the list is empty at the start \r\n nums.times do |seq| \r\n n = 0 \r\n nums.times do |nums| # run a loop for the sequence \r\n list[n + series] = n + 1 \r\n n += 1 \r\n end \r\n series += seq + 1 # exponential growth \r\nend \r\n return list \r\nend", "def repeated_number_ranges(arr)\n\n\nend", "def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend", "def range(arr)\n # your code goes here\n arr = arr.sort\n arr.last - arr.first\nend", "def series_up(nums)# did not have time to do this function\n series = 0 # start the list at the right value\n list = [] # the list is empty at the start \n nums.times do |seq| # Run a loop for the sequence\n n = 0# set it equal to orignal num\n nums.times do |nums|\n list[n+ series] = n + 1\n n += 1\n end\n\n series += seq + 1 # exponetial growth \n end\n return list\n\nend", "def get_sequence(low, high)\n (low..high).to_a\nend", "def last_ids(number)\n (1 + size - number..size).to_a\n end", "def range(arr)\n arr.sort[-1] - arr.sort[0]\nend", "def series_up(n) # Got help again. My first code couldn't adapt at all. This one has a reset limit, meaning it loops the amount of times it needs to for each interger. Still not perfect, but almost there. \n list = [1]\n i = 1\n length = n*(n+1)/2\n reset = 3\n list.push i\n i += 1\n if i == reset\n reset += 1\n end\n return list\nend", "def repeated_number_ranges(arr)\n ranges = []\n start = nil\n arr.each.with_index do |num, i|\n next_num = arr[i + 1]\n if num == next_num\n start ||= i\n elsif start\n ranges << [start, i]\n start = nil\n end\n end\n ranges\nend", "def repeated_number_ranges(numbers)\n ranges = []\n start_index = nil\n\n numbers.each_with_index do |el, idx|\n next_el = numbers[idx + 1]\n if el == next_el\n start_index = idx unless start_index\n elsif start_index\n ranges.push([start_index, idx])\n start_index = nil\n end\n end\n\n ranges\nend", "def repeated_number_ranges(arr)\n rtn=[]\n start_idx=nil\n arr.each_with_index do |num,idx |\n nex_num=arr[idx+1]\n if num==nex_num\n start_idx=idx unless start_idx\n elsif start_idx\n rtn<<[start_idx,idx]\n start_idx=nil\n end\n end\n rtn\nend", "def integer_pigeonhole_sort(numbers)\n sorted = []\n\n numbers.length.times do |i|\n sorted << i\n end\n\n sorted\nend", "def age_of_n_oldest_priority_appeals(num)\n []\n end", "def series_up(n)\n #nlist is the list that will be the output of the code\n nlist = []\n #i changed from an if statement to a loop.\n (n*(n+1)/2+1).times do |i|\n i.times do |x|\n nlist.push(x+1)\n end\n end\n #I use three dots to only get the information i need from the code\n return nlist[0...(n*(n+1)/2)].to_a\nend", "def series_up(num)\n series = 0\n list = [] #starts as empty\n #puts \"running code\"\n num.times do |pattern|\n n = 0#original num\n num.times do |num|\n list[n + series] = n + 1\n n += 1\n end \n series += pattern + 1 \n #makes it grow exponentially\n end\n return list \nend", "def amicables(limit)\n numbers = Array.new(limit, 0)\n (1...limit).each do |i|\n ((i * 2)...limit).step(i) do |j|\n numbers[j] += i\n end\n end\n result = []\n numbers.each_with_index do |j, i|\n if j < limit && i == numbers[j] && i != j\n result << i\n end\n end\n result\nend", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def cracklepop_numbers(from, to)\n (from..to).to_a.map { |n| cracklepop_number(n) }\nend", "def makeArrayConsecutive2(statues)\n a = statues.sort\n count = 0\n if statues.count > 1\n for num in a.shift..a.pop\n unless statues.include?(num)\n count += 1\n end\n end\n end\n count\nend", "def repeated_number_ranges(arr)\n\n result = []\n arr.uniq.each do |x|\n temp = []\n arr.each_with_index do |y, i|\n temp << i if x == y\n end\n result << [temp[0], temp[-1]] if temp.length > 1\n end\n\n result\nend", "def range(arr)\n # your code goes here\n sorted_arr = arr.sort\n sorted_arr.last - sorted_arr.first\nend", "def straight_values_from(from)\n (from.to_i...from.to_i + 5).to_a\n end", "def running_total(numbers)\n numbers.map.with_index { |_, i| numbers[0..i].reduce(:+)}\nend", "def repeated_number_ranges(arr)\n result = []\n start_idx = nil\n last_idx = nil\n arr.each_index do |idx|\n if start_idx == nil && arr[idx] == arr[idx + 1]\n start_idx = idx\n elsif start_idx && arr[idx] != arr[idx + 1]\n last_idx = idx\n result << [start_idx, last_idx]\n start_idx = nil\n last_idx = nil\n end\n end\n result\nend", "def twosum(array, target)\n return [] if array.length<=1\n cache = {}\n array.each.with_index do |e,i|\n if cache.include? (target-e)\n return [i,cache[target-e]]\n else\n cache[e] = i\n end\n end\n return []\nend", "def every_other\n i = 1\n numbers = []\n 50.times do\n numbers << i\n i+= 2\n end\n return numbers\nend", "def repeated_number_ranges(numbers)\n result = []\n initializer = nil\n i = 0\n while i < numbers.length\n if numbers[i] == numbers[i + 1]\n initializer = i if initializer.nil?\n elsif !initializer.nil?\n result << [initializer, i]\n initializer = nil\n end\n i += 1\n end\n result\nend", "def oddNumbers(l, r)\nfirst_num = l.even? ? (l + 1) : l\n(first_num..r).step(2).to_a\nend", "def range(arr)\n arr = arr.sort \n return arr[arr.length-1] - arr[0]\nend", "def count_up(number)\n (1..number).to_a\nend", "def countup(num)\n (1..num).to_a\nend", "def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end", "def range(start,final)\n return [] if start >= final\n return [final - 1] if start == final - 1\n\n arr = []\n result = range(start,final-1)\n arr.concat(result)\n arr.push ( final - start )\n arr\nend", "def missing(nums)\n (nums.first.to_i...nums.last.to_i).to_a - nums\nend", "def makeArrayConsecutive2(statues)\n\n sorted = statues.sort\n max = sorted[-1]\n count = 0\n array = []\n i = sorted[0]\n while i <= max\n array << i\n i += 1\n end\n p array\n p sorted\n count = array.length - sorted.length\n \n return count\n\nend", "def repeated_number_ranges(arr)\n ranges = []\n start_idx = nil\n (0...arr.length).each do |idx|\n if arr[idx] == arr[idx + 1]\n start_idx = idx unless start_idx\n elsif start_idx\n ranges << [start_idx, idx]\n start_idx = nil\n end\n end\n ranges\nend", "def element_times_index(numbers)\n new_nums = []\n \n i = 0\n while i < numbers.length\n new_nums << numbers[i] * i\n \n i += 1\n end\n \n return new_nums\n end", "def high_and_low(numbers)\n p arr = numbers.split\n arr_new = Array.new\n arr.each do |x|\n arr_new << x.to_i\n end\n p arr_new.sort!\n p \"#{arr_new[-1]} #{arr_new[0]}\"\nend", "def repeated_number_ranges(arr)\n result = []\n end_index = 0\n arr.each_index do |idx|\n next if idx < end_index\n start_index = false\n start_index = idx if arr[idx] == arr[idx + 1]\n if start_index\n end_index = start_index + 1\n end_index += 1 while arr[start_index] == arr[end_index]\n result << [start_index, end_index - 1]\n end\n end\n result\nend", "def series_up(num)\n seq = 0\n list = []\n # list[(num * (num + 1) / 2) - 1] = num wasn't doing anything for me\n num.times do |pat| # I swtiched to num.times because I couldn't do list.each because list is blank\n t = 0\n num.times do |numb|\n list[t + seq] = t + 1 # How it knows where to put what number\n t += 1\n end\n seq += pat + 1 # grows exponentially to make it add a new space every time\n end\n return list\nend", "def removNb(n)\n res = []\n total = (n*n + n) / 2\n range = (1..n)\n \n (1..n).each do |a|\n b = ((total - a) / (a * 1.0 + 1.0))\n if b == b.to_i && b <= n\n res.push([a,b.to_i])\n end\n end\n\n return res\nend", "def birthdayCakeCandles(ar)\n tc = []\n\n ar.sort.reverse.each do |num|\n if tc.empty?\n tc.push(num)\n elsif tc.first == num\n tc.push(num)\n elsif tc.first < num\n tc.clear\n tc.push(num)\n end\n end\n\n tc.count\nend", "def cout(n)\n\tw=[0,1,2,3,4,5,6,7,8,9]\n\tx=[]\n\tk=1\n\twhile x!=w do \n\t\tm=n*k\n\t\t\twhile m>0 do\n\t\t\t\tt=m%10\n\t\t\t\tx=x.push(t)\n\t\t\t\tx.sort!\n\t\t\t\tx.uniq!\n\t\t\t\tm=m/10\t\n\t\t\tend\n\t\tk=k+1\n\tend\nreturn (k-1)*n\nend", "def mark_sort array\n array_max = array.max\n array_min = array.min\n markings = [0] * (array_max - array_min + 1)\n array.each do |a|\n markings[a - array_min] += 1\n end\n\n res = []\n markings.length.times do |i|\n markings[i].times do\n res << i + array_min;\n end\n end\n\n res\nend", "def sequence(num)\n 1.downto(num).to_a\nend", "def descending(numbers)\n result = []\n index = numbers.length - 1\n numbers.length.times do\n result << numbers[index]\n index = index - 1\n end\n result\nend", "def descending(numbers)\n result = []\n index = numbers.length - 1\n numbers.length.times do\n result << numbers[index]\n index = index - 1\n end\n result\nend", "def descending(numbers)\n result = []\n index = numbers.length - 1\n numbers.length.times do\n result << numbers[index]\n index = index - 1\n end\n result\nend", "def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend", "def range(start,finish)\n if start == finish\n return [start]\n end\n\n prev_arr = range(start+1, finish)\n prev_arr << start\n return prev_arr\nend", "def element_times_index(numbers)\n times = []\n i = 0\n\n while i < numbers.length\n old_arr = numbers[i]\n new_arr = old_arr * i\n times << new_arr\n i += 1\n end\n times\nend", "def loopy_range(max, step)\n numbers =[]\n for nums in (0..max)\n numbers.push(nums)\n end\n puts \"The end array is #{numbers}\"\nend", "def element_times_index(numbers)\n\tmulti = []\n \n\ti = 0\n\twhile i < numbers.length\n\t\titem = numbers[i]*i\n\t\tmulti << item\n\t\ti += 1\n end\n\n\treturn multi\nend", "def map_value\n\t[3, 7, 14, 15, 22, 41].map { |e| e + 1 }\nend", "def missing_numbers(nums)\n (nums.first..nums.last).to_a - nums\nend", "def get_all_steps range, step\n values = []\n value = range.first\n while value <= range.last\n values.push value\n value += step\n end\n return values\nend", "def makeArrayConsecutive2(statues)\n max_value = statues.max\n min_value = statues.min\n result_array = []\n\n if min_value == max_value\n 0\n else\n for i in range(min_value, max_value)\n result_array.append(i)\n end\n end\n result_array.size - statues.size\nend", "def sequence(number)\n (1..number).to_a\nend", "def sequence(number)\n (1..number).to_a\nend", "def get_gaps (array)\n return [] if array.empty?\n (array.first .. array.last).to_a - array\nend", "def rt(ary)\n ary.each_with_object([]) {|num,new_ary| new_ary << ary[0..ary.find_index(num)].reduce(:+)}\nend", "def sequence(count, first)\n (1..count).map { |idx| idx * first }\nend", "def repeated_number_ranges(arr)\n ranges = []\n idx = 0\n arr.each do |e|\n if arr.count(e) > 1\n first, last = count_range(arr, e, idx)\n if first != last\n if first <= 1 || first > 1 && arr[first] != arr[first-1]\n ranges.push([first, last])\n end\n end\n end\n idx = idx + 1\n end\n return ranges.uniq\nend", "def repeated_number_ranges(arr)\n counter = 0\n answer = []\n while counter < arr.length\n temp = []\n while arr[counter] == arr[counter + 1]\n if temp.length == 0\n temp << counter\n end\n counter += 1\n end\n if temp.length == 1\n temp << counter\n answer << temp \n end\n counter += 1\n end\nanswer\nend", "def series_up(n)\n new_list=[] # to push into a new list\n (n + 1).times do |index| #You need the nested loop index.times to run at least once. Since Index starts at 0, you need to add 1 so that it runs at least once\n index.times do |value| # this runs the loop each time until it reaches the number needed\n new_list.push(value + 1) #Same as the loop above. Since the value starts at 0, you need to start at 1 bc that's what the challenge wants you to do. the .push pushes it into the new list \n end \n end \n return new_list # this makes the function print the newly created list\nend", "def running_total(array)\n result = []\n array.each_index do |i|\n result[i] = (0..i).to_a.map { |e| array[e] }.inject(:+)\n end\n result\nend", "def range(start_val, end_val)\n return [] if start_val + 1 == end_val\n nums = [start_val + 1]\n nums + range(start_val + 1, end_val)\nend", "def numUnique2 list\n current_num = list[0]\n unique_numbers = [list[0]]\n\n list.each do |num|\n if num != current_num\n current_num = num\n unique_numbers << num\n end\n end\n return \"**#{unique_numbers.length}**\"\nend", "def my_array_splitting_method(source)\n divide = source.sort_by{|x| x.to_s}\n total = divide.find_all{|item| item % 1 == 0 }.count \n total -= 1\n divide.partition.with_index { |_, index| index <= total }\nend", "def running_total(arr)\n new_arr = []\n running_total = arr[0]\n arr.each_with_index do |element, index|\n new_arr.push(running_total)\n running_total = running_total + arr[index + 1].to_s.to_i\n end\n new_arr\nend", "def running_total(arr)\n arr.map.with_index { |_int, i| arr[0..i].sum }\nend", "def get_indices_of_item_weights(arr, limit)\n # Good Luck, and have a good one :)\n x = 0\n while x < arr.length do \n temp = limit - arr[x]\n temp_arr = arr[0...x] + arr[x + 1..-1]\n if temp_arr.include?(temp)\n return [x, arr.index(temp)]\n end\n x += 1\n end\n return nil \nend", "def filter_by_factor_of(enum, x)\n x -= 1\n result = []\n result << enum.first\n current = 1\n while current < x do\n current += 1\n result << enum[enum.length / x * current]\n end \n result << enum.last\n result\n end", "def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend", "def buy_fruit(fruits)\n result = []\n fruits.each do |pair|\n pair.last.times { |i| result << pair.first}\n end\n result\nend", "def number_counting_seq(n)\r\n\r\nend", "def sequence(num)\r\n new_arr = []\r\n (1..num).step(1) { |n| new_arr << n }\r\n new_arr\r\nend", "def count(n,ar)\r\n result = Array.new(100){|x| x = 0}\r\n ar.each { |x| result[x] = result[x]+1 }\r\n return result\r\nend", "def multiples_of( x, xmax )\n ct = x\n nums = []\n while ct <= xmax\n nums << ct\n ct += x\n end\n return nums\nend", "def element_times_index(numbers)\n \n new_arr = []\n\n i = 0 \n while i < numbers.length\n new_num = numbers[i] * i\n new_arr << new_num\n i += 1\n end\n\n return new_arr\nend", "def buy_fruit(list)\n new_list = []\n list.each { |arr| arr[1].times { new_list << arr[0] } }\n new_list\nend", "def count_by(x, n)\n a=[]\n y=0\n n.times {y+=x; a<<y}\n a\nend", "def element_times_index(numbers)\n i = 0\n count = 0\n while i < numbers.length\n numbers[i] = numbers[i] * count\n count += 1\n i += 1\n end\n return numbers\nend", "def running_total(array)\n array.map.with_index { |e, i| array[0..i].reduce(:+) }\nend", "def goldbach_list(range)\n range.select { |n| n % 2 == 0 }. map { |n| goldbach(n) }\nend", "def equil_idcs(a)\n left = 0\n sum = a.inject(:+)\n equils = []\n a.each_with_index do |num, idx|\n sum -= num\n equils << idx if left == sum\n left += num\n end\n equils.empty? ? -1 : equils\nend", "def sequence(integer)\n (1..integer).to_a\nend", "def sequence(integer)\n (1..integer).to_a\nend", "def sequence(num)\n\n results = []\n\n 1.upto(num) { |num| results << num }\n\n results\n\nend", "def range(arr)\n\nend", "def monkey_count(n)\n [*1..n]\nend", "def sorted_scores(unsorted_scores, highest_score)\n score_counts = Array.new(101, 0) # 101 because it has to be inclusive of 100\n\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n sorted_scores = []\n\n highest_score.downto(0) do |score|\n count = score_counts[score]\n\n count.times do |_time|\n sorted_scores.push(score)\n end\n end\n\n sorted_scores\nend", "def sequence(count, first)\n sequence = []\n number = first\n\n count.times do\n sequence << number\n number += first\n end\n sequence\nend", "def my_custom_while_with_range_op(the_max, the_increment)\n numbers = []\n (0..the_max).step(the_increment).each do |i|\n puts \"At the top i is #{i}\"\n numbers.push(i)\n i += the_increment\n puts \"Numbers now: \", numbers\n puts \"At the bottom i is #{i}\"\n end\n return numbers\nend", "def range(start, finish)\n return [] if start >= finish\n [start + 1] + range(start + 1, finish)\nend", "def sequence(num)\n (1..num).to_a\nend", "def sequence(num)\n (1..num).to_a\nend", "def sequence(num)\n (1..num).to_a\nend" ]
[ "0.7610117", "0.6555771", "0.6534972", "0.6340324", "0.62796617", "0.6234124", "0.62291795", "0.620265", "0.61924005", "0.6176269", "0.6168404", "0.6165806", "0.61275774", "0.61271924", "0.6105388", "0.60709107", "0.606117", "0.60477865", "0.6046792", "0.6046085", "0.6036601", "0.60279983", "0.60099745", "0.5992822", "0.5991992", "0.5985258", "0.59816927", "0.5979881", "0.5971639", "0.5971579", "0.5962033", "0.59562016", "0.594503", "0.59395", "0.59337753", "0.5924449", "0.59211797", "0.59203506", "0.5914622", "0.59136796", "0.59045494", "0.5892906", "0.5890723", "0.58897936", "0.58883667", "0.58694005", "0.5860946", "0.585517", "0.5845054", "0.5845054", "0.5845054", "0.5833173", "0.582917", "0.58203757", "0.5816753", "0.5814325", "0.5806265", "0.58035713", "0.58014345", "0.57968056", "0.5792387", "0.5792387", "0.5791597", "0.57882535", "0.5785077", "0.57747906", "0.5774012", "0.57711285", "0.576704", "0.5762203", "0.57594603", "0.5755183", "0.57551533", "0.5754602", "0.5753223", "0.57509845", "0.57477874", "0.5747777", "0.574583", "0.57433206", "0.5738902", "0.5736183", "0.5735149", "0.5731893", "0.57293826", "0.57290536", "0.5728045", "0.5726222", "0.57248944", "0.57225627", "0.57225627", "0.57198036", "0.57187724", "0.5716703", "0.5715723", "0.57155484", "0.57049084", "0.57041883", "0.57028973", "0.57028973", "0.57028973" ]
0.0
-1
GET /people GET /branches/1/people GET /businesses/1/people
def index render :index if @people render :index_for_patrons if @patrons end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def index\n case\n when params.has_key?(:company_id) then\n @parent = Company.find(params[:company_id])\n @people = @parent.people\n when params.has_key?(:person_id) then\n @parent = Person.find(params[:person_id])\n @people = @parent.people \n else\n @people = Person.all\n end\n @q = @people.ransack(params[:q])\n @people = @q.result.order(first_name: 'ASC').paginate(page: params[:page], per_page: 10 || params[:per_page])\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end", "def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end", "def fetch_people\n @people = People.find(params[:id])\n end", "def list_people\n @nbr = Job.where('company_id = ?', params[:id])\n .distinct\n .pluck(:person_id)\n .count\n params[:q] = {} if params[:q].nil?\n params[:q]['company_id_eq'] = params[:id]\n @q = Job.ransack(params[:q])\n @jobs = @q.result\n .includes(:company, :person)\n .page(pointed_page)\n\n render 'companies/company_people'\n end", "def show\n \n \n @people= Person.findByNameOrId(params[:id])\n \n if (@people.length == 1) \n @person = @people[0]\n else \n if(@people.length > 1)\n @name = params[:id].capitalize\n disambiguation\n return\n end\n end \n \n if(!@person)\n redirect_to '/search?q=' +params[:id].is_a?(Numeric) #+ params[:id].to_s + '&page=1'\n return\n end\n \n @max_depth = params[:family_tree_depth] || 3 \n @max_depth = @max_depth.to_i\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # show.html.erb\n format.xml { render :xml => @person }\n end\n end", "def index\n @root = \"people\"\n \n @people = Person.find(:all)\n end", "def index\n @people = current_organization.people.all\n end", "def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend", "def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end", "def find\n @people = Person.where params.slice(:given_name, :family_name, :family_name2, :city_village, :gender)\n\n case @people.size\n when 0\n if Site.master?\n head :not_found\n else\n# find_remote\n end\n when 1\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n format.json { render :json => @people.to_json }\n end\n else\n respond_to do |format|\n format.html { render :action => 'index', :status => :multiple_choices }\n format.xml { render :xml => @people, :status => :multiple_choices }\n format.json { render :json => @people.to_json, :status => :multiple_choices }\n end\n end\n end", "def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end", "def index\n respond_with(@people)\n end", "def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def index\n redirect_to people_path\n end", "def show\n @neighborhood = Neighborhood.find_by_slug(params[:id])\n @branches = Branch.select(\"DISTINCT branches.id, branches.name, branches.slug\")\n .joins(\"INNER JOIN interviews ON interviews.branch_id = branches.id\")\n .where(\"interviews.neighborhood_id = ? AND is_demo = ?\", @neighborhood.id, 0)\n .order(\"name\")\n \n # @branches = Branch.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def show\n @person = Person.find(params[:id])\n @address = @person.addresses.take\n @identifiers = @person.identifiers\n @parent = @person.company\n end", "def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend", "def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end", "def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @branches }\n end\n end", "def index\n @people = Person.includes(:names).search(params[:search]).order(\"person_names.last_name ASC\")\n\n if params[:state] == 'in_project'\n @people = @people.joins(user: :memberships)\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' } # index.html.erb\n format.json { render json: @people }\n end\n \n end", "def index\n @page_title = t('branches.index.title', :government_name => current_government.name)\n @branches = Branch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @branches }\n end\n end", "def people\n\t\tif logged_in? then\n\t\t\tredirect_to \"/people/#{current_user.login}/#{params[:peoplecontroller]}/#{params[:peopleaction]}\", :status => 301\n\t\telse\n\t\t\tredirect_to '/', :status => 301\n\t\tend\n\tend", "def index\n @branches = Branch.where(:regional_id=>current_user.parent_id)\n end", "def find_bridges(params={}, headers=default_headers)\n @logger.info(\"Find Bridges.\")\n get(\"#{@api_url}/bridges\", params, headers)\n end", "def show\n\t\t@household = Household.find(params[:id])\n\t\t@people = @household.people\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @household }\n\t\tend\n\tend", "def people(query={})\n response = self.simple_client.get(\"/api/v1/people?#{query.to_query}\")\n # TODO modularize, re-use\n if response[\"page\"]\n return WillPaginate::Collection.create(response[\"page\"],response[\"per_page\"]) do |pager|\n pager.replace(response[\"people\"])\n pager.total_entries = response[\"total_entries\"]\n end\n else\n return response\n end\n end", "def search_people(query)\n get(\"/v1/search/people\", query: query)\n end", "def index\n @people = People.all\n end", "def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @branches }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def index\n @people_1 = Hr::Job.category_job()\n @people_9 = Hr::Lookups::MyselfStatus.select_y\n params[:q] = params[:q] ? params[:q] : {}\n @search = Hr::Person.ransack(params[:q])\n @hr_people = @search.result.paginate(:page => params[:page])\n end", "def index\n @cb_people = CbPerson.all\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @branches = @restaurant.branches\n end", "def index\n @people = Person.all\n respond_with(@people)\n end", "def friends\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id]) \n @persons = @person.get_all_friends\n \n respond_to do |format|\n format.html # friends.html.erb\n format.xml { render :xml => @persons }\n end\n \n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def index\n @group_branches = GroupBranch.paginate(:page => params[:page], :per_page => 10)\n end", "def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end", "def index\n @request_people = RequestPerson.all\n end", "def index\n @groups = Group.all\n @people = Person.all\n end", "def index\n @branch_routes = BranchRoute.all\n end", "def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend", "def index\n \t@people = Person.all\n end", "def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end", "def index\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n if params[:person_id]\n @person = Person.find(params[:person_id])\n @upcoming_harvests = @person.upcoming_harvests\n @past_harvests = @person.past_harvests\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end", "def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end", "def index\n @people = User.order(:nickname).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @people }\n end\n end", "def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end", "def show\n @branches = @entity.branches\n end", "def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end", "def getPeople\n\t\t\t\tbegin\n\t\t\t\t\t# Call getPeopleData method to retrieve data from SalesLoft API\n\t\t\t\t\t# [TODO] LOG [DEBUG MESSAGE]\n\t\t\t\t\tresponse_body = getPeopleData\n\t\t\t\t\t\n\t\t\t\t\t# Return Response\n\t render json: {\n\t \tresponse_data: response_body,\n\t \toperation: \"get_people_data\",\n\t \tstatus: \"success\",\n\t \ttimestamp:Time.now, \n\t \tuuid: SecureRandom.uuid, \n\t \tresponse_code: 200,\n\t \tmessage: \"Data Retrieved\"\n\t }\n \trescue StandardError => e\n \t\t# [TODO] LOG [ERROR MESSAGE]\n \t\trender json: {\n\t \tresponse_data: e.message,\n\t \toperation: \"people_data\",\n\t \tstatus: \"error\",\n\t \ttimestamp:Time.now, \n\t \tuuid: SecureRandom.uuid, \n\t \tresponse_code: 500,\n\t \tmessage: \"Error Occured\"\n\t } \n \tend # End rescue block\n\t\t\tend", "def index\n\n @people = Person.filter(params.slice(:name_like))\n @people = @people.where([\"union_id = ?\", current_person.union_id]) if request.format.json? && !owner?\n @people = @people.where(\"not invited_by_id is null\").order([:last_name, :first_name, :id])\n \n respond_to do |format|\n format.html \n format.json \n end\n end", "def people\n @people = Person.find(:all, :order => 'family_name, given_name')\n\n respond_to do |format|\n format.html # people.html.erb\n format.xml { render :xml => @people }\n end\n end", "def index\n if @patron\n @patron_merges = @patron.patron_merges.order('patron_merges.id').page(params[:page])\n elsif @patron_merge_list\n @patron_merges = @patron_merge_list.patron_merges.order('patron_merges.id').includes(:patron).page(params[:page])\n else\n @patron_merges = PatronMerge.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @patron_merges }\n end\n end", "def index\n @branches = Branch.order(:id) if current_user.is_admin?\n @branches = current_user.company.branches.order(:id) if current_user.is_admin_company?\n if @branches.nil?\n redirect_back_or_default home_url\n end\n end", "def index\n @company_branches = CompanyBranch.all\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def index\n @club = Club.find_by_slug(params[:club_id])\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end", "def index\n if params[:harvest_id]\n @parent = Harvest.find(params[:harvest_id])\n @harvestings = @parent.harvestings\n elsif params[:person_id]\n @parent = Person.find(params[:person_id])\n @harvestings = @parent.harvestings\n else\n #should not get here\n @harvestings = Harvesting.all\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n @branches = Branch.all\n end", "def index\n @branches = Branch.all\n end", "def index\n @branches = Branch.all\n end", "def index\n @branches = Branch.all\n end", "def index\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n add_breadcrumb 'Groups', hub_groups_path(@hub)\n append_title \"#{@hub.name} Groups\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @groups }\n end\n end", "def index\n @visit_people = VisitPerson.all\n end", "def index\n add_crumb 'Users', users_path\n add_crumb @user.name, user_path(@user)\n add_crumb 'Projects', user_projects_path(@user)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end", "def get_people\n return @people\n end", "def index\n @people = Person.scoped\n if params[:status]\n \t@people = @people.has_status(params[:status])\n end\n if params[:role]\n \t@people = @people.has_role(params[:role])\n end\n if params[:tag]\n \t@people=@people.has_tag(params[:tag])\n end\n respond_with @people do |format|\n \tformat.png {send_data view_context.photo_strip('png', 12), type: \"image/png\",disposition: \"inline\"}\n \tformat.jpg {send_data view_context.photo_strip('jpg', 12), type: \"image/jpg\",disposition: \"inline\"}\n end\n end", "def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end", "def index\n @accounts = current_user.person.linked_in_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "def index\n @people = do_search_people(@person, :friends, :with_tags => !request.xhr?,\n :url => hash_for_contacts_path)\n end", "def index\n @providers_branches = Providers::Branch.paginate(page: params[:page], per_page: 5).order('id Desc').all\n render :layout =>false\n end", "def list(*args)\n params = arguments(args).params\n\n if (user_name = params.delete('user'))\n response = get_request(\"/users/#{user_name}/orgs\", params)\n elsif args.map(&:to_s).include?('every')\n response = get_request('/organizations', params)\n else\n # For the authenticated user\n response = get_request('/user/orgs', params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "def index\n authorize! :index, Branch\n\n if current_user.is?(:superadmin)\n @branches = Branch.page(params[:page]).per(20).order('id DESC')\n else\n @branches = @current_store.branches.page(params[:page]).per(20).order('id DESC')\n end\n\n end", "def index\r\n if current_account.is_worker?\r\n @branches = current_account.branches.paginate(:page => params[:page], :per_page => 25)\r\n else\r\n @branches = @current_shop.all_branches.paginate(:page => params[:page], :per_page => 25)\r\n end\r\n end", "def people\n Harvest::Resources::Person\n end", "def show\n @branch = @repository.branches.where(:name => params[:branch_name]).first!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @branch }\n end\n end", "def index(person)\n end", "def show\n @branch = Branch.find(params[:id], :include => :assignments)\n @salespeople = Salesperson.find_not_in_branch( @branch.id )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @branch }\n end\n end", "def index\n @people = Person.all\n end", "def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end", "def index\n @team_people = TeamPerson.all\n end" ]
[ "0.62222105", "0.59114003", "0.58923566", "0.5868764", "0.5868764", "0.58610666", "0.5840585", "0.5797233", "0.5790994", "0.5766361", "0.5759379", "0.57427806", "0.5725173", "0.5719261", "0.56513345", "0.5619096", "0.5614046", "0.5614046", "0.5607476", "0.5590379", "0.5589269", "0.55779934", "0.55697125", "0.5555692", "0.555376", "0.555105", "0.5535856", "0.55354273", "0.5499126", "0.5487378", "0.5477318", "0.54531235", "0.5449832", "0.54423743", "0.5412963", "0.54115427", "0.5398526", "0.53912085", "0.5383276", "0.53715986", "0.53696895", "0.53634846", "0.5349837", "0.53476644", "0.5347047", "0.5339143", "0.5335221", "0.53330696", "0.53308934", "0.5324013", "0.5324013", "0.5324013", "0.5324013", "0.5324013", "0.5324013", "0.5324013", "0.5324013", "0.5324013", "0.532372", "0.5322983", "0.5315941", "0.53116393", "0.5306886", "0.5291752", "0.5285837", "0.52761847", "0.526346", "0.52606326", "0.52598596", "0.5258077", "0.5254823", "0.52398455", "0.5232365", "0.52303076", "0.5230134", "0.5222719", "0.5221894", "0.52156377", "0.5207818", "0.5207818", "0.5207818", "0.5203794", "0.52037114", "0.5202291", "0.52007467", "0.51992315", "0.51956725", "0.5186902", "0.517983", "0.51744676", "0.51738894", "0.51736414", "0.5168553", "0.51631856", "0.5157476", "0.51481736", "0.51435393", "0.5142498", "0.5141915", "0.51396704", "0.513713" ]
0.0
-1
GET /family_histories GET /family_histories.json
def index @family_histories = FamilyHistory.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end", "def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end", "def show\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end", "def frequent_foods\n get(\"/user/#{@user_id}/foods/log/frequent.json\")\n end", "def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def show\n family = current_family\n p current_family\n render json: family.as_json\n end", "def getHistories\n account = current_user.account\n if account.nil?\n render status: 400, json: {error: \"Invalid User\"}\n else\n devices = Device.find_all_by_user_id(current_user.id)\n device_ids = []\n devices.each do |d|\n device_ids << d.id\n end\n rewards = RewardHistory.where(:account_id => account.id)\n achievements = AchievementHistory.where(:device_id => device_ids)\n offers = OfferHistory.where(:device_id => device_ids)\n promos = PromoCodeHistory.where(:account_id => account.id)\n referrals = ReferralCodeHistory.where(:account_id => account.id)\n referrees = ReferralCodeHistory.where(:referrer_id => account.id)\n\n returnUserHistories = []\n\n rewards.each do |r|\n history = UserHistory.new\n description_string = \"\"\n if r.processed == false\n description_string = \"Pending reward\"\n else\n description_string = \"Reward redeemed!\"\n end\n history.populate(r.reward.name, description_string, \"#{r.reward.image.url}\", r.amount, r.created_at)\n returnUserHistories << history\n end\n\n achievements.each do |a|\n history = UserHistory.new\n history.populate(a.achievement.name, \"Achievement Complete!\", \"#{a.achievement.app.image.url}\", a.achievement.cost,\n a.created_at)\n returnUserHistories << history\n end\n\n offers.each do |o|\n history = UserHistory.new\n history.name = o.company\n history.description = \"Offer completed from: \" + o.company + \"!\"\n history.amount = o.amount\n history.date = o.created_at\n returnUserHistories << history\n end\n\n promos.each do |p|\n history = UserHistory.new\n history.name = \"Promotional Code\"\n history.description = \"Promotional Code #{p.promo_code.name} redeemed!\"\n history.amount = p.value\n history.date = p.created_at\n returnUserHistories << history\n end\n\n referrals.each do |r|\n history = UserHistory.new\n history.name = \"Referrer Install Bonus\"\n history.description = \"Referral code entered!\"\n history.amount = r.referree_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n referrees.each do |r|\n history = UserHistory.new\n history.name = \"Referral Bonus\"\n history.description = \"#{r.account.user.username} entered your referral code!\"\n history.amount = r.referrer_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n returnUserHistories = returnUserHistories.sort_by(&:date).reverse\n\n render status: 200, json: returnUserHistories\n end\n end", "def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def index\n @formating_histories = FormatingHistory.all\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "def index\n @favories = Favory.all\n end", "def show\n @cartucho = Cartucho.find(params[:id])\n @historials =@cartucho.historials\n @historial = Historial.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartucho }\n end\n end", "def index\n @historials = Historial.all\n end", "def index\n @historials = Historial.all\n end", "def index\n @historials = Historial.all\n end", "def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end", "def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end", "def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def index\n @families = Family.all\n end", "def index\n @families = Family.all\n end", "def index\n @families = Family.all\n end", "def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end", "def index\n #@histories = History.all\n @histories = History.find( :all, :limit => 100, :order => \"id DESC\" )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end", "def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend", "def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end", "def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end", "def index\n @family_relationships = FamilyRelationship.all\n end", "def history(level)\n data = @data['families'].find { |type| type['name'] == 'History' }\n badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) }\n HQTrivia::Badge.new(badge)\n end", "def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end", "def index\r\n @families = Family.all\r\n end", "def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end", "def index\n @harvest_histories = HarvestHistory.all\n end", "def index\n @three_child_histories = ThreeChildHistory.all\n end", "def index\n @daily_horoscopes = DailyHoroscope.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_horoscopes }\n end\n end", "def index\n @thermostat_histories = ThermostatHistory.all\n end", "def index\n @bhistories = Bhistory.all\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def show\n render json: @history\n end", "def index\n past_histories = PastHistory.where(user_id: params[:user_id])\n render json: past_histories.as_json(include: :recipe, only: :created_at)\n end", "def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end", "def index\n @document_histories = DocumentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @document_histories }\n end\n end", "def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end", "def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end", "def show\n @reading_history = @user.reading_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_history }\n end\n end", "def index\n @sales_tax_exemption_customer_histories = SalesTaxExemptionCustomerHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_tax_exemption_customer_histories }\n end\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def destroy\n @family_history.destroy\n respond_to do |format|\n format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @service_histories = ServiceHistory.all\n end", "def index\n @drink_histories = DrinkHistory.first(100)\n end", "def show\n @dish = Dish.find(params[:id])\n add_to_history(@dish.restaurant.name, restaurant_path(@dish.restaurant))\n add_to_history('dishes', restaurant_dishes_path(@dish.restaurant))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def index\n @species = Species.eager_load(:family, :species_locations, :images).order('families.name')\n respond_to do |format|\n format.html {\n not_found\n }\n format.xml { render :xml => @species }\n format.json {\n render :template => 'species/index.json'\n }\n end\n end", "def query_histories_with_http_info(project_id, body, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: SearchApi.query_histories ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling SearchApi.query_histories\" if project_id.nil?\r\n # verify the required parameter 'body' is set\r\n fail ArgumentError, \"Missing the required parameter 'body' when calling SearchApi.query_histories\" if body.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/histories\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = @api_client.object_to_http_body(body)\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'ArtifactHistoryResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: SearchApi#query_histories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end", "def show\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historical }\n end\n end", "def index\n @education_histories = EducationHistory.all\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def query_histories(project_id, body, opts = {})\r\n data, _status_code, _headers = query_histories_with_http_info(project_id, body, opts)\r\n return data\r\n end", "def index\n @originating_histories = OriginatingHistory.all\n end", "def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end", "def show\n @category_history = CategoryHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_history }\n end\n end", "def show\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_feature }\n end\n end", "def index\n @dating_histories = DatingHistory.all\n end", "def index\n @node_histories = NodeHistory.all\n end", "def index\n @q = Foodhistory.ransack(params[:q])\n @foodhistories = @q.result\n end", "def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\n end\n end", "def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end", "def show\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_history }\n end\n end", "def show\n render json: @service_history\n end", "def index\n @historic_refinancings = HistoricRefinancing.all\n end", "def index\r\n @medical_histories = MedicalHistory.all\r\n end", "def index\r\n @medical_histories = MedicalHistory.all\r\n end", "def index\n @weight_histories = WeightHistory.all\n end", "def show\n render json: @family_image\n end", "def index\n @historics = Historic.all\n end", "def index\n unless params[:usage].nil?\n usage = params[:usage] == 'nil' ? nil : params[:usage]\n @unified_histories = UnifiedHistory.where(usage: usage)\n else\n @unified_histories = UnifiedHistory.all\n end\n @unified_histories = @unified_histories.page(params[:page])\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def index\n @votaciones_hists = VotacionesHist.all\n end", "def show\n @history = History. all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render 'show', format: 'json', handlers: 'jbuilder', status: :ok\n }\n end\n end", "def index\n @visit_histories = VisitHistory.all\n end", "def show\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_blog }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end", "def show\n @buying_history = BuyingHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @buying_history }\n end\n end", "def index\n @search_histories = SearchHistory.all\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @pediatric_histories = PediatricHistory.all\n end", "def show\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_usership }\n end\n end", "def index\n @dev_folios = DevFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dev_folios }\n end\n end", "def show\n @breadcrumb = 'read'\n @product_family = ProductFamily.find(params[:id])\n @products = @product_family.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n @stocks = @product_family.product_family_stocks.paginate(:page => params[:page], :per_page => per_page).order('store_id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_family }\n end\n end" ]
[ "0.71313196", "0.66687083", "0.65626675", "0.6493162", "0.6366066", "0.6365955", "0.6337237", "0.6239882", "0.6203846", "0.62029326", "0.6159766", "0.6154554", "0.6091634", "0.6067703", "0.6065467", "0.60643333", "0.60643333", "0.6047217", "0.60415894", "0.6040515", "0.6034986", "0.60309136", "0.6017651", "0.6017651", "0.6012937", "0.5979559", "0.59697104", "0.5936159", "0.5936159", "0.5936159", "0.5934329", "0.59270984", "0.59240776", "0.5915726", "0.5912783", "0.5866379", "0.5854978", "0.58309704", "0.5818388", "0.58174556", "0.58098364", "0.5797323", "0.5790764", "0.57880485", "0.5771566", "0.57544523", "0.5751761", "0.5750891", "0.5750241", "0.57480484", "0.5745374", "0.5741147", "0.57381296", "0.5726538", "0.5715234", "0.5693417", "0.5688592", "0.5687456", "0.56866586", "0.56859165", "0.56843764", "0.5672735", "0.5657271", "0.5655383", "0.5652783", "0.5652783", "0.5652443", "0.56515557", "0.5632046", "0.5626687", "0.5621676", "0.5610106", "0.56079113", "0.5601216", "0.5600451", "0.55985093", "0.55923605", "0.55844826", "0.5576566", "0.5574565", "0.5574565", "0.557375", "0.5571296", "0.55644274", "0.5560857", "0.55594707", "0.55505675", "0.5540523", "0.55343056", "0.5530985", "0.5524657", "0.55235004", "0.5516912", "0.55142397", "0.54979116", "0.5490547", "0.5487151", "0.5480605", "0.548006", "0.54799545" ]
0.76875293
0
GET /family_histories/1 GET /family_histories/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @family_histories = FamilyHistory.all\n end", "def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end", "def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end", "def show\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end", "def show\n family = current_family\n p current_family\n render json: family.as_json\n end", "def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def frequent_foods\n get(\"/user/#{@user_id}/foods/log/frequent.json\")\n end", "def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end", "def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end", "def show\n @cartucho = Cartucho.find(params[:id])\n @historials =@cartucho.historials\n @historial = Historial.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartucho }\n end\n end", "def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def show\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historical }\n end\n end", "def index\n @formating_histories = FormatingHistory.all\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def index\n @historials = Historial.all\n end", "def index\n @historials = Historial.all\n end", "def index\n @historials = Historial.all\n end", "def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end", "def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end", "def getHistories\n account = current_user.account\n if account.nil?\n render status: 400, json: {error: \"Invalid User\"}\n else\n devices = Device.find_all_by_user_id(current_user.id)\n device_ids = []\n devices.each do |d|\n device_ids << d.id\n end\n rewards = RewardHistory.where(:account_id => account.id)\n achievements = AchievementHistory.where(:device_id => device_ids)\n offers = OfferHistory.where(:device_id => device_ids)\n promos = PromoCodeHistory.where(:account_id => account.id)\n referrals = ReferralCodeHistory.where(:account_id => account.id)\n referrees = ReferralCodeHistory.where(:referrer_id => account.id)\n\n returnUserHistories = []\n\n rewards.each do |r|\n history = UserHistory.new\n description_string = \"\"\n if r.processed == false\n description_string = \"Pending reward\"\n else\n description_string = \"Reward redeemed!\"\n end\n history.populate(r.reward.name, description_string, \"#{r.reward.image.url}\", r.amount, r.created_at)\n returnUserHistories << history\n end\n\n achievements.each do |a|\n history = UserHistory.new\n history.populate(a.achievement.name, \"Achievement Complete!\", \"#{a.achievement.app.image.url}\", a.achievement.cost,\n a.created_at)\n returnUserHistories << history\n end\n\n offers.each do |o|\n history = UserHistory.new\n history.name = o.company\n history.description = \"Offer completed from: \" + o.company + \"!\"\n history.amount = o.amount\n history.date = o.created_at\n returnUserHistories << history\n end\n\n promos.each do |p|\n history = UserHistory.new\n history.name = \"Promotional Code\"\n history.description = \"Promotional Code #{p.promo_code.name} redeemed!\"\n history.amount = p.value\n history.date = p.created_at\n returnUserHistories << history\n end\n\n referrals.each do |r|\n history = UserHistory.new\n history.name = \"Referrer Install Bonus\"\n history.description = \"Referral code entered!\"\n history.amount = r.referree_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n referrees.each do |r|\n history = UserHistory.new\n history.name = \"Referral Bonus\"\n history.description = \"#{r.account.user.username} entered your referral code!\"\n history.amount = r.referrer_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n returnUserHistories = returnUserHistories.sort_by(&:date).reverse\n\n render status: 200, json: returnUserHistories\n end\n end", "def show\n @dish = Dish.find(params[:id])\n add_to_history(@dish.restaurant.name, restaurant_path(@dish.restaurant))\n add_to_history('dishes', restaurant_dishes_path(@dish.restaurant))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def show\n @reading_history = @user.reading_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_history }\n end\n end", "def index\n #@histories = History.all\n @histories = History.find( :all, :limit => 100, :order => \"id DESC\" )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end", "def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end", "def show\n @history = History. all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render 'show', format: 'json', handlers: 'jbuilder', status: :ok\n }\n end\n end", "def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end", "def index\n @favories = Favory.all\n end", "def show\n render json: @history\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def show\n @category_history = CategoryHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_history }\n end\n end", "def index\n @daily_horoscopes = DailyHoroscope.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_horoscopes }\n end\n end", "def show\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_history }\n end\n end", "def show\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_feature }\n end\n end", "def index\n @family_relationships = FamilyRelationship.all\n end", "def index\n @document_histories = DocumentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @document_histories }\n end\n end", "def show\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_blog }\n end\n end", "def history(level)\n data = @data['families'].find { |type| type['name'] == 'History' }\n badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) }\n HQTrivia::Badge.new(badge)\n end", "def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_histories }\n end\n end", "def index\n @reading_histories = current_user.reading_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reading_histories }\n end\n end", "def show\n render json: @family_image\n end", "def show\n render json: @service_history\n end", "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n past_histories = PastHistory.where(user_id: params[:user_id])\n render json: past_histories.as_json(include: :recipe, only: :created_at)\n end", "def index\n @families = Family.all\n end", "def index\n @families = Family.all\n end", "def index\n @families = Family.all\n end", "def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end", "def destroy\n @family_history.destroy\n respond_to do |format|\n format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @buying_history = BuyingHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @buying_history }\n end\n end", "def show\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_history }\n end\n end", "def index\n @drink_histories = DrinkHistory.first(100)\n end", "def getjson\n sha = params[:data]\n history = History.find_or_initialize_by({:sha => sha})\n if !history.new_record?\n render :json => history.json.to_json\n else\n raise ActionController::RoutingError.new('Not Found')\n end\n end", "def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end", "def show\n @daily_horoscope = DailyHoroscope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_horoscope }\n end\n end", "def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def show\n @holy_book = HolyBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holy_book }\n end\n end", "def get_history_version(title_number, version)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?version=' + version.to_s)\n\n if (response.code != '200') then\n raise \"Failed to retrieve historical version specified: \" + response.body\n end\n\n return JSON.parse(response.body)\nend", "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def index\n @sales_tax_exemption_customer_histories = SalesTaxExemptionCustomerHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_tax_exemption_customer_histories }\n end\n end", "def show\n @farm = Farm.find(params[:id])\n @herds = Herd.where(:farm_id => @farm.id)\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @farm }\n end\n end", "def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end", "def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end", "def index\r\n @families = Family.all\r\n end", "def query_histories_with_http_info(project_id, body, opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: SearchApi.query_histories ...\"\r\n end\r\n # verify the required parameter 'project_id' is set\r\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling SearchApi.query_histories\" if project_id.nil?\r\n # verify the required parameter 'body' is set\r\n fail ArgumentError, \"Missing the required parameter 'body' when calling SearchApi.query_histories\" if body.nil?\r\n # resource path\r\n local_var_path = \"/api/v3/projects/{projectId}/histories\".sub('{format}','json').sub('{' + 'projectId' + '}', project_id.to_s)\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\r\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = @api_client.object_to_http_body(body)\r\n auth_names = ['Authorization']\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'ArtifactHistoryResource')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: SearchApi#query_histories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end", "def index\n @harvest_histories = HarvestHistory.all\n end", "def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\n end\n end", "def index\n @three_child_histories = ThreeChildHistory.all\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end", "def index\n @historic_refinancings = HistoricRefinancing.all\n end", "def index\n @service_histories = ServiceHistory.all\n end", "def show\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_usership }\n end\n end", "def index\n @thermostat_histories = ThermostatHistory.all\n end", "def show\n @asset_allocation_history = AssetAllocationHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset_allocation_history }\n end\n end", "def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\n end\n end", "def show\n @father = Father.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @father }\n end\n end", "def show\n @herb = Herb.find_by_permalink(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @herb }\n end\n end", "def index\n @historics = Historic.all\n end", "def index\n @historicals = @project.historical\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @historicals }\n end\n end", "def create\n @family_history = FamilyHistory.new(family_history_params)\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully created.' }\n format.json { render :show, status: :created, location: @family_history }\n else\n format.html { render :new }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end", "def index\n @bhistories = Bhistory.all\n end", "def show\n @favorite_bundle = FavoriteBundle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favorite_bundle }\n end\n end", "def show\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @control_family }\n end\n end", "def show\n @howner = Howner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @howner }\n end\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\n @medical_histories = MedicalHistory.all\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def show\n @breadcrumb = 'read'\n @product_family = ProductFamily.find(params[:id])\n @products = @product_family.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n @stocks = @product_family.product_family_stocks.paginate(:page => params[:page], :per_page => per_page).order('store_id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_family }\n end\n end", "def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end" ]
[ "0.7502044", "0.74096537", "0.6789069", "0.67738414", "0.65864724", "0.6479679", "0.6472558", "0.6462367", "0.63592696", "0.6343431", "0.63351244", "0.6300005", "0.62610215", "0.6254033", "0.62124187", "0.61935014", "0.61935014", "0.6092397", "0.6086366", "0.60638154", "0.60629666", "0.60487735", "0.604618", "0.60447896", "0.60447896", "0.60082495", "0.6007506", "0.59988135", "0.5963646", "0.5960147", "0.5956612", "0.5945304", "0.59370553", "0.59186393", "0.5900543", "0.58971107", "0.58873534", "0.5880122", "0.5872397", "0.58476603", "0.58326775", "0.581631", "0.58142823", "0.5809378", "0.5806808", "0.5804761", "0.580307", "0.57996804", "0.57970035", "0.5773483", "0.5772227", "0.5772111", "0.57690847", "0.57630944", "0.57623583", "0.57623583", "0.57623583", "0.5742359", "0.5738609", "0.57352304", "0.5712167", "0.5696993", "0.5688397", "0.5682062", "0.5679336", "0.5674089", "0.5669163", "0.56671894", "0.56617814", "0.56600463", "0.56597465", "0.5657302", "0.56554294", "0.5646108", "0.5635931", "0.56277734", "0.56247514", "0.56192786", "0.5614996", "0.560995", "0.5601161", "0.56010807", "0.559778", "0.5597288", "0.5594334", "0.5593168", "0.55913347", "0.55910885", "0.5591031", "0.5576805", "0.5575666", "0.5574423", "0.55713916", "0.5570215", "0.55688345", "0.55685097", "0.55681664", "0.55681664", "0.5567738", "0.5566763", "0.5563781" ]
0.0
-1
POST /family_histories POST /family_histories.json
def create @family_history = FamilyHistory.new(family_history_params) respond_to do |format| if @family_history.save format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully created.' } format.json { render :show, status: :created, location: @family_history } else format.html { render :new } format.json { render json: @family_history.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @family_history = FamilyHistory.new(params[:family_history])\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully created.' }\n format.json { render json: @family_history, status: :created, location: @family_history }\n else\n format.html { render action: PersonalDetail.find(@family_history.personal_detail_id) }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @family_histories = FamilyHistory.all\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end", "def create\n @historial = Historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @historial, notice: 'Historial was successfully created.' }\n format.json { render :show, status: :created, location: @historial }\n else\n format.html { render :new }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @histroal = Historial.new(histroal_params)\n\n respond_to do |format|\n if @histroal.save\n format.html { redirect_to @histroal, notice: 'Historial was successfully created.' }\n format.json { render :show, status: :created, location: @histroal }\n else\n format.html { render :new }\n format.json { render json: @histroal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@fundamentals_history = FundamentalsHistory.new\n @fundamentals_history = @company.fundamentals_histories.build(params[:fundamentals_history])\n\n respond_to do |format|\n if @fundamentals_history.save\n format.html { redirect_to @fundamentals_history, notice: 'Fundamentals history was successfully created.' }\n format.json { render json: @fundamentals_history, status: :created, location: @fundamentals_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundamentals_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def create\n @habit = Habit.new(habit_params)\n @habit.source = params[:for_family].to_i == 1 ? current_family : current_user\n\n respond_to do |format|\n if @habit.save\n format.html { redirect_to habit_path(@habit), notice: '習慣データを作成しました.' }\n format.json { render json: @habit, status: :created, location: @habit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @habit.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_to_historical(data_hash, title_number)\n\n response = rest_post_call($HISTORIAN_URL + '/' + title_number, data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to create the historical data: \" + response.body\n end\n\n return response.body\nend", "def create\n @historial_odt = HistorialOdt.new(params[:historial_odt])\n\n respond_to do |format|\n if @historial_odt.save\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully created.' }\n format.json { render json: @historial_odt, status: :created, location: @historial_odt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts :family\n @family = FamilyDecorator.decorate(Family.new(params[:family]))\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end", "def index\n @fundamentals_histories = @company.fundamentals_histories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamentals_histories }\n end\n end", "def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end", "def create\n @foodhistory = Foodhistory.new(foodhistory_params)\n @foodhistory.user_id = current_user.id\n\n respond_to do |format|\n if @foodhistory.save\n format.html { redirect_to @foodhistory, notice: 'Foodhistory was successfully created.' }\n format.json { render :show, status: :created, location: @foodhistory }\n else\n format.html { render :new }\n format.json { render json: @foodhistory.errors, status: :unprocessable_entity }\n end\n end\n end", "def family_history_params\n params.require(:family_history).permit(:first_name, :last_name, :relationship, :dob, :dod, :medical_history, :patient_id)\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def destroy\n @family_history.destroy\n respond_to do |format|\n format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @housing_feature = HousingFeature.new(params[:housing_feature])\n\n respond_to do |format|\n if @housing_feature.save\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully created.' }\n format.json { render json: @housing_feature, status: :created, location: @housing_feature }\n else\n format.html { render action: \"new\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @historial = Historial.new(params[:historial])\n @historial.cartucho = Cartucho.find(params[:cartucho_id])\n \n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @historial = @customer.historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n format.html { redirect_to @customer}\n format.json { render :show, status: :created, location: @historial }\n else\n format.html { render :new }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end", "def create\n @votaciones_hist = VotacionesHist.new(votaciones_hist_params)\n\n respond_to do |format|\n if @votaciones_hist.save\n format.html { redirect_to @votaciones_hist, notice: 'Votaciones hist was successfully created.' }\n format.json { render :show, status: :created, location: @votaciones_hist }\n else\n format.html { render :new }\n format.json { render json: @votaciones_hist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @harvest_history = HarvestHistory.new(harvest_history_params)\n\n respond_to do |format|\n if @harvest_history.save\n format.html { redirect_to @harvest_history, notice: 'Harvest history was successfully created.' }\n format.json { render :show, status: :created, location: @harvest_history }\n else\n format.html { render :new }\n format.json { render json: @harvest_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @os_family = OsFamily.new(os_family_params)\n\n respond_to do |format|\n if @os_family.save\n format.html { redirect_to @os_family, notice: 'Os family was successfully created.' }\n format.json { render :show, status: :created, location: @os_family }\n else\n format.html { render :new }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def family_history_params\n params.require(:family_history).permit(\n :user_id, :family_member_relation, :prion_disease, :cardiac_disease, :cardiac_event, :cardiac_event_ages,:cardiac_death, :cardiac_death_age, :diabetes, :diabetes_type, :organ_diseases,:organ_disease_name, :respiratory_disease, :respiratory_disease_names, :cancer, :cancer_death, :cancer_types, :cancer_event_age, :high_blood_pressure, :stroke, :alzheimers_or_dementia, :osteoporosis, :bleeding_disorder)\n end", "def create\n @album = Album.new(album_params)\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n @album.update_histories.create(user_id: current_user.id, action_type: UpdateHistory::ALBUM_CREATE)\n format.html { redirect_to @album, notice: 'アルバムを作成しました。' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @illness_history = current_user.illness_histories.new(params[:illness_history])\n\n respond_to do |format|\n if @illness_history.save\n flash[:notice] = 'IllnessHistory was successfully created.'\n format.html { redirect_to(medical_histories_path) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @family_relationship = FamilyRelationship.new(family_relationship_params)\n\n respond_to do |format|\n if @family_relationship.save\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully created.' }\n format.json { render :show, status: :created, location: @family_relationship }\n else\n format.html { render :new }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @historical = Historical.new(params[:historical])\n\n respond_to do |format|\n if @historical.save\n format.html { redirect_to @historical, notice: 'Historical was successfully created.' }\n format.json { render json: @historical, status: :created, location: @historical }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @weekly_histogram = WeeklyHistogram.new(weekly_histogram_params)\n\n respond_to do |format|\n if @weekly_histogram.save\n format.html { redirect_to @weekly_histogram, notice: 'Weekly histogram was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_histogram }\n else\n format.html { render :new }\n format.json { render json: @weekly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @herb = Herb.new(params[:herb])\n\n respond_to do |format|\n if @herb.save\n format.html { redirect_to @herb, notice: 'Herb was successfully created.' }\n format.json { render json: @herb, status: :created, location: @herb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @herb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @farmer_family = @farmer.farmer_families.build(farmer_family_params)\n\n respond_to do |format|\n if @farmer_family.save\n SystemLog.create(description: \"Cadastraou uma novo membro da família para o agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia adicionado com sucesso' }\n format.json { render :show, status: :created, location: @farmer_family }\n else\n format.html { render :new }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @family_image = FamilyImage.new(family_image_params)\n\n if @family_image.save\n render json: @family_image, status: :created, location: @family_image\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def create\n @reading_history = @user.reading_histories.build(params[:reading_history])\n\n respond_to do |format|\n if @reading_history.save\n format.html { redirect_to '/', notice: 'new reading history was successfully added.' }\n format.json { render json: @reading_history, status: :created, location: @reading_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reading_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def create\n @paciente = Paciente.new(paciente_params)\n @paciente.user=current_user\n\n respond_to do |format|\n if @paciente.save\n historial=Historial.new\n historial.paciente=@paciente\n historial.save\n\n format.html { redirect_to @paciente, notice: 'Paciente creado exitosamente.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @housing = Housing.new(housing_params)\n\n respond_to do |format|\n if @housing.save\n format.html { redirect_to @housing, notice: 'Housing was successfully created.' }\n format.json { render :show, status: :created, location: @housing }\n else\n format.html { render :new }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_history.update(family_history_params)\n format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_history }\n else\n format.html { render :edit }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @buying_history = BuyingHistory.new(params[:buying_history])\n\n respond_to do |format|\n if @buying_history.save\n format.html { redirect_to @buying_history, :notice => 'Buying history was successfully created.' }\n format.json { render :json => @buying_history, :status => :created, :location => @buying_history }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @buying_history.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tracing_couple_family = TracingCoupleFamily.new(tracing_couple_family_params)\n\n\n respond_to do |format|\n if @tracing_couple_family.save\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully created.' }\n format.json { render :show, status: :created, location: @tracing_couple_family }\n else\n format.html { render :new }\n format.json { render json: @tracing_couple_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aircraft = Aircraft.find(params[:aircraft_id])\n @aircraft_history = @aircraft.aircraft_histories.create(params[:aircraft_history])\n redirect_to aircraft_path(@aircraft)\n end", "def create\n historial_params = params[:historial]\n with_bill = historial_params.delete(:with_bill)\n @historial = Historial.new(historial_params)\n\n respond_to do |format|\n if @historial.save\n if with_bill.present?\n format.html { redirect_to new_bill_path(\n client_id: @historial.cliente_id,\n historial_id: @historial.id\n ), notice: 'Presupuesto ha sido creado.' }\n else\n format.html { redirect_to @historial, notice: 'Presupuesto ha sido creado.' }\n end\n format.json { render json: @historial, status: :created, location: @historial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @historic = Historic.new(historic_params)\n\n respond_to do |format|\n if @historic.save\n format.html { redirect_to @historic, notice: 'Historic was successfully created.' }\n format.json { render :show, status: :created, location: @historic }\n else\n format.html { render :new }\n format.json { render json: @historic.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def new\n @fundamentals_history = FundamentalsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def index\n @formating_histories = FormatingHistory.all\n end", "def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @experience_history = ExperienceHistory.new(params[:experience_history])\n\n respond_to do |format|\n if @experience_history.save\n format.html { redirect_to @experience_history, notice: 'Experience history was successfully created.' }\n format.json { render json: @experience_history, status: :created, location: @experience_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @experience_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_foodhistory\n @foodhistory = Foodhistory.find(params[:id])\n end", "def create\n @s_history = SHistory.new(s_history_params)\n\n respond_to do |format|\n if @s_history.save\n logger = MyLogger.instance\n logger.logInformation(\"******** History *******\")\n logger.logInformation(\"New History entry: \" + @s_history.staff.staff_number + ' - ' + @s_history.staff.name + ',' + @s_history.staff.surname)\n logger.logInformation(\"entry type: \" + @s_history.type_ent.description)\n\n format.html { redirect_to @s_history, notice: 'Staff history entry was successfully created.' }\n format.json { render :show, status: :created, location: @s_history }\n else\n format.html { render :new }\n format.json { render json: @s_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @formating_history = FormatingHistory.new(formating_history_params)\n\n respond_to do |format|\n if @formating_history.save\n format.html { redirect_to @formating_history, notice: 'Formating history was successfully created.' }\n format.json { render :show, status: :created, location: @formating_history }\n else\n format.html { render :new }\n format.json { render json: @formating_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end", "def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :created, :location => @control_family }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end", "def create\n @historic_refinancing = HistoricRefinancing.new(historic_refinancing_params)\n\n respond_to do |format|\n if @historic_refinancing.save\n format.html { redirect_to @historic_refinancing, notice: 'Historic refinancing was successfully created.' }\n format.json { render :show, status: :created, location: @historic_refinancing }\n else\n format.html { render :new }\n format.json { render json: @historic_refinancing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sub_family = SubFamily.new(sub_family_params)\n\n respond_to do |format|\n if @sub_family.save\n format.html { redirect_to @sub_family, notice: 'Sub familia foi criada.' }\n format.json { render :show, status: :created, location: @sub_family }\n else\n format.html { render :new }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:family][:user_id] = current_user.id if params[:family][:user_id]==nil\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n @family = Family.new(family_params)\n # if current_user.families.count == 0\n # current_user.username = @family.name\n # current_user.save\n # end\n\n respond_to do |format|\n if @family.save\n format.json { render json: {created: @family} }\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :new }\n end\n end\n end", "def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @heirarchy = Heirarchy.new(heirarchy_params)\n\n respond_to do |format|\n if @heirarchy.save\n format.html { redirect_to @heirarchy, notice: 'Heirarchy was successfully created.' }\n format.json { render json: {success: @heirarchy } }\n else\n format.html { render :new }\n format.json { render json: {error: @heirarchy.errors } }\n end\n end\n end", "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def create\n @book_history = BookHistory.new(book_history_params)\n\n respond_to do |format|\n if @book_history.save\n format.html { redirect_to @book_history, notice: 'Book history was successfully created.' }\n format.json { render :show, status: :created, location: @book_history }\n else\n format.html { render :new }\n format.json { render json: @book_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hastag = Hastag.new(hastag_params)\n\n respond_to do |format|\n if @hastag.save\n format.html { redirect_to @hastag, notice: 'Hastag was successfully created.' }\n format.json { render :show, status: :created, location: @hastag }\n else\n format.html { render :new }\n format.json { render json: @hastag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @weight_history = WeightHistory.new(weight_history_params)\n\n respond_to do |format|\n if @weight_history.save\n format.html { redirect_to @weight_history, notice: \"Weight history was successfully created.\" }\n format.json { render :show, status: :created, location: @weight_history }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @weight_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def create\n\t\tauthorize! :create, HistorialEstadoPresupuesto\n @historial_estado_presupuesto = HistorialEstadoPresupuesto.new(historial_estado_presupuesto_params)\n\n respond_to do |format|\n if @historial_estado_presupuesto.save\n format.html { redirect_to @historial_estado_presupuesto, notice: 'Historial estado presupuesto fue creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @historial_estado_presupuesto }\n else\n format.html { render :new }\n format.json { render json: @historial_estado_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @history = History.new(history_params)\n\n respond_to do |format|\n if @history.save\n format.html { redirect_to @history, notice: 'History was successfully created.' }\n format.json { render action: 'show', status: :created, location: @history }\n else\n format.html { render action: 'new' }\n format.json { render json: @history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @family_blog = FamilyBlog.new(params[:family_blog])\n\n respond_to do |format|\n if @family_blog.save\n @person = Person.find_by_id(@family_blog.person_id)\n format.html { redirect_to @person, notice: 'Family blog was successfully created.' }\n format.json { render json: @family_blog, status: :created, location: @family_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_blog.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @housing_feature = HousingFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_feature }\n end\n end", "def frequent_foods\n get(\"/user/#{@user_id}/foods/log/frequent.json\")\n end", "def create\n @daily_happiness = DailyHappiness.new(daily_happiness_params)\n\n respond_to do |format|\n if @daily_happiness.save\n format.html { redirect_to @daily_happiness, notice: 'Daily happiness was successfully created.' }\n format.json { render :show, status: :created, location: @daily_happiness }\n else\n format.html { render :new }\n format.json { render json: @daily_happiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medical_history = MedicalHistory.new(medical_history_params)\n\n respond_to do |format|\n if @medical_history.save\n format.html { redirect_to @medical_history, notice: 'Medical history was successfully created.' }\n format.json { render :show, status: :created, location: @medical_history }\n else\n format.html { render :new }\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medical_history = MedicalHistory.new(medical_history_params)\n\n respond_to do |format|\n if @medical_history.save\n format.html { redirect_to @medical_history, notice: 'Medical history was successfully created.' }\n format.json { render :show, status: :created, location: @medical_history }\n else\n format.html { render :new }\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def historial_params\n params.require(:historial).permit(:alum_id, :mat_id, :calif_1, :calif_2, :calif_3, :final, :ext_1, :ext_2, :esp)\n end", "def create\n @purchased_history = PurchasedHistory.new(purchased_history_params)\n\n respond_to do |format|\n if @purchased_history.save\n format.html { redirect_to @purchased_history, notice: 'Purchased history was successfully created.' }\n format.json { render :show, status: :created, location: @purchased_history }\n else\n format.html { render :new }\n format.json { render json: @purchased_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @flat_happening = FlatHappening.where(:namespaced_id => params[:flat_happening][:namespaced_id]).first_or_initialize(params[:flat_happening])\n # @happening = Happening.where(:source => params[:happening][:source], :meta => params[:happening][:meta]).first_or_initialize(create_params)\n\n if @flat_happening.save\n render json: @flat_happening, status: :created\n # , location: @flat_happening\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "def create\n @change_history = ChangeHistory.new(params[:change_history])\n\n respond_to do |format|\n if @change_history.save\n format.html { redirect_to @change_history, notice: 'Change history was successfully created.' }\n format.json { render json: @change_history, status: :created, location: @change_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @change_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @medical_history = MedicalHistory.new(medical_history_params)\r\n\r\n respond_to do |format|\r\n if @medical_history.save\r\n format.html { redirect_to @medical_history, notice: 'Historial medico creado con exito.' }\r\n format.json { render :show, status: :created, location: @medical_history }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n if @family_history.update_attributes(params[:family_history])\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patient_history = PatientHistory.new(params[:patient_history])\n\n respond_to do |format|\n if @patient_history.save\n format.html { redirect_to @patient_history, notice: 'Patient history was successfully created.' }\n format.json { render json: @patient_history, status: :created, location: @patient_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.find(params[:employee_id])\n \n @work_history = @employee.work_histories.new(work_history_params)\n skip_authorization\n\n respond_to do |format|\n if @work_history.save\n format.html { redirect_to admin_employee_work_histories_path(@employee), notice: 'Work history was successfully created.' }\n format.json { render :show, status: :created, location: @work_history }\n else\n format.html { render :new }\n format.json { render json: @work_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pediatric_history = PediatricHistory.new(pediatric_history_params)\n\n respond_to do |format|\n if @pediatric_history.save\n format.html { redirect_to @pediatric_history, notice: 'Historial pediatrico creado con exito.' }\n format.json { render :show, status: :created, location: @pediatric_history }\n else\n format.html { render :new }\n format.json { render json: @pediatric_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @product_family = ProductFamily.new(params[:product_family])\n @product_family.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.save\n format.html { redirect_to @product_family, notice: crud_notice('created', @product_family) }\n format.json { render json: @product_family, status: :created, location: @product_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @female_shot_put = FemaleShotPut.new(female_shot_put_params)\n\n respond_to do |format|\n if @female_shot_put.save\n format.html { redirect_to action:index, notice: 'Female shot put was successfully created.' }\n format.json { render :show, status: :created, location: @female_shot_put }\n else\n format.html { render :new }\n format.json { render json: @female_shot_put.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @water_history = WaterHistory.new(water_history_params)\n\n respond_to do |format|\n if @water_history.save\n format.html { redirect_to @water_history, notice: 'Water history was successfully created.' }\n format.json { render :show, status: :created, location: @water_history }\n else\n format.html { render :new }\n format.json { render json: @water_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @med_history = @patient.med_histories.new(med_history_params)\n\n respond_to do |format|\n if @med_history.save\n # format.html { redirect_to @med_history, notice: 'Med history was successfully created.' }\n # byebug\n format.html { redirect_to edit_patient_path(@med_history.patient.id), notice: 'Med history was successfully created.' }\n\n format.json { render :show, status: :created, location: @med_history }\n else\n format.html { render :new }\n format.json { render json: @med_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end", "def create\n @habit = Habit.new(params[:habit])\n current_user.habits << @habit\n\n respond_to do |format|\n if @habit.save\n format.html { redirect_to habits_path, notice: 'Habit was successfully created.' }\n format.json { render json: @habit, status: :created, location: @habit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @habit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dating_history = DatingHistory.new(dating_history_params)\n\n respond_to do |format|\n if @dating_history.save\n format.html { redirect_to @dating_history, notice: 'Dating history was successfully created.' }\n format.json { render :show, status: :created, location: @dating_history }\n else\n format.html { render :new }\n format.json { render json: @dating_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @operation_history = OperationHistory.new(params[:operation_history])\n\n respond_to do |format|\n if @operation_history.save\n format.html { redirect_to @operation_history, notice: 'Operation history was successfully created.' }\n format.json { render json: @operation_history, status: :created, location: @operation_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @operation_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "def create\n @father = Father.new(params[:father])\n\n respond_to do |format|\n if @father.save\n format.html { redirect_to @father, notice: 'Father was successfully created.' }\n format.json { render json: @father, status: :created, location: @father }\n else\n format.html { render action: \"new\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66057336", "0.6605026", "0.6574083", "0.64806885", "0.6414705", "0.6218579", "0.6141314", "0.59926724", "0.59926724", "0.5957328", "0.5945642", "0.5911225", "0.5866166", "0.57638484", "0.5754734", "0.57402015", "0.5734575", "0.5723629", "0.57108974", "0.57061374", "0.5661345", "0.5641938", "0.5628851", "0.5616401", "0.56007093", "0.55943596", "0.5577256", "0.5575252", "0.5560192", "0.554041", "0.55373204", "0.552334", "0.5517173", "0.5515433", "0.549875", "0.5497752", "0.5489468", "0.54746336", "0.5457851", "0.54460424", "0.54363364", "0.54302835", "0.5397268", "0.5391922", "0.53873867", "0.53836346", "0.537606", "0.5373628", "0.5372797", "0.53721005", "0.53630805", "0.53602374", "0.5358632", "0.5350869", "0.53493685", "0.53471494", "0.5343784", "0.5342218", "0.5341685", "0.5338804", "0.5337255", "0.5330111", "0.5329468", "0.53292036", "0.5316031", "0.5311115", "0.53082645", "0.5307467", "0.53071636", "0.53005195", "0.52968353", "0.52935594", "0.52923834", "0.5291319", "0.5285767", "0.5285262", "0.52827066", "0.527958", "0.5276807", "0.5273297", "0.5273297", "0.52725625", "0.5255327", "0.52550226", "0.5254927", "0.5251293", "0.5251083", "0.52464205", "0.5242914", "0.52278566", "0.52265143", "0.5220349", "0.5209047", "0.5208685", "0.52058077", "0.5203436", "0.5203389", "0.519992", "0.5199701", "0.51893616" ]
0.6653563
0
PATCH/PUT /family_histories/1 PATCH/PUT /family_histories/1.json
def update respond_to do |format| if @family_history.update(family_history_params) format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully updated.' } format.json { render :show, status: :ok, location: @family_history } else format.html { render :edit } format.json { render json: @family_history.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n if @family_history.update_attributes(params[:family_history])\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @historial.update(historial_params)\n format.html { redirect_to @historial, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @historial }\n else\n format.html { render :edit }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @historial.update(historial_params)\n format.html { redirect_to @historial, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @historial }\n else\n format.html { render :edit }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(params[:historial])\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foodhistory.update(foodhistory_params)\n format.html { redirect_to @foodhistory, notice: 'Foodhistory was successfully updated.' }\n format.json { render :show, status: :ok, location: @foodhistory }\n else\n format.html { render :edit }\n format.json { render json: @foodhistory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @family.update(family_params)\r\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @family }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @histroal.update(histroal_params)\n format.html { redirect_to @histroal, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @histroal }\n else\n format.html { render :edit }\n format.json { render json: @histroal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end", "def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n old = @hr_person\n if @hr_person.update(hr_person_params)\n if params[:change_seat]\n @hr_person.hr_person_histories.create(old.attributes.except('id', 'created_by', 'updated_by', 'created_at', 'updated_at'))\n end\n format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '资料创建成功!') }\n format.json { render :show, status: :ok, location: @hr_person }\n else\n format.html { render :edit }\n format.json { render json: @hr_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@fundamentals_history = FundamentalsHistory.find(params[:id])\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n if @fundamentals_history.update_attributes(params[:fundamentals_history])\n format.html { redirect_to @fundamentals_history, notice: 'Fundamentals history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamentals_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub_family.update(sub_family_params)\n format.html { redirect_to @sub_family, notice: 'Sub família foi atualizada.' }\n format.json { render :show, status: :ok, location: @sub_family }\n else\n format.html { render :edit }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_relationship.update(family_relationship_params)\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_relationship }\n else\n format.html { render :edit }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n if @historial_odt.update_attributes(params[:historial_odt])\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @product_family = ProductFamily.find(params[:id])\n @product_family.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n format.html { redirect_to @product_family,\n notice: (crud_notice('updated', @product_family) + \"#{undo_link(@product_family)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favory.update(favory_params)\n format.html { redirect_to @favory, notice: \"Favory was successfully updated.\" }\n format.json { render :show, status: :ok, location: @favory }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @favory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family = Family.find(params[:id])\n\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = \"Family #{@family.business_name} was successfully updated.\"\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tracing_couple_family.update(tracing_couple_family_params)\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully updated.' }\n format.json { render :show, status: :ok, location: @tracing_couple_family }\n else\n format.html { render :edit }\n format.json { render json: @tracing_couple_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html {\n redirect_to housings_url, notice: 'Housing was successfully updated.' }\n format.json {\n render json: {}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html { redirect_to @housing, notice: 'Housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_family.update(os_family_params)\n format.html { redirect_to @os_family, notice: 'Os family was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_family }\n else\n format.html { render :edit }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@family ||= Family.find(params[:id])\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = 'Family was successfully updated.'\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @farmer_family.update(farmer_family_params)\n SystemLog.create(description: \"Atualizou as informações do membro da família do agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @farmer_family }\n else\n format.html { render :edit }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @history.update(history_params)\n format.html { redirect_to @history, notice: 'History was successfully updated.' }\n # format.json { render :show, status: :ok, location: @history }\n upper = @history.fandom_id ? @history.fandom : @history.history\n format.json { return render json: { data: @history, upper: upper, status: :ok } }\n else\n format.html { render :edit }\n # format.json { render json: @history.errors, status: :unprocessable_entity }\n format.json { return render json: { data: @history, status: :unprocessable_entity, message: \"The History's Date (#{@history.event_date.strftime('%F')}) is already exist!\" } }\n end\n end\n end", "def update\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n if @control_family.update_attributes(params[:control_family])\n format.html { redirect_to @control_family, :notice => 'Control family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @female_shot_put.update(female_shot_put_params)\n format.html { redirect_to @female_shot_put, notice: 'Female shot put was successfully updated.' }\n format.json { render :show, status: :ok, location: @female_shot_put }\n else\n format.html { render :edit }\n format.json { render json: @female_shot_put.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @historic.update(historic_params)\n format.html { redirect_to @historic, notice: 'Historic was successfully updated.' }\n format.json { render :show, status: :ok, location: @historic }\n else\n format.html { render :edit }\n format.json { render json: @historic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_document.update(family_document_params)\n format.html { redirect_to @family_document, notice: \"Family document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @family_document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def set_family_history\n @family_history = FamilyHistory.find(params[:id])\n end", "def update\n @favorite_bundle = FavoriteBundle.find(params[:id])\n\n respond_to do |format|\n if @favorite_bundle.update_attributes(params[:favorite_bundle])\n format.html { redirect_to @favorite_bundle, notice: 'Favorite bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favorite_bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n historial_params = params[:historial]\n with_bill = historial_params.delete(:with_bill)\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(historial_params)\n if with_bill.present?\n format.html { redirect_to new_bill_path(\n client_id: @historial.cliente_id,\n historial_id: @historial.id\n ), notice: 'Presupuesto actualizado =)'}\n else\n format.html { redirect_to @historial, notice: 'Presupuesto actualizado =)' }\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @father = Father.find(params[:id])\n\n respond_to do |format|\n if @father.update_attributes(params[:father])\n format.html { redirect_to @father, notice: 'Father was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family = Family.find(params[:id])\n @user = User.find_by_email(session[:user_email])\n if @user && @user.identity == 2\n\t@family.approved_by = nil\n end\n respond_to do |format|\n if @family.update_attributes(params[:family])\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @h_old = @housing_detail.dup\n @h_old.save\n\n @housing_detail.status = 'Waiting for Approval'\n @housing_detail.version_id = HousingDetail.where(category_id: @h_old.category_id).maximum(:version_id) + 1\n @housing_detail.updatedby = current_user.email\n\n respond_to do |format|\n if @housing_detail.update(housing_detail_params)\n format.html { redirect_to @housing_detail, notice: 'Housing detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing_detail }\n else\n format.html { render :edit }\n format.json { render json: @housing_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def update\n @holy_book = HolyBook.find(params[:id])\n\n respond_to do |format|\n if @holy_book.update_attributes(params[:holy_book])\n format.html { redirect_to @holy_book, notice: 'Holy book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @holy_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @houmon.update(houmon_params)\n format.html { redirect_to @houmon, notice: 'Houmon was successfully updated.' }\n format.json { render :show, status: :ok, location: @houmon }\n else\n format.html { render :edit }\n format.json { render json: @houmon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n if @family_unit.update_attributes(params[:family_unit])\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @habitant.update(habitant_params)\n format.html { redirect_to @habitant, notice: 'Habitant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @habitant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @single_housing.update(single_housing_params)\n format.html { redirect_to @single_housing, notice: 'Single housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @single_housing }\n else\n format.html { render :edit }\n format.json { render json: @single_housing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n if @family_blog.update_attributes(params[:family_blog])\n format.html { redirect_to @family_blog, notice: 'Family blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_blog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @growth.update(growth_params)\n format.html { redirect_to @growth, notice: 'Growth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @growth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @history.update(history_params)\n format.html { redirect_to @history, notice: 'History was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully created.' } \n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @family_group.update(family_group_params)\n format.html { redirect_to @family_group, notice: 'Family group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @barrels_income.update(barrels_income_params)\n format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barrels_income.errors, status: :unprocessable_entity }\n end\n end\n end", "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", "def update\n @daily_horoscope = DailyHoroscope.find(params[:id])\n\n respond_to do |format|\n if @daily_horoscope.update_attributes(params[:daily_horoscope])\n format.html { redirect_to @daily_horoscope, notice: 'Daily horoscope was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daily_horoscope.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n if @family_crest.update_attributes(params[:family_crest])\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @femalejump_head.update(femalejump_head_params)\n format.html { redirect_to @femalejump_head, notice: 'Femalejump head was successfully updated.' }\n format.json { render :show, status: :ok, location: @femalejump_head }\n else\n format.html { render :edit }\n format.json { render json: @femalejump_head.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @harvest_history.update(harvest_history_params)\n format.html { redirect_to @harvest_history, notice: 'Harvest history was successfully updated.' }\n format.json { render :show, status: :ok, location: @harvest_history }\n else\n format.html { render :edit }\n format.json { render json: @harvest_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_history.update(book_history_params)\n format.html { redirect_to @book_history, notice: 'Book history was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_history }\n else\n format.html { render :edit }\n format.json { render json: @book_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end", "def update\n respond_to do |format|\n if @historic_refinancing.update(historic_refinancing_params)\n format.html { redirect_to @historic_refinancing, notice: 'Historic refinancing was successfully updated.' }\n format.json { render :show, status: :ok, location: @historic_refinancing }\n else\n format.html { render :edit }\n format.json { render json: @historic_refinancing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n if @fishing_method.update_attributes(params[:fishing_method])\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @harvesting = Harvesting.find(params[:id])\n\n respond_to do |format|\n if @harvesting.update_attributes(params[:harvesting])\n format.html { redirect_to @harvesting, notice: 'Harvesting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @harvesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @housing_form = HousingForm.find(params[:id])\n\n respond_to do |format|\n if @housing_form.update_attributes(params[:housing_form])\n format.html { redirect_to @housing_form, notice: 'Housing form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @medical_history.update(medical_history_params)\n format.html { redirect_to @medical_history, notice: 'Medical history was successfully updated.' }\n format.json { render :show, status: :ok, location: @medical_history }\n else\n format.html { render :edit }\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @medical_history.update(medical_history_params)\n format.html { redirect_to @medical_history, notice: 'Medical history was successfully updated.' }\n format.json { render :show, status: :ok, location: @medical_history }\n else\n format.html { render :edit }\n format.json { render json: @medical_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @votaciones_hist.update(votaciones_hist_params)\n format.html { redirect_to @votaciones_hist, notice: 'Votaciones hist was successfully updated.' }\n format.json { render :show, status: :ok, location: @votaciones_hist }\n else\n format.html { render :edit }\n format.json { render json: @votaciones_hist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @bookid = params[:id]\n @childid = params[:hire][:childid]\n\n respond_to do |format|\n if @hire.update(hire_params)\n format.html { redirect_to @hire, notice: \"Updated! Nice work.\" }\n format.js.coffee { }\n format.json { render :show, status: :ok, location: @hire }\n else\n format.html { render :edit }\n format.json { render json: @hire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @homily.update(homily_params)\n \n format.html { redirect_to @homily, notice: 'Homily was successfully updated.' }\n format.json { render :show, status: :ok, location: @homily }\n else\n format.html { render :edit }\n format.json { render json: @homily.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n if @familium.update_attributes(params[:familium])\n format.html { redirect_to @familium, notice: 'Familia fue actualizada existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def update\n @chamado = Chamado.find(params[:id])\n\n respond_to do |format|\n if @chamado.update_attributes(params[:chamado])\n #Cria historico\n Audit.create(:idchamado => @chamado.id, :tipousuario => 1, :mudancas => @chamado.tracked_changes)\n \n format.html { redirect_to @chamado, notice: 'Chamado was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chamado.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formating_history.update(formating_history_params)\n format.html { redirect_to @formating_history, notice: 'Formating history was successfully updated.' }\n format.json { render :show, status: :ok, location: @formating_history }\n else\n format.html { render :edit }\n format.json { render json: @formating_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @history.update(history_params)\n format.html { redirect_to @history, notice: 'History was successfully updated.' }\n format.json {\n render 'show', format: 'json', handlers: 'jbuilder', status: :ok\n }\n else\n format.html { render :edit }\n format.json { render json: @history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @daily_happiness.update(daily_happiness_params)\n format.html { redirect_to @daily_happiness, notice: 'Daily happiness was successfully updated.' }\n format.json { render :show, status: :ok, location: @daily_happiness }\n else\n format.html { render :edit }\n format.json { render json: @daily_happiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thermostat_history.update(thermostat_history_params)\n format.html { redirect_to @thermostat_history, notice: 'Thermostat history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thermostat_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @rh.update(rh_params)\n format.html { redirect_to @rh, notice: 'Rh was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rh.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n if @experience_history.update_attributes(params[:experience_history])\n format.html { redirect_to @experience_history, notice: 'Experience history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taxon.update(taxon_params)\n format.html { redirect_to taxons_path, notice: \"Species: '#{@taxon.common_name}' was successfully updated.\" }\n format.json { render :show, status: :ok, location: @taxon }\n else\n format.html { render :edit }\n format.json { render json: @taxon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_fix_history.update(property_fix_history_params)\n format.html { redirect_to user_histories_path, notice: 'Property fix history was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_fix_history }\n else\n format.html { render :edit }\n format.json { render json: @property_fix_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hood.update(hood_params)\n format.html { redirect_to @hood, notice: 'Hood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource_response(@headline, headline_params)\n end", "def update\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n if @favourite_food.update_attributes(params[:favourite_food])\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @male_shot_put_head.update(male_shot_put_head_params)\n format.html { redirect_to @male_shot_put_head, notice: 'Male shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @male_shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @male_shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n if @patient_history.update_attributes(params[:patient_history])\n format.html { redirect_to @patient_history, notice: 'Patient history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @housing = Housing.find(params[:id])\n\n respond_to do |format|\n if @housing.update_attributes(params[:housing])\n flash[:notice] = 'Housing was successfully updated.'\n format.html { redirect_to(@housing) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @housing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n if @barrio.update_attributes(params[:barrio])\n format.html { redirect_to @barrio, notice: 'Barrio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @language_family.update(language_family_params)\n format.html { redirect_to @language_family, notice: 'Language family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6985075", "0.6592985", "0.65639323", "0.65639323", "0.65053546", "0.64841425", "0.64764565", "0.64654005", "0.6414846", "0.6368925", "0.6331091", "0.62963295", "0.6273065", "0.6264191", "0.6253739", "0.6142333", "0.6139469", "0.61380905", "0.6137319", "0.6135581", "0.6109141", "0.60996246", "0.6099538", "0.60943013", "0.6072069", "0.6054153", "0.6050446", "0.6042568", "0.6027042", "0.60035425", "0.5998329", "0.5970243", "0.5950822", "0.5946946", "0.59439546", "0.59425664", "0.5939183", "0.59362644", "0.59362644", "0.5935633", "0.59045666", "0.5899945", "0.58794105", "0.5875143", "0.58609086", "0.58594483", "0.583434", "0.5829677", "0.58227503", "0.5799164", "0.57798445", "0.5778986", "0.57785463", "0.57746196", "0.57732034", "0.577202", "0.5770775", "0.5758733", "0.5756982", "0.5754749", "0.5752073", "0.5748464", "0.57480586", "0.57468486", "0.57442486", "0.57324237", "0.5729488", "0.57282925", "0.5725464", "0.5723343", "0.5723343", "0.57202107", "0.57185197", "0.5714455", "0.571095", "0.5709074", "0.56931806", "0.569235", "0.5691307", "0.56907326", "0.56816995", "0.56701267", "0.56686497", "0.5659587", "0.56593907", "0.56591195", "0.5658326", "0.5657497", "0.5656912", "0.5652032", "0.56520224", "0.56498396", "0.5647072", "0.5646133", "0.5645742", "0.5643069", "0.5642628", "0.5642189", "0.5636938", "0.5636519" ]
0.7013667
0
DELETE /family_histories/1 DELETE /family_histories/1.json
def destroy @family_history.destroy respond_to do |format| format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end", "def destroy\n @historial.destroy\n respond_to do |format|\n format.html { redirect_to historials_url, notice: 'Historial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @foodhistory.destroy\n respond_to do |format|\n format.html { redirect_to foodhistories_url, notice: 'Foodhistory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "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", "def destroy\n @histroal.destroy\n respond_to do |format|\n format.html { redirect_to historials_url, notice: 'Historial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unified_history.destroy\n respond_to do |format|\n format.html { redirect_to unified_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end", "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", "def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to session[:redirect_path] }\n format.json { head :ok }\n end\n end", "def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pediatric_history.destroy\n respond_to do |format|\n format.html { redirect_to pediatric_histories_url, notice: 'Historial borrado creado con exito.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @medical_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_histories_url, notice: 'Historial medico borrado con exito.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @item_history.destroy\n respond_to do |format|\n format.html { redirect_to bmet_item_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n #@fundamentals_history = FundamentalsHistory.find(params[:id])\n @fundamentals_history.destroy\n\n respond_to do |format|\n format.html { redirect_to company_fundamentals_histories_url(@company) }\n format.json { head :no_content }\n end\n end", "def destroy\n @change_history = ChangeHistory.find(params[:id])\n @change_history.destroy\n\n respond_to do |format|\n format.html { redirect_to change_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @history_thermostat.destroy\n respond_to do |format|\n format.html { redirect_to history_thermostats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @history.destroy\n respond_to do |format|\n format.html { redirect_to histories_url, notice: 'History was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @historic.destroy\n respond_to do |format|\n format.html { redirect_to historics_url, notice: 'Historic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @medical_history.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_histories_url, notice: 'Historial Medico eliminado.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @votaciones_hist.destroy\n respond_to do |format|\n format.html { redirect_to votaciones_hists_url, notice: 'Votaciones hist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_history = PatientHistory.find(params[:id])\n @patient_history.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @harvest_history.destroy\n respond_to do |format|\n format.html { redirect_to harvest_histories_url, notice: 'Harvest history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @medical_history.destroy\n respond_to do |format|\n format.html { redirect_to medical_histories_url, notice: 'Medical history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @three_child_history.destroy\n respond_to do |format|\n format.html { redirect_to three_child_histories_url, notice: 'Three child history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_history.destroy\n respond_to do |format|\n format.html { redirect_to visit_histories_url, notice: 'Visit history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "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", "def destroy\n @asset_allocation_history = AssetAllocationHistory.find(params[:id])\n @asset_allocation_history.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_allocation_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @herald.destroy\n respond_to do |format|\n format.html { redirect_to heralds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @history.destroy\n\n respond_to do |format|\n format.html { redirect_to(histories_url, :notice => \"削除しました\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @history_file_delete.destroy\n respond_to do |format|\n format.html { redirect_to history_file_deletes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medical_history.destroy\n respond_to do |format|\n format.html { redirect_to medical_histories_url, notice: 'Medical history was successfully destroyed.' }\n format.json { head :no_content }\n #format.json {render json: {id: @medical_history.id}, status: :ok}\n end\n end", "def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @operation_history = OperationHistory.find(params[:id])\n @operation_history.destroy\n\n respond_to do |format|\n format.html { redirect_to operation_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @s_history.destroy\n respond_to do |format|\n format.html { redirect_to s_histories_url, notice: 'S history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @experience_history = ExperienceHistory.find(params[:id])\n @experience_history.destroy\n\n respond_to do |format|\n format.html { redirect_to experience_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historic_refinancing.destroy\n respond_to do |format|\n format.html { redirect_to historic_refinancings_url, notice: 'Historic refinancing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bhistory.destroy\n respond_to do |format|\n format.html { redirect_to bhistories_url, notice: 'Bhistory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @heirarchy.destroy\n respond_to do |format|\n format.html { redirect_to heirarchies_url, notice: 'Heirarchy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dating_history.destroy\n respond_to do |format|\n format.html { redirect_to dating_histories_url, notice: 'Dating history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @formating_history.destroy\n respond_to do |format|\n format.html { redirect_to formating_histories_url, notice: 'Formating history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_history.destroy\n respond_to do |format|\n format.html { redirect_to patient_histories_url, notice: 'Patient history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @originating_history.destroy\n respond_to do |format|\n format.html { redirect_to originating_histories_url, notice: 'Originating history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @laptop_history.destroy\n respond_to do |format|\n format.html { redirect_to laptop_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_history = CategoryHistory.find(params[:id])\n @category_history.destroy\n\n respond_to do |format|\n format.html { redirect_to category_histories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_histogram.destroy\n respond_to do |format|\n format.html { redirect_to weekly_histograms_url, notice: 'Weekly histogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @query_history = QueryHistory.find(params[:id])\n @query_history.destroy\n\n respond_to do |format|\n format.html { redirect_to query_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_log = HeatLog.find(params[:id])\n @heat_log.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @family_relationship.destroy\n respond_to do |format|\n format.html { redirect_to family_relationships_url, notice: 'Family relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchased_history.destroy\n respond_to do |format|\n format.html { redirect_to purchased_histories_url, notice: 'Purchased history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end", "def destroy\n @os_family.destroy\n respond_to do |format|\n format.html { redirect_to os_families_url, notice: 'Os family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_horoscope = DailyHoroscope.find(params[:id])\n @daily_horoscope.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_horoscopes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chamado = Chamado.find(params[:id])\n @chamado.destroy\n\n #Deleta o historico\n @audits = Audit.find_all_by_idchamado(params[:id])\n\n @audits.each do |a|\n a.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to chamados_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @daily_happiness.destroy\n respond_to do |format|\n format.html { redirect_to daily_happinesses_url, notice: 'Daily happiness was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @med_history.destroy\n respond_to do |format|\n format.html { redirect_to med_histories_url, notice: 'Med history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quality_history = QualityHistory.find(params[:id])\n @quality_history.destroy\n\n respond_to do |format|\n format.html { redirect_to quality_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_account_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_account_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @node_history.destroy\n respond_to do |format|\n format.html { redirect_to node_histories_url, notice: 'Node history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @historical = Historical.find(params[:id])\n @historical.destroy\n\n respond_to do |format|\n format.html { redirect_to historicals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end", "def destroy\n @cocktail_history = CocktailHistory.find(params[:id])\n @cocktail_history.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktail_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # TODO: should admin or librarian be allowed to perform this action?\n @book_history.destroy\n respond_to do |format|\n format.html { redirect_to book_histories_url, notice: 'Book history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weight_history.destroy\n respond_to do |format|\n format.html { redirect_to weight_histories_url, notice: \"Weight history was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @house_hunter.destroy\n respond_to do |format|\n format.html { redirect_to house_hunters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_history.destroy\n\n head :no_content\n end", "def destroy\n @tracing_couple_family.destroy\n respond_to do |format|\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @houmon.destroy\n respond_to do |format|\n format.html { redirect_to houmons_url, notice: 'Houmon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @leader_history = LeaderHistory.find(params[:id])\n @leader_history.destroy\n\n respond_to do |format|\n format.html { redirect_to leader_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @male_shot_put_head.destroy\n respond_to do |format|\n format.html { redirect_to male_shot_put_heads_url, notice: 'Male shot put head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @medhistory = Medhistory.find(params[:id])\n @medhistory.destroy\n\n respond_to do |format|\n format.html { redirect_to medhistories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @document_history = DocumentHistory.find(params[:id])\n @document_history.destroy\n\n respond_to do |format|\n format.html { redirect_to document_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hd_dzp_history = Hd::DzpHistory.find(params[:id])\n @hd_dzp_history.destroy\n\n respond_to do |format|\n format.html { redirect_to hd_dzp_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @past_history.destroy\n respond_to do |format|\n format.html { redirect_to past_histories_url, notice: 'Past history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @female_shot_put.destroy\n respond_to do |format|\n format.html { redirect_to female_shot_puts_url, notice: 'Female shot put was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @buying_history = BuyingHistory.find(params[:id])\n @buying_history.destroy\n\n respond_to do |format|\n format.html { redirect_to buying_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rishabh.destroy\n respond_to do |format|\n format.html { redirect_to rishabhs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end", "def destroy\n @family_unit = FamilyUnit.find(params[:id])\n @family_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to family_units_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_history.destroy\n respond_to do |format|\n format.html { redirect_to service_histories_url, notice: 'Service history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @speaking_history.destroy\n respond_to do |format|\n format.html { redirect_to speaking_histories_url, notice: 'Speaking history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @femalejump_head.destroy\n respond_to do |format|\n format.html { redirect_to femalejump_heads_url, notice: 'Femalejump head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hpt_history = HptHistory.find(params[:id])\n @hpt_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(hpt_histories_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.77003956", "0.7304784", "0.7102137", "0.70926046", "0.7087947", "0.7070217", "0.70327663", "0.69991046", "0.6875669", "0.6871906", "0.68471956", "0.6830725", "0.6784044", "0.67737746", "0.6766836", "0.6754331", "0.67354196", "0.67286074", "0.6727467", "0.67243314", "0.6723221", "0.67193466", "0.6692354", "0.6690822", "0.66868246", "0.6686118", "0.6673393", "0.66728926", "0.66708744", "0.66658366", "0.66619426", "0.66585636", "0.6647183", "0.6646572", "0.66450936", "0.66385657", "0.6625066", "0.6613247", "0.66120917", "0.66115814", "0.6611568", "0.6605196", "0.66045", "0.66028184", "0.66003525", "0.6597346", "0.65874255", "0.65801394", "0.6578073", "0.65763295", "0.6574415", "0.65738046", "0.656327", "0.6553831", "0.653784", "0.65364", "0.65362984", "0.6535596", "0.6534904", "0.65332705", "0.6526509", "0.6522455", "0.6513431", "0.6509828", "0.65002435", "0.64913714", "0.64907473", "0.64872104", "0.6487195", "0.64865047", "0.647796", "0.6473589", "0.64663774", "0.64606017", "0.64600587", "0.64576423", "0.6456492", "0.6456326", "0.6449939", "0.64479756", "0.6446793", "0.64436215", "0.6442595", "0.64387137", "0.6437405", "0.6433721", "0.64330643", "0.64326227", "0.64321554", "0.6431138", "0.64310515", "0.64310515", "0.6430284", "0.6425212", "0.6421484", "0.6420958", "0.6419725", "0.64189786", "0.64156437", "0.64151525" ]
0.7507815
1
Use callbacks to share common setup or constraints between actions.
def set_family_history @family_history = FamilyHistory.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def family_history_params params.require(:family_history).permit(:first_name, :last_name, :relationship, :dob, :dod, :medical_history, :patient_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end" ]
[ "0.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683", "0.6290449", "0.6282986", "0.6241265", "0.62392694", "0.62192893", "0.621427", "0.62099457", "0.6195319", "0.61785376", "0.61747766", "0.6172739", "0.6162921", "0.6152228", "0.6152062", "0.6148811", "0.6122391", "0.6117956", "0.61083806", "0.6106195", "0.609274", "0.60815483", "0.60710186", "0.6064253", "0.60213476", "0.6018128", "0.60146624", "0.601063", "0.60068774", "0.60068774", "0.60026145", "0.6000521", "0.59987193", "0.5992379", "0.59922844", "0.5991889", "0.59803206", "0.5966244", "0.5959778", "0.5959708", "0.59588563", "0.5956974", "0.5953329", "0.59528023", "0.59439695", "0.59413165", "0.59397036", "0.59397036", "0.5933782", "0.59323835", "0.59258395", "0.59253365", "0.5917244", "0.59111005", "0.59093463", "0.5907942", "0.59047514", "0.58979666", "0.58971125", "0.589613", "0.5895083", "0.5893643", "0.5892825", "0.5887658", "0.5883417", "0.5878839", "0.5874345", "0.5869008", "0.5868205", "0.58672875", "0.5867031", "0.58662426", "0.5864551", "0.5863614", "0.5862626", "0.5861952", "0.58596134", "0.5855716", "0.58536863", "0.5851665", "0.5850823" ]
0.0
-1
Returns an array of routes, ignoring exceptions
def my_routes my_routes = [] exceptions = %w(Login Signin) self.class.routes['GET'].each do |r| route = r.first.to_s.gsub(/\W+|mix/,'').capitalize my_routes << route unless exceptions.include?(route) end return my_routes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def routes_normal\n return Array.new\n end", "def get_routes\n raise \"Method not implemented\"\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes_unhighlighted\n return Array.new\n end", "def routes_out_of_region\n return Array.new\n end", "def all_routes\n matching_routes\n end", "def allowed_routes\n introspector.routes.keep_if(&method(:allow_route?))\n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes\n raise NotImplementedError\n end", "def gather_endpoints_to_check\n Rails.application.routes.routes.map do |route|\n verb = route.verb.downcase.to_sym\n example_path = route.path.spec\n .to_s.gsub('(.:format)', '')\n .gsub(/:([^\\/]+)/,'SOME_PLACEHOLDER_PARAM')\n .gsub('*path', 'SOME_PLACEHOLDER_PATH')\n .gsub('*filename','SOME_PLACEHOLDER_FILENAME')\n next unless verb.present?\n [verb, example_path]\n end.compact\n end", "def show_all_routes\n if @routes.empty?\n routes_void\n else\n routes_list\n end\n end", "def routes\n @routes ||= load_routes\n end", "def routes_highlighted\n return Array.new\n end", "def recognized_routes_for(env)\n Array(router.recognize(env).first)\n end", "def all_selectable_routes\n (page_routes + rails_routes).uniq.sort\n end", "def routes\n @route_map.dup\n end", "def routers\n @cons.map{|c| c[:router]}.uniq.map{|m| try_resolve m}\n end", "def routes_list\n response = RestClient.get(\n BASE_URL,\n params: {command: 'routeList', a: AGENCY}\n )\n\n parse_routes_response(response.body)\n end", "def named_routes\n return [] unless app_obj.respond_to?(:routes)\n\n app_obj.routes.map { |route|\n request_method = route.request_methods.first\n next if !route.name || request_method == 'HEAD'\n route_name = route.name.to_s\n route_name =\n if route.controller\n route_name.split(\" \", 2).map{|name| \":#{name}\" }.join(\", \")\n else\n \":#{route_name}\"\n end\n name_array = \"(#{route_name})\"\n original_path = route.original_path.is_a?(Regexp) ? route.original_path.inspect : route.original_path\n full_path = File.join(uri_root, original_path)\n OpenStruct.new(:verb => request_method, :identifier => route.name, :name => name_array, :path => full_path)\n }.compact\n end", "def routes\n @routes || self.class.routes\n end", "def get_routes\n\t\trequest = Packet.create_request('stdapi_net_config_get_routes')\n\t\troutes = []\n\n\t\tresponse = client.send_request(request)\n\n\t\t# Build out the array of routes\n\t\tresponse.each(TLV_TYPE_NETWORK_ROUTE) { |route|\n\t\t\troutes << Route.new(\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_SUBNET),\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_NETMASK),\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_GATEWAY))\n\t\t}\n\n\t\treturn routes\n\tend", "def routes\n app_obj.routes\n end", "def routing_keys\n []\n end", "def anchored_routes; end", "def getRoutesTo(station)\n routeList = @toNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def routes\n cached_routes\n end", "def available_routes\n routes = {}\n @components.each_value do |c|\n c.proxy.routes.each do |r|\n if routes[r] == nil\n routes[r] = c.proxy.uri\n else\n raise \"Route '#{r}' already handled by component \" +\n routes[r].name\n end\n end if c.registered?\n end\n routes\n end", "def show_routes\n seen = []\n unless Merb::Router.named_routes.empty?\n puts \"==== Named routes\"\n Merb::Router.named_routes.each do |name,route|\n # something weird happens when you combine sprintf and irb\n puts \"Helper : #{name}\"\n meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/\n puts \"HTTP method: #{meth || 'GET'}\"\n puts \"Route : #{route}\"\n puts \"Params : #{route.params.inspect}\"\n puts\n seen << route\n end\n end\n puts \"==== Anonymous routes\"\n (Merb::Router.routes - seen).each do |route|\n meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/\n puts \"HTTP method: #{meth || 'GET'}\"\n puts \"Route : #{route}\"\n puts \"Params : #{route.params.inspect}\"\n puts\n end\n nil\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes\n ['Agriculture, environmental and animal care', 'Business administration', 'Catering and hospitality' \\\n 'Construction',\n 'Creative and design', 'Digital', 'Engineering and manufacturing', 'Hair and beauty', 'Health and science',\n 'Legal, finance and accounting', 'Protective services', 'Sales, marketing and procurement', 'Transport']\n end", "def routes\n routes_method.call\n end", "def route_for(request) #:nodoc:\n index, params = match(request)\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def routes\n request :get, '/routes'\n end", "def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def routes(&block); end", "def routes(&block); end", "def routes(filter = nil)\n Rails.application.reload_routes!\n formatted = formatted_routes\n if filter\n formatted.select!{ |r| r.match(filter) }\n end\n puts formatted\n end", "def routes_map; end", "def show_routes\n seen = []\n unless Merb::Router.named_routes.empty?\n puts \"Named Routes\"\n Merb::Router.named_routes.each do |name,route|\n puts \" #{name}: #{route}\"\n seen << route\n end\n end\n puts \"Anonymous Routes\"\n (Merb::Router.routes - seen).each do |route|\n puts \" #{route}\"\n end\n nil\n end", "def routes\n routes = get('/gtfs/routes')\n routes.map do |route|\n Route.from_json(route)\n end\n end", "def routes\n context[:routes]\n end", "def _routes; end", "def whitelisted_routes\n grack_route? || internal_route? || lfs_route? || sidekiq_route?\n end", "def all\n routes = {}\n routable.each do |r|\n routes.merge!(@ruhoh.collection(r).routes)\n end\n routes\n end", "def routes_normal\n return @routes[:inside_region]\n end", "def index\n @routes = Route.get_active\n end", "def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end", "def load_routes\n\n # get our routes\n routes = Rails.application.routes.routes.to_a\n\n # filter out internal routes, those outside our base context, and those with no name\n routes.reject!{ |r| r.internal or !r.defaults.key?( :controller ) or r.name.nil? }\n\n # finally, map everything to a simpler version\n self.routes = routes.map do |r|\n {\n controller: r.defaults[:controller],\n action: r.defaults[:action].to_sym,\n name: r.name,\n params: r.parts.reject{ |p| p == :format }\n }\n end\n\n end", "def routes\n @active_routes ||= Workling::Discovery.discovered.map { |clazz| @routing.queue_names_routing_class(clazz) }.flatten\n end", "def common_routes\n [\n [ search_path, 'Search Talks', 'talks' ],\n [ helps_path, 'Help' , 'helps' ], # TBD: replace with help search\n [ credits_path, 'Credits' , 'credits' ],\n [ static_pages_about_path, 'About' , 'static_pages' ],\n [ static_pages_contact_path, 'Contact' , 'static_pages' ],\n [ static_pages_privacy_path, 'Privacy' , 'static_pages' ],\n [ static_pages_sitemap_path, 'Site Map', 'static_pages' ]\n ]\n end", "def parse_routes!\n allowed_routes.each do |route|\n if (endpoint = endpoints.find_from_route(route))\n endpoint.merge_http_methods!(route[:http_methods])\n else\n controller = controllers.find_or_create_from_route(route)\n endpoint = endpoints.create_from_route(route, controller)\n\n controller.add_endpoint(endpoint)\n end\n end\n end", "def route_sets; end", "def routes(context={})\n \n routes = [{:path => '/admin/system',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/system/, \n :title => 'Sistema', \n :description => 'Reads the log messages',\n :fit => 1,\n :module => :system },\n {:path => '/admin/logger',\n :parent_path => '/admin/system',\n :regular_expression => /^\\/admin\\/logger/, \n :title => 'Trazas', \n :description => 'Reads the log messages',\n :fit => 1,\n :module => :system },\n {:path => '/logger-config',\n :regular_expression => /^\\/admin\\/logger-config/, \n :title => 'Logger configuration', \n :description => 'Configure the logger',\n :fit => 1,\n :module => :system }, \n {:path => '/business-events',\n :regular_expression => /^\\/admin\\/business-events/, \n :title => 'Business events',\n :description => 'Manage the business events.',\n :fit => 1,\n :module => :system }]\n \n end", "def index\n @routes = Route.hottest\n end", "def index\n @rails_routes = RailsRoute.all\n end", "def print_routes \n \n # Create a new hash\n h = Hash.new()\n\n # Use Sinatra advanced routes\n # to build out a hash based on the routes\n Sinatra::Application.each_route do |route|\n unless route.path.eql? \"/\" or route.path.eql? \"/*\"\n h[route.path.split(\"/\")[1]] = request.base_url + route.path \n end\n end\n\n # Return that badboy\n return h\n\nend", "def no_routes\n end", "def routes\n routes = {}\n self.class.each_route do |route|\n #routes[:name] = route.app.name # \"SomeSinatraApp\"\n info = {}\n routes[route.path.to_s.to_sym] = info # that's the path given as argument to get and akin\n info[:verb] = route.verb # get / head / post / put / delete\n info[:file] = route.file # \"some_sinatra_app.rb\" or something\n info[:line] = route.line # the line number of the get/post/... statement\n info[:pattern] = route.pattern # that's the pattern internally used by sinatra\n info[:keys] = route.keys # keys given when route was defined\n info[:conditions] = route.conditions # conditions given when route was defined\n info[:block] = route.block # the route's closure\n end\n routes\n end", "def route_index\n route via: :get, path: '', member: false\n end", "def routes\n Resources::Routes.new(self)\n end", "def get_routes(params)\n graph_data = create_data(params)\n if graph_data.is_a?(Array)\n graph_data.each do |data|\n add_vertex(data[0][0], data[0][1])\n end\n path_array = shortest_path(params[:source], params[:destination])\n if path_array.is_a?(Array)\n get_path_description(path_array, params)\n else\n path_array\n end\n else\n graph_data\n end\n end", "def capture(&block)\n routes_before, named_route_keys_before = self.routes.dup, self.named_routes.keys\n yield\n [self.routes - routes_before, self.named_routes.except(*named_route_keys_before)]\n end", "def routes(path = nil, &blk)\n if path or block_given?\n @routes = Config::Routes.new(root, path, &blk)\n else\n @routes\n end\n end", "def route_enclosing_names\n @route_enclosing_names ||= returning(Array.new) do |req|\n enclosing_segments.each do |segment|\n unless segment.is_optional or segment.is_a?(::ActionController::Routing::DividerSegment)\n req << [segment.value, true] if segment.is_a?(::ActionController::Routing::StaticSegment)\n req.last[1] = false if segment.is_a?(::ActionController::Routing::DynamicSegment)\n end\n end\n end\n end", "def resources\n @resources ||= begin\n resources = request_path.strip.\n split('/').\n compact.\n map(&:strip).\n each_with_index.\n select { |_, index| index % 2 == 1 }.\n map { |a, _| a.to_sym }\n\n *rest, tail = *resources\n if RAILS_METHODS.index(tail)\n rest\n else\n resources\n end\n end\n end", "def get_routes\n @agency = params[:name]\n request_url = \"http://services.my511.org/Transit2.0/GetRoutesForAgency.aspx?token=#{@@token}&agencyName=#{@agency}\"\n request_url = request_url.gsub(/ /,\"%20\")\n @routes = search_for_key(parse_request(request_url), \"Route\")\n @routes = [@routes] unless @routes.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end", "def custom_routes; end", "def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE, path: '/', action: :delete }\n\t\t\t\t\t]\n\t\t\t\tend", "def diffable_routes\n self.routes.select { |route| route.gateway_id != \"local\" and route.origin != \"CreateRouteTable\" and !route.destination_prefix_list_id }\n end", "def routes\n [@name.downcase]\n end", "def external_routes; end", "def named_routes(namespace=nil)\n unless routes = opts[:namespaced_routes][namespace]\n raise RodaError, \"unsupported multi_route namespace used: #{namespace.inspect}\"\n end\n routes.keys\n end", "def route_for(request)\n index, params = if @around_match\n send(@around_match, request) { match(request) }\n else\n match(request)\n end\n route = routes[index] if index\n if !route\n raise ControllerExceptions::NotFound, \n \"No routes match the request: #{request.uri}\"\n end\n [route, params]\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def each\n @routes.each do |rt|\n yield rt\n end\n self\n end", "def without(*paths)\n routes = paths.map { |p| match_for p }\n self.class.new(routes: @routes - routes)\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def routes\n @routes ||= Engine.routes.url_helpers\n end", "def read_routes(space_guid, domain_guid = nil)\n routes = []\n\n @client.routes.each do |route|\n if route.space && route.space.guid == space_guid\n if domain_guid != nil\n routes << Route.new(route.name, route.guid) if route.domain.guid == domain_guid\n else\n routes << Route.new(route.name, route.guid)\n end\n end\n end\n\n routes\n end", "def routes(context={})\n \n routes = [{:path => '/admin/media',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/media/,\n :title => 'Medios',\n :description => 'Gestión de medios',\n :fit => 1,\n :module => :media_gallery}, \n {:path => '/admin/media/config',\n :parent_path => '/admin/media',\n :regular_expression => /^\\/admin\\/media\\/config/,\n :title => 'Configuración',\n :description => 'Configuración medios',\n :fit => 1,\n :module => :media_gallery}, \n {:path => '/admin/media/album',\n :parent_path => '/admin/media',\n :regular_expression => /^\\/admin\\/media\\/album/,\n :title => 'Albums',\n :description => 'The albums admin tools to create and modify media albums',\n :fit => 1,\n :module => :media_gallery}, \n {:path => '/admin/media/photo/:album_name',\n :parent_path => '/admin/media/album',\n :regular_expression => /^\\/admin\\/media\\/photo\\/.+/,\n :title => 'Photos',\n :description => 'It manages the album\\'s photos. Used to upload and edit the album\\'s photos.',\n :fit => 1,\n :module => :media_gallery},\n {:path => '/gallery/:album_name',\n :regular_expression => /^\\/photo_gallery\\/.+/,\n :title => 'Photos',\n :description => 'It shows the album\\'s photos.',\n :fit => 1,\n :module => :media_gallery}]\n \n end", "def list_paths\n @paths = RouteRecognizer.new.initial_path_segments.reject do |path|\n %w(assets rails).include? path\n end\n end", "def list_inbound_routes(limit = nil,\r\n offset = nil)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/v2/routes'\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'limit' => limit,\r\n 'offset' => offset\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\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 if _context.response.status_code == 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n \r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def call_routes\n return @call_routes\n end", "def to_a\n @routes\n end" ]
[ "0.7562973", "0.7328139", "0.73165554", "0.73165554", "0.7283972", "0.718276", "0.7081735", "0.70598453", "0.6834728", "0.6817335", "0.6817335", "0.6816099", "0.67349327", "0.66528654", "0.6646333", "0.6638214", "0.6599385", "0.6574866", "0.6520511", "0.6517264", "0.650079", "0.6441233", "0.6423828", "0.63832647", "0.63347346", "0.6319025", "0.6316586", "0.62916815", "0.62858343", "0.62854856", "0.62545145", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.62385607", "0.6234554", "0.6227193", "0.6215025", "0.62049216", "0.6202683", "0.6192863", "0.6192863", "0.6163586", "0.6152042", "0.61489487", "0.6135228", "0.61274695", "0.61222243", "0.61207086", "0.6094827", "0.6092755", "0.60786355", "0.60486233", "0.60484344", "0.6031808", "0.60268396", "0.6001346", "0.5992933", "0.5979055", "0.5971972", "0.5961679", "0.59562045", "0.59131485", "0.59088975", "0.58836126", "0.58826715", "0.5845911", "0.5837157", "0.58357644", "0.5821495", "0.5808988", "0.5808587", "0.580745", "0.5799926", "0.5793604", "0.57749563", "0.5774631", "0.57744634", "0.57674694", "0.57652473", "0.57652473", "0.57652473", "0.57652473", "0.5748501", "0.5746642", "0.57434", "0.5735351", "0.5734787", "0.572775", "0.5721341", "0.5707031", "0.56992745", "0.5697881" ]
0.7773459
0
Sanitize text input before evaluating
def sanitize( str ) return str.scan(/\d|\(|\)|\*|\+|\-|\/|\.|\%/).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(context,input)\n safe = ''\n begin\n safe = antisamy(context,input)\n rescue Exception => e\n end\n safe\n end", "def sanitize!; end", "def sanitize(text)\n sanitized_text = text.dup\n\n # Strip URLs\n sanitized_text.gsub!(URL_REGEX, '')\n\n # Strip @mention style tokens\n sanitized_text.gsub!(MENTION_REGEX, '')\n\n sanitized_text\n end", "def sanitize_input(input)\n\t\tclean_input = input.to_s.scan(/(\"[^\"]+?\"|\\S+)/).flatten.join \" \"\n\n case clean_input[-1]\n when '+'\n [ clean_input[0...-1], :verbose ]\n when '!'\n [ clean_input[0...-1], :full ]\n else\n [ clean_input, :basic ]\n end\n end", "def sanitize(context,input)\n whitelist(input,Owasp::Esapi::Ecnoder::CHAR_ALPHANUMERIC)\n end", "def sanitize(value)\n case value\n when Regexp then value.source\n else Regexp.escape value\n end\n end", "def sanitize(text)\n text.gsub(@filter) { |gotcha| 'x' * gotcha.length }\n end", "def sanitize(string, options = {})\n Engine.clean(string)\n end", "def clean_input(input)\n input.strip\n end", "def sanitize(words)\n#lowercases the string\n lower_case = lowerCase(words)\n#removes all the special elements\nclean_string = clean(lower_case)\nend", "def validate_and_sanitize\n validate\n end", "def sanitize(text)\n text.squeeze\n text.capitalize!\n text.gsub!('&', '&amp;')\n text.gsub!('<', '&lt;')\n text.gsub!('>', '&gt;')\n return text\nend", "def sanitize_inputs\n attributes.each do |attr_name, attr_value|\n next unless attr_value.is_a? String\n self[attr_name] = strip_markup attr_value\n end\n end", "def sanitize_input(str)\n str.chomp.strip \n # remueve al final del string los \\n,\\t,\\r(chomp) \n #y remueve los espacios en blanco (strip)\n end", "def standardize_input\n valid_characters = Regexp.new(/\\A[A-Zvx\\^\\&\\!\\~\\|\\-\\>\\<\\(\\)\\ \\[\\]\\{\\}\\,\\+]*\\z/)\n if @user_input =~ valid_characters\n @user_input = @user_input.dup\n @user_input.gsub!(/v/, \"|\")\n @user_input.gsub!(/\\^/, \"&\")\n @user_input.gsub!(/\\~/, \"!\")\n @user_input.gsub!(/\\-\\>/, \">\")\n @user_input.gsub!(/\\<\\-/, \"<\")\n @user_input.gsub!(/\\[\\{/, \"(\")\n @user_input.gsub!(/\\]\\}/, \")\")\n @user_input.gsub!(/\\<\\-\\>/, \"+\")\n @user_input.gsub!(/\\<\\>/, \"+\")\n @user_input\n else\n raise \"Invalid characters in input\"\n end\n end", "def sanitize(text)\n text.gsub('<', '&lt;').gsub('>', '&gt;')\n end", "def sanitize(tainted)\n untainted = tainted\n \n untainted = rule1_sanitize(tainted)\n \n # Start - RULE #2 - Attribute Escape Before Inserting Untrusted Data into HTML Common Attributes\n # End - RULE #2 - Attribute Escape Before Inserting Untrusted Data into HTML Common Attributes\n \n # Start - RULE #3 - JavaScript Escape Before Inserting Untrusted Data into HTML JavaScript Data Values\n # End - RULE #3 - JavaScript Escape Before Inserting Untrusted Data into HTML JavaScript Data Values\n \n # Start - RULE #4 - CSS Escape Before Inserting Untrusted Data into HTML Style Property Values\n # End - RULE #4 - CSS Escape Before Inserting Untrusted Data into HTML Style Property Values\n \n untainted\n end", "def clean_input(text)\n text.gsub(/\\r/, '') rescue text\n end", "def sanitize_text_field(str)\n filtered = _sanitize_text_fields(str, false)\n\n # Filters a sanitized text field string.\n apply_filters( 'sanitize_text_field', filtered, str)\n end", "def sanitize(str)\n return \"\" if !str\n return Sanitize.clean(str)\n end", "def validate_and_sanitize\n super\n end", "def sanitize_data(value)\n HtmlSanitizer.sanitize(value)\n end", "def sanitize_input\n\t\t# to remove whitespace, use \n\t\t# self.<fieldname>.strip!\n\t\tself.homephone = self.homephone.gsub(/\\D/,'') if !self.homephone.blank?\n\t\tself.workphone = self.workphone.gsub(/\\D/,'') if !self.workphone.blank?\n\t\tself.cellphone = self.cellphone.gsub(/\\D/,'') if !self.cellphone.blank?\n\t\tself.fax = self.fax.gsub(/\\D/,'') if !self.fax.blank?\n\t\tself.prefcontactmethod = :Email if self.prefcontactmethod.blank?\n #\t\tself.email = self.email.downcase if self.email.present?\n\tend", "def format_input(text)\n\t\ttext.downcase.gsub(' ', '').gsub('\\\\', '') \n\tend", "def sanitize_data(data)\n data\n end", "def _sanitize_text_fields(str, keep_newlines = false)\n return '' unless str.is_a? String\n filtered = wp_check_invalid_utf8(str)\n # TODO continue implement _sanitize_text_fields\n filtered\n end", "def sanitize_input(input_string)\n sanitized = Shellwords.shellescape(input_string)\n $logger.info(\"module or branch name #{sanitized} had to be escaped!\") unless input_string == sanitized\n sanitized\n end", "def sanitize_text(text)\n text = unescape_text(text)\n text = extract_text(text) if aruba.config.remove_ansi_escape_sequences\n\n text.chomp\n end", "def validate_and_sanitize\n\n r = validate\n return r unless r.success?\n\n success\n\n end", "def clean_user_input(input)\n cleansed_input = input.strip.downcase.split.join(\" \")\n cleansed_input\n end", "def sanitize(content)\n content.to_s.gsub(/[^\\w]/, '')\n end", "def validate_and_sanitize\n r = validate\n return r unless r.success?\n success\n end", "def sanitize\n self.summary = sanitize_string(summary)\n self.description = sanitize_string(description)\n self.post_install_message = sanitize_string(post_install_message)\n self.authors = authors.collect {|a| sanitize_string(a) }\n end", "def sanitize_string(value)\n value.sub(/\\A['\"](.*)['\"]\\Z/, '\\1').gsub(/\\\\\"|\"|'/, '\"')\n end", "def sanitize text\n [' ', '\\r\\n', \"\\r\\n\", \"\\n\", \"\\r\", \"\\t\", / ^/, / $+/, /^  /, /^ /].each { |text_to_remove|\n text.gsub!(text_to_remove,'')\n }\n return text\n end", "def sanitized_string\n @sanitized_string ||= (\n str = string.dup\n # Remove thousand separator commas\n str.gsub! /(\\d)(,)(?=\\d{3}\\b)/, '\\1'\n\n # replace any non number or decimal characters with spaces\n str.gsub! /[^0-9\\.]/, ' '\n\n str\n )\n end", "def clean(text)\n @cleaner.clean(text)\n end", "def clean_text\n text.tr(\"'@_\", '').gsub(/\\W/, ' ').gsub(/[0-9]/, '').downcase\n end", "def bad_sanitize(str)\n str.gsub(/'/,\"''\")\nend", "def sanitize_input(input_string)\n sanitized = Shellwords.shellescape(input_string)\n $logger.info(\"branch name #{sanitized} had to be escaped!\") unless input_string == sanitized\n sanitized\n end", "def sanitize_data\n sanitize_permalink\n sanitize_name\n end", "def clean_string(input)\r\n unless input.nil?\r\n input = input.to_s.gsub(/^[\\s]+|[\\s]+$/, \"\")\r\n end\r\n return input\r\n end", "def sanitize(review)\n xss_filter(review)\n end", "def sanitize(args = '')\n args\n end", "def sanitize(string_or_io)\n Loofah.scrub_fragment(string_or_io, :escape).to_s\n end", "def repair(text); end", "def sanitize_data\n sanitize_name\n sanitize_city\n sanitize_zip_code\n sanitize_address\n end", "def sanitize_data\n sanitize_name\n sanitize_city\n sanitize_zip_code\n sanitize_address\n end", "def antisamy(context,input)\n if input.nil?\n if @allow_nil\n return nil\n end\n user = \"#{context}: Input number required\"\n log = \"Input number required: context=#{context}, input=#{input}\"\n raise Owasp::Esapi::ValidationException.new(user,log,context)\n end\n canonical = @string_rule.valid(context,input)\n begin\n r = AntiSamy.scan(canonical,@@policy)\n unless r.messages.empty?\n Esapi.logger.info(:SECURITY_FAILURE,\"Cleaned up HTML error #{r.messages}\")\n end\n # AntiSamy will wrap loose content in a <p> if there is no starting tag\n clean = r.clean_html\n # Strip out the >p> tags\n if clean =~ /^\\<p\\>(.*)\\<\\/p\\>$/\n x = $1\n unless input =~ /^\\</\n clean = x\n end\n end\n return clean.strip\n rescue Exception => e\n user = \"#{context}: Invalid HTML input\"\n log = \"Invalid HTML input: context=#{context} error=#{e.message}\"\n raise Owasp::Esapi::ValidationException.new(user,log,context,e)\n end\n end", "def scrub_input(instring)\n unless instring =~ /\\A[a-zA-Z0-9\\.\\-_]*\\z/\n puts \"#{instring} is an invalid attribute\"\n exit 1\n end\nend", "def preprocess_text(text)\n\n # Warn user if text exceeds max_length.\n if text.length > @max_length\n text = text[0..@max_length]\n warn(\"WARNING:: string cut length > #{@max_length}:\\n\")\n warn('text:: '+text)\n end\n\n text = @encoder.clean(text)\n text = remove_diacritics(text)\n\n # correct expected length for vectors with 0's\n @encoder.input_to_sequence(text)\n end", "def sanitize(name)\n #name.gsub(\".\", \"_\").gsub(/<.+>/, \"\")\n name.gsub(\".\", \"_\").gsub(\"$\", \"_\")\nend", "def sanitize(str)\n str.gsub(%r{[\\\\/*?\"<>|\\s,#]:}, '').downcase\n end", "def sanitize(str)\n DescriptionSanitizer.new.sanitize(str)\n end", "def clean_value\n if (type == :string || type == :text) && !Axlsx.trust_input\n Axlsx.sanitize(::CGI.escapeHTML(@value.to_s))\n else\n @value.to_s\n end\n end", "def sanitized_string(string)\n text = Sanitize.fragment(string.to_s).squish\n CGI.unescapeHTML(text).gsub(/&nbsp;/, ' ')\n end", "def sanitize_result(result)\n result = result.downcase\n\n # many times, featured results, or additional producers are appended\n # to the result like so: (featuring beep and boop...)\n result = result.gsub(/[\\(\\)\\[\\]]/, \"\")\n\n # remove all [.'!&+] and replace them with \"\"\n result = result.gsub(/[.'!&+]/, \"\")\n\n # remove all - or _ and replace them with \" \"\n result = result.gsub(/[-_]/, \" \")\n\n # remove all blacklisted articles\n result = result.gsub(/\\b(#{BLACKLIST})\\b/, \"\")\n\n # replace multiple spaces with a single space\n result = result.gsub(/\\s+/, \" \").strip\n end", "def sanitize_and_remove_lines(text)\n remove_lines(sanitize(text))\n end", "def sanitize_and_remove_lines(text)\n remove_lines(sanitize(text))\n end", "def clean_html(html)\n Sanitize.clean(html) rescue html\n end", "def sanitize_text(arg)\n\t\tif arg.is_a? Hash\n\t\t\tHash[arg.to_a.map do |x, y|\n\t\t\t\t[x, y.lines.map(&:chomp).join(\"\\n\")]\n\t\t\tend]\n\t\telse\n\t\t\t#arg is a String\n\t\t\targ.lines.map(&:chomp).join(\"\\n\")\n\t\tend\n\tend", "def clean( input )\n input.gsub( %r/\\s+/, '' )\n end", "def pre_normalize(text); end", "def validate_user_input(input)\r\n if input =~ \"/(script)|(&lt;)|(&gt;)|(%3c)|(%3e)|(SELECT) |(UPDATE) |\"\\\r\n \"(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&amp;lt;)|\"\\\r\n \"(&amp;gt;)/\"\r\n return nil\r\n end \r\n return input \r\n end", "def clean_share_input(input) \n raw(input).gsub(/\"/, '\\'')\n end", "def sanitize_query(q)\n return '' if q.nil?\n q.gsub(/\\s+/, ' ').gsub(/[^a-zA-Z 0-9\\*\\?'\\\"]/i, '?')\n end", "def sanitized\n @original && @original.gsub(/[^0-9]+/, '') || ''\n end", "def validate_and_sanitize\n\n r = validate\n return r unless r.success?\n\n r = validate_and_sanitize_params\n return r unless r.success?\n\n success\n end", "def sanitize_params\n # @where[/\\w*=\\'(.*)\\'/].gsub(/\\'/, \"''\")\n # @where.sub!(/\\w*=\\'(.*)\\'/, { |s| puts s })\n end", "def sanitize_from_db(text, allowed_tags = NB.allowed_html_tags)\n text = sanitize_from_evernote(text)\n text = text.gsub(/#{ NB.truncate_after_regexp }.*\\Z/m, '')\n .gsub(/<br[^>]*?>/, \"\\n\")\n .gsub(/<b>|<h\\d>/, '<strong>')\n .gsub(%r{</b>|</h\\d>}, '</strong>')\n # OPTIMIZE: Here we need to allow a few more tags than we do on output\n # e.g. image tags for inline image.\n text = sanitize_by_settings(text, allowed_tags)\n text = format_blockquotes(text)\n text = format_code(text)\n text = remove_instructions(text)\n end", "def clean_text(datacontent)\n return datacontent.gsub(/[^a-z0-9]/i, \"\").downcase\nend", "def smartify(input); end", "def sanitize!\n return self if @sanitized\n replace(HTMLEntities.new.encode(self))\n @sanitized = true\n return self\n end", "def sanitize(sql_query)\n sql_query[0..22].downcase.split('').each.select {|w| w =~ /[a-z]|[áéíóúü]/i}.join('') \nend", "def sanitize content #:nodoc:\n if content.is_a? String\n content.chomp!\n content.gsub!(/\\t/, ' ') # don't display tab\n content.gsub!(/[^[:print:]]/, '') # don't display non print characters\n else\n content\n end\n end", "def sanitize content #:nodoc:\n if content.is_a? String\n content.chomp!\n content.gsub!(/\\t/, ' ') # don't display tab\n content.gsub!(/[^[:print:]]/, '') # don't display non print characters\n else\n content\n end\n end", "def sanitize_data str\n str.to_s.strip.gsub(%r{^(-\\s)+}, \"\")\n end", "def filter_text(text)\n text = text.to_s\n text.gsub('&', '&amp;')\n text.gsub('\\'', '&#039;')\n text.gsub('\"', '&quot;')\n text.gsub('<', '&lt;')\n text.gsub('>', '&gt;')\n text\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize(action); end", "def sanitize(s, level=:relaxed)\n Sanitize.clean(s, DC::Sanitizer::LEVELS[ level ] )\n end", "def validate_text(text)\n return validate({:rawdata => text})\n end", "def sanitize(q)\n # Escape special characters\n # http://lucene.apache.org/core/4_8_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description#Escaping_Special_Characters\n escaped_characters = Regexp.escape('\\\\+-&|!(){}[]^~*?:\\/')\n q = q.gsub(/([#{escaped_characters}])/, '\\\\\\\\\\1')\n\n # AND, OR and NOT are used by lucene as logical operators. We need\n # to escape them\n ['AND', 'OR', 'NOT'].each do |word|\n escaped_word = word.split('').map {|char| \"\\\\#{char}\" }.join('')\n q = q.gsub(/\\s*\\b(#{word.upcase})\\b\\s*/, \" #{escaped_word} \")\n end\n\n # Escape odd quotes\n if q.count('\"') % 2 == 1\n q = q.gsub(/(.*)\"(.*)/, '\\1\\\"\\2')\n end\n\n q\n end", "def sanitize_content\n self.title = helpers.sanitize(self.title)\n self.user_name = helpers.sanitize(self.user_name)\n end", "def sanitize(object) #:nodoc:\n quote_value(object)\n end", "def sanitize(input, options={})\n return \"\" if input.nil? or input.empty?\n \n # Only take elements inside of <body>\n @doc = Hpricot(input)\n @doc = Hpricot(@doc.at(\"body\").inner_html) if @doc.at(\"body\")\n sanitized = Aqueduct::RailsSanitizer.white_list_sanitizer.sanitize(@doc.to_html)\n\n # Start parsing sanitized doc\n @doc = Hpricot(sanitized)\n\n # Rewrite all id's to appened network_key\n append_id(@options[:append]) unless @options[:append].nil?\n\n @options[:formatted] == false ? @doc.to_html.gsub(/\\r|\\n/i,'') : @doc.to_html \n end", "def sanitize_user\r\n self.first_name = Sanitize.clean(self.first_name).gsub('&amp;','&').gsub('&gt;', '>') unless self.first_name.blank?\r\n end", "def apply_validations_for_text\n apply_validations_for_string\n end", "def clean(text)\n ctext = text.gsub(/[^\\p{Latin}0-9']/, ' ')\n ctext.gsub!(\"'\", \"' \")\n ctext\n end", "def scrub\n self.gsub(/[^a-zA-Z\\s0-9\\.]/, '').gsub(/\\t/, ' ').gsub(/\\r/, ' ').gsub(/\\s\\s/, '').lstrip.rstrip\n end", "def parse_text(text)\n ## Strip html\n Sanitize::clean!(text, :remove_contents => ['script','style'])\n text.gsub!(/[\\n\\t]+/, ' ')\n text\n end", "def scrub(text)\n return '' unless text.present?\n\n text.to_s.gsub(/[\\r\\n]/, ' ').gsub('%', '%25')\n end", "def safe_output(input)\n sanitize Nokogiri::HTML.fragment(CGI.unescapeHTML(input)).to_s\n end", "def sanitize(template)\n begin\n if template =~ /\\A\".+\"\\Z/m\n # Case 1\n sanitize_with_json(template)\n else\n # Case 2\n sanitize_with_regexp(template)\n end\n rescue JSON::ParserError\n # Case 3\n template\n end\n end", "def validate_and_sanitize\n r = super\n return r unless r.success?\n\n success\n end", "def smartify(text)\n return '' if text.nil? || text.empty?\n RubyPants.new(text).to_html\n end", "def smartify(text)\n return '' if text.nil? || text.empty?\n RubyPants.new(text).to_html\n end", "def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend", "def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend" ]
[ "0.7259956", "0.7239552", "0.7047935", "0.6918973", "0.6913846", "0.6901053", "0.685648", "0.6817125", "0.68129134", "0.6762043", "0.6730322", "0.6708264", "0.6682563", "0.6679509", "0.66620135", "0.66361964", "0.6616259", "0.6613669", "0.6605613", "0.6556117", "0.6501612", "0.6499795", "0.6492226", "0.6487914", "0.6476458", "0.6404654", "0.64027375", "0.63820755", "0.63774997", "0.6368643", "0.63215077", "0.6303828", "0.6299441", "0.6286394", "0.6283791", "0.62807035", "0.6274618", "0.6262445", "0.6252437", "0.6247422", "0.6243295", "0.6226811", "0.6218096", "0.620814", "0.62034094", "0.6202629", "0.6202418", "0.6202418", "0.61955076", "0.6173497", "0.617299", "0.6170037", "0.6159979", "0.6157542", "0.6120416", "0.611602", "0.6104461", "0.6102593", "0.6102593", "0.6098768", "0.6075952", "0.60727566", "0.6056496", "0.6052005", "0.6048798", "0.6046313", "0.60430145", "0.6038915", "0.6036902", "0.6028919", "0.602883", "0.60181725", "0.6009823", "0.6007292", "0.6003571", "0.6003571", "0.59956783", "0.5992446", "0.59885305", "0.59885305", "0.5988185", "0.59738874", "0.5971522", "0.59682053", "0.59611964", "0.5959952", "0.5958036", "0.5949827", "0.59484196", "0.59419054", "0.5941641", "0.5937045", "0.59361935", "0.59328943", "0.5932848", "0.59233856", "0.59133595", "0.59133595", "0.589426", "0.589426" ]
0.6239531
41
we can welcome new and known users, need a helper
def welcome( user ) session[:user] = user session[:last_login] = Time.now.strftime("%m-%d-%Y %H:%M:%S") redirect "/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome\n @current_user = current_user\n end", "def welcome(user)\n @the_new_user_who_signed_up = user\n\n mail to: user.email, from: \"jeff@startergrill.com\"\n end", "def verify_welcome_message\n if is_newbie_changed? && is_newbie == false\n generate_welcome_message\n DefaultFollowerService.new(self).assign\n end\n end", "def welcome\n # only admin can send emails like these\n if !@current_user.is_admin?\n respond_with_403 and return\n end\n \n \n if @user.is_active == 0\n flash[:error] = \"Please Activate this Agent before sending welcome email.\"\n else\n UserNotifier::deliver_user_created(@user, @user.save_new_password)\n flash[:notice] = 'Welcome email has been sent.'\n end\n \n \n redirect_to user_path\n end", "def welcome\n # redirect_back(fallback_location: root_path) if @commoner.user.sign_in_count > 1\n @commoner = current_user.meta\n end", "def welcomeUser(*args)\r\n user = args.first\r\n puts \"welcome #{user}\"\r\n # end of method\r\nend", "def new_user\n \n end", "def welcome_user\n puts \"Welcome to #{pastel.bright_cyan('Groupie')}.\"\n puts \"Keep up with your favorite bands, never miss a show!\"\n puts \"Type #{pastel.bright_cyan('exit')} at any time to quit the app.\"\n puts \"Type #{pastel.bright_cyan('concerts')} to get started.\"\n end", "def welcome\n system 'clear'\n puts \"--------LOGIN--------\"\n menu = [\"Login\", \"Create new user\"]\n choice = @prompt.select(\"\", menu)\n case choice\n when \"Login\"\n login\n when \"Create new user\"\n create_account\n end\n end", "def welcome(user)\n\n mail to: user.email, subject: \"Welcome to Teamhuddle\"\n end", "def welcome\n if user_logged_in?\n redirect_to root_path\n else\n redirect_to new_user_registration_path\n end\n end", "def welcome_user(opts)\n extract_vars(opts)\n @is_welcome_user = true\n\n I18n.with_locale(@newsletter_user.lang) do\n @newsletter = Newsletter.new(\n title: @newsletter_setting.title_subscriber,\n content: @newsletter_setting.content_subscriber\n )\n end\n\n process_email\n end", "def run\n @user = \"\"\n welcome\n login_or_signup\n say_hi_to_user\n initial_menu \n end", "def wechat\n if wechat_user_solver.success?\n # is it a new user ?\n handle_after_sign_up! wechat_user_solver.data[:customer]\n sign_in_user wechat_user_solver.data[:customer]\n else\n failure\n end\n end", "def welcome\r\n end", "def welcome\n self.user_id = nil\n prompt.select(\"\\nWelcome to the Forum! Choose an action - \\n (Press Esc at any time to return to this menu!\") do |menu|\n menu.choice \"Login\", -> {login}\n menu.choice \"Create Account\", -> {account_creation}\n menu.choice \"Browse as a Guest\", -> {\n user_id = nil\n show_threads\n }\n menu.choice \"Exit\", -> {exit}\n end\n \n end", "def welcome(user)\n @greeting = \"Hi.\"\n @name = user.name unless user.name == nil || user.name = \"Anonymous\"\n\n mail to: user.email, subject: 'Hi & nice to meet you.'\n end", "def make_user\n end", "def welcome \n end", "def welcome \n end", "def welcome_user\n header\n puts \"\\n\\nWelcome #{self.active_user.name}, you are now logged in!\\n\"\n self.area_prompt\nend", "def welcome(user)\n @user = user\n mail to: @user.email\n end", "def handle_new_user \n system \"clear\" \n CoffeeMan.stay_logo\n username = @prompt.ask(\"Create a username\", required: true) \n #check if new username already exists\n if User.all.map(&:username).include?(username)\n puts 'This username already exist'\n sleep 5 / 2\n system \"clear\"\n sleep 1\n #redirect to log in option method\n CoffeeMan.stay_logo\n self.log_in\n else\n #if new username doesn't exist, create a new password\n password = @prompt.mask(\"Create a password\", required: true) \n end \n #after everything, create a new user instance \n @userid = User.create(username: username, password: password) \n main_menu\nend", "def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end", "def new_list_users\n\n end", "def newUser\n end", "def new_user_welcome(user_id)\n @user = User.find(user_id)\n\n mail :to => recipient(@user.email), :subject => \"Welcome to 25c!\"\n end", "def welcome\n\tend", "def on_welcome(connection, user, text)\n end", "def welcome(user)\n @greeting = \"Hi #{user.fullname}\"\n\n mail to: \"#{user.email}\"\n end", "def greet\n puts 'Welcome to the school review app, the best resource for school information in the world!'\n @prompt.select(\"Are you a returning user or a new user?\") do |menu|\n menu.choice \"Returning User\", -> { User.handle_returning_user }\n menu.choice \"New User\", -> { User.handle_new_user }\n end\n end", "def welcome(user)\n #def welcome(email)\n @appname = \"Birdy's golf store\"\n mail( :to => user.email,\n #mail( :to => email,\n :subject => \"Welcome to #{@appname}!\")\n end", "def welcome(user)\n @user = user.first_name\n mail(to: user.account.email, subject: 'Welcome to the woods')\n end", "def set_welcome\n end", "def welcome(user)\n @user = user\n @greeting = \"Hi\"\n mail(to:\"nithyarajar@gmail.com\", sub:\"Welcome to Devfolio\")\n end", "def greet\n system \"clear\"\n self.spinner(\"Loading App\")\n self.spinner(\"🔺 Enumerati-ing 🔺 \")\n welcome = \"Welcome\".colorize(:light_green)\n se = \"Student Exchange\".colorize(:light_magenta)\n puts \"_\".colorize(:light_green) * \"Welcome to Student Exchange, the best book exchanging application on campuses throughout USA!\".length\n choice = self.prompt.select(\"Welcome to \".colorize(:light_green) + \"Student Exchange\".colorize(:color => :light_magenta, :mode => :bold) + \", the best book exchanging application on campuses throughout USA!\\n\".colorize(:light_green) + \"Are you a new user or returning user?\".colorize(:color => :light_green).underline, [\"New User\", \"Returning User\", \"Exit\"])\n puts \" \"\n # Based on the user's choice, will redirect them to the appropriate User method\n # We set the user instance object to the user object we created (new user) or retrieved (returning user)\n case choice\n when \"New User\"\n user = User.handle_new_user\n self.spinner(\"Creating Account\")\n self.user = user\n self.main_menu\n when \"Returning User\"\n user = User.handle_returning_user\n self.spinner(\"Restoring Session\")\n self.user = user\n self.main_menu\n when \"Exit\"\n puts \"Smell ya later! 🦄\"\n exit\n end \n end", "def welcome\n UserMailer.welcome\n end", "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", "def welcomeTwoUsers(user1, user2)\r\n puts \"Welcome #{user1} and #{user2}\"\r\nend", "def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend", "def check_for_user\n if User.count == 0\n User.create({:login => \"admin\", :password => \"password\", :password_confirmation => \"password\", :name => 'blog owner', :email => \"none@none\", :time_zone => \"Europe/London\"})\n # Display the newly created users details\n notify \"No users found, so default user created: authenticate with login \\\"admin\\\", password \\\"password\\\", and then change your password.\"\n end\n login_required\n end", "def welcome\nend", "def welcome(user)\n @name = user.email.split(\"@\").first\n @name = @name.titleize\n @greeting = \"Hi\"\n\n mail to: \"#{@name} <user.email>\"\n end", "def welcome(user)\n @user = user\n \n mail to: @user.email, subject: \"[Post] Welcome! Thanks for signing up.\"\n end", "def welcome(user)\n mail(to: user.email, subject: \"[Blueprint] Thanks for registering!\") do |format|\n template = user.mentor? ? 'welcome_mentor' : 'welcome_hacker'\n format.html { render template }\n format.text { render template }\n end\n end", "def welcome(user)\n \n user = @inquiry\n \n @greeting = \"Hi #{user.name}\"\n\n mail(:from => \"admin@testapp.com\",\n :to => user.email,\n :subject => \"Thanks for reaching out\")\n end", "def welcome_information(user)\n @account = user\n mail(:to => named_email(user), :subject => \"Liveplus - Welcome\")\n end", "def welcome\n # show welcome\n end", "def welcome(user)\n @user = user\n @greeting = \"Hi\"\n\n mail to: \"thomasjyang@gmail.com\", :subject => \"Awesome subject for welcome\"\n end", "def welcome(user_id)\n user = User.find(user_id)\n mail(\n to: \"#{user.email}\",\n subject: \"Welcome to Lister!\"\n )\n end", "def welcome(user)\n @user = user\n \n mail(:to => user.email, :subject => \"Registered\")\n end", "def new_user_handler\n nil\n end", "def welcome(user)\n @user = user\n mail to: @user.email, subject: \"Bienvenu sur QstomR\"\n end", "def welcome(user)\n @user = user\n mail to: @user.email, from: \"welcome@theshoplift.com\"\n end", "def welcome_mail(user)\n mail to: user.email,\n subject: \"Welcome to Startglory\"\n\n end", "def available_to(who)\n case who\n when 'logged_in' then redirect_to root_path if !current_user\n when 'logged_out' then redirect_to home_path if current_user\n end\n end", "def welcome(user)\n @user = user\n mail(to: @user.email, subject: \"Welcome to DevPoint Labs!\")\n end", "def welcome(user, password)\n @greeting = \"Hi\"\n @email = user.email\n @password = password\n\n mail to: user.email\n end", "def registration( new_user )\n @greeting = \"Launch 'n Dine\"\n mail to: new_user.email,\n subject: \"Launch 'n Dine Welcomes You\"\n end", "def welcome(user)\n @user=user\n @url = 'http://www.pemplum.es'\n\n mail to: @user.email, subject: 'bienvenido'\n end", "def notify_admin_about_newbie(user)\n @user = user\n mail \n end", "def welcome(user)\n @appname = \"Oasis Books\"\n mail( :to => user.email,\n :subject => \"Welcome to #{@appname}!\")\n end", "def redirect_to_welcome_path(user)\n welcome_path(new_user_id: user.id)\n end", "def set_user; end", "def new_user first_name: \"first\", last_name: \"last\"\n puts \"Welcome to our site, #{first_name} #{last_name}!\"\nend", "def user; end", "def user; end", "def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_name = message.from.nil? ? '' : ', ' + message.from.first_name\n send_message \"#{greetings.sample.capitalize}#{first_name}!\\n Enter /help for options.\"\n end", "def welcome(user)\n\t\t@user = user\n\t\t@url = 'http://soul-space.heroku.com/sign-up'\n\t\tmail(to: @user.email, subject: 'Welcome to Soul Space: Sign-up Confirmation')\n\tend", "def welcome_email(user)\n\t\t@user = user\n\t\tmail(to: user.email.to_s, subject: \"Welcome to Interest Points\")\t\n\tend", "def is_user?\ncurrent_user.username == @userl.username\n end", "def first_login\n if !current_user.adm? && (!current_user.last_name.present? || !current_user.email.present? || \n !current_user.job.present? || !current_user.cpf.present? || current_user.email == (0...6).map { ('a'..'z').to_a[rand(26)] }.join+\"@facebook.com\") \n redirect_to edit_user_path(current_user)\n flash[:info] = \"Complete seu cadastro!\"\n \n if !current_user.last_name.present?\n flash[:info] = \"Sobrenome não registrado.\"\n end\n \n if !current_user.email.present?\n flash[:info] = \"Email não registrado.\"\n end\n \n if !current_user.job.present?\n flash[:info] = \"Trabalho não registrado.\"\n end\n \n if !current_user.cpf.present?\n flash[:info] = \"CPF não registrado.\"\n end\n \n if current_user.email == (0...6).map { ('a'..'z').to_a[rand(26)] }.join+\"@facebook.com\"\n flash[:info] = \"Registre o seu email.\"\n end\n end\n end", "def welcome\n system 'clear'\n puts header.call \"Welcome to Ruby QuickNews\"\n puts \"Please login or create a new username\"\n login_menu\n end", "def welcome(user)\n @user = user\n # if WelcomeCall.find_by(booking_id: @booking.id)\n # message.perform_deliveries = false\n # else\n email_with_name = %(\"#{@user.full_name}\" <#{@user.email}>)\n mail(to: email_with_name, subject: 'Stacey - coliving')\n # end\n end", "def welcome_email\n # User welcome email sent.\n end", "def users\n \n end", "def create_new_user\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Tell us a little about yourself. It will only take a moment.\"\n puts \"\"\n puts \"What is your name?\"\n puts \"\"\n new_user_full_name = gets.strip\n self.quit if new_user_full_name == \"quit\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Is there something you'd like to be called, other than your first name?\"\n puts \"\"\n puts \" 1. Yes\"\n puts \" 2. No\"\n puts \"\"\n nick_name = gets.strip\n if nick_name == \"1\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"What would you like us to call you? (In other words, what is your nickname?)\"\n puts \"\"\n new_user_nickname = gets.chomp.split.map(&:capitalize).join(' ')\n User.name_search_and_greeting_new(new_user_full_name, new_user_nickname, self)\n elsif nick_name == \"2\"\n User.name_search_and_greeting_new(new_user_full_name, nil, self)\n user_name_array = new_user_full_name.split(\" \")\n elsif nick_name == \"quit\"\n self.quit\n end\n self.where_are_you_at?\n end", "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", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end", "def login_new_user\n name = 'test_user_' + rand(1000).to_s\n user = TestHelper.ensure_user_exists(name, name)\n login_user user\n user\nend", "def welcome\n puts message_list[:welcome]\n # help\n end", "def check_user_info_initialized\n exists = UserInfo.exists?(current_user.id)\n create = controller_name == 'user_infos' && %w(new create).include?(action_name)\n if exists && create\n redirect_to(user_info_path)\n elsif !exists && !create\n flash[:notice] = \"Page will be available after filling in your information.\"\n redirect_to(new_user_info_path)\n end\n end", "def welcome\n # welcome my user \n puts \"Welcome to the book search database\\n\"\nend", "def user_welcome_notice(user)\n @user = user\n mail(:to => @user.email, :subject => \"Welcome to SocialStreet\") unless @user.email.blank?\n end", "def generate_welcome_message\n return if [User.main_admin.id, User.security_id, User.bot_id, User.support_id].include?(id)\n \n # from security\n msg = \"<p>#{first_name},</p>\"\n msg << '<p>Welcome to LoveRealm. Your security is our number one priority. For the sake of your own safety, please do follow these general guidelines:</p>' \n msg << '<ol type=\"i\"><li>Beware of individuals who request that you send money to them outside this app.</li>' \n msg << '<li>We encourage giving as it is an avenue for God’s blessings, however the most secure way to give online via this platform is to send money via LoveRealm’s secure payment system. Only institutions/organizations that are individually verified by our staff are allowed to accept payments via this platform, thus the most secure way to give online is via LoveRealm’s payment system</li>' \n msg << '<li>When physically meeting friends you made online, it is advisable to meet in public places. </li>' \n msg << '<li>If any user on this platform is behaving suspiciously, please do well to report them on their profile. You can also directly message our security staff via this chat and we will act accordingly.</li></ol>'\n msg << '<p>Thank you for your co-operation :)</p>'\n msg << '<p>Watchdogs of LoveRealm</p>'\n Conversation.get_single_conversation(id, User.security_id).messages.create!({sender_id: User.security_id, body: msg, is_safe_body: true})\n \n # from main admin\n msg = '<p>Hi there,</p>'\n msg << '<p>I’m Dr. Ansong, co-founder and CEO at LoveRealm. <br>Feel free to message me if you have any issues.</p>'\n msg << '<p>Thanks.</p>'\n Conversation.get_single_conversation(id, User.main_admin_id).messages.create!({sender_id: User.main_admin_id, body: msg, is_safe_body: true})\n \n # from Support\n msg = \"<p>Dear #{first_name}</p>\"\n msg << \"<p>Welcome to LoveRealm. On our community, you will meet like minded believers who are ready to help you grow in your faith. You will also form valuable friendships and relationships through this app.</p>\"\n msg << \"<p>Feel free to share your thoughts and inspiration on LoveRealm. Our community is ever ready to assist you should you have prayer requests or mind boggling questions. Don't worry if you are shy, you can use the anonymity feature.:). Our chat rooms are also really fun and you should find time to check it out.</p>\"\n msg << \"<p>In case you need someone to talk to, you can try out the counselors on this platform. We do encourage you to join your church through this platform so as to ensure constant fellowship. If your church is not yet on LoveRealm, you can invite them to set up a church account. This will actually help your church grow and it’s totally free.</p>\"\n msg << \"<p>In case you are having any challenges, feel free to reply to this message. Our support staff will assist you.</p>\"\n msg << \"<p>Thank you, <br>The LoveRealm Team.</p>\"\n Conversation.get_single_conversation(id, User.support_id).messages.create!({sender_id: User.support_id, body: msg, is_safe_body: true})\n end", "def create\n\t\tsuper\n\t\tif @user.persisted?\n\t\t\tUserMailer.welcome(@user).deliver_now\n\t\tend\n\tend", "def run\n tml\n welcome_user\n login_or_create_user\n present_menu_options\nend", "def user\n end", "def welcome(user)\n @user = user\n\n mail(to: user.email,\n cc: \"goodo73@gmail.com\", \n subject: \"[AFL Finals Sharemarket] Welcome to the AFL Finals Sharemarket website\")\n end", "def admin_required\n #just a patch until i can implement users and roles\n \n # \"Speak friend, and enter\" (Moria)\n session[:friend] ||= params[:friend]\n session[:friend] || redirect_to(home_path)\n end", "def augment\n @users = User.all\n @user = current_user\n if @user.update_attributes(user_params)\n flash[:success] = \"Welcome to Telmi!\"\n render 'index'\n else\n render 'nda_page'\n flash[:danger] = \"Unable to create user. Please try again.\"\n end\n end", "def mts_hello\n puts \"Hello! Welcome to the Millennial Translation Service. Please enter your name.\".colorize(:light_green)\n\n name = gets.chomp.capitalize\n # take the name and search to see if they have an account\n if User.exists?(user_name: name) # if returning user, display options, User.find_user returns the object if found\n puts \"Welcome back, #{name.capitalize}!\".colorize(:light_green)\n mts_step_one(name)\n else # if the user is new, create a new user\n puts \"This is the first time we have seen you, #{name.capitalize.underline}. Let's show you around.\".colorize(:light_green)\n User.create(user_name: name)\n new_user_orientation(name)\n end\nend", "def welcome_email\n NotifierMailer.welcome_email User.take\n end", "def create\n hobo_create do\n if valid?\n self.current_user = this\n flash[:notice] = t(\"hobo.messages.you_are_site_admin\", :default=>\"You are now the site administrator\")\n redirect_to home_page\n end\n end\n end", "def create\n hobo_create do\n if valid?\n self.current_user = this\n flash[:notice] = t(\"hobo.messages.you_are_site_admin\", :default=>\"You are now the site administrator\")\n redirect_to home_page\n end\n end\n end", "def forgot\n\n\n\t\t#if user already exists,\n\t\t#attempt to send txt to user\n\t\t#and redirect to session controller to ask user to sign in w pin\n\tend", "def notify_admin_about_newbie(user)\n @user = user\n mail\n end", "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", "def welcome(user)\n @user = user\n mail(to: @user.email, subject: 'Welcome to TimeTrckr.com')\n end", "def user_present(host, username)\n case host['platform']\n when /eos/\n on(host, \"useradd #{username}\")\n else\n host.user_present(username)\n end\n end" ]
[ "0.7073493", "0.68903244", "0.6831217", "0.6808093", "0.6763209", "0.676031", "0.6738259", "0.67248815", "0.66971934", "0.6687613", "0.6685772", "0.6672079", "0.666584", "0.664756", "0.6617702", "0.65855557", "0.6584371", "0.65809256", "0.65606236", "0.65596086", "0.65409327", "0.6535467", "0.65146995", "0.6512855", "0.6512252", "0.6506871", "0.6497346", "0.6491949", "0.64739335", "0.64729553", "0.64713013", "0.6465198", "0.64266354", "0.64044607", "0.6395328", "0.63949084", "0.63854915", "0.63820225", "0.63725495", "0.63491434", "0.6346714", "0.63396925", "0.6339367", "0.63349354", "0.6331136", "0.6326314", "0.6325344", "0.6307181", "0.62772006", "0.62756014", "0.62711805", "0.6265516", "0.6262541", "0.6248414", "0.6237565", "0.6233354", "0.62245846", "0.6218356", "0.6217048", "0.62101936", "0.6206896", "0.6202317", "0.6192868", "0.6191242", "0.61881524", "0.61871505", "0.61871505", "0.61865807", "0.6186408", "0.61814195", "0.61728364", "0.6171221", "0.6164735", "0.6147226", "0.6147148", "0.6144871", "0.6144866", "0.61441463", "0.61439514", "0.6143086", "0.61423314", "0.6127678", "0.611523", "0.6111899", "0.61098874", "0.6109268", "0.6105028", "0.60970086", "0.6095829", "0.6094313", "0.6082697", "0.6069314", "0.6067502", "0.6064836", "0.6064836", "0.6062251", "0.60548764", "0.6046822", "0.60459507", "0.6042889" ]
0.6305389
48
Returns users and their attributes Optional: filter, fields
def index users = get_collection(visible_users) || return respond_to do |format| format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) } format.json { render json: users.to_json(only: DEFAULT_FIELDS) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n Iterable.request(conf, '/users/getFields').get\n end", "def get_users(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"users\", params)\n end", "def read_users(status=nil)\n # if a filter is provided for the status then set it otherwise just search for people\n # Note: The filter will not capture users that do not have their status set. \n if status\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:status].to_s, status ? status : \"*\")\n else\n filter = Net::LDAP::Filter.eq(:objectClass, \"inetOrgPerson\")\n end\n return search_map_user_fields(filter)\n end", "def all(read_attributes=\"01\")\n options = default_options_to_merge_with.merge({ query: { full: read_attributes} })\n self.class.get(\"/#{@api_ver}/users\", options)\n end", "def attributes(username)\n @users[username][:attributes]\n end", "def users\n if params._type_filter != 'all'\n store.users.where(graduation_year: \"#{params._type_filter}\").all\n else\n store.users.all\n end\n end", "def getUsers() #:name, :default_currency, :locale\r\n returnArray = []\r\n retrieveData(\"/v1/users\")[\"data\"].each do |item|\r\n returnArray << User.new(item[\"name\"], item[\"default_currency\"], item[\"locale\"])\r\n end\r\n return returnArray\r\n end", "def get_ldap_allusers_attributes(upi:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('cn', \"#{upi}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n yield response # Only want the first entry\n end\n return nil\n end", "def users\n set_attributes_for(User)\n User.find(:all)\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def index\n @user_attributes = UserAttribute.all\n end", "def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend", "def fetch_users\n user_relational_query = get_model_query\n @total_filtered_users = user_relational_query.count\n\n return if @total_filtered_users < 1\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @users = user_relational_query.limit(@page_size).offset(offset).all\n # No need to query kyc detail if filter applied is kyc_submitted_no\n if @allowed_filters[GlobalConstant::User.is_kyc_submitted_filter].to_s != GlobalConstant::User.kyc_submitted_false\n @user_kyc_details = UserKycDetail.using_client_shard(client: @client).\n where(user_id: @users.collect(&:id)).all.index_by(&:user_id)\n end\n end", "def users\n @attributes[:users]\n end", "def liked_users \n users = object.liked_users.collect do |liked_user|\n # user = User.find_by(id: liked_user.liked_user_id)\n # user.attributes.except!(\"created_at\", :updated_at, :email)\n user = User.select(:id, :name, :gender, :age, :bio).find_by(id: liked_user.liked_user_id)\n end\n end", "def get_users_by_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_users_by_search ...\"\n end\n \n # resource path\n path = \"/Users/Search\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'first_name'] = opts[:'first_name'] if opts[:'first_name']\n query_params[:'last_name'] = opts[:'last_name'] if opts[:'last_name']\n query_params[:'email'] = opts[:'email'] if opts[:'email']\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIUser>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_users_by_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def users(filter = {})\n handler[:people].filter(filter)\n end", "def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end", "def get_users(options = {})\n options[:include] = [:roles, :groups, :center]\n page_opts = {:page => options.delete(:page) || 1, :per_page => options.delete(:per_page) || 20}\n sort = options.delete(:sort) || \"users.id\"\n order = options.delete(:order) || \"asc\"\n order_by = \"#{sort} #{order}\"\n puts \"order_by #{order_by}\"\n users = if self.has_access?(:user_show_all) # gets all users which are not login-users\n User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).order(order_by).paginate(page_opts).uniq\n elsif self.has_access?(:user_show_admins)\n User.users.with_roles(Role.get_ids(Access.roles(:user_show_admins))).order(order_by).paginate(page_opts)\n elsif self.has_access?(:user_show)\n User.users.in_center(self.center).order(order_by).paginate(page_opts)\n else\n WillPaginate::Collection.new(page_opts[:page], page_opts[:per_page])\n end\n return users\n end", "def get_ldap_user_attributies(upi:, attributes:)\n response = {}\n @treebase = 'dc=UoA,dc=auckland,dc=ac,dc=nz'\n filter = Net::LDAP::Filter.eq( 'objectCategory', 'user' ) & Net::LDAP::Filter.eq('cn', \"#{upi}\")\n attr_list = []\n attributes.each { |k, _v| attr_list << k }\n @ldap.search( base: @treebase, filter: filter, attributes: attr_list ) do |entry|\n attributes.each do |attribute, value|\n response[value] = entry[attribute][0].to_s.strip\n end\n return response # Only want the first entry\n end\n return nil\n end", "def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def extract_user_object_attributes(users)\n arr = users.inject([]) do |a, user|\n u = HashWithIndifferentAccess.new(user)\n a << u.slice(*USER_ATTRIBUTES)\n end\n\n return arr\n end", "def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.icn\n }\n end", "def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end", "def get_users(options = {})\n options[:include] = [:roles, :groups, :center]\n options[:page] ||= 1\n options[:per_page] ||= 20\n users = if self.has_access?(:user_show_all) # gets all users which are not login-users\n User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).paginate(options).uniq\n elsif self.has_access?(:user_show_admins)\n User.users.with_roles(Role.get_ids(Access.roles(:user_show_admins))).paginate(options)\n elsif self.has_access?(:user_show)\n User.users.in_center(self.center).paginate(options)\n else\n WillPaginate::Collection.new(options[:page], options[:per_page])\n end\n return users\n end", "def get_users(options = {})\n options[:include] = [:roles, :groups, :center]\n options[:page] ||= 1\n options[:per_page] ||= 20\n users = if self.has_access?(:user_show_all) # gets all users which are not login-users\n User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).paginate(options).uniq\n elsif self.has_access?(:user_show_admins)\n User.users.with_roles(Role.get_ids(Access.roles(:user_show_admins))).paginate(options)\n elsif self.has_access?(:user_show)\n User.users.in_center(self.center).paginate(options)\n else\n WillPaginate::Collection.new(options[:page], options[:per_page])\n end\n return users\n end", "def users model = User.bands\n @users ||= find_users model\n end", "def user_search(params = {})\n request = Ohmage::Request.new(self, :post, 'user/search', params)\n # TODO: make a utility to abstract creation of array of base objects\n t = []\n request.perform[:data].each do |k, v|\n t << Ohmage::User.new(k => v)\n end\n t\n end", "def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end", "def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def restrict_fields\n\n allowed_fields=User.new.attributes.keys\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n if @fields.present?\n @users=@users.select(@fields) \n else\n @fields=allowed_fields\n end \n end", "def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end", "def all_users\n @user = User.where(created_by: @current_user.id).select(:id,:email,:username,:mobile,:address)\n if @user.present?\n render json: {success:true,data:@user}\n else\n render json: {success:false,message:\"No Records Found\"}\n end\n end", "def attributes\n attrs = super\n if attrs['user'] && attrs['user']['id']\n attrs.merge!('user_id' => attrs['user']['id'])\n attrs.delete 'user'\n end\n attrs\n end", "def get_user_collection_fields(username)\n query_and_build \"users/#{username}/collection/fields\"\n end", "def users\n \n @users = User.where(:enabled => true)\n @users = @users.where(:role => params[:role].upcase) if params[:role]\n @users = @users.where(:id => params[:id]) if params[:id]\n respond_to do |format|\n format.xml { render :xml => @users.to_xml }\n end\n \n end", "def list\r\n\r\n @restricted_fields = []\r\n pagin_opts = {:include => [:customers,:profiles]}\r\n pagin_opts[:page]\t = params[:page].to_i > 0 ? params[:page].to_i : 1\r\n pagin_opts[:per_page]\t = (params[:per_page] || cookies[:users_per_page] || 50).to_i\r\n pagin_opts[:order]\t = @default_order if @default_order\r\n pagin_opts[:order]\t||= 'users.' +params[:sort_by] if !params[:sort_by].blank?\r\n pagin_opts[:conditions] ||= @default_filter if @default_filter\r\n pagin_opts[:conditions] ||= params[:conditions] if params[:conditions].is_a?(Hash)\r\n pagin_opts[:joins]\t||= @joins_fields || []\r\n\r\n @users = User.paginate(pagin_opts)\r\n render(:xml => @users.to_xml(:dasherize => false, :only => [:id,:login,:first_name,:last_name,:email,:telephone,:language,:active,:hashed_password,:salt,:last_login,:last_session_id], :methods => [:customers_human_display,:password,:user_accesses_human_display,:accesses_human_display,:profiles_human_display,:dev_feedbacks_human_display,:file_imports_human_display])) and return if params[:format] == 'xml'\r\n render(:json => @users) and return if params[:format] == 'json'\r\n render(:pdf => @users, :action => :list) and return if params[:format] == 'pdf'\r\n if !params[:group_by].blank? && [\"login\", \"first_name\", \"last_name\", \"email\", \"telephone\", \"language\", \"active\", \"password\", \"hashed_password\", \"salt\", \"last_login\", \"last_session_id\"].include?(params[:group_by])\r\n @users_groups = @users.inject({}) { |acc,elt|\r\n crit = nil\r\n if [].include?(params[:group_by])\r\n crit = elt.send(params[:group_by]) ? elt.send(params[:group_by]).disp_name : nil\r\n else\r\n crit = elt.attributes[params[:group_by]]\r\n end\r\n acc[crit] ||= []\r\n acc[crit] << elt\r\n acc\r\n }\r\n end\r\n end", "def user_attributes\n {\n email: \"test@example.com\",\n username: \"Test\",\n bio: \"bio\",\n url: \"https://example.com\",\n twitter: \"djensenius\",\n portrait: \"head.jpg\"\n }\nend", "def searchUsers\n # if current_user.rolable.class.name == \"Charity\"\n # return User.where.not(rolable_type: 'Business')\n # # list_a = User.where(rolable_type: 'Business').order(:rolable_id).pluck(:id, :rolable_id)\n # # search_list = Business.order(:id).pluck(:id, :name)\n\n # # search_list.each_with_index do |x, index|\n # # x[0] = list_a[index][0]\n # # end\n # # sea\n # # search_list = Business.where(active: true).pluck(:name)\n # # search_list.each do |b|\n # # list << b.name\n # # current_user\n # elsif current_user.rolable.class.name == \"Business\"\n # return User.where(rolable_type: 'Charity')\n # # list_a = User.where(rolable_type: 'Charity').order(:rolable_id).pluck(:id, :rolable_id)\n # # search_list = Charity.order(:id).pluck(:id, :name)\n # # search_list.each_with_index do |x, index|\n # # x[0] = list_a[index][0]\n # # end\n # # # search_list.each do |c|\n # # # list << c.name\n # # # end\n # end\n return User.where.not(rolable_type: 'Donor')\n end", "def get_all_users(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"user\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end", "def find_all_for_support_ui\n execute_sql(:read, :user) do\n table.select(:username, :email, :serialized_object).map do |row|\n inflate_model(row)\n end\n end\n end", "def index\n @users = []\n if current_user.admin?\n @users = User.all\n @users = @users.where(\"users.firstname like ?\", \"%#{params[:firstname]}%\") if params[:firstname].present?\n @users = @users.where(\"users.lastname like ?\", \"%#{params[:lastname]}%\") if params[:lastname].present?\n @users = @users.where(\"users.dni like ?\", \"%#{params[:dni]}%\") if params[:dni].present?\n @users = @users.where(role: params[:rl]) if params[:rl].present?\n end\n json_response(@users.to_json(only: [:id, :firstname, :lastname, :email, :role, :dni, :address, :phone]))\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def core_user_get_users(criteria)\n params = {}\n\n counter = 0\n criteria.each do |key,value|\n params['criteria[' + counter.to_s + '][key]'] = key.to_s\n params['criteria[' + counter.to_s + '][value]'] = value\n counter = counter + 1\n end\n\n response = request(params)\n\n if response['users']\n users = response['users'].map { |user| Hashie::Mash.new(user) }\n end\n end", "def core_user_get_users(criteria)\n params = {}\n\n counter = 0\n criteria.each do |key,value|\n params['criteria[' + counter.to_s + '][key]'] = key.to_s\n params['criteria[' + counter.to_s + '][value]'] = value\n counter += 1\n end\n\n response = request(params: params)\n\n if response['users']\n response['users'].map { |user| Hashie::Mash.new(user) }\n end\n end", "def get_users(request); end", "def set_users\n \n columns=params[:columns]\n order=params[:order][\"0\"]\n search_list=User.attribute_names.select do |item|\n !@model_config[item].nil? && @model_config[item][\"searchable\"]\n end\n @filteredUsers=User.all\n @filteredUsers=@filteredUsers.order(\"#{columns[order[\"column\"]][\"data\"]} #{order[\"dir\"]}\") #单项排序\n @users=@filteredUsers.offset(params[:start]).limit(params[:length])\n end", "def users(options = {})\n request_params = {\n per_page: options.fetch(:per_page, nil),\n page: options.fetch(:page, nil),\n include_totals: options.fetch(:include_totals, nil),\n sort: options.fetch(:sort, nil),\n connection: options.fetch(:connection, nil),\n fields: options.fetch(:fields, nil),\n include_fields: options.fetch(:include_fields, nil),\n q: options.fetch(:q, nil),\n search_engine: options.fetch(:search_engine, nil)\n }\n get(users_path, request_params)\n end", "def users\n records do |instance|\n instance['users'] = user.where('organization_id': instance['_id'])\n end\n end", "def get_all\n @user_repository.get_all_users\n end", "def v2_api_response\n user_attributes = self.attributes.only(:id, :email, :first_name, :last_name, :company, :job_title, :phone_number, :webpage, :type, :address_1, :address_2, :city, :state, :zip, :country, :mobile, :fax, :designer_firm, :designer_name, :my_products_count)\n user_attributes.merge! :is_premium => self.premium?, :avatar => ([:thumb, :small, :large].collect do |kind| { kind => self.avatar(kind).to_s } end)\n if self.premium?\n user_attributes.merge! :firm => self.firm.attributes.only(:id, :name, :logo, :tier_id)\n end\n user_attributes\n end", "def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def users options = {}\n query = {\n \"skip\" => options[:skip],\n \"limit\" => options[:limit],\n \"q\" => options[:search]\n }\n\n data = client.get \"/#{api_prefix}/rooms/#{id}/users\", query\n\n User::Collection.new self, data\n end", "def user\n {\n id: object.user.id,\n email: object.user.email,\n birthday: object.user.birthday,\n first_name: object.user.first_name,\n middle_name: object.user.middle_name,\n last_name: object.user.last_name,\n phone: object.user.phone,\n gender: object.user.gender,\n neighborships: object.user.neighborships\n }\n end", "def index\n @user_fields = UserField.all\n end", "def index\n @user_fields = UserField.all\n end", "def filter_users\n allowed_keys=[\"email\", \"admin\"]\n filtering_keys=allowed_keys & params.keys\n filtering_keys.each {|key| filter_by_key(key)}\n end", "def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def users\n company_ids = [self.id]\n company_ids += advisor_company_ids if advised?\n\n user_ids = UserAffiliation.where(:company_id.in => company_ids).with_access.only(:user_id).map(&:user_id)\n User.where(:id.in => user_ids).order_by(created_at: :asc)\n end", "def user_filter_options username=nil\n user_list = User.by_name.map { |u| [u.username, u.username] }\n user_list.unshift ['All users', 'all']\n\n selected = get_user_filter username\n options_for_select user_list, selected\n end", "def index\n authorize User\n\n @users = !!params[:search] ? User.search_includes(params[:search]) : User.all_includes\n\n @users = User.filter_with(@users, params[:filter]) if !!params[:filter]\n\n @users = User.sort_num_desc(@users, params[:sort_by]) if !!params[:sort_by]\n end", "def get_users_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_users ...\"\n end\n \n # resource path\n path = \"/Users\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIUser>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def users\n get('get_users')\n end", "def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end", "def getUsers\r\n if params[:userTerm].blank? \r\n params[:userTerm] = nil\r\n end\r\n if params[:page].nil?\r\n params[:page] = 1\r\n end\r\n if params[:type].blank?\r\n params[:type] = 0 # 0 - ue part. ,1 - exp followers, 2 user following, 3 user followers\r\n end\r\n if params[:id].blank? && !UsersExprience.isExists(params[:id].to_i) && params[:typeview] == 0\r\n params[:id] = 0 # 0 - ue part. , user exp follow , 1 - reported, 2- global\r\n end\r\n users = nil\r\n case params[:type].to_i\r\n when 0\r\n user_existed = ''\r\n if params[:id].to_i != 0\r\n user_existed = UsersExprienceFollowers.following(params[:id].to_i).map(&:users_id).join(\",\") \r\n else \r\n user_existed = UsersExprienceFollowers.following(params[:id].to_i).map(&:user_id).join(\",\") \r\n end\r\n unless UsersExprienceFollowers.following(params[:id].to_i).size != 0\r\n users = UsersFollows.followers(params[:user].id).uniq\r\n else\r\n users = UsersFollows.followers(params[:user].id).where(\"users_follows.user_id not in (\" + user_existed +\")\").uniq\r\n end \r\n when 1 \r\n users = UsersExprienceFollowers.following(params[:id].to_i).uniq\r\n when 2\r\n users = UsersFollows.following(params[:user].id).uniq\r\n else \r\n users = UsersFollows.followers(params[:user].id).uniq\r\n end\r\n unless params[:userTerm].blank? \r\n searchTerms = \"%\" + params[:userTerm].downcase + \"%\"\r\n users = users.where(\"lower(users_profiles.lname) like ? or lower(users_profiles.fname) like ?\",searchTerms,searchTerms)\r\n end \r\n users = users.page(params[:page].to_i).per(APP_CONFIG[\"Max_Page\"])\r\n usersProfile = Array.new\r\n users.each do |item|\r\n userObj = nil\r\n case params[:type].to_i\r\n when 2\r\n userObj = UsersProfile.byUser(item.ref_user_id).first\r\n when 3\r\n userObj = UsersProfile.byUser(item.user_id).first\r\n else\r\n userObj = UsersProfile.byUser(item.id).first\r\n end\r\n\r\n unless userObj.nil?\r\n asset = {\r\n :id => -1,\r\n :uri=> ''\r\n }\r\n unless userObj.image_id.nil?\r\n if userObj.image_id != 0 \r\n assetObj = Assets.where({id:userObj.image_id}).first.asset.url(:small)\r\n asset[:id] = userObj.image_id\r\n asset[:uri] = assetObj\r\n end\r\n end\r\n is_ue = false\r\n is_follow = false\r\n if params[:type].to_i == 1&& !UsersExprience.isExists(params[:id].to_i)\r\n is_uep = !UsersExprienceParticipants.isExists(item.id,params[:id].to_i)\r\n end\r\n if params[:type].to_i == 2 \r\n is_follow = !UsersFollows.isExists(item.user_id,params[:user].id)\r\n end\r\n if params[:type].to_i == 3\r\n is_follow = UsersFollows.isExists(item.user_id,params[:user].id)\r\n end\r\n \tdataHash ={\r\n \t\tfname: userObj.fname,\r\n \t\tlname: userObj.lname,\r\n \t\tid: userObj.user_id,\r\n \t\timage: asset,\r\n status: {\r\n is_follow: is_follow\r\n }\r\n \t}\r\n \tusersProfile.push(dataHash)\r\n end\r\n end\r\n @responseObject = OpenStruct.new({\r\n status: true,\r\n errors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n objectData: OpenStruct.new({ items: usersProfile, total: users.num_pages }),\r\n timestamp: (Date.new).to_time.to_i.abs\r\n })\r\n \trender :template => 'api/v1/users/members/getUsers' ,:handlers => [:rabl], :formats => [:json]\r\n\tend", "def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end", "def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# A filter used to exclude specific types of users\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\t# A limit for the number of records to display on a page\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('user', 'list', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def users\n res = []\n url = data['links']['roleUsers']\n tmp = GoodData.get url\n tmp['associatedUsers']['users'].each do |user_url|\n user = GoodData.get user_url\n res << GoodData::Profile.new(user)\n end\n res\n end", "def list_users\n \t#p params[:search]\n \tif params[:search].nil?\n \t\t@users= User.all\n \telse\n \t\t@users= User.search_users(params)#this function from model\n \tend\n end", "def show\n #below line is default with selected attributes\n #render json: @user, :only => [:id, :name, :email, :age, :company]\n\n render json: @user\n end", "def get_users(count=42, offset=0)\n # Build a Filter String with a corresponding array of\n # prepared filters for the sql execution\n # (prepared statements prevent sql injection)\n prepared_filters = []\n filter_string = \"\"\n\n ALLOWED_FILTERS.each do |filter_name|\n if params.has_key?(filter_name) && \"All\" != params[filter_name]\n filter_string += \" AND #{filter_name} LIKE ?\"\n prepared_filters << params[filter_name]\n end\n end\n\n # If no user filters provided we will defalt to California\n filter_string = \"AND location LIKE '%CALIFORNIA%'\" if filter_string.empty?\n\n prepared_filters << count.to_i\n prepared_filters << offset.to_i\n\n # Connect to the database\n Database.new.execute(\n \"SELECT pictures.username,\n pictures.url,\n profiles.created_at,\n profiles.location\n FROM pictures\n JOIN profiles ON profiles.username = pictures.username\n WHERE size = 'small' #{filter_string}\n ORDER BY profiles.created_at DESC\n LIMIT ? OFFSET ?\",\n prepared_filters\n )\n end", "def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end", "def get_all_user_data\n load_user_data(nil)\n end", "def list_all_users\n\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end", "def index\n @users = User.order('id ASC').page(params[:page]).per(20)\n \n if params[:name].present?\n @users = @users.get_by_name params[:name]\n end\n \n if params[:allow].present?\n @users = @users.where(:allow => true)\n end\n \n if params[:createday].present?\n time = Time.parse(params[:createday]).all_day\n @users = @users.where(:created_at => time)\n end\n \n if params[:movieexist].present?\n @users = @users.where(:movie => nil)\n end\n end", "def user(*eras)\n from_eras(*eras, field: :users)\n end", "def user(*eras)\n from_eras(*eras, field: :users)\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def users(*args)\n params = arguments(args, required: [:q]).params\n params['q'] ||= arguments.q\n\n get_request('/search/users', arguments.params)\n end", "def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @filter = params[:filter] if params.has_key? :filter and %w{unapproved invited}.include? params[:filter]\n\n if params[:search]\n @search = User.search { fulltext params[:search] }\n @users = user_query.where(id: @search.results.map(&:id))\n else\n @users = user_query.order(updated_at: :desc)\n end\n end", "def export_users_fields\n case params[:type]\n when 'SALE'\n User.seller\n when 'CANDIDATE'\n User.hh\n end\n end", "def index\n if @search.nil?\n @search = User.search(params[:search])\n @users = nil\n else\n @search.meta_sort = \"email.asc\" if @search.meta_sort.nil?\n @users = @search.paginate(:page => params[:page])\n end\n end", "def user\n name = params[:name]\n number = params[:number]\n mail = params[:mail]\n id = params[:id]\n mail = \"#{mail}@gionee.com\" if mail.present? && mail.exclude?(\"@\")\n\n scope = User.all\n scope = scope.where(:id => id) if id.present?\n scope = scope.like(name) if name.present?\n scope = scope.where(:empId => number) if number.present?\n scope = scope.joins(:email_addresses).where(:email_addresses => {:address => mail}) if mail.present?\n\n users = scope.count == User.all.count ? [] : scope.limit(30)\n hash = users.map do |user|\n {\n :name => user.name,\n :id => user.id,\n :global_id => user.login,\n :number => user.empId,\n :mail => user.mail,\n :dept => user.dept_name,\n :dept_id => user.dept.try(:id)\n }\n end\n render :json => hash\n end", "def index\n @count = User.all.count\n @count_male = User.male.count\n @count_female = User.female.count\n @count_other = User.other.count\n @average = User.average(:age)\n @minimum = User.minimum(:age)\n @maximum = User.maximum(:age)\n\n @users = filter(params[:first], params[:city], params[:min], params[:max], params[:male], params[:female])\n end", "def list\n @search = {}\n @search[:editor] = true if filter_params[:editor] == '1'\n @search[:admin] = true if filter_params[:admin] == '1'\n @text = ['username ilike :text', text: \"%#{filter_params[:text]}%\"] if filter_params[:text].present?\n @pagy, @users = pagy(User.where(@search).where(@text))\n end", "def index\n @user_types_map = User.user_types.map{|k, v| [k, v.humanize.pluralize]}.to_h\n @filter = params[:filter] || 'Current'\n if @filter == 'All'\n @users = User.order(:email)\n elsif @user_types_map.values.include? @filter\n @users = User.where(locked_out: false, user_type: @user_types_map.key(@filter)).order(:email)\n else\n @users = User.where(locked_out: false).order(:email)\n end\n end", "def user_list\n\t\tres = {}\n\t\tusers = User.where(\"lower(name) ~ ?\",params[:pattern].downcase)\n\t\tif users\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:users] = users.pluck(:name, :email, :image)\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend", "def query\n ::User.all\n end", "def show_users\n @users = User.where(store: false, admin: false)\n end", "def collectors\n data = User.\n all.\n order(:name).\n map{|u| {id: u.id, name: u.name}}\n\n render_ok users: data\n end", "def read_all_about_it user\n \n collection.find(who_id: user.id,\n who_class: user.class.to_s\n ).collect{|args| Extra.new args }\n \n end", "def all_active_directory_users\n filter = Net::LDAP::Filter.construct(\n '(&(objectCategory=organizationalPerson)(givenName=*)(sn=*)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))')\n entries = OP_CONN.search(filter: filter)\n users = []\n entries.each do |entry|\n user = User.new(convert_user_attributes(entry))\n user.status = :enabled if (!user.disabled? && user.is_app_user?)\n users << user\n end\n users\n rescue Net::LDAP::LdapError => e\n return []\n end", "def member_results\n Spree::User.latest.includes(:profile_image, :user_authentications).search!(q)\n end", "def get_all\n\t\tif !params.has_key?(\"count\") or params[:count].empty?\n\t\t\tparams[:count]= 50\n\t\tend\n\t\tif !params.has_key?(\"start\") or params[:start].empty? \n\t\t\tparams[:start] = 0 \n\t\tend\n\t\tusers = []\n\t\tUser.all.limit(params[:count]).offset(params[:start]).each do |u|\n\t\t\thash = u.attributes \n\t\t\thash[:client] = u.client ? u.client.name : nil\n\t\t\tusers.push(hash)\n\t\tend\n\t\trespond({ status: 0, users: users, start: params[:start] })\n\tend" ]
[ "0.7016345", "0.68872595", "0.68271273", "0.6814705", "0.67519397", "0.6750368", "0.6740111", "0.67067736", "0.67007023", "0.6672344", "0.6665858", "0.66351116", "0.65872335", "0.65813106", "0.6567486", "0.6565599", "0.65570134", "0.64925903", "0.64878386", "0.64814043", "0.6480629", "0.6423941", "0.6410217", "0.6408324", "0.6406157", "0.64046615", "0.6400676", "0.6382944", "0.6365265", "0.6363321", "0.63367546", "0.6333935", "0.63153607", "0.6309634", "0.6296633", "0.6295954", "0.6295635", "0.6291406", "0.6291187", "0.62791944", "0.62787944", "0.6260878", "0.6256806", "0.6255956", "0.62468565", "0.6241863", "0.6236851", "0.6235439", "0.62344617", "0.6226976", "0.61990243", "0.61978936", "0.6187158", "0.6180063", "0.61715794", "0.61707693", "0.6164665", "0.6164665", "0.6163724", "0.6155646", "0.6155584", "0.61496633", "0.61464703", "0.6146047", "0.61376834", "0.6128968", "0.6124475", "0.61051506", "0.6099789", "0.6099479", "0.6089387", "0.608784", "0.60853004", "0.60838264", "0.60836166", "0.60677373", "0.6067568", "0.60603684", "0.60513175", "0.6050367", "0.6048251", "0.6042362", "0.6042362", "0.6032139", "0.60279953", "0.6025854", "0.60239345", "0.6021753", "0.60122615", "0.6007336", "0.6004403", "0.6002552", "0.6000606", "0.59954846", "0.59951663", "0.59905297", "0.59880525", "0.59868246", "0.5986732", "0.59864324", "0.5978591" ]
0.0
-1
Creates a new user Requires: user_name, type, first_name, last_name Optional: section_name, grace_credits
def create if has_missing_params?([:user_name, :type, :first_name, :last_name]) # incomplete/invalid HTTP params render 'shared/http_status', locals: { code: '422', message: HttpStatusHelper::ERROR_CODE['message']['422'] }, status: :unprocessable_entity return end # Check if that user_name is taken user = User.find_by(user_name: params[:user_name]) unless user.nil? render 'shared/http_status', locals: { code: '409', message: 'User already exists' }, status: :conflict return end # No conflict found, so create new user param_user_type = params[:type].camelize.downcase params.delete(:type) begin case param_user_type when 'enduser' EndUser.create!(params.permit(*DEFAULT_FIELDS)) when 'adminuser' AdminUser.create!(params.permit(*DEFAULT_FIELDS)) else render 'shared/http_status', locals: { code: '422', message: 'Unknown user type' }, status: :unprocessable_entity return end rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity else render 'shared/http_status', locals: { code: '201', message: HttpStatusHelper::ERROR_CODE['message']['201'] }, status: :created end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if has_missing_params?([:user_name, :type, :first_name, :last_name])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n\n # Check if that user_name is taken\n user = User.find_by_user_name(params[:user_name])\n unless user.nil?\n render 'shared/http_status', locals: {code: '409', message:\n 'User already exists'}, status: 409\n return\n end\n\n # No conflict found, so create new user\n param_user_type = params[:type].downcase\n params.delete(:type)\n\n if param_user_type == 'student'\n user_class = Student\n user_type = User::STUDENT\n elsif param_user_type == 'ta' || param_user_type == 'grader'\n user_class = Ta\n user_type = User::TA\n elsif param_user_type == 'admin'\n user_class = Admin\n user_type = User::ADMIN\n elsif param_user_type == 'testserver'\n user_class = TestServer\n user_type = User::TEST_SERVER\n else # Unknown user type, Invalid HTTP params.\n render 'shared/http_status', locals: { code: '422', message:\n 'Unknown user type' }, status: 422\n return\n end\n\n attributes = { user_name: params[:user_name] }\n attributes = process_attributes(params, attributes)\n\n new_user = user_class.new(attributes)\n new_user.type = user_type\n unless new_user.save\n # Some error occurred\n render 'shared/http_status', locals: {code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500']}, status: 500\n return\n end\n\n # Otherwise everything went alright.\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n end", "def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create_user user={}, account={}\n\n req = {}\n req.merge!({ :user => user }) unless user.empty?\n req.merge!({ :account => account }) unless account.empty?\n\n request('create-user', req)\n\n end", "def create_user(options = {})\n post :create, {:user => { :name => 'quire', :point_value => \"2\", :login => 'quire', :email => 'quire@example.com',\n :password => 'quire', :password_confirmation => 'quire' }.merge(options)}, {:user_id => \"1\"}\n end", "def create_user\n params = {\n client_id: @client_id,\n email: @email\n }\n @user = User.using_client_shard(client: @client).create!(params)\n end", "def create_user\n \t@user = User.new(user_params)\n @user.username = @user.name.split.sum\n \t@user.facility_id = current_user.facility_id\n \t@user.email = 'medinternational.dev'+@user.username.to_s + \"@gmail.com\"\n \t@user.language = \"english\"\n \t@user.password = \"password\"\n @user.role = Role.find_by_name(\"bmet_tech\")\n \trespond_to do |format|\n \t\tif @user.save\n \t\t\tformat.html { redirect_to settings_path, notice: 'User successfully created'}\n \t\t\tformat.json { redirect_to settings_path, notice: 'User successfully created'}\n \t\telse\n \t\t\tformat.html {redirect_to settings_path, notice: 'Failed to create user'}\n \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity}\n \t\tend\n \tend\n end", "def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "def create\n first_name, last_name, email, password = *params.values_at(:first_name, :last_name, :email, :password)\n\n if [first_name, last_name, email, password].any?(&:blank?)\n return render_success({status:\"error\", message: 'invalid create parameters'})\n end\n\n #User already exists\n if User.exists?(email: email.downcase)\n return render_success({status:\"error\", message:\"user already exists\"})\n end\n #create user\n User.transaction do\n @user = User.new(\n name: (first_name + \" \" + last_name).titleize,\n email: email.downcase,\n password: password,\n password_confirmation: password\n )\n if @user.save!\n render_success({status:\"success\", message:\"created\"})\n else\n render_success({status:\"error\", message:\"user creation failed\"})\n end\n end\n end", "def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end", "def create\n @user = User.new(user_params)\n if @user.save\n\n redirect_to edit_user_path(@user.id)\n else\n redirect_to sign_up_path\n end\n end", "def create_user \\\n user,\n options: nil,\n &block\n request = {\n user: user\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::CreateUserRequest\n @create_user.call(request, options, &block)\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "def create\n @user = User.new params[:user]\n if @user.save\n flash[:notice] = \"#{@user.full_name} was successfully added.\"\n redirect_to users_path\n else\n render :action => :new\n end\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user\n\t \to = [('a'..'z'), ('1'..'9')].map { |i| i.to_a }.flatten\n\t \tstring = (0...9).map { o[rand(o.length)] }.join\n\t \t@user = User.create( username: params[:user][:username],password: string ,rol: params[:user][:rol], name: params[:user][:name], carrier: params[:user][:carrier], email: params[:user][:email], landline: params[:user][:landline], cell_phone: params[:user][:cell_phone], container: params[:user][:cell_phone], liquid_charge: params[:user][:liquid_charge], dry_charge: params[:user][:dry_charge] )\n\t \trespond_to do |format|\n\t \t\tif @user.save\n\t \t\t\tflash[:notice] = 'Se ha creado un nuevo usuario'\n\t \t\t\tformat.html { redirect_to users_path }\n\t \t\t\tformat.js {}\n\t \t\t\tformat.json { render :show, status: :created, location: @user }\n\t \t\telse\n\t \t\t\twarden.custom_failure!\n\t \t\t\tformat.html { render :new }\n\t \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t \t\tend\n\t \tend\n\t end", "def create_user\n @user = User.new(user_params)\n @user.role = :user\n if @user.save\n correct_cs_entries @user\n correct_ci_entries @user\n render 'objects/user.json'\n else\n @msg = \"Error in generating user\"\n @details = @user.errors\n render \"objects/msg.json\", status: :bad_request\n end\n end", "def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end", "def create_user(obj, type)\n @logger.info(\"Creating user for #{type} #{obj.name}\")\n user = SugarCRM::User.new\n user.user_name = (type == 'agent') ? obj.emerchantpay_agent_id : obj.emerchantpay_iso_id\n user.user_name ||= \"EMP\"\n user.last_name = obj.name\n user.type_c = type\n #user.email1 = obj.email_address || \"mail@example.com\"\n user.email1 = 'stefan@emerchantpay.com'\n user.status = 'Inactive'\n user.system_generated_password = false\n user.save!\n obj.assigned_user_id = user.id\n obj.save!\n \n populate_user_pool(user, type)\n end", "def create_user(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateUser'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :comments\n\t\t\targs[:query]['Comments'] = optional[:comments]\n\t\tend\n\t\tif optional.key? :display_name\n\t\t\targs[:query]['DisplayName'] = optional[:display_name]\n\t\tend\n\t\tif optional.key? :email\n\t\t\targs[:query]['Email'] = optional[:email]\n\t\tend\n\t\tif optional.key? :mobile_phone\n\t\t\targs[:query]['MobilePhone'] = optional[:mobile_phone]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @user = User.new(user_attributes)\n if @user.save\n created(@user)\n else\n validation_errors(@user)\n end\n end", "def sign_up(name:, user_name:)\n user_name = user_name.downcase\n return SYNTAX_ERROR if include_punctuation?(user_name)\n return TOO_LONG_ERROR if too_long?(user_name)\n return TOO_SHORT_ERROR if too_short?(user_name)\n\n @user_class.add(name: name, user_name: user_name)\n end", "def create_user(options={})\n\t\t\tUser.create({\n\t\t\t\tusername: \"user example\",\n\t\t\t\temail: \"example@email.com\",\n\t\t\t\tpassword: \"password\",\n\t\t\t\tpassword_confirmation: \"password\"\n\t\t\t}.merge(options))\n\t\tend", "def create_user(input)\n User.create(name: input)\n end", "def create\n @user = User.new(fname: params[:user][:fname], lname: params[:user][:lname], username: params[:user][:username], password: params[:user][:password], email: params[:user][:email])\n if @user.save\n flash[:notice] = \"You are now part of the club!!\"\n redirect_to root_path\n \n else\n flash[:notice] = \"There was an error creating your account.\"\n end\n end", "def create\n @user = User.new(user_params)\n @user.user_type = 'regular'\n if @user.save\n flash[:info] = \"User account created successfully.\"\n redirect_to root_url\n else\n flash[:danger] = @user.save!\n render 'new'\n end\n end", "def create_user\n user = User.create(user_params)\n \n if user.valid?\n #Create a default bookshelf for the new users\n user.bookshelves.create(name: \"Default\", description: \"Default bookshelf\")\n \n render :nothing => true, :status => :created\n else\n render :nothing => true, :status => :error\n end\n end", "def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end", "def create\n @user = User.new(user_params)\n # TODO Check if submitted email is in our list of professor emails\n # If so, create a professor_user, if not, create a student\n # DON'T use the existence of grad_year for this purpose\n # Check the user is valid? before creating the student or professor\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend", "def create\n user = User.new(user_params)\n msg = if user.save\n 'User has successfully created.'\n else\n set_error(:unprocessable_entity, user)\n end\n common_response(msg, user: user)\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create_user\n User.create name: \"test\", email: \"test@example.com\", password: \"123456\"\n end", "def new_user(name)\n User.create(name: name)\nend", "def create_user_type(type)\n if User.find_by_username(type).nil?\n User.create({ \n email: \"#{type}@#{type}.com\", \n username: \"#{type}\",\n university: University.first,\n role: User.roles[type],\n password: 'password',\n encrypted_password: Devise.bcrypt(User, 'password')\n })\n end\nend", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = 'User created!'\n redirect_to login_path\n else\n flash[:danger] = @user.errors.full_messages\n redirect_to signup_path\n end\n end", "def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end", "def create\n\t\tuser_params = params.require(:user).permit(:first_name, :last_name, :email, :password)\n\t\t@user = User.create(user_params)\n\t\tlogin(@user) #log in user\n\t\tredirect_to \"/users/#{@user.id}\" #go to show\n\tend", "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "def create_user(description= {})\n request(Net::HTTP::Post, \"/api/#{API_VERSION}/user\", nil, description, true)\n end", "def add_user(user_data, name = nil, opts = { :client => GoodData.connection })\n generated_pass = rand(10E10).to_s\n domain_name = name || user_data[:domain]\n user_data = user_data.to_hash\n data = {\n :login => user_data[:login] || user_data[:email],\n :firstName => user_data[:first_name] || 'FirstName',\n :lastName => user_data[:last_name] || 'LastName',\n :password => user_data[:password] || generated_pass,\n :verifyPassword => user_data[:password] || generated_pass,\n :email => user_data[:email] || user_data[:login]\n }\n\n # Optional authentication modes\n tmp = user_data[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = user_data[:company_name]\n tmp = user_data[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = user_data[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = user_data[:phone]\n tmp = user_data[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = user_data[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = user_data[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = user_data[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n begin\n url = \"/gdc/account/domains/#{domain_name}/users\"\n response = c.post(url, :accountSetting => data)\n rescue RestClient::BadRequest\n raise GoodData::UserInDifferentDomainError, \"User #{data[:login]} is already in different domain\"\n end\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n c.create(GoodData::Profile, raw)\n end", "def create_user(user)\n open_canvas_http\n\n # the v1 is API version, only one option available in Canvas right now\n # accounts/1 refers to the Beyond Z account, which is the only one\n # we use since it is a custom installation.\n request = Net::HTTP::Post.new('/api/v1/accounts/1/users')\n request.set_form_data(\n 'access_token' => Rails.application.secrets.canvas_access_token,\n 'user[name]' => user.name,\n 'user[short_name]' => user.first_name,\n 'user[sortable_name]' => \"#{user.last_name}, #{user.first_name}\",\n 'user[terms_of_use]' => true,\n 'pseudonym[unique_id]' => user.email,\n 'pseudonym[send_confirmation]' => false\n )\n response = @canvas_http.request(request)\n\n new_canvas_user = JSON.parse response.body\n\n # this will be set if we actually created a new user\n # reasons why it might fail would include existing user\n # already having the email address\n\n # Not necessarily an error but for now i'll just make it throw\n raise \"Couldn't create user #{user.email} in canvas #{response.body}\" if new_canvas_user['id'].nil?\n\n user.canvas_user_id = new_canvas_user['id']\n\n user\n end", "def create\n @user = User.new(user_params)\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'user was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_user = User::User.new(user_user_params)\n\n respond_to do |format|\n if @user_user.save\n format.html { redirect_to @user_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user_user }\n else\n format.html { render :new }\n format.json { render json: @user_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create_user\n return @user.send_confirmation_instructions if @user\n\n @user = User.create!(new_agent_params.slice(:email, :name, :password, :password_confirmation))\n end", "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\n end", "def create_user(**args)\n params = parameters(args) do\n required_params :name, :email, :active_flag\n optional_params :name, :email, :active_flag\n end\n request(:post, 'users', params)\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to root_url, :notice => \"You have succesfully signed up!\"\n else\n :notice => \"Unable to create profile for user\"\n render :new\n end\n end", "def create_user\n @user = User.new(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "def create\n @user = User.new(params[:user])\n @user.attributes = params[:user]\n if @user.save\n flash[:success] = I18n.t('users.created')\n redirect_to users_path\n else\n self.bread\n add_crumb(I18n.t('users.new'),new_user_path)\n render 'new'\n end\n end", "def create\n # user_params.permit(:first_name, :last_name, :email, :password, :password_confirmation)\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:user] = t('user_create')\n redirect_to user_path(@user)\n else\n render 'new'\n end\n end", "def create_user(**data)\n create_object(type: 'User', data: { enabled: true }.merge(data))\n end", "def create\n unless User::USER_TYPES.include? params[:type]\n render json: format_errors({ type: [\"must be either Student or Lecturer. Received: #{params[:type]}\"] }),\n status: :unprocessable_entity\n return\n end\n\n @user = User.new(user_params).process_new_record\n\n if @user.save\n if @user.student?\n unless sp = StudentProfile.create(student: @user)\n render json: format_errors(sp.errors), status: :unprocessable_entity\n end\n end\n render json: @user, status: :created\n else\n render json: format_errors(@user.errors), status: :unprocessable_entity\n end\n end", "def create_user(email, password, full_name = nil, language = nil)\n options = { email: email, password: password }\n options[:language] = language if language\n options[:full_name] = full_name if full_name\n\n query_api '/auth/user', options\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\n end\n end", "def create\n user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password]\n )\n if user.save\n session[:current_user_id] = user.id\n redirect_to \"/\"\n else\n flash[:error] = user.errors.full_messages.join(\". \")\n redirect_to new_user_path\n end\n end", "def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end", "def create_user\n puts \"Whats your name?\"\n name = gets.chomp\n puts \"Where would you like to go?\"\n destination = gets.chomp\n puts \"How long would you like to stay?\"\n duration = gets.chomp.to_i\n @user = User.new(name, destination, duration)\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "def create_user(username, options = {})\n payload = {\n \"username\" => username,\n \"email\" => \"#{username}@opscode.com\",\n \"first_name\" => username,\n \"last_name\" => username,\n \"display_name\" => username,\n \"password\" => \"foobar\"\n }\n\n users_url = \"#{@server}/users\"\n\n r = post(users_url, @superuser, :payload => payload)\n if r.code == 409\n puts \"The user #{username} already exists... regenerating a key for it now\"\n payload[\"private_key\"] = true\n r = put(\"#{users_url}/#{username}\", @superuser, :payload => payload)\n end\n\n private_key = parse(r)[\"private_key\"]\n\n # The \"admin\" and \"associate\" options here are more of a metadata\n # than actually creating an admin or associating. This allows\n # Pedant tests to succeed even if the users config table has changed.\n Pedant::User.new(username, private_key, platform: self, preexisting: false, admin: options[:admin], associate: options[:associate])\n end", "def create(user)\n # If the caller has already set an id, trust it.\n user.assign_id!(new_uuid) unless user.id\n user.update_timestamps!\n user.last_updated_by!(requester_authz_id)\n\n validate_before_create!(user)\n\n # If you say you know the authz id, then we trust that it already exists\n user.create_authz_object_as(requester_authz_id) unless user.authz_id\n user_side_create(user)\n user.persisted!\n user\n rescue Sequel::DatabaseError => e\n log_exception(\"User creation failed\", e)\n self.class.query_failed!(e.message)\n end", "def create_user(name, email, password)\n\n # Password is hashed automatically\n user = User.new(name: name, email: email, password: password)\n user.save!\n end", "def create\n logout_keeping_session!\n\n\t\t# create a new user with the parameters provided\n @user = User.new(params[:user])\n\t\t\n\t\t# if creation of @user is successful and if it was written to the database successfully\n success = @user && @user.save\n\t\t\n\t\t# if success is TRUE and if there were no errors\n if success && @user.errors.empty?\n\t\t\t# redirect back and flash a pop up regarding successful creation \n redirect_back_or_default('/')\n gflash :success => \"Thanks for signing up! We're sending you an email with your activation code.\"\n else\n\t\t\t# else display pop up error and redirect back to the page\n gflash :error => \"We couldn't set up that account, sorry. Please try again, or contact an admin (link is above).\"\n render :action => 'new'\n end\n end", "def add_user(opts)\n generated_pass = rand(10E10).to_s\n data = {\n :login => opts[:login] || opts[:email],\n :firstName => opts[:first_name] || 'FirstName',\n :lastName => opts[:last_name] || 'LastName',\n :password => opts[:password] || generated_pass,\n :verifyPassword => opts[:password] || generated_pass,\n :email => opts[:email] || opts[:login]\n }\n\n # Optional authentication modes\n tmp = opts[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = opts[:company_name]\n tmp = opts[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = opts[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = opts[:phone]\n tmp = opts[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = opts[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = opts[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = opts[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n url = \"/gdc/account/domains/#{opts[:domain]}/users\"\n response = c.post(url, :accountSetting => data)\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n\n c.create(GoodData::Profile, raw)\n end", "def create\n @user = User.new(user_params)\n\n return render action: 'new' unless @user.save\n\n client = Dwolla.new\n\n first_name = @user.first_name\n last_name = @user.last_name\n email = @user.email\n type = \"personal\"\n address = @user.address\n city = @user.city\n state = @user.state\n postal_code = @user.postal_code\n date_of_birth = @user.date_of_birth\n last_four_of_ssn = @user.last_four_of_ssn\n\n client.create_customer(first_name, last_name, email, type, address, city, state, postal_code, date_of_birth, last_four_of_ssn)\n redirect_to user_path(@user), notice: 'Created user'\n end", "def create\n user = User.new( first: params[:first],\n last: params[:last],\n username: params[:username],\n password: params[:password])\n if user.save\n flash[:notice] = \"Good job!\"\n redirect_to :root\n else\n flash[:alert] = \"Oops, no bueno\"\n redirect_to :back\n end\n end", "def create\n @user = User.new(email:session[:userinfo].info.email,\n name:session[:userinfo].info.name,\n uid:session[:userinfo].uid)\n if @user.save\n @user.save\n redirect_to @user, notice: \"Welcome #{@user.name}!\"\n else\n redirect_to root_path, status: \"Something went wrong. Let's try this again.\"\n end\n end", "def create\n\t\t@user = User.new(user_params)\n# We used to pass new(params[:user]) which defined params as a \n# hash of hashes for the user object. Eq to saying \n# @user = User.new(name: \"joe\", email: \"joe@\"... etc.) but it was insecure \n# so instead now we define the params we want to be accessible and required.\n\t\tif @user.save\t\t\t\n# Handles a successful save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Welcome to Winecards!\"\n\t\t\tredirect_to @user\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n gender: params[:gender],\n birthday: params[:birthday],\n address: params[:address],\n phone_number: params[:phone_number],\n currently_doing: params[:currently_doing],\n education: params[:education],\n references: params[:references],\n additional_info: params[:additional_info],\n image_url: params[:image_url],\n parents: params[:parents],\n siblings: params[:siblings],\n shul: params[:shul],\n summers: params[:summers],\n height: params[:height],\n shadchan_info: params[:shadchan_info],\n looking_for: params[:looking_for],\n )\n if @user.save\n render json: { message: \"User created successfully\" }, status: :created\n else\n render json: { errors: @user.errors.full_messages }, status: :bad_request\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n\t sign_in @user unless signed_in?\n\t flash[:success] = \"Signup successful\"\n redirect_to @user\n else\n render 'new'\n end\n end", "def create\n @user = User.new(params[:user])\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n \n if @user.create_first\n flash[:message] = \"<h2>#{t('welcome', :scope => 'refinery.users.create', :who => @user.username).gsub(/\\.$/, '')}.</h2>\".html_safe\n\n sign_in(@user)\n redirect_back_or_default(refinery.admin_root_path)\n else\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to root_path, notice: 'User was successfully created'\n else\n render action: 'new'\n end\n end", "def create\n\t\t\n\t\treg_params = params.require(:user).permit(\n\t\t\t:name, :email, :password, :password_confirmation\n\t\t)\n\n\t\tname = reg_params[:name]\n\t\temail = reg_params[:email]\n\t\tpassword = reg_params[:password]\n\t\tpassword_confirmation = reg_params[:password_confirmation]\n\n\t\tnew_user = User.new(\n\t\t\tname: name,\n\t\t\temail: email,\n\t\t\tpassword: password,\n\t\t\tpassword_confirmation: password_confirmation\n\t\t)\n\n\t\tif new_user.valid?\n\t\t\tnew_user.save(validate: false)\n\t\t\tflash[:success] = \"Account successfully created.\"\n\t\telse\n\t\t\tflash[:error] = new_user.errors.full_messages\n\t\tend\n\t\tredirect_to root_path\n\tend", "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "def addUser(course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary)\n @conn.exec_prepared(\"insert_user\", [course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary])\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n @user.save\n redirect_to @user\n else\n flash[:alert] = \"The information you entered was invalid.\" \n redirect_to signup_path\n end\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "def create\n @user = User.new(\n fname: params[:user][:fname],\n lname: params[:user][:lname]\n )\n\n if @user.save\n flash[:notice] = \"The user was created\"\n redirect_to user_path(@user)\n else\n # flash[:alert] = \"The user was not created\"\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to edit_user_url(@user), notice: 'User was successfully created.' }\n format.json { render :edit, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n flash[:notice] = t('users.create.notice')\n redirect_to users_path\n else\n render :action => \"new\"\n end\n end", "def create\n params[:user][:user_role_id] ||= UserRole.lowest.id\n\n if !current_user.can_assign_role?(params[:user][:user_role_id])\n role = UserRole.find(params[:user][:user_role_id])\n render json: { error: { detail: \"Forbidden: This operation is only available to users with role '#{ role.name }'.\", status: 403 } }, status: 403\n return\n else\n @user = User.find_by_email(params[:user][:email])\n if @user\n raise CircaExceptions::BadRequest, \"User with email #{params[:user][:email]} already exists.\"\n else\n params[:user][:password] ||= SecureRandom.hex(8)\n if params[:user][:agreement_confirmed]\n params[:user][:agreement_confirmed_at] = Time.now\n end\n @user = User.create!(user_params)\n update_notes\n render json: SerializeUser.call(@user)\n return\n end\n end\n end", "def create\n @title = 'Users Management'\n @breadcrumb = 'Users > New'\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html {\n if @user.user_type.name == 'customer'\n redirect_to login_url, notice: 'Registration is completed. Please login'\n else\n redirect_to @user, notice: 'User was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @user }\n else\n format.html {\n if @user.user_type.name == 'customer'\n redirect_to registrations_path, alert: @user.errors.full_messages.to_sentence\n else\n redirect_to new_user_path, alert: @user.errors.full_messages.to_sentence\n end\n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(email = nil, login = nil, password = nil, first_name = nil, last_name = nil)\n if password == nil\n password = @pointconfig[\"generic_user_password\"]\n end\n\n res = query(\"principal-update\", \n \"email\" => email,\n \"login\" => login, \n \"password\" => password,\n \"first-name\" => first_name,\n \"last-name\" => last_name,\n \"send-email\" => false,\n \"has-children\" => 0, \n \"type\" => \"user\")\n\n puts \"ACS: user created\"\n return res.body\n end", "def create_user(email, pass, login = nil, id = nil, cui = nil)\n send_req({\n act: :user_create,\n cloudflare_email: email,\n cloudflare_pass: pass,\n cloudflare_username: login,\n unique_id: id,\n clobber_unique_id: cui\n })\n end", "def create\n @user = User.new_user(params[:user])\n @user.attributes.each do |attr, val|\n logger.debug(\"attr: #{attr}, val: #{val}\")\n end\n\n if @user.save\n flash[:success] = \"Successfully created account, please sign in\"\n redirect_to login_path\n else\n flash[:warning] = \"Couldn't process the user\"\n render action: \"new\"\n end\n\n end", "def create\n @user = User.new(user_params_create)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: \"User #{@user.surname} #{@user.name} was successfully created.\"}\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user request_pb, options:, &block\n request_json = JSON.parse ::Google::Showcase::V1beta1::CreateUserRequest.encode_json(request_pb)\n\n uri = \"/v1beta1/users\"\n body = request_pb.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Showcase::V1beta1::User.decode_json result_json[:body]\n end", "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "def create_user\n # first insert into user_secrets and use it's id in users table\n @user_secret = UserSecret.using_client_shard(client: @client).create!(login_salt: @login_salt_hash[:ciphertext_blob])\n\n password_e = User.using_client_shard(client: @client).get_encrypted_password(@password, @login_salt_hash[:plaintext])\n\n @user = User.using_client_shard(client: @client).new(\n client_id: @client_id,\n email: @email,\n password: password_e,\n user_secret_id: @user_secret.id,\n status: GlobalConstant::User.active_status,\n last_logged_in_at: Time.now.to_i\n )\n\n @user.send(\"set_\" + GlobalConstant::User.doptin_mail_sent_property) if @client.is_verify_page_active_for_client?\n @user.save!\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.742768", "0.73657745", "0.73572886", "0.73361236", "0.7325564", "0.7279954", "0.7276551", "0.7272052", "0.72412324", "0.723935", "0.7228596", "0.7221998", "0.7205386", "0.7201958", "0.7193282", "0.7187215", "0.7177707", "0.71776205", "0.71757144", "0.7173474", "0.71734244", "0.71680075", "0.7167087", "0.7142784", "0.7118961", "0.71177113", "0.7103955", "0.7091774", "0.7090503", "0.70831704", "0.70720714", "0.70687973", "0.70649683", "0.70643425", "0.7057187", "0.70486426", "0.70430523", "0.7039283", "0.70350015", "0.7026263", "0.70146626", "0.69974077", "0.69904876", "0.69898903", "0.6988416", "0.69843006", "0.6983302", "0.6980007", "0.6980007", "0.69776386", "0.69775695", "0.69775695", "0.697117", "0.6965699", "0.6958243", "0.69579846", "0.69568866", "0.6955707", "0.695476", "0.6952842", "0.69526285", "0.69524246", "0.69489217", "0.6946904", "0.6944856", "0.69415206", "0.693806", "0.69371074", "0.69260204", "0.6918113", "0.6912119", "0.69016385", "0.6900658", "0.69000626", "0.6899801", "0.6898457", "0.6896194", "0.68954605", "0.68884903", "0.68840843", "0.68798536", "0.68790585", "0.687799", "0.6876875", "0.6874947", "0.68695205", "0.6869196", "0.6867427", "0.6866538", "0.6863718", "0.68565077", "0.68562096", "0.685266", "0.684639", "0.6839069", "0.6838102", "0.6837728", "0.6835944", "0.68286693", "0.68284297" ]
0.73636085
2
Returns a user and its attributes Requires: id Optional: filter, fields
def show user = visible_users.find_by(id: params[:id]) if user.nil? # No user with that id render 'shared/http_status', locals: { code: '404', message: 'No user exists with that id' }, status: :not_found else respond_to do |format| format.xml { render xml: user.to_xml(only: DEFAULT_FIELDS, root: :user, skip_types: true) } format.json { render json: user.to_json(only: DEFAULT_FIELDS) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}\", params)\n end", "def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def find(user_id, read_attributes=\"01\")\n options = default_options_to_merge_with.merge({ query: { full: read_attributes} })\n self.class.get(\"/#{@api_ver}/users/#{user_id}\", options)\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def get_user(id)\r\n # Prepare query url.\r\n _path_url = '/users/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n UserDetail.from_hash(decoded)\r\n end", "def user(id:)\n User.find(id)\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def get_user(id, &block)\n get(\"#{@base_url}/user/#{id}/json\", user_mapping, block)\n end", "def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def get_user(id, accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n get(path, options, AvaTax::VERSION) end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def get_user_data\n @user = User.find(params[:id])\n end", "def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end", "def get_user(id)\n conn = @client.get do |req|\n req.url \"/api/v2/user/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end", "def get_single_user_lti(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/users/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n User.new(response)\n \n\n end", "def get_users(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"users\", params)\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end", "def user(id)\n target = \"#{self.base_url}/user/#{id.to_s}/\"\n self.class.get(target, {basic_auth: self.auth})\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def fields\n Iterable.request(conf, '/users/getFields').get\n end", "def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end", "def user(id = 'self')\n get(\"users/#{id}\").user\n end", "def show\n user = if params[:username]\n User.where(username: params[:username]).first\n elsif params[:email]\n User.where(email: params[:email]).first\n elsif params[:id]\n User.where(id: params[:id])\n else\n raise \"No field provided\" \n end\n render json: user.to_json\n end", "def user\n {\n id: object.user.id,\n email: object.user.email,\n birthday: object.user.birthday,\n first_name: object.user.first_name,\n middle_name: object.user.middle_name,\n last_name: object.user.last_name,\n phone: object.user.phone,\n gender: object.user.gender,\n neighborships: object.user.neighborships\n }\n end", "def user(user_id, fields: nil, include_fields: true)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n path = \"#{users_path}/#{user_id}\"\n request_params = {\n fields: fields,\n include_fields: include_fields\n }\n get(path, request_params)\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def user; User.find_by_id(user_id); end", "def get_user_info(*fields)\n str_fields = fields.map(&:to_s).join(',')\n url = GRAPH_URL + @user.id + '?fields=' + str_fields + '&access_token=' +\n ENV['ACCESS_TOKEN']\n begin\n return call_graph_api(url)\n rescue => e\n return false\n end\n end", "def user(id)\n Bibliovore::User.new(\n get_endpoint(\"users/#{id}\", 'user'), self\n )\n end", "def get_user(id)\n @users[id]\n end", "def get_user_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserApi.get_user_by_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_user_by_id\"\n end\n if @api_client.config.client_side_validation && id < 0\n fail ArgumentError, 'invalid value for \"id\" when calling UserApi.get_user_by_id, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = \"/users/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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 = ['API Key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'UserResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_user_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(user_id)\n User.find user_id\n end", "def get_user_byid(id)\n @user = User.find_by_id(id)\n end", "def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end", "def get_user_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_user ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_user\" if id.nil?\n \n # resource path\n path = \"/Users/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIUser')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_user\n return User.all if params[:user_id].nil?\n\n User.find(params[:user_id])\n end", "def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end", "def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end", "def get_user_details\n\t\tid = params[:id]\n\t\tTheCityAdmin::AdminApi.connect(Rcplugin::CITY_ADMIN_SECRET,Rcplugin::CITY_USER_TOKEN)\n\t\t@user = TheCityAdmin::User.load_by_id(id)\n\tend", "def finder\n User.find_by(id: @id, name: @name, email: @email)\n end", "def get_user_data(id)\n load_user_data(id)\n @user_data[@user_id]\n end", "def db_user_access(id = nil)\n return nil if id.nil?\n \n data = {:id => id}\n \n rows = User.where(data).first\n \n if !rows.nil? then\n return rows\n else\n return nil\n end\n end", "def user(body)\n User.find(body[:id])\n end", "def show\n @user_filter_attribute = UserFilterAttribute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_filter_attribute }\n end\n end", "def get_user_by_id(id)\n resp = request('getUserByID', {:userID => id})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end", "def fetch_user(id)\n client.user(id)\n end", "def attributes(username)\n @users[username][:attributes]\n end", "def users(filter = {})\n handler[:people].filter(filter)\n end", "def show\n respond_with User\n .select('id','email','daystart','daydur','history_back','history_forward')\n .find(params[:id])\n end", "def get\n\t\t\t\tparams.required(:id)\t\n\n\t\t\t\t# Grab the service that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n\t\t\t\t@user = service.users.find params[:id]\n\t\t\tend", "def find_user_by_id(id)\n User.find(id)\n end", "def get_user_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_user ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_user\"\n end\n # resource path\n local_var_path = '/api/3/users/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'User')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_user_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_user ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_user\"\n end\n # resource path\n local_var_path = '/users/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20026')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load\n\t\tresult = Array.new\n\t\terror_list = []\n\n\t\tunless User.exists? params[:user_id]\n\t\t\treturn render json: 'No such user was found', status: 404\n\t\tend\n\n\t\trecords = Amount.find_by_sql [\n\t\t\t'SELECT name, value, category\n\t\t\t FROM users AS u\n\t\t\t INNER JOIN amounts AS a\n\t\t\t ON u.id = a.user_id\n\t\t\t WHERE a.user_id = ?',\n\t\t\t params[:user_id]\n\t\t]\n\n\t\trecords.each do |record|\n\t\t\tresult << record.attributes.except('id')\n\t\tend\n\n\t\treturn render json: result, status: 200\n\tend", "def find_user\n @user = User[:id => params[:id]]\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :email => HttpClient::Preconditions.assert_class_or_nil('email', opts.delete(:email), String),\n :token => HttpClient::Preconditions.assert_class_or_nil('token', opts.delete(:token), String)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/users\").with_query(query).get.map { |hash| Apidoc::Models::User.new(hash) }\n end", "def show\n @user = UserService.getUserById(params[:id])\n end", "def user_by_id\n @users = User.where(:role_id => 2)\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end", "def getUser( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"get\",\"/user\",params)\n end", "def view_user(params)\n user_id = params.delete(:user_id)\n raise ArgumentError.new(\"user_id required\") unless user_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"user/#{user_id}\"), :query_params => params)\n return unless res.successful?\n User::Person.new(res.data)\n end", "def read_users(status=nil)\n # if a filter is provided for the status then set it otherwise just search for people\n # Note: The filter will not capture users that do not have their status set. \n if status\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:status].to_s, status ? status : \"*\")\n else\n filter = Net::LDAP::Filter.eq(:objectClass, \"inetOrgPerson\")\n end\n return search_map_user_fields(filter)\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def select_all_user_info_id(user_id)\n p \"uder id #{user_id}s\"\n p \"look here#{get_db_as_hash().execute(\"SELECT * FROM user WHERE user_id = ?\", user_id).first}\"\n return get_db_as_hash().execute(\"SELECT * FROM user WHERE user_id = ?\", user_id).first\n end", "def attributes\n attrs = super\n if attrs['user'] && attrs['user']['id']\n attrs.merge!('user_id' => attrs['user']['id'])\n attrs.delete 'user'\n end\n attrs\n end", "def users_api_show_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersAPIApi#users_api_show ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling users_api_show\" if id.nil?\n \n # resource path\n path = \"/users/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'User')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersAPIApi#users_api_show\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_user_from_id(user_id)\n \t\tuser = nil\n \t\tunless user_id.blank?\n\t \t\tcol = :email\n\t \t\tif CONFIG[:enable_username?]\n\t \t\t\tunless is_email(user_id)\n\t \t\t\t\tcol = :username\n\t \t\t\tend\n\t \t\tend\n#\t \t\tp \"Finding user by col: #{col}, user_id = #{user_id}\"\n\t \t\tuser = User.find_by(col => user_id.downcase)\n\t \tend\n\t \tuser\n \tend", "def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end", "def getUserDetails *args\n options=fill_args [:username,:userid],[],*args\n if options[:username]==nil && options[:userid]==nil\n raise \"Username or userid is required\"\n end\n if options[:username]!=nil && options[:userid]!=nil\n raise \"Both username and userid is not allowed\"\n end\n request \"/User/getUserDetails.json\",options\n end", "def show\n #below line is default with selected attributes\n #render json: @user, :only => [:id, :name, :email, :age, :company]\n\n render json: @user\n end", "def get_users(id)\r\n db = connect() \r\n return result2 = db.execute(\"SELECT * FROM users WHERE userid=(?)\", id)\r\n end", "def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.icn\n }\n end", "def get_user \n @user = User.find(params[:id])\n end", "def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end", "def find(id, password = nil)\n response = @client.get(\"/users/#{id}\") # need to escape this\n user = User.new(@client, response)\n user.password = password\n return user\n end", "def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end", "def load(user: nil, fields: nil)\n Driver::Helpers.required_arguments %i[user], binding\n\n Driver::Exceptions.raise_unless_argument_error? user, User\n Driver::Exceptions.raise_unless_argument_error? fields, String if fields\n Driver::Exceptions.raise_unless_reference? id\n\n response = Services::Data.get user: user, service: service, endpoint: endpoint, fields: fields, ids: id.split(\"/\").last\n self.fields.parse data: response.data['entries'].first, xmlns: response.data['xmlns']\n response\n end", "def find_user\n User.find(params.fetch(:id))\n end", "def account_user(id)\n get(\"accountuser/#{id}\")\n end", "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end", "def find(user_id)\n sql = \"SELECT * FROM users WHERE id=$1\"\n result = Repos.db_adapter.exec(sql, [user_id])\n User.new(result[0][\"name\"], result[0][\"email_address\"], result[0][\"id\"])\n end", "def fetch_user\n id = params[:id] || params[:user].try(:fetch,:id)\n user = User.find(params[:id])\n authorize user, :update?\n return user\n end", "def user_management_get_single_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def for_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").get\n end", "def find_user_by_id(id)\n users.find_by_id(id)\n end", "def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end", "def profile\n @user = UserService.getUserById(params[:id])\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def get_user(id)\n begin\n user = JSON.parse(RestClient.get construct_url(\"user/#{id}\"))\n rescue RestClient::ResourceNotFound => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end", "def find_user(id_or_attrs)\n if id_or_attrs.is_a? Hash\n User.find_by_slug(id_or_attrs[:slug])\n else\n User.find(id_or_attrs)\n end\n end", "def get_user(user_id)\n return User.find(user_id)\n end", "def users_api_show(id, opts = {})\n data, status_code, headers = users_api_show_with_http_info(id, opts)\n return data\n end", "def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend", "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end" ]
[ "0.6934946", "0.68955755", "0.67761314", "0.67599165", "0.67517364", "0.66539705", "0.6638836", "0.65345836", "0.6522974", "0.64992446", "0.64217705", "0.6408829", "0.64018524", "0.639262", "0.63476866", "0.63447464", "0.6324918", "0.6309589", "0.6297333", "0.6277602", "0.6272603", "0.62659466", "0.6251425", "0.624879", "0.62419224", "0.62319815", "0.6223073", "0.62101907", "0.6199179", "0.61904716", "0.61899567", "0.6176737", "0.6159256", "0.6151269", "0.61380994", "0.6135201", "0.6118267", "0.61139107", "0.6086012", "0.6085191", "0.6084048", "0.60805064", "0.6071006", "0.6052486", "0.60488683", "0.60472447", "0.60359925", "0.60217595", "0.60149604", "0.60122603", "0.6007655", "0.59949964", "0.5993199", "0.5991725", "0.5987703", "0.5986882", "0.59722286", "0.5971562", "0.5967264", "0.5959839", "0.59574765", "0.5955708", "0.5950691", "0.59497726", "0.59497726", "0.5947903", "0.5947415", "0.59471995", "0.5928945", "0.5917957", "0.5916262", "0.59144425", "0.58990675", "0.58868337", "0.58836806", "0.587792", "0.5875886", "0.58737755", "0.58708066", "0.58650506", "0.5864566", "0.5861841", "0.5858754", "0.5852436", "0.5843808", "0.5843468", "0.5843341", "0.58412546", "0.58315814", "0.5828778", "0.5826084", "0.5823221", "0.58222604", "0.58192605", "0.5817031", "0.58128744", "0.58063227", "0.5802411", "0.579244", "0.5790754", "0.5790152" ]
0.0
-1
Requires: id Optional: first_name, last_name, user_name
def update user = visible_users.find_by(id: params[:id]) if user.nil? render 'shared/http_status', locals: { code: '404', message: 'User was not found' }, status: :not_found return end user.update!(user_params) rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity rescue StandardError render 'shared/http_status', locals: { code: '500', message: HttpStatusHelper::ERROR_CODE['message']['500'] }, status: :internal_server_error else render 'shared/http_status', locals: { code: '200', message: HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name_with_id\n id.to_s + \": \" + user.first_name + \" \" + user.last_name\n end", "def get_name(id)\n return \"\" if !id\n user = User.find(id)\n user.first_name + ' ' + user.last_name\n end", "def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end", "def user_id\n self.title_and_name\n end", "def get_full_name(user_id)\n if user_id\n u = User.find(user_id)\n return u.firstname + \" \" + u.lastname\n else\n return \"Unknown\"\n end\n end", "def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end", "def first_name\n user = User.find_by_id(sent_by).first_name\n end", "def first_name # same as field name ;\n User.where(id: object.user_id)[0].first_name\n end", "def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end", "def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end", "def initialize(id, first_name, last_name, options = {})\n @id = id\n @first_name = first_name\n @last_name = last_name\n @email = options[:email]\n @note = options[:note]\n end", "def entire_name_with_id\r\n self.entire_full_name + \" (#{self.id})\"\r\n end", "def name(user_id)\n User.find(user_id).email\n end", "def user_params\n params.require(:users).permit(:_id, :firstName, :lastName, :email)\n end", "def initialize(id, first_name, last_name, email, note)\n @id = id\n @first_name = first_name\n @last_name = last_name\n @email = email\n @note = note\n end", "def full_name(user)\n user.first_name + ' ' + user.last_name\n end", "def name\n name_str = \"#{first_name} #{last_name}\".strip\n if name_str.length < 1\n name_str = email\n end\n if name_str.length < 1\n name_str = \"Person utan namn (id #{id})\"\n end\n name_str\n end", "def get_user_name_by_id(user_id)\n @user = User.find(:first ,:select=>\"name\",:conditions=>[\"id=#{user_id}\"])\n return @user.name\n end", "def id\n @user = User.find_by_id(params[:id])\n\n respond_to do |format|\n if @user!=nil\n format.html { render json: {:message => \"Here are #{@user.firstname} #{@user.lastname}'s details.\", :user => @user}}\n else\n format.html { render json: {:message => \"Cannot find user - that ID number does not exist. Please enter a valid ID number.\"}}\n end\n end\n end", "def user(id:)\n User.find(id)\n end", "def user_full_name\n first_name + \" \" + last_name\n end", "def user_params\n params.require(:user).permit(:id, :firstName, :lastName, :email)\n end", "def user; User.find_by_id(user_id); end", "def set_name\n person = CMU::Person.find(andrew_id)\n if !person.nil?\n self.first_name = person.first_name\n self.last_name = person.last_name\n end\n end", "def firstname_lastname\n a = User.where(:firstname => params[:firstname], :lastname => params[:lastname])\n \n respond_to do |format|\n if a.size>0\n format.html { render json: {:message => \"Here is the user you're looking for!\", :user => a}}\n else\n format.html { render json: {:message => \"We don't have that user. Sorry.\"}}\n end\n end\n end", "def set_user\n @user = User.find(params[:last_name] || params[:id])\n end", "def possible_name_params\n params.require(:possible_name).permit(:user_id, :name, :first_lastname, :second_lastname)\n end", "def last_name # same as field name ;\n User.where(id: object.user_id)[0].last_name\n end", "def find_name_or_email\n if self.first_name.present? && self.last_name.present?\n self.first_name + \" \" + self.last_name\n else\n self.name || self.email\n end\n end", "def save_user( args )\n user_id = args.delete( :user_id ) if args.has_key?( :user_id )\n user_name = args.delete( :user_name ) if args.has_key?( :user_name )\n \n row = {}\n if user_id and user_name\n row = { min_field( :user_id ) => user_id, min_field( :user_name ) => user_name }\n else\n row = { min_field( :user_name ) => user_name }\n end\n \n user = users.find_one( row, :fields => ['_id'] )\n return user['_id'] if user\n\n now = args[:created_at]\n row[min_field(:date_id)] = \"%4d%02d%02d\" % [now.year, now.month, now.day]\n \n users.save( row )\n end", "def full_name\n if !first_name && !last_name\n return \"New User\"\n else\n return first_name + \" \" + last_name\n end\n end", "def username_and_first_name\n if first_name.nil?\n username\n else\n \"#{username} (#{first_name})\"\n end\n end", "def user(first_name)\n puts first_name\nend", "def name\n last_name + \", \" + first_name\n end", "def name\n last_name + \", \" + first_name\n end", "def name\n last_name + \", \" + first_name\n end", "def name \n last_name + \", \" + first_name\n end", "def user_id; 1; end", "def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end", "def display_resource(user)\n \"#{user.first_name} - #{user.last_name}\"\n end", "def user\n user_name = User.where(:id => params[:id]).first.try(:name)\n \n user_data = {\n id: params[:id],\n name: user_name\n }\n \n respond_to do |format|\n format.html { redirect_to root_path } # search.html.erb\n format.json { render json: user_data }\n end\n end", "def first_name; end", "def first_name; end", "def first_name; end", "def author\n if not user.present? or (user.first_name.blank? and user.last_name.blank?)\n \"Anonymous\"\n else\n [user.try(:first_name), user.try(:last_name)].reject(&:blank?).join(' ')\n end\n end", "def first_name; end", "def user_full_name\n return object.billing_name if object.billing_name.present?\n \"#{user_firstname} #{user_lastname}\"\n end", "def find_by_id!\n User.find(@username_or_id)\n end", "def name\n last_name + \", \" + first_name\nend", "def update\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.first = params[\"first\"]\n \tuser.last = params[\"last\"]\n \tuser.email = params[\"email\"]\n user.phone = params[\"phone\"]\n user.add_l1 = params[\"add1\"]\n \tuser.city = params[\"city\"]\n \tuser.state = params[\"state\"]\n \tuser.zip = params[\"zip\"]\n \tuser.age = params[\"age\"]\n \tuser.save\n \tredirect_to show_lobbys_url\n\tend", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "def first_name\n firstName\n end", "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "def last_name_first\n self.last_name + ', ' + self.first_name\n end", "def get_name(id)\n @users.each do |user|\n return user[:name] if user[:id] == id\n end\n nil\n end", "def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end", "def user_name\n User.find(self.user_id).name\n end", "def names_by_user # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Name, :by_user, :user => user)\n show_selected_names(query)\n end\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def create_user(user_id, user_email)\n \n puts user_id\n puts user_email\n new_user = User.first_or_create( {:googleuniqueid => user_id},{\n :googleuniqueid => user_id,\n :googleemail => user_email,\n :useralias => user_email,\n });\n new_user.save\n return new_user\nend", "def user_params\n params.require(:user).permit(:id, :first_name, :last_name, :email, :username)\n end", "def find_user(id)\n contact = find(id)\n\n create_user(contact.attributes)\n end", "def find_by_id\n User.find_by_id(@username_or_id)\n end", "def add_initial_user\n initial_user = Member.where(:email => \"administrator@administrator.com\").first\n \n unless initial_user\n # Create an initial position.\n position = Position.new\n position.name = \"Administrator\"\n position.pos_type = \"Administrator\"\n position.save\n \n # Create an initial division.\n division = Division.new\n division.name = \"Administrator\"\n division.save\n \n # Find initial position and division created.\n # Id´s will be used to crete initial user.\n position = Position.where(:name => \"Administrator\").first\n division = Division.where(:name => \"Administrator\").first\n \n # Create an initial user with position and divison created above.\n member = Member.new\n member.name = \"Administrator\"\n member.email = \"administrator@administrator.com\"\n member.password = \"administrator\"\n member.major = \"NONE\"\n member.grad_year = 9999\n member.member_since = 9999\n member.hometown = \"NONE\"\n member.position_id = position.id\n member.division_id = division.id\n member.save\n end\n end", "def full_name\n object.first_name + \" \" + object.last_name\n end", "def created_by; User.get(self.created_by_id) || Lead.get(self.created_by_id) || Account.get(self.created_by_id) || Contact.get(self.created_by_id) || Opportunity.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id) || Lead.get(self.created_by_id) || Account.get(self.created_by_id) || Contact.get(self.created_by_id) || Opportunity.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id) || Lead.get(self.created_by_id) || Account.get(self.created_by_id) || Contact.get(self.created_by_id) || Opportunity.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id) || Lead.get(self.created_by_id) || Account.get(self.created_by_id) || Contact.get(self.created_by_id) || Opportunity.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id) || Lead.get(self.created_by_id) || Account.get(self.created_by_id) || Contact.get(self.created_by_id) || Opportunity.get(self.created_by_id); end", "def initialize(args = {})\n @id = args[:id]\n @first_name = args[:first_name]\n @last_name = args[:last_name]\n @email = args[:email]\n @phone = args[:phone]\n @created_at = args[:created_at]\n end", "def salutation\n if not first_name.blank?\n return first_name\n else\n return computing_id\n end\n end", "def goodreads_user_id\n return session['goodreads_user_id'] if session['goodreads_user_id']\n\n access_token = begin\n request_token.get_access_token\n rescue OAuth::Unauthorized\n return\n end\n\n goodreads_user_id, first_name = Goodreads.fetch_user access_token\n\n @users.insert(first_name: first_name, goodreads_user_id: goodreads_user_id) unless @users.first(goodreads_user_id: goodreads_user_id)\n @user = @users.first(goodreads_user_id: goodreads_user_id)\n\n env['rollbar.person_data'] = {id: @user[:id], username: @user[:first_name]}\n session['goodreads_user_id'] = goodreads_user_id\n end", "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", "def merge_identities(user, auth)\n if auth.info[:first_name] && !user.first_name.present?\n user.first_name = auth.info[:first_name]\n end\n\n if auth.info[:last_name] && !user.last_name.present?\n user.last_name = auth.info[:last_name]\n end\n\n if auth.info[:email] && !user.email.present?\n user.email = auth.info[:email]\n end\n\n create_new_identity(user,auth)\n end", "def set_user\n if params[:name]\n @user = User.where(name: params[:name]).first\n else\n count = User.count\n exists = User.exists?(params[:id].to_i)\n if (params[:id].to_i <= count) and exists\n @user = User.find(params[:id])\n end\n end\n end", "def get_user_name_by_id(user_id, include_middle = false)\n\t\tif user_id.nil? \n\t\t\treturn 'ERROR'\n\t\telse\n\t\t\tuser_name_fields = User.where('id = ?',user_id).first\n\t\t\tif user_name_fields.nil?\n\t\t\t\treturn 'USER NOT FOUND'\n\t\t\tend\n\t\t\t\n\t\t\tif user_name_fields.middle_name.nil? or user_name_fields.middle_name.empty? # ignore include_middle if there is nothing\n\t\t\t\t\"#{user_name_fields.first_name} #{user_name_fields.last_name}\"\n\t\t\telse\n\t\t\t\t\"#{user_name_fields.first_name} #{(include_middle ? user_name_fields.middle_name + ((user_name_fields.middle_name.length == 1)? '.' : '') : '')} #{user_name_fields.last_name}\"\n\t\t\tend\n\t\tend\n\tend", "def create_good\n first_name = params[:first_name]\n set_name(first_name)\n end", "def initialize(person_id, name, last_name)\n @person_id = person_id\n @name = name\n @last_name = last_name\n end", "def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end", "def check_name_existence\n users = Center.joins(:profile).where(institution_id: institution_id).where('profiles.firstname =?',firstname)\n errors.add(:firstname,\"already taken for this entrys\") if !users.blank? and self.id != users.first.id\n end", "def users\n #adding this instead of the create_users action\n if params[:name] != nil\n @user = User.create(name: params[:name], age: params[:age])\n end\n if(params[:id] != nil)\n\n end\n @users = User.all\n end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end", "def created_by; User.get(self.created_by_id); end" ]
[ "0.722545", "0.7037313", "0.6978342", "0.65697396", "0.6357903", "0.63168395", "0.63143796", "0.63092244", "0.62979305", "0.62963176", "0.62564266", "0.61787206", "0.61498547", "0.6109742", "0.6078087", "0.6045767", "0.6044269", "0.6029161", "0.6023883", "0.5987191", "0.5987012", "0.5962679", "0.5952288", "0.5937397", "0.59164846", "0.5899618", "0.58918786", "0.5890708", "0.5872333", "0.5848003", "0.5838496", "0.583804", "0.5833367", "0.5798619", "0.5798619", "0.5798619", "0.5785138", "0.578324", "0.5766633", "0.57557064", "0.57516277", "0.57390404", "0.57390404", "0.57390404", "0.5738976", "0.5737623", "0.573", "0.572774", "0.5717584", "0.5713401", "0.5712804", "0.57096255", "0.57067657", "0.570364", "0.57027495", "0.5695396", "0.56952345", "0.56920314", "0.56880236", "0.56863", "0.56862295", "0.56784534", "0.5676259", "0.5670656", "0.565661", "0.5642658", "0.5642658", "0.5642658", "0.5642658", "0.5642658", "0.56384695", "0.56370574", "0.5633483", "0.56324977", "0.5628991", "0.56266874", "0.5624126", "0.56222814", "0.5618446", "0.56183004", "0.56166154", "0.5615804", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247", "0.56098247" ]
0.0
-1
Update a user's attributes based on their user_name as opposed to their id (use the regular update method instead) Requires: user_name
def update_by_username if has_missing_params?([:user_name]) # incomplete/invalid HTTP params render 'shared/http_status', locals: { code: '422', message: HttpStatusHelper::ERROR_CODE['message']['422'] }, status: :unprocessable_entity return end user = User.find_by(user_name: params[:user_name]) if user.nil? render 'shared/http_status', locals: { code: '404', message: 'User was not found' }, status: :not_found return end user.update!(user_params) rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity rescue StandardError render 'shared/http_status', locals: { code: '500', message: HttpStatusHelper::ERROR_CODE['message']['500'] }, status: :internal_server_error else render 'shared/http_status', locals: { code: '200', message: HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update\n # If no user is found, render an error.\n user = User.find_by_id(params[:id])\n if user.nil?\n render 'shared/http_status', locals: {code: '404', message:\n 'User was not found'}, status: 404\n return\n end\n\n # Create a hash to hold fields/values to be updated for the user\n attributes = {}\n\n unless params[:user_name].blank?\n # Make sure the user_name isn't taken\n other_user = User.find_by_user_name(params[:user_name])\n if !other_user.nil? && other_user != user\n render 'shared/http_status', locals: {code: '409', message:\n 'Username already in use'}, status: 409\n return\n end\n attributes[:user_name] = params[:user_name]\n end\n\n attributes = process_attributes(params, attributes)\n\n user.attributes = attributes\n unless user.save\n # Some error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n return\n end\n\n # Otherwise everything went alright.\n render 'shared/http_status', locals: {code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200']}, status: 200\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_by_username\n if has_missing_params?([:user_name])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: { code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422'] }, status: 422\n return\n end\n\n # Check if that user_name is taken\n user = User.find_by_user_name(params[:user_name])\n if user.nil?\n render 'shared/http_status', locals: { code: '404', message:\n 'User was not found' }, status: 404\n return\n end\n user.attributes = process_attributes(params, {})\n\n unless user.save\n # Some error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n return\n end\n\n # Otherwise everything went alright.\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200'] }, status: 200\n end", "def update_user(user_name, options = {})\n request({\n 'Action' => 'UpdateUser',\n 'UserName' => user_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateUser.new\n }.merge!(options))\n end", "def update_user(user_or_id, attributes)\n instantize_user(user_or_id).update(attributes)\n end", "def update\n @user = User.find(params[:id])\n\n @user.update(\n name: params[:user][:name],\n email: params[:user][:email]\n )\n # update user then redirect them to their own page\n flash[:update] = \"Account successfully updated.\"\n redirect_to user_path(@user)\n end", "def update_user(user, attributes)\n user.update(attributes)\n end", "def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end", "def update\n user_params = params.require(:user).permit(:first_name, :last_name, :bio, :email, :image)\n user = User.find_by username: params[:username]\n if !user || user.id != session[:user_id]\n flash[:error] = \"You are not authorized to edit this user's profile.\"\n redirect_to user_path params[:username]\n else\n user.update_attributes(user_params)\n redirect_to user_path(user.username)\n end\n end", "def update_user(user_id, attributes)\n put(\"/v1/users/#{user_id}\", attributes)\n end", "def update_user(id, attributes)\n elektron_identity.put(\"users/#{id}\") { { user: attributes } }.body[\n \"user\"\n ]\n end", "def update\n @user = find_user(params[:username])\n\n if @user.update(user_params, current_user)\n redirect_to users_path\n else\n render('edit', status: :unprocessable_entity)\n end\n end", "def update\n User.find(id: params[:id]).update(name: params[:name])\n redirect_to action: \"index\"\n end", "def update\n\t\tif current_user._id == user_params[:id]\n\t\t\t@user = User.find_by(:id => user_params[:id])\n\t\t\t@user.update({\n\t\t\t\tfirst_name: user_params[:first_name],\n\t\t\t\tlast_name: user_params[:last_name],\n\t\t\t\tphone_number: user_params[:phone_number],\n\t\t\t\tfacebook_link: user_params[:facebook_link],\n\t\t\t\tcar_model: user_params[:car_model],\n\t\t\t\tlicense_plate: user_params[:license_plate]\n\t\t\t})\n\t\t\t@user.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tuser: @user\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'You are not authorized to edit this field!'\n\t\t\t}, status: 422\n\t\tend\n\tend", "def update\n\t\tparams[:user][:email] = params[:user][:email].strip\n\t\tparams[:user][:name] = params[:user][:name].strip\n\t\tputs params\n\t\tif @user.update_attributes(user_params)\n\t\t\tflash[:success] = \"Profile updated\"\n\t\t\tredirect_to edit_user_path\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend", "def update\n\t\t@user = User.find(params(:id))\n\t\t@user.update(user_params)\n\tend", "def update_user(user_name:, user:)\n validate_user_name(:user_name, user_name)\n response = wrap_response(@connection.put(user_path(user_name), user))\n\n response.fmap { |r| SftpgoClient::ApiResponse.new(r.body) }\n end", "def update_user(user)\n contact = find(user.id)\n\n mapper.update(user, contact.attributes)\n end", "def update\n @user_name = UserName.find(params[:id])\n\n respond_to do |format|\n if @user_name.update_attributes(params[:user_name])\n format.html { redirect_to(@user_name, :notice => 'User name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user(**params)\n params.merge!(id: existing_user.id)\n api_query(query, variables: params)\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params.require(:user).permit(:username, :email))\n redirect_to users_path\n else\n render 'edit'\n end\n end", "def update_user\n end", "def update(user)\n unless user.id\n self.class.invalid_object!(\"Cannot save user #{user.username} without a valid id\")\n end\n\n user.update_timestamps!\n\n validate_before_update!(user)\n\n execute_sql(:update, :user) { table.filter(:id => user.id).update(map_to_row!(user.for_db)) }\n rescue Sequel::DatabaseError => e\n log_exception(\"User update failed\", e)\n self.class.query_failed!(e.message)\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def updateUser(linkedInInfo, user)\n user.update_attributes(:firstName => getValueFromLinkedInInfo(linkedInInfo, 'firstName'),\n :lastName => getValueFromLinkedInInfo(linkedInInfo, 'lastName'),\n :location => getValueFromLinkedInInfo(linkedInInfo, 'location'),\n :industry => getValueFromLinkedInInfo(linkedInInfo, 'industry'),\n :numConnections => getValueFromLinkedInInfo(linkedInInfo, 'numConnections'),\n :position => getValueFromLinkedInInfo(linkedInInfo, 'title'),\n :company => getValueFromLinkedInInfo(linkedInInfo, 'company'),\n :emailAddress => getValueFromLinkedInInfo(linkedInInfo, 'emailAddress'))\n user.save\n return user\n end", "def update\n @user = User.find_by_username(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:success] = \"Account updated.\"\n format.html { redirect_to @user }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Can update first name, last name, email and handle\n #@user = get_user_for_update(params[:id])\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n user_session.name = @user.full_name\n flash_notice(:user_data_updated)\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n flash_error(:user_data_not_updated)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n rescue\n logger.error(\"error updating user\")\n end", "def update\n # finds user with id of params[:id]\n @user = User.find params[:id]\n\n # updates the attributes of this user to whatever values are stored in\n # params[:user]\n @user.update params[:user]\n\n # redirect to edit action\n redirect_to edit_user_path\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n session[:userName] = @user.userName\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @user = params[:user] # need whitelist to make mass assignment\n @user = User.find(params[:id])\n\n #create new user\n if @user!=nil && @user.update_attributes(user_params)\n flash[:notice] = \"User '#{@user.username}' updated successfully.\"\n redirect_to(:action => 'list')\n else\n render('edit') # sign up will receive @user and auto fill form again\n end\n end", "def update\n @user = User.find_by_username(params[:id])\n\n # Only allow users to update themselves\n unless @user.id == @current_user.id\n redirect_to @user\n end\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n edited_user = User.find(params[:id])\n edited_user.update( params.require(:user).permit(:username) )\n redirect_to \"/users/#{edited_user.id}\"\nend", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n\t\t@user = current_user\n\t\t@user.name = params[:name]\n\t\t@user.phone = params[:phone]\n\t\t@user.phone_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_path)\n\t\telse\n\t\t\tflash[:alert] = \"Unable to update profile\"\n\t\t\trender \"edit\", layout: \"application_inside\"\n\t\tend\n\tend", "def update\n @user = User.find(params[:id]) \n p @user\n\n # p params[:user]\n \n # @user.update(user_params2)\n if @user.update_attribute(:name,params[:user][:name]) && \n @user.update_attribute(:email,params[:user][:email]) &&\n @user.authenticate(params[:user][:password])\n flash[:success] = \"Profile Updated\"\n redirect_to @user\n else\n flash[:success] = \"Password is wrong\"\n redirect_to @user\n end\n \n \n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n @user.name = params[:user][:name]\n @user.handle = params[:user][:handle]\n @user.admin = params[:user][:admin]\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.update(user_params)\n end", "def custom_update\n user = User.find(params[:id])\n user.update_attributes(params[:user])\n render :text => true\n end", "def db_update_user_name(userid, name)\n\t\t\n\t\t# SQL statement for updating a user's name\n\t\tquery = \"UPDATE users\n\t\t\t\tSET name='%%name%%'\n\t\t\t\tWHERE userid='%%userid%%';\"\n\t\t\n\t\t# Fill in the name and userid values in the SQL statement\n\t\tquery = query.gsub(/%%name%%/, PG::Connection.escape_string(name)).gsub(/%%userid%%/, PG::Connection.escape_string(userid))\n\t\t\n\t\t# Connect to the database\n\t\tconn = DBTools.new.connectToDB()\n\t\t\n\t\t#Execute SQL Statement\n\t\tresults = conn.exec(query)\n\t\t\n\t\t# If there are 0 results\n if (results.cmd_tuples() == 0)\n \tresults.clear()\n conn.finish()\n raise \"Name not updated.\"\n\n # If there are too many results (this should never occur)\n elsif (results.cmd_tuples() > 1)\n \tresults.clear()\n \tconn.finish()\n raise \"Too many names changed. Database now corrupt.\"\n \n # Update successful\n else\n \tresults.clear()\n \tconn.finish()\n end\n\tend", "def updateUserNew\n user = current_user\n name = params[:name]\n phone = params[:phone]\n address = params[:address]\n user.update(name: name, phone: phone, address: address)\n redirect_to students_path\n end", "def update!\n unless id\n raise \"user can not be updated before it is created.\"\n end\n hash = \"W10=\"\n\n payload = {\n \"id\" => id,\n \"email\" => @email_address,\n \"time_zone\" => @time_zone,\n \"country\" => @country,\n \"preferred_language\" => @language,\n \"receive_campaign_emails\" => \"true\",\n \"hash\" => hash,\n \"username\" => @email_address,\n \"last_login_at\" => get_last_login_at!,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"user\" => {\n \"email\" => @email_address,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"time_zone\" => @time_zone,\n \"receive_campaign_emails\" => \"true\",\n \"country\" => @country,\n \"preferred_language\" => @language\n }\n }\n\n response = authenticated_request(:put, \"api/client/users/#{id}\", payload: payload)\n response[:status]\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update \n user = User.find_by(username: @current_user.username)\n user.update!(username_edit_params)\n response = { message: Message.account_edited, status: :ok}\n json_response(response)\n end", "def update\n @user = User.find_by_name(params[:user][:name])\n\n respond_to do |format|\n begin\n\t# Including validate presence of password\n\t@user.update_attributes!(params[:user])\n # Encode a password\n @user.update_attributes!(\n :password => Digest::SHA1.hexdigest(\n \t @user.password + Wanacie::Application.config.password_salt),\n :password_confirmation => Digest::SHA1.hexdigest(\n \t @user.password_confirmation + Wanacie::Application.config.password_salt))\n\n format.html { redirect_to user_by_name_path(@user.name) , notice: 'User was successfully updated.' }\n format.json { head :no_content }\n rescue\n format.html { render 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n \n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n # something went wrong, go back to the edit form with existing user info\n render 'edit'\n end # if\n end", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update\n @user = User.update(params[:user])\n end", "def update\n if @current_user.update(user_params)\n if @current_user.saved_change_to_attribute?(\"first_name\") || @current_user.saved_change_to_attribute?(\"last_name\")\n redirect_to home_path, notice: \"Your name has been updated successfully.\"\n elsif @current_user.saved_change_to_attribute?(\"order_categories_by\")\n redirect_to categories_path, notice: \"Journal sorting changed.\"\n else\n redirect_back(fallback_location: root_path)\n end\n else\n render action: 'edit'\n end\n end", "def update\n @user = User.find_by_urlname(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated successfully\"\n format.html { redirect_to user_path(@user) }\n format.xml { head :ok }\n else\n flash[:error] = \"There were problems updating the profile\"\n format.html { render :action => 'edit' }\n format.xml { @user.errors.to_xml }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "def update_user(username, params)\n\t\t\t\tif @session['datastore'].has_key?(username)\n\t\t\t\t\t@session['datastore'][username] = params\n\t\t\t\tend\n\t\t\tend", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n\n respond_to do |format|\n if @user.id == current_user.id and @user.update_attributes(User.from_params(params))\n format.json { head :no_content }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = params[\"id\"].to_i\n name = params[\"name\"]\n linkedin_connections = params[\"linkedin_connections\"].to_i\n facebook_connections = params[\"facebook_connections\"].to_i\n twitter_followers = params[\"twitter_followers\"].to_i\n\n user = User.find(id)\n user.update(\n id: id,\n name: name, \n linkedin_connections: linkedin_connections, \n facebook_connections: facebook_connections, \n twitter_followers: twitter_followers,\n social_connection_index: User.compute_social_connection(\n linkedin_connections,\n facebook_connections,\n twitter_followers\n )\n )\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} successfully updated!\"\n format.html { redirect_to @user }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find_by(id: params[:id])\n if @user.update_attributes :username => user_params[:username], :email => user_params[:email], :password => user_params[:password]\n render :show\n else\n render :edit\n end\n end", "def update\n # find and update a specific user\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User updated'\n redirect_to users_path\n else\n flash[:error] = 'Update error'\n render :action => \"edit\", :id => @user\n end\n end", "def update_user!(user: nil)\n user_index = nil\n existing_user = nil\n\n users.each.with_index do |old_user, index|\n if old_user.email.casecmp(user.email.downcase).zero?\n user_index = index\n existing_user = old_user\n break\n end\n end\n\n if existing_user.nil?\n logger.debug(\"Couldn't update user #{user.email} because they don't exist\")\n raise \"Couldn't update user #{user.email} because they don't exist\"\n else\n users = self.users\n users[user_index] = user\n self.users = users\n logger.debug(\"Updating user #{existing_user.email}, writing out users.json to #{user_file_path}\")\n return true\n end\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n @user = User.find(params[:id])\n\n update_protected_attrs_from_params(:user, :login, :active) do |p|\n @user.attributes = p\n @user\n end\n \n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to([:admin, @user]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n\t\t@user = User.find(params[:id])\n\t\t# @user.assign_attributes(user_params)\n\n\t\t# Only try to save attributes that have been updated\n\t\tparams[:user].delete(:password) if params[:user][:password].blank?\n\t\t\n\t\tif @user.update_attributes(user_params)\n\n\t\t\t\trender json: @user, status: 200\n\n\t\telse\n\t\t\tprint(\"error updating user #{@user.errors.messages.inspect}\")\n\t\t\trender json: { errors: @user.errors.messages.inspect }, status: 422\n\t\tend\n\n\tend", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n\t\tuser = User.find(params[:id])\n if user\n if @current_user.id == user.id\n \n user.encrypted_password = nil if params[:password]\n user.password = params[:password] if params[:password]\n user.password_confirmation = params[:password_confirmation] if params[:password]\n user.first_name = params[:first_name] if params[:first_name]\n user.last_name = params[:last_name] if params[:last_name]\n \n if user.save()\n payload = {\n error: false,\n id: user.id\n }\n render status: 200, json: payload\n else\n errors = []\n user.errors.keys.each do |key|\n errors << {field: key, message: user.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 403\n end\n else\n render status: 404\n end\n\tend", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n\t\tparams.permit!\n\t\t@user = User.find(params[:id])\n\t\t@first_name = params[:user][:first_name].to_s\n\t\t@second_name = params[:user][:second_name].to_s\n\t\t@last_name = params[:user][:last_name].to_s\n\n\t\tif @first_name != \"-\" and @second_name != \"-\" and @last_name != \"-\"\n\t\t\t\t@user.update_attribute(:active,1)\n\t\tend\t\n\n\t\tif User.find_by_id(session[:user_id]).access != \"admin\" and @user_id == session[:user_id]\n\t\t\tif\tUser.authenticate(@user.name, params[:old_password]) == @user\n\t\t\t\t@user.update_attribute(:password, \"#{params[:user][:password]}\")\n\t\t\telse\n\t\t\t\tparams[:user][:password] = \"\"\n\t\t\tend\n\t\tend\n\t\t\t\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url,\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", "def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update!\n data = Steam::API.user(steam_id).first\n update(\n name: data[:personaname],\n avatar_url: data[:avatarfull],\n last_updated: Time.now\n )\n end", "def update\n @user = User.find(params[:id])\n end", "def update\n @user= User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Successfully updated abuser.\"\n redirect_to users_path\n else\n render :action => 'edit'\n end\nend", "def update!(options: {})\n\t\t\tuser = User.perform_request User.api_url(\"users/#{id}\"), :put, options, true\n\n\t\t\tif user\n\t\t\t\toptions.each do |key, value|\n\t\t\t\t\tself.send(\"#{key}=\", user['data'][\"#{key}\"])\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend", "def update\n @user = User.find(params[:id])\n\n # Don't change password if it wasn't entered\n params[:user].delete_if {|k,v| (k == \"password\" or k == \"password_confirmation\") and v.blank? }\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n @user.update_attribute(:admin, params[:user][:admin])\n @user.update_attribute(:name, params[:user][:name])\n format.html { redirect_to(users_path, :notice => 'User was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n\t@user = User.find(params[:id])\n\tif @user.update_attributes(params[:user])\n\t\tflash[:success] = \"Profile updated.\"\n\t\tredirect_to @user\n\telse\n\t\t@title = \"Edit user\"\n\t\trender 'edit'\n\tend\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user(data, options = {})\n GoodData::Domain.update_user(data, { client: client }.merge(options))\n end", "def update\n \n @user = User.find(params[:id])\n \n bSave = true\n \n if(bSave)\n bSave = @user.update_attribute(:bio,params[:user][:bio])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:location,params[:user][:location])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:first_name,params[:user][:first_name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:last_name,params[:user][:last_name])\n end\n if(bSave)\n bSave = @user.update_attribute(:name,params[:user][:name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:email,params[:user][:email])\n #@user.email = params[:user][:email]\n #bSave = @user.save\n end\n \n #debugger\n respond_to do |format|\n if bSave\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@user = User.find(params[:id])\n\t\t@user.update_attributes(user_params)\n\t\t\tflash[:success] = \"Profile updated!\"\n\t\t\tredirect_to @user\n\tend", "def update\n @user = @current_user\n\n if user_params[:name].strip.empty?\n @user.name = \"Murakami\"\n end\n\n if @user.update user_params\n if user_params[:image_url]\n req = Cloudinary::Uploader.upload( user_params[:image_url])\n @user.image_url = req[\"url\"]\n end\n @user.save\n redirect_to root_path\n else\n render :edit\n end\n end", "def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end", "def update\n if @user.update_attributes(update_user_params)\n alert_js('SUCCESS user updated.')\n else\n alert_js('!!!ERROR updating user!!!')\n end\n end", "def update\n @user = User.find(current_user.id)\n if @user.update_attributes(user_params)\n redirect_to account_url, flash: { success: t(:update_user_success) }\n else\n render 'edit'\n end\n end", "def update\n @user.update_attributes!(user_params)\n \n render nothing: true, status: :no_content\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:success] = 'Changes to your account information have been saved.'\n redirect_to @user\n else\n @page_title = \"Edit user #{@user.id}\"\n render 'edit'\n end\n end", "def update\n @current_user = User.find( params[:id] )\n @current_user.update!( user_params )\n redirect_to user_path( @current_user.id )\n end", "def user=(user)\n self.update_attributes(:user_id => user.id)\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def set_user_name_field(user_name)\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update_attributes(user_params)\n head :ok\n else\n head :internal_server_error\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:success] = 'Profile updated.'\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n if @user.update_attributes(user_params)\n redirect_to users_url, :notice => 'User was successfully updated.'\n else\n render :action => \"edit\"\n end\n end", "def update\n @user = User.find(params[:id])\n unless @account.admin || @account.username==@user.username\n flash[:warning] = \"You do not have enough access rights to edit this user.\"\n redirect_to root_path\n return\n end\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_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", "def update_user(id:, **args)\n params = parameters(args) do\n required_params :active_flag\n optional_params :active_flag\n end\n request(:put, \"users/#{id}\", params)\n end", "def update\n @user = User.find(params[:user_name])\n if @user.update(user_params)\n # Tell the User1Mailer to send a password email after save\n # User1Mailer.password_email(@user).deliver_now\n render status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user\n user = User.find(params[:id])\n user.update! update_user_params(params)\n @users = User.order(:last_name, :first_name)\n @user = current_user\n render :index\n end" ]
[ "0.84820056", "0.8066077", "0.77982724", "0.77982724", "0.7791103", "0.77834505", "0.7758361", "0.7603567", "0.7551911", "0.7431223", "0.7361754", "0.7343018", "0.7340448", "0.7332482", "0.7327722", "0.73186034", "0.73155755", "0.72816426", "0.72469085", "0.72282124", "0.7209688", "0.7195437", "0.71928567", "0.7171015", "0.71326506", "0.71185565", "0.7101518", "0.7096978", "0.7079265", "0.70763606", "0.70718884", "0.7039941", "0.7033662", "0.703313", "0.7027232", "0.70167005", "0.70129216", "0.7007955", "0.70031667", "0.6998059", "0.69810987", "0.6979553", "0.69782346", "0.6970779", "0.6965576", "0.696194", "0.69610715", "0.6941705", "0.6941049", "0.69254225", "0.692221", "0.69160825", "0.69124514", "0.69078755", "0.69074136", "0.6887529", "0.6886052", "0.6885362", "0.68845505", "0.6878891", "0.68769133", "0.68740976", "0.68606764", "0.6817924", "0.6815997", "0.6813113", "0.6809036", "0.6801687", "0.6800046", "0.6799559", "0.6799559", "0.6799559", "0.67977184", "0.6789145", "0.6784535", "0.6771061", "0.6764541", "0.6763406", "0.6760018", "0.67596734", "0.6758593", "0.67557234", "0.67504066", "0.67470455", "0.6742702", "0.6741293", "0.6729439", "0.67249286", "0.67248666", "0.6718801", "0.67123073", "0.6702799", "0.6700958", "0.6695032", "0.6694649", "0.6694483", "0.66875863", "0.66857785", "0.6685298", "0.66846555" ]
0.73235136
15
Do not make AutotestUser users visible
def visible_users User.where.not(type: :AutotestUser) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def off_org_users\n \n end", "def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end", "def testNoAction\n executeTest('DummyUser', {})\n end", "def include_public_users?\n true\n end", "def show_users\n @users = User.where(store: false, admin: false)\n end", "def viewable_users\n @viewable_users ||= (controllable_users + request_applicants + controllable_users.map{|uu|uu.request_applicants}).flatten.uniq\n end", "def users_hide_or_show_superusers\n if current_user.superuser?\n User.all\n else\n User.less_superusers\n end\n end", "def users_hide_or_show_superusers\n if current_user.superuser?\n User.all\n else\n User.less_superusers\n end\n end", "def set_users\n @can_change_owner = policy(@run || Run).current_user_allowed_to_crud?\n @users = policy_scope(User).map{|u| [ u.name, u.id ] } if @can_change_owner\n end", "def accessible_for?(user)\n user_id == user.id && !user.anonimous?\n end", "def user_actions(user)\n can_act_as_logged_in_user(user) unless Revs::Application.config.restricted_beta # also have logged in privileges if we are not in beta\n end", "def set_users\n\n end", "def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def visible_users\n is_superadmin? ? User.all : title.users\n end", "def setup\n @user = users(:brock)\n end", "def disable_test_autorun\n toggle_test_autorun false\n end", "def on_users_account\n true\n end", "def admin\n check_admin_without_render(current_user)\n @users = User.find(:all, :order => \"updated_at\", :conditions => [\"junk is NOT NULL\", ])\n end", "def disable_expired_users()\n confluence_user_names.each do |name|\n next if name == \"conflusa\" \n ldap_person = find_in_ldap(name)\n \n if ldap_person.nil? || !eligible_for_confluence?(ldap_person)\n user = find_in_confluence(name)\n user.disable()\n @disabled_users << user \n end\n end\n end", "def set_user; end", "def unscrape?\n @user.is_admin?\n end", "def accessible\n accessible_for(Aurita.user)\n end", "def show\n @users = User.all\n authorize @colaboradore\n end", "def check_local_users_do_not_exist(users)\n @users_that_should_be_absent << {\n nodes_selectors_stack: current_nodes_selectors_stack,\n users: users.is_a?(Array) ? users : [users]\n }\n end", "def show\n uninvited_users\n end", "def show\n require_user()\n end", "def list_all_users\n\n end", "def transferrable_to_users\n collaborator_users.where.not(id: user_id)\n end", "def service_user(_user)\n can :access, :stats\n can :access, :export unless RuntimeConfig.elections_active?\n can :access, :voters if RuntimeConfig.elections_started? && RuntimeConfig.elections_active?\n end", "def show\n @users = @event.users\n\n unless current_user.super_user\n unless @users.include?(current_user)\n flash[:warning] = t(\"oops_not_access\")\n redirect_to root_path\n end\n end\n end", "def users\n \n end", "def instruct_user!\n end", "def setup\n \n @user = users(:david)\n \n end", "def user\n\t\tfalse\n\tend", "def is_potential_user?\n\t\ttrue\n\tend", "def test_shold_not_show_to_non_admin\n sign_in Factory.create(:user)\n get :show\n assert_response :redirect\n end", "def visible?(user=User.current)\n true\n end", "def test_status_against_anonymous_user\n classes = [Expression, Event, Manifestation, Resource, Superwork, Work]\n statuses = Status.find(:all)\n check_class_list(classes, statuses, \"You are not authorised to view the intended page\")\n end", "def list_users?\n user.present? && user.admin?\n end", "def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end", "def users_only\n deny_access(\"You must be signed in to access this page.\") unless signed_in?\n end", "def setup\n @user = users(:tommy)\n end", "def test_disabled_user_display\n $ie.link(:text, (users :disabled).login).click\n h1 = $ie.h1(:text, /#{(users :disabled).to_s}/)\n #puts \"\\n\" + li.html + \"\\n\"\n assert !h1.locate_tagged_element(\"strike\",:text,(users :disabled).to_s).nil?\n end", "def assert_user_cant_access(user, actions, params = {})\r\n assert_user_access_check(false, user, actions, params)\r\n end", "def additional_users_for_edit\n []\n end", "def faft_robot(user)\n end", "def allow_anon\n end", "def skip_user_details?\n org_details[:skip_user_details]\n end", "def users_only\n redirect_to band_path(current_user.accountable) if is_band\n end", "def customize_new_user(user)\n # user.level = User::Levels::MEMBER\n # user.can_approve_posts = false\n # user.can_upload_free = false\n # user.is_super_voter = false\n #\n # user.base_upload_limit = 10\n # user.comment_threshold = -1\n # user.blacklisted_tags = [\"spoilers\", \"guro\", \"scat\", \"furry -rating:s\"].join(\"\\n\")\n # user.default_image_size = \"large\"\n # user.per_page = 20\n # user.disable_tagged_filenames = false\n true\n end", "def setup\n @user = users(:tom)\n end", "def show\n set_user\n end", "def make_first_user_admin\n return unless User.count.zero?\n\n self.is_admin = true\n self.approved = true\n end", "def make_user\n end", "def invitable_users\n @title = \"Invitar usuario\"\n @invitable_users = GetInvitableUsers.call(@previa_group)\n end", "def index\n # authorize! :index, @user, :message => 'Not authorized as an administrator.'\n @users = User.all\n end", "def addable_watcher_users\n users = self.project.users.sort - self.watcher_users\n users.reject! {|user| !user.allowed_to?(:view_issues, self.project)}\n users\n end", "def readonly_user\n super\n end", "def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end", "def forbid_anonymous_user_param\n if is_anonymous? && params.has_key?('user')\n raise Forbidden, 'Not allowed to list other users environments, because '\\\n 'you are seen as an anonymous one'\n end\n end", "def user; end", "def user; end", "def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end", "def current_user_can_list_users\n bounce_user unless User.can_list_users? current_user\n end", "def test_user_create_mode_off\r\n original_value = MAX_USER_GENERATION\r\n begin\r\n Object.const_set('MAX_USER_GENERATION', 0)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@invitee_not_in_system_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n \r\n #KS- make sure a user was NOT created for kavin620@yahoo.com\r\n assert_nil User.find_by_string('kavin620@yahoo.com')\r\n ensure\r\n Object.const_set('MAX_USER_GENERATION', original_value)\r\n end\r\n end", "def items_to_check\n User.not_admins\n end", "def check_profile_enabled(u)\n fn = u.first_name\n ln = u.last_name\n un = u.username\n e = u.email\n visit user_path(u)\n assert page.has_css?('title', text: full_title(\"User: #{fn} #{ln}\"),\n visible: false)\n assert page.has_css?('h1', text: \"User: #{fn} #{ln}\",\n visible: false)\n assert page.has_text?(\"Username: #{un}\")\n assert page.has_text?(\"Email: #{e}\")\n end", "def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end", "def setup\n @user = users(:michael)\n end", "def users\n\n end", "def preview_only?(user)\n !listed && !author?(user)\n end", "def hide\n @this_user.update_attributes(:visible => false)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end", "def setup\n @user = users :michael\n end", "def is_user_specific?\n false\n end", "def login_as\n @page_title = _('Login_as')\n @page_icon = 'key.png'\n\n\n @users = User.select(\"*, #{SqlExport.nice_user_sql}\").where(hidden: 0).order(\"nice_user ASC\")\n\n end", "def eventunscrape?\n @user.is_admin?\n end", "def new_list_users\n\n end", "def viewable_by?(user)\n Sugar.public_browsing? || user ? true : false\n end", "def creatable_without_user\n false\n end", "def set_ShowUser(value)\n set_input(\"ShowUser\", value)\n end", "def enduser_ignored?\n true\n end", "def readable_by? user\n true\n end", "def index\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = User.find(session[:user_id])\n end\n end", "def users() @users = DiggUsers.new end", "def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def admin_only\n false\n end", "def true_user_can_impersonate?\n true_user and Rails.configuration.dm_unibo_common[:impersonate_admins] and Rails.configuration.dm_unibo_common[:impersonate_admins].include?(true_user.upn)\n end", "def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end", "def applies_to?(user); false end", "def correct_user_to_edit\n not_allow if (@job.user.id != current_user.id) \n end", "def IsUserDev(user_id)\r\n return user_id == OWNER_ID || COBALT_DEV_ID.include?(user_id)\r\n end", "def unhide\n @this_user.update_attributes(:visible => true)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end", "def disabled?\n user.nil?\n end", "def index\n @users = User.select{ |_| can? :read, _ }\n end", "def require_user\n end", "def show\n if !current_user.isAdmin? and current_user.id != @user.id\n redirect_to user_path(current_user.id)\n end\n end", "def in_test_or_root_user\n if !current_user.sk.root?\n in_test\n end\n end", "def test_admins_can_see_other_agents\n login_as :oleg\n get :show, :id => users(:jack).id\n assert_response :success\n end", "def non_creators(list, users)\n members = []\n users.each do |user|\n if !List.is_creator?(list, user)\n members << user\n end\n end\n members\n end" ]
[ "0.67973125", "0.64449453", "0.63261586", "0.632516", "0.6189137", "0.6185949", "0.61498743", "0.61498743", "0.6094246", "0.60853875", "0.6016768", "0.60043406", "0.6004092", "0.5987089", "0.5983152", "0.59766114", "0.59692746", "0.596323", "0.5935923", "0.5933732", "0.59253633", "0.5921044", "0.59149575", "0.5894502", "0.58928007", "0.58880377", "0.5884026", "0.58745766", "0.5874448", "0.58673656", "0.58603734", "0.58510846", "0.58277714", "0.58245647", "0.58170116", "0.58108777", "0.5809868", "0.58011407", "0.5792187", "0.57913214", "0.57911694", "0.5788653", "0.57841545", "0.5777952", "0.57773715", "0.5775996", "0.5759886", "0.57546234", "0.5750533", "0.5742799", "0.5741331", "0.57336426", "0.57336026", "0.5728191", "0.5720514", "0.5716297", "0.5712982", "0.5710676", "0.5710535", "0.5702855", "0.56943774", "0.56939423", "0.56939423", "0.5686119", "0.56832415", "0.56819546", "0.5681574", "0.56786066", "0.5677888", "0.5677371", "0.5672792", "0.5663732", "0.5661655", "0.56601185", "0.56565845", "0.5652607", "0.56507456", "0.56451607", "0.5644768", "0.5635576", "0.5632939", "0.5631079", "0.56302285", "0.5629326", "0.56272584", "0.5626418", "0.5622762", "0.56209576", "0.5619967", "0.5619795", "0.56171954", "0.5616376", "0.56159717", "0.5615688", "0.5610646", "0.5604194", "0.56025195", "0.5602462", "0.55983824", "0.5596269" ]
0.75043565
0
Average Revenue Per Order
def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil) orders_count = get_orders_count(order_type, start_date, end_date) return (get_revenue(order_type, start_date, end_date)/orders_count).round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)\n (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)\n end", "def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end", "def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)\n if get_orders_count(order_type, start_date, end_date) > 0\n (get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0)\n else\n 0\n end\n end", "def average_unit_price\n orders_in_last_30_days = orders.in_last_days(30)\n summed_price_of_orders(orders_in_last_30_days) / summed_units_of_orders(orders_in_last_30_days) unless orders.empty?\n end", "def revenue\n sales_by_vendor = sales.map {|sale| sale.amount }\n sales_by_vendor.reduce(0,:+)\n end", "def average_price\n item_receipts = @item.item_receipts.where(created_at: @range)\n return '0' unless item_receipts.present?\n result = item_receipts.sum(:price) / item_receipts.count\n Money.new(result * 100).to_s\n end", "def average_revenue\n # input: total_revenue, total_time_spent(hours),\n # output: average_revenue = total_revenue / total_time_spent\n average_revenue = 0\n total_time = Trip.total_time(trips)/60/60.round(2)\n average = self.total_revenue / total_time\n average_revenue += average\n return average_revenue.round(2)\n end", "def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def product_avg_price(array_item)\n\tproduct_tot_sales(array_item)/product_tot_purchases(array_item)\nend", "def brand_avg_price(array_item)\n\tprice_total = brand_stock_list(array_item).map {| one_stock | one_stock[\"full-price\"].to_f}\n \t(price_total.inject(:+)/price_total.length).round(2)\nend", "def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end", "def average_rent\n unit_rent = @units.each_key do |unit, value|\n unit[:monthly_rent]\n end\n (unit_rent.sum / 2).round(1)\n end", "def get_average_orders_per_customer(customer_type=nil)\n (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def total_earned\n totals = []\n\n self.orders.each do |order|\n totals << order.total_price\n end \n\n return totals.inject{ |sum, n| sum + n } \n end", "def get_average_price(toy)\n\treturn get_total_sales(toy) / get_total_purchases(toy)\nend", "def average_variance\n return '0' unless item_receipts_with_variance.present?\n result = item_receipts_with_variance.map{ |ir| (ir.price - ir.item_order.price).abs }.reduce(&:+) / item_receipts_with_variance.count\n Money.new(result * 100).to_s\n end", "def get_avg_revenue_per_hour\n avg_rev = (get_total_revenue / get_total_trip_durations_in_hours).round(2)\n return avg_rev.nan? ? 0.0 : avg_rev\n end", "def revenue\n sum = 0\n sales.each do |sale|\n sum += sale.amount\n end\n sum\n end", "def revenue\n sales_array = self.sales\n total = 0\n\n sales_array.each do |sale|\n total += sale.amount\n end\n\n return total\n end", "def revenue\n sales_array = self.sales\n total = 0\n\n sales_array.each do |sale|\n total += sale.amount\n end\n\n return total\n end", "def revenue\n revenue_amount = 0\n sales.each do |sale|\n revenue_amount += sale.amount\n end\n return revenue_amount\n end", "def average_amount\n (paid_infos.values.inject(:+) / paid_infos.size).round(2)\n end", "def total_revenue\n total = 0.00\n self.my_orders.each do |order|\n total += order.merchant_subtotal(self.id)\n end\n return total\n end", "def average_price(products)\n \t\tprice_array = products.map { |product| product.price.to_f}\n \t\tavg = price_array.reduce(:+) / price_array.size.to_f\n \t\tavg.round(2)\n \tend", "def revenue\n vend_id = @vendor_id\n found_sale_items = self.sales(vend_id)\n total_revenue = 0\n found_sale_items.each do |sale|\n total_revenue += sale.amount\n end\n return total_revenue\n end", "def average_price\n sum = menu_items.sum {|item| item.price}.to_f\n avg = sum/menu_items.count\n avg.round(2)\n end", "def avg_price(products)\n # subtotal=0\n # products.map do |product|\n # subtotal = subtotal + product[:price]\n # end\n # (subtotal / products.count).round(2)\n #ou\n #subtotal = subtotal / products.count\n #subtotal.round(2)\n\n ##reduce\n subtotal = products.reduce(0) do |total, product|\n total = total + product[:price]\n end\n (subtotal / products.count).round(2)\nend", "def average(range = nil)\n return (range == nil ? self.transactions : self.transactions.all(:date => range)).avg(:amount)\n end", "def gross_revenue\n purchases.to_a.sum(&:gross_revenue)\n end", "def compute(order)\n rate = self.calculable\n line_items = order.line_items.select { |i| i.product.tax_category == rate.tax_category }\n line_items.inject(0) {|sum, line_item|\n sum += (line_item.price * rate.amount * line_item.quantity)\n }\n end", "def average_price\n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def average_price_brand item\n\t$brand_price = 0.0\n\t$same_brand.each {|toy| $brand_price += toy[\"full-price\"].to_f}\n\t$average_price = 0.0\n\t$same_brand.each {|toy| $average_price = ($brand_price / $same_brand.length)}\nend", "def average_price\n populate_price_data unless @average_price\n @average_price\n end", "def average_investment\n fetch(:average_investment) { total_investment_over_lifetime / 2 }\n end", "def invoice_revenue\n InvoiceItem.group(:invoice_id).where(invoice_id: id).sum('quantity * unit_price').values.pop\n end", "def average_rating\n cal_average_rating(@products)\n end", "def average_price(micro)\n sum = 0\n i = 0\n micro.products.each do |item|\n sum += item.price\n i += 1\n end\n @aver_price = sum / micro.products.length\n end", "def average_sold_price(start_datetime, end_datetime, sale_lease, type)\n filter = filter_listings(start_datetime, end_datetime, sale_lease, type)\n filter.where.not(sold_date: nil).average(:sold_price).to_f\n end", "def revenue\n Product.joins(:store_products, :purchases).where(store_products: {store_id: self.id}).sum(:price)\n end", "def avg_price\n (open+close+high+low).scale(0.25)\n end", "def revenue\n invoice_items.total_revenue\n end", "def total_sales_brand item\n\t$brand_revenue = 0.0\n\t$same_brand.each {|toy| $brand_revenue += toy[\"purchases\"].inject(0) {|m,n| m + n[\"price\"]}}\nend", "def revenue\n Sale.sales_sum_in_cents(@id)\n end", "def product_avg_discount(array_item)\n\tproduct_full_price(array_item).to_f-product_avg_price(array_item)\nend", "def revenue\n (quantity * product.price).to_f\n end", "def best_invoice_by_revenue\n invoice_list = se.invoices.all\n calculate_invoice_totals(invoice_list)\n end", "def average_rent(units = @units)\n average_rent = 0\n units.each do |unit|\n average_rent += unit.monthly_rent.to_f\n end\n average_rent / units.length.to_f\n end", "def average_brand_price(brand)\n 'Average Product Price: $' + format('%.2f', brand.average_price)\n end", "def brand_average_price(brand) \n full_price_brand = 0 \n brands_items(brand).each do |toy| \n full_price_brand += toy[\"full-price\"].to_f \n end \n $report_file.puts \"Average price #{brand}: #{(full_price_brand/brands_items(brand).length).round(2)}\" \nend", "def average_price()\n sum = 0.0\n n = 0\n listings.each do |listing|\n sum += listing.price\n n += 1\n end\n return(sum/n) if n != 0\n n.to_f\n end", "def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend", "def find_avg(offers)\n if offers.count != 0\n temp =[]\n offers[0].each{|i|\n temp << i.price\n }\n temp.sum.to_f/temp.count\n else\n 0\n end\n\n end", "def average_price toy\n\t$average_price = $total_amount / toy[\"purchases\"].length\nend", "def average_items_per_merchant\n groups = merchant_stores\n vals = merchant_store_item_counts(groups)\n mean = average(vals)\n return mean.round(2)\n end", "def revenue\n @revenue ||=\n if number_of_units.zero? || output_capacity_per_unit.zero?\n 0.0\n else\n revenue_curve.sum\n end\n end", "def gross_revenue\n item.price * count\n end", "def average_price\n # CARYN SAYS: make sure you're testing! I can tell you didn't because menu_item should be pluralized\n # like the method defined above \n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def brand_tot_sales(array_item)\n\ttotal_sales = 0\n\tbrand_stock_list(array_item).each do | each_item | \n\t\teach_item[\"purchases\"].each do | each_item_price |\n\t\t\ttotal_sales += each_item_price[\"price\"]\n\t\tend\n\tend\n\treturn total_sales.round(2)\nend", "def average arr\n sum = 0\n arr.each {|i| sum += i}\n average = sum/(arr.size) \nend", "def gross_revenue\n purchasers.to_a.sum(&:gross_revenue)\n end", "def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end", "def avg(prevs)\n avg = prevs.reduce(:+) / prevs.size\n avg.round(3)\nend", "def revenue\n end", "def get_average_price_brand(brands_hash)\n\ttotal_price_brand = 0\n average_price_brand = 0\n brands_hash.each do |item|\n \ttotal_price_brand += item['full-price'].to_f\n \taverage_price_brand = (total_price_brand / brands_hash.length).round(2)\n end\n return average_price_brand\nend", "def average(arr)\n sum = arr.reduce(:+).to_f \n sum / arr.size\nend", "def average()\n if(@countN > 0) then\n return @sum / @countN ;\n else\n return 0.0 ;\n end\n end", "def product_tot_sales(array_item)\n\tprice_only = array_item[\"purchases\"].map {| my_price | my_price[\"price\"]}\n \tprice_only.inject(:+)\nend", "def average_ask\n asks = @asks.map { |x| x.fetch(:price) }\n asks.inject(:+) / asks.count\n end", "def average_bid\n bids = @bids.map { |x| x.fetch(:price) }\n bids.inject(:+) / bids.count\n end", "def average(arr)\n sum = arr.reduce(:+)\n sum / arr.size\nend", "def average_amount_operations\n \tif operations.any?\n \t total = operations.sum(:amount)\n \t count = operations.count\n \t total/count\n \tend\n end", "def average(arr)\n (arr.sum.to_f / arr.size).round(2)\nend", "def profit\n revenue - total_costs\n end", "def findAverage arr\n sum = 0\n for ocenka in arr do\n sum = sum + ocenka \n \n end\n average = sum / arr.length\n return average\nend", "def calculate_average_stats(stats)\n # selling price for unsold securities\n stats[:selling_unsold_price] = quote.price * stats[:unsold_amount]\n # difference between selling and buying price of unsold securities\n stats[:selling_unsold_income_price] = stats[:selling_unsold_price] - stats[:buying_unsold_price]\n # average prices\n stats[:buying_unsold_average_price] =\n stats[:unsold_amount].zero? ? 0 : (stats[:buying_unsold_price].to_f / stats[:unsold_amount]).round(4)\n stats[:exchange_profit] =\n stats[:buying_unsold_price].zero? ? 0 : ((stats[:selling_unsold_income_price] / stats[:buying_unsold_price]) * 100).round(2)\n # dividents\n stats[:dividents_amount_price] = dividents_amount_price(quote, stats[:unsold_amount])\n stats\n end", "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end", "def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end", "def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end", "def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end", "def average(arr)\n arr.reduce(:+).to_f / arr.size\nend", "def total_revenue_after_discounts\n total_revenue.first.to_f - total_discount.to_f\n end", "def avg\n only_with('avg', 'DateTime', 'Numeric')\n itms = items.compact\n size = itms.size.to_d\n if type == 'DateTime'\n avg_jd = itms.map(&:jd).sum / size\n DateTime.jd(avg_jd)\n else\n itms.sum / size\n end\n end", "def get_rating_averages\n set = GumRatingRelationship.where(:gum_id => self.id)\n return([set.average(:rank_1), set.average(:rank_2), set.average(:rank_3), set.average(:rank_4), set.average(:rank_5) ])\n end", "def average(arr)\n arr.sum / arr.size\nend", "def total_revenue \n if @trips.length > 0 \n revenue = @trips.map do |trip|\n (trip.cost - 1.65) * 0.8 \n end \n revenue.sum\n elsif @trips.length == 0 \n return 0 \n end \n end", "def order_total\n order.items.sum(:price)\n end", "def average(producer)\n total = 0\n @values.each do |result|\n total += producer.call(result)\n end\n avg = total / @values.length\n return avg.to_f\n end", "def product_avg_discount_per(array_item)\n\t(product_avg_discount(array_item)/product_full_price(array_item).to_f * 100).round(2)\n\t#avg_price_dis/retail_pr.to_f * 100).round(2)}%\"\n\nend", "def grade_average\n @grades.inject(:+) / @grades.size\n end", "def average_income; end", "def revenue_curve\n @revenue_curve ||= load_curve * order.price_curve\n end", "def calculate_average\n return 0 unless reviews.size.positive?\n avg = self.reviews.average(:rating) #.to_f.round(2) # * 100\n update_column(:rating, avg)\n end", "def average(arr)\n (arr.sum / arr.length.to_f).round(2)\nend", "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def average_population\n @store[:population].inject { |sum, population| sum + population }.to_f / @store[:population].length\n end", "def rating_average(obj)\n if obj.reviews.count >= 1\n array = []\n obj.reviews.each do |review|\n array.push(review.rating)\n end\n return (array.inject{ |sum, el| sum + el }.to_f / array.size).to_i\n else\n if obj.class.name == \"SharespaceVenue\"\n \"No reviews yet.\"\n else\n \"No reviews yet.\"\n end\n end\n\n\n\n end", "def revenue #returns the the sum of all of the vendor's sales (in cents) ##WORKS\n\t \tmy_revenue = 0\n\t \tmy_revenue_generators = sales\n\n\t \tmy_revenue_generators.each do |sale|\n\t \t\tmy_revenue += sale.amount\n\t \tend\n\t \ttotal_sales_in_cents = my_revenue * 100\n\t \t# puts total_sales_in_cents.to_s + \" cents. can you believe it?\"\n\t\treturn total_sales_in_cents\n\tend", "def avg_payoff\n payoff = []\n n_player_payoffs.each do |p|\n payoff << p.payoff \n end\n \n payoff.sum / payoff.length.to_f\n end", "def total_revenue(status = \"all\")\n revenue = 0.00\n\n if status == \"all\"\n self.order_items.where.not(status: \"cancelled\").find_each do |item|\n revenue += item.subtotal #instance method in order_items\n end\n else\n self.order_items.where(\"status = ?\", status).find_each do |item|\n revenue += item.subtotal\n end\n end\n\n if revenue > 0\n return revenue\n else\n return 0\n end\n end", "def get_total_revenue\n return calculate_total_revenue\n end" ]
[ "0.7875154", "0.7629451", "0.7084407", "0.6970247", "0.69223315", "0.67495847", "0.67010206", "0.6605434", "0.6582496", "0.65723115", "0.655904", "0.6548161", "0.64764345", "0.64655304", "0.64185876", "0.6418556", "0.6379762", "0.63695186", "0.6352476", "0.6352476", "0.63215005", "0.62818533", "0.62813264", "0.62807494", "0.6257032", "0.62351716", "0.6213802", "0.6189657", "0.6189147", "0.6137167", "0.6103001", "0.607384", "0.60649383", "0.6037656", "0.60342", "0.6018017", "0.6015992", "0.6015067", "0.60030353", "0.5989349", "0.5982802", "0.5979753", "0.59772754", "0.5974435", "0.5969414", "0.59667236", "0.59635043", "0.5959277", "0.5959245", "0.595844", "0.5916983", "0.5916716", "0.59089905", "0.59064764", "0.5896552", "0.5888628", "0.58477235", "0.5841518", "0.5830421", "0.58217204", "0.58007073", "0.5800235", "0.579793", "0.5797883", "0.57957876", "0.57938683", "0.5778208", "0.57772714", "0.5775581", "0.57723475", "0.5767283", "0.5762919", "0.57596076", "0.575476", "0.5739325", "0.57334274", "0.5733033", "0.5733009", "0.5726171", "0.57243866", "0.5715429", "0.57056874", "0.5705449", "0.5699576", "0.569264", "0.5687862", "0.5683905", "0.5682967", "0.56829196", "0.567763", "0.5676922", "0.56721324", "0.56714326", "0.56662554", "0.56642604", "0.56629837", "0.56606495", "0.5658391", "0.5657555", "0.56548625" ]
0.78708464
1
Average Revenue Per Order Item
def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil) (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end", "def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)\n orders_count = get_orders_count(order_type, start_date, end_date)\n return (get_revenue(order_type, start_date, end_date)/orders_count).round(2)\n end", "def average_price\n item_receipts = @item.item_receipts.where(created_at: @range)\n return '0' unless item_receipts.present?\n result = item_receipts.sum(:price) / item_receipts.count\n Money.new(result * 100).to_s\n end", "def product_avg_price(array_item)\n\tproduct_tot_sales(array_item)/product_tot_purchases(array_item)\nend", "def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)\n if get_orders_count(order_type, start_date, end_date) > 0\n (get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0)\n else\n 0\n end\n end", "def brand_avg_price(array_item)\n\tprice_total = brand_stock_list(array_item).map {| one_stock | one_stock[\"full-price\"].to_f}\n \t(price_total.inject(:+)/price_total.length).round(2)\nend", "def average_revenue\n # input: total_revenue, total_time_spent(hours),\n # output: average_revenue = total_revenue / total_time_spent\n average_revenue = 0\n total_time = Trip.total_time(trips)/60/60.round(2)\n average = self.total_revenue / total_time\n average_revenue += average\n return average_revenue.round(2)\n end", "def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def average_variance\n return '0' unless item_receipts_with_variance.present?\n result = item_receipts_with_variance.map{ |ir| (ir.price - ir.item_order.price).abs }.reduce(&:+) / item_receipts_with_variance.count\n Money.new(result * 100).to_s\n end", "def average_price\n sum = menu_items.sum {|item| item.price}.to_f\n avg = sum/menu_items.count\n avg.round(2)\n end", "def average_unit_price\n orders_in_last_30_days = orders.in_last_days(30)\n summed_price_of_orders(orders_in_last_30_days) / summed_units_of_orders(orders_in_last_30_days) unless orders.empty?\n end", "def average_rent\n unit_rent = @units.each_key do |unit, value|\n unit[:monthly_rent]\n end\n (unit_rent.sum / 2).round(1)\n end", "def revenue\n sales_by_vendor = sales.map {|sale| sale.amount }\n sales_by_vendor.reduce(0,:+)\n end", "def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end", "def average_price\n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def average_price_brand item\n\t$brand_price = 0.0\n\t$same_brand.each {|toy| $brand_price += toy[\"full-price\"].to_f}\n\t$average_price = 0.0\n\t$same_brand.each {|toy| $average_price = ($brand_price / $same_brand.length)}\nend", "def average_items_per_merchant\n groups = merchant_stores\n vals = merchant_store_item_counts(groups)\n mean = average(vals)\n return mean.round(2)\n end", "def product_avg_discount(array_item)\n\tproduct_full_price(array_item).to_f-product_avg_price(array_item)\nend", "def get_average_price(toy)\n\treturn get_total_sales(toy) / get_total_purchases(toy)\nend", "def total_sales_brand item\n\t$brand_revenue = 0.0\n\t$same_brand.each {|toy| $brand_revenue += toy[\"purchases\"].inject(0) {|m,n| m + n[\"price\"]}}\nend", "def revenue\n invoice_items.total_revenue\n end", "def get_avg_revenue_per_hour\n avg_rev = (get_total_revenue / get_total_trip_durations_in_hours).round(2)\n return avg_rev.nan? ? 0.0 : avg_rev\n end", "def invoice_revenue\n InvoiceItem.group(:invoice_id).where(invoice_id: id).sum('quantity * unit_price').values.pop\n end", "def avg_price(products)\n # subtotal=0\n # products.map do |product|\n # subtotal = subtotal + product[:price]\n # end\n # (subtotal / products.count).round(2)\n #ou\n #subtotal = subtotal / products.count\n #subtotal.round(2)\n\n ##reduce\n subtotal = products.reduce(0) do |total, product|\n total = total + product[:price]\n end\n (subtotal / products.count).round(2)\nend", "def average_amount\n (paid_infos.values.inject(:+) / paid_infos.size).round(2)\n end", "def item_average_rating\n item_rating / count_properties_names rescue 0\n end", "def average_price\n # CARYN SAYS: make sure you're testing! I can tell you didn't because menu_item should be pluralized\n # like the method defined above \n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def gross_revenue\n item.price * count\n end", "def revenue\n revenue_amount = 0\n sales.each do |sale|\n revenue_amount += sale.amount\n end\n return revenue_amount\n end", "def brand_tot_sales(array_item)\n\ttotal_sales = 0\n\tbrand_stock_list(array_item).each do | each_item | \n\t\teach_item[\"purchases\"].each do | each_item_price |\n\t\t\ttotal_sales += each_item_price[\"price\"]\n\t\tend\n\tend\n\treturn total_sales.round(2)\nend", "def revenue\n sum = 0\n sales.each do |sale|\n sum += sale.amount\n end\n sum\n end", "def revenue\n sales_array = self.sales\n total = 0\n\n sales_array.each do |sale|\n total += sale.amount\n end\n\n return total\n end", "def revenue\n sales_array = self.sales\n total = 0\n\n sales_array.each do |sale|\n total += sale.amount\n end\n\n return total\n end", "def revenue\n vend_id = @vendor_id\n found_sale_items = self.sales(vend_id)\n total_revenue = 0\n found_sale_items.each do |sale|\n total_revenue += sale.amount\n end\n return total_revenue\n end", "def product_avg_discount_per(array_item)\n\t(product_avg_discount(array_item)/product_full_price(array_item).to_f * 100).round(2)\n\t#avg_price_dis/retail_pr.to_f * 100).round(2)}%\"\n\nend", "def average_rating\n cal_average_rating(@products)\n end", "def average_rating\n sum = self.queue_items.map {|item| item.rating}.reduce(:+)\n length = self.queue_items.length\n sum / length\n end", "def average_price(products)\n \t\tprice_array = products.map { |product| product.price.to_f}\n \t\tavg = price_array.reduce(:+) / price_array.size.to_f\n \t\tavg.round(2)\n \tend", "def get_average_orders_per_customer(customer_type=nil)\n (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def avg\n only_with('avg', 'DateTime', 'Numeric')\n itms = items.compact\n size = itms.size.to_d\n if type == 'DateTime'\n avg_jd = itms.map(&:jd).sum / size\n DateTime.jd(avg_jd)\n else\n itms.sum / size\n end\n end", "def brand_average_price(brand) \n full_price_brand = 0 \n brands_items(brand).each do |toy| \n full_price_brand += toy[\"full-price\"].to_f \n end \n $report_file.puts \"Average price #{brand}: #{(full_price_brand/brands_items(brand).length).round(2)}\" \nend", "def revenue\n (quantity * product.price).to_f\n end", "def product_tot_sales(array_item)\n\tprice_only = array_item[\"purchases\"].map {| my_price | my_price[\"price\"]}\n \tprice_only.inject(:+)\nend", "def gross_revenue\n purchases.to_a.sum(&:gross_revenue)\n end", "def total_revenue\n total = 0.00\n self.my_orders.each do |order|\n total += order.merchant_subtotal(self.id)\n end\n return total\n end", "def average_price(micro)\n sum = 0\n i = 0\n micro.products.each do |item|\n sum += item.price\n i += 1\n end\n @aver_price = sum / micro.products.length\n end", "def avg_price\n (open+close+high+low).scale(0.25)\n end", "def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end", "def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end", "def average_price()\n sum = 0.0\n n = 0\n listings.each do |listing|\n sum += listing.price\n n += 1\n end\n return(sum/n) if n != 0\n n.to_f\n end", "def average_investment\n fetch(:average_investment) { total_investment_over_lifetime / 2 }\n end", "def average_bid\n bids = @bids.map { |x| x.fetch(:price) }\n bids.inject(:+) / bids.count\n end", "def average_rent(units = @units)\n average_rent = 0\n units.each do |unit|\n average_rent += unit.monthly_rent.to_f\n end\n average_rent / units.length.to_f\n end", "def average_brand_price(brand)\n 'Average Product Price: $' + format('%.2f', brand.average_price)\n end", "def find_avg(offers)\n if offers.count != 0\n temp =[]\n offers[0].each{|i|\n temp << i.price\n }\n temp.sum.to_f/temp.count\n else\n 0\n end\n\n end", "def average_sold_price(start_datetime, end_datetime, sale_lease, type)\n filter = filter_listings(start_datetime, end_datetime, sale_lease, type)\n filter.where.not(sold_date: nil).average(:sold_price).to_f\n end", "def total_earned\n totals = []\n\n self.orders.each do |order|\n totals << order.total_price\n end \n\n return totals.inject{ |sum, n| sum + n } \n end", "def compute(order)\n rate = self.calculable\n line_items = order.line_items.select { |i| i.product.tax_category == rate.tax_category }\n line_items.inject(0) {|sum, line_item|\n sum += (line_item.price * rate.amount * line_item.quantity)\n }\n end", "def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end", "def total_revenue_generation\n items_by_merchant.each do |merchant, items|\n total_revenue = 0\n items.each do |item|\n invoice_items.each do |invoice_item|\n if invoice_item.item_id === item.id\n total_revenue += invoice_item.quantity * invoice_item.unit_price\n end\n end\n end\n merchant.total_revenue = total_revenue\n end\n end", "def revenue\n Product.joins(:store_products, :purchases).where(store_products: {store_id: self.id}).sum(:price)\n end", "def average_price\n populate_price_data unless @average_price\n @average_price\n end", "def average_price toy\n\t$average_price = $total_amount / toy[\"purchases\"].length\nend", "def average(range = nil)\n return (range == nil ? self.transactions : self.transactions.all(:date => range)).avg(:amount)\n end", "def revenue\n @revenue ||=\n if number_of_units.zero? || output_capacity_per_unit.zero?\n 0.0\n else\n revenue_curve.sum\n end\n end", "def calculate_average\n return 0 unless reviews.size.positive?\n avg = self.reviews.average(:rating) #.to_f.round(2) # * 100\n update_column(:rating, avg)\n end", "def best_invoice_by_revenue\n invoice_list = se.invoices.all\n calculate_invoice_totals(invoice_list)\n end", "def average(ratings)\n ratings.inject(0.0) { |sum, el| sum + el.to_f } / ratings.size\n end", "def potential_revenue\n @inventory.inject(0) do |total, inventory|\n total += inventory.first.price * inventory.last\n end\n end", "def avg(prevs)\n avg = prevs.reduce(:+) / prevs.size\n avg.round(3)\nend", "def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend", "def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end", "def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend", "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end", "def revenue\n Sale.sales_sum_in_cents(@id)\n end", "def profit\n revenue - total_costs\n end", "def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end", "def total_revenue_after_discounts\n total_revenue.first.to_f - total_discount.to_f\n end", "def revenue\n Invoice.joins(:invoice_items, :transactions)\n .where(merchant: self.id, 'transactions.result' => 'success')\n .sum('invoice_items.quantity * invoice_items.unit_price')\n end", "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end", "def average_ask\n asks = @asks.map { |x| x.fetch(:price) }\n asks.inject(:+) / asks.count\n end", "def average arr\n sum = 0\n arr.each {|i| sum += i}\n average = sum/(arr.size) \nend", "def average()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Average::AverageRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def get_average_price_brand(brands_hash)\n\ttotal_price_brand = 0\n average_price_brand = 0\n brands_hash.each do |item|\n \ttotal_price_brand += item['full-price'].to_f\n \taverage_price_brand = (total_price_brand / brands_hash.length).round(2)\n end\n return average_price_brand\nend", "def rating_average(obj)\n if obj.reviews.count >= 1\n array = []\n obj.reviews.each do |review|\n array.push(review.rating)\n end\n return (array.inject{ |sum, el| sum + el }.to_f / array.size).to_i\n else\n if obj.class.name == \"SharespaceVenue\"\n \"No reviews yet.\"\n else\n \"No reviews yet.\"\n end\n end\n\n\n\n end", "def calculate_average_rating\n weighted_drinks_ratings.sum.to_f / weighted_drinks_ratings.count\n end", "def avg_score\n reviews.average(:rating).round(2).to_f\n end", "def gross_revenue\n purchasers.to_a.sum(&:gross_revenue)\n end", "def get_avg_rating(rides)\n total_rating = 0\n rides.each do |ride|\n total_rating += ride[:rating]\n end\n return total_rating.to_f / get_num_rides(rides)\nend", "def revenue_by_item_id(hash)\n hash.each { |item_id, inv_items|\n hash[item_id] = inv_items.inject(0){ |sum, item| sum += revenue(item) }\n }; return hash\n end", "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end", "def total_prices_te_by_taxes_rates\n order_items.reduce({}) do |total_prices, order_item|\n taxes_rate = order_item.product_taxes_rate.to_f\n\n total_prices[taxes_rate] ||= 0\n total_prices[taxes_rate] += order_item.product_price_te.to_f\n total_prices\n end\n end", "def total_revenue \n if @trips.length > 0 \n revenue = @trips.map do |trip|\n (trip.cost - 1.65) * 0.8 \n end \n revenue.sum\n elsif @trips.length == 0 \n return 0 \n end \n end", "def average_rating\n ratings.average(:value).to_f\n end", "def avg(field)\n aggregates(field)[\"avg\"]\n end", "def average_rating\n ratings\n .average(:rating)\n .to_f\n .round(2)\n end", "def average(arr)\n sum = arr.reduce(:+)\n sum / arr.size\nend", "def grade_average\n @grades.inject(:+) / @grades.size\n end", "def calc_average!\n update!(avg_rating: ratings.average(:rating))\n end" ]
[ "0.73492616", "0.7346743", "0.7330883", "0.7138519", "0.70750594", "0.702968", "0.69464535", "0.6928561", "0.68511236", "0.681629", "0.6796739", "0.6688929", "0.6666513", "0.6660459", "0.66324747", "0.6626453", "0.66040957", "0.65604335", "0.64406735", "0.6434388", "0.6410795", "0.6409607", "0.63743025", "0.63427263", "0.63259107", "0.6323459", "0.6310084", "0.6300227", "0.6283125", "0.62612706", "0.6261229", "0.6254918", "0.6254918", "0.6240862", "0.6211113", "0.6208273", "0.62079227", "0.61777735", "0.6160712", "0.61582196", "0.6154983", "0.6142724", "0.61076605", "0.6107305", "0.60911226", "0.6091067", "0.6069323", "0.60406554", "0.6039456", "0.6027655", "0.6027538", "0.60142183", "0.6000297", "0.5997951", "0.59790397", "0.5978364", "0.5951453", "0.5951387", "0.5948005", "0.59435195", "0.59421766", "0.59387165", "0.5928253", "0.5925039", "0.59138036", "0.5906921", "0.59027106", "0.5885997", "0.5885355", "0.5880585", "0.5880267", "0.5876377", "0.58527637", "0.5851392", "0.58507764", "0.58452415", "0.5843001", "0.58389467", "0.5838416", "0.58281416", "0.58202803", "0.5816257", "0.58085454", "0.58060503", "0.5791086", "0.5778311", "0.5777427", "0.5774931", "0.5767584", "0.5765472", "0.57611823", "0.5761069", "0.5756187", "0.5752916", "0.5734855", "0.5726968", "0.57190096", "0.57172316", "0.57121295", "0.57080114" ]
0.8286279
0
Average Orders Per Customer
def get_average_orders_per_customer(customer_type=nil) (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end", "def index\n # uses the customer_orders scope to retrieve all the orders that the current customer has made\n @orders = Order.customer_orders(current_customer)\n # uses the customer_average_order_cost scope to calculate the average cost of all the orders that the\n # current customer has made\n @average_cost_of_orders = Order.customer_average_order_cost(current_customer)\n end", "def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)\n if get_orders_count(order_type, start_date, end_date) > 0\n (get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0)\n else\n 0\n end\n end", "def average_items_per_merchant\n groups = merchant_stores\n vals = merchant_store_item_counts(groups)\n mean = average(vals)\n return mean.round(2)\n end", "def avg_reviews_with_owner(before = DateTime.new(2050,01,01))\n code_reviews(before).average(:total_reviews_with_owner)\n end", "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end", "def average_rating\r\n comments.average(:rating).to_f\r\n end", "def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)\n orders_count = get_orders_count(order_type, start_date, end_date)\n return (get_revenue(order_type, start_date, end_date)/orders_count).round(2)\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def update_for_customer\n reviews = Review.find_for_all_product_of_customer(customer.id)\n nb_reviews = reviews.size\n score_reviews = reviews.average(:score)\n customer.nb_reviews = nb_reviews\n customer.score_reviews = score_reviews\n customer.save\n end", "def average_credit_score\n @tenants.inject{ |sum, t| sum + t.credit_score }.to_f / @tenants.size\n end", "def average(producer)\n total = 0\n @values.each do |result|\n total += producer.call(result)\n end\n avg = total / @values.length\n return avg.to_f\n end", "def average_rent\n unit_rent = @units.each_key do |unit, value|\n unit[:monthly_rent]\n end\n (unit_rent.sum / 2).round(1)\n end", "def average_unit_price\n orders_in_last_30_days = orders.in_last_days(30)\n summed_price_of_orders(orders_in_last_30_days) / summed_units_of_orders(orders_in_last_30_days) unless orders.empty?\n end", "def avg\n array = []\n# this DO-loop will put all the star ratings into an array\n @reviews.each do |count|\n array.push(count.star.to_i)\n end\n# this line will calculate the actual average of all the star ratings\n outavg = array.inject(0.0) { |sum, el| sum + el } / array.size\n end", "def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end", "def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end", "def getAverages(account)\n\tcataAvg = []\n\t@people[account].each_value {|catagoryTotal| cataAvg.push((catagoryTotal.sum.round(2) / catagoryTotal.length).round(2))}\n\treturn cataAvg\nend", "def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end", "def average(ratings)\n ratings.inject(0.0) { |sum, el| sum + el.to_f } / ratings.size\n end", "def avg_lines_per_commit_by_week events\n cls_by_month = lines_added_per_commit(events).group_by {|date,_| week_from_date(date) }\n cls_by_month.flat_map {|_,cls| cls.map {|cl| cl[1]}.mean }\nend", "def reviews_avg\n number_with_precision(self.member_reviews.avg(:rating), precision: 1)\n end", "def test_average_invoices_per_merchant\n\n sa = SalesAnalyst.new(se)\n info = sa.se.merchants.all.map {|merchant| merchant.invoices.count}\n result = average(info)\n assert_equal sa.average_invoices_per_merchant, result\n end", "def rating_average(obj)\n if obj.reviews.count >= 1\n array = []\n obj.reviews.each do |review|\n array.push(review.rating)\n end\n return (array.inject{ |sum, el| sum + el }.to_f / array.size).to_i\n else\n if obj.class.name == \"SharespaceVenue\"\n \"No reviews yet.\"\n else\n \"No reviews yet.\"\n end\n end\n\n\n\n end", "def average_rating\n cal_average_rating(@products)\n end", "def avg_reviews\n @avg = self.reviews.average(:rating) \n @avg ? @avg : 0\nend", "def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)\n (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)\n end", "def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end", "def get_mean(collection)\n collection_length = collection.length\n total = 0\n total = collection.inject( nil ) { |sum,x| sum ? sum+x : x }\n (total.to_f / collection_length.to_f)\n end", "def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end", "def average_rating\n reviews.average(:rating)\n end", "def average_review_rating\n self.reviews.all.average(:rating)\n end", "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end", "def average_reviews \n zmienna = self.reviews.sum(\"vote\") \n zmienna2 = self.reviews.count\n if zmienna2 == 0\n wynik = 0\n else \n wynik = zmienna/zmienna2\n end \n end", "def get_avg\n recentReviewed = get_user_cards(Result.all)\n filteredDates = get_dates(recentReviewed)\n totalScore = filteredDates.reduce(0) {|curr,n| curr + n.score} \n totalScore/filteredDates.count \n end", "def avg_score\n reviews.average(:rating).round(2).to_f\n end", "def calculate_reviews_average(score)\n (self.reviews_average * self.reviews_count + score) / (self.reviews_count + 1)\n end", "def product_avg_price(array_item)\n\tproduct_tot_sales(array_item)/product_tot_purchases(array_item)\nend", "def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend", "def average_score\n if reviews.size > 0\n (reviews.sum(:rating) / reviews.size).round(1)\n else\n 0.0\n end\n end", "def average_reviews\n numerator = 0\n denominator = 0\n total = 0\n n = 0\n self.trainings.each do |training|\n unless training.average_reviews.nil?\n n += training.average_reviews[:number]\n numerator += training.average_reviews[:average_score] * training.average_reviews[:number]\n denominator += training.average_reviews[:number]\n end\n end\n if denominator != 0\n (total = numerator / denominator)\n total\n else\n \"No reviews\"\n end\n end", "def calculate_average\n return 0 unless reviews.size.positive?\n avg = self.reviews.average(:rating) #.to_f.round(2) # * 100\n update_column(:rating, avg)\n end", "def avg(prevs)\n avg = prevs.reduce(:+) / prevs.size\n avg.round(3)\nend", "def average_ratings\n ratings.average(:int_value)\n end", "def mean\n @sum / @count\n end", "def average_amount_operations\n \tif operations.any?\n \t total = operations.sum(:amount)\n \t count = operations.count\n \t total/count\n \tend\n end", "def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end", "def average_amount\n (paid_infos.values.inject(:+) / paid_infos.size).round(2)\n end", "def get_avg_rating(movie_ratings)\n sum = 0\n movie_ratings.each { |b| sum += b }\n @average_movie_rating = (sum.to_f / @movie_ratings.count.to_f).round(1)\n end", "def avg_score\n return 0 unless reviews.size.positive?\n\n reviews.average(:score).to_f.round(2)\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def get_average_price(toy)\n\treturn get_total_sales(toy) / get_total_purchases(toy)\nend", "def total_earned\n totals = []\n\n self.orders.each do |order|\n totals << order.total_price\n end \n\n return totals.inject{ |sum, n| sum + n } \n end", "def average_rating\n if reviews.count >= 1\n self.reviews.average(:rating).to_f\n else\n \"No reviews yet!\"\n end\n end", "def findAverage arr\n sum = 0\n for ocenka in arr do\n sum = sum + ocenka \n \n end\n average = sum / arr.length\n return average\nend", "def average_rating\n return 'n/a' if reviews.empty?\n #return 0 if reviews.empty?\n (reviews.pluck(:rating).sum / reviews.count.to_f).round(2)\n end", "def avg_score\n return 0 unless reviews.count.positive?\n\n reviews.average(:score).round(2).to_f\n end", "def average_price(products)\n \t\tprice_array = products.map { |product| product.price.to_f}\n \t\tavg = price_array.reduce(:+) / price_array.size.to_f\n \t\tavg.round(2)\n \tend", "def recalculate_average()\n\n #find total of all review ratings by iterating through them\n total = 0\n self.reviews.each do |review|\n total = total + review.rating\n end\n\n newAvg = total / self.reviews.size\n\n self.update_attribute(:avg_rating, newAvg)\n end", "def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end", "def mean\n sum / count.to_f\n end", "def user_average_rating(user)\n #av = promedio (avarage), counter = contador(para calcular el total de reviews realizada)\n av, counter = 0.0, 0.0\n \n Review.where(user_id: user.id).each_with_index do |review, i|\n if review.rating\n av = av + review.rating\n counter = counter + 1.0\n end\n end\n\n av / counter\n end", "def display_results()\n @customers = @customers.sort_by{ |customer,values| values[:points] }.reverse\n @customers.map { |customer,values|\n if values[:total_amount] > 0\n print(\"#{customer}: #{values[:points]} points with #{values[:average_points]} points per order. \\n\")\n else\n print(\"#{customer}: No orders.\\n\")\n end\n }\n end", "def average_rating\n ratings.inject(0.0) {|sum, num| sum +=num} / ratings.length\n end", "def avg_rating\n stars_array = []\n ratings.each do |rating|\n stars_array << rating.stars\n end\n return stars_array.inject{ |sum, el| sum + el }.to_f / stars_array.size\n end", "def average_rating\n if reviews.count > 0\n ratings = reviews.map { |review| review.rating }\n sum = ratings.reduce(:+)\n if sum > 0\n average = sum / ratings.count\n average.round(1)\n else\n return 0\n end\n else\n return 0\n end\n end", "def average()\n if(@countN > 0) then\n return @sum / @countN ;\n else\n return 0.0 ;\n end\n end", "def userAvgCalculator\n\t\t\ttotal = 0\t\t\t\t\t\t\t\t\t# Initial total prayers\n\t\t\t# Loop through each all the Day prayers\n\t\t\t@rawData.each do |day|\n\t\t\t\ttotal += 1 if day[:fajr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:zuhr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:asr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:maghrib] == 2\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:isha] == 2\t\t\t# Add one to total if prayer performed\n\t\t\tend\n\t\t\t# Calculate how many days the user was requested for a response,\n\t\t\t# and the user responded and or the email was deactivated\n\t\t\tavg = (total / @timesRequestSent.to_f).round(2) # Calculate the average\n\t\tend", "def average_credit_score\n\n #Validation\n if @apt_tenants.size <= 0\n p \"No Tenants!\"\n else\n #Isolating credit Scores\n every_credit = self.apt_tenants.map { |i| i.credit_score }\n\n #Summing total, then dividing by arr size\n average_credit = every_credit.reduce(:+) / every_credit.size\n\n #passing to class instance\n @apt_avg_c = average_credit\n end\n end", "def avg_price(products)\n # subtotal=0\n # products.map do |product|\n # subtotal = subtotal + product[:price]\n # end\n # (subtotal / products.count).round(2)\n #ou\n #subtotal = subtotal / products.count\n #subtotal.round(2)\n\n ##reduce\n subtotal = products.reduce(0) do |total, product|\n total = total + product[:price]\n end\n (subtotal / products.count).round(2)\nend", "def driver_avg_rating(driver)\n all_ratings = driver[:rides].map { |ride| ride[:rating] }\n avg_rating = all_ratings.sum.to_f / all_ratings.length.to_f\n return avg_rating\nend", "def calcTotalCustomerValue\n\t\t\n\tend", "def calculate_average_stats(stats)\n # selling price for unsold securities\n stats[:selling_unsold_price] = quote.price * stats[:unsold_amount]\n # difference between selling and buying price of unsold securities\n stats[:selling_unsold_income_price] = stats[:selling_unsold_price] - stats[:buying_unsold_price]\n # average prices\n stats[:buying_unsold_average_price] =\n stats[:unsold_amount].zero? ? 0 : (stats[:buying_unsold_price].to_f / stats[:unsold_amount]).round(4)\n stats[:exchange_profit] =\n stats[:buying_unsold_price].zero? ? 0 : ((stats[:selling_unsold_income_price] / stats[:buying_unsold_price]) * 100).round(2)\n # dividents\n stats[:dividents_amount_price] = dividents_amount_price(quote, stats[:unsold_amount])\n stats\n end", "def average_stats\n Review.find_by_sql([\"\n SELECT \n ROUND((AVG(rv.rating)::numeric),1) as total_rating,\n ROUND((AVG(rv.coffee_rating)::numeric),1) as total_coffee,\n ROUND((AVG(rv.food)::numeric),1) as total_food,\n ROUND((AVG(rv.noise_level)::numeric),1) as total_noise_level,\n ROUND((AVG(rv.work_friendly)::numeric),1) as total_work_friendly,\n COUNT(rv.rating) as total_reviews_count\n FROM reviews AS rv\n WHERE rv.coffee_shop_id = ?\n \", id]).first\n end", "def avg_score\n return 0 unless reviews.count.positive?\n reviews.average(:score).round(2).to_f\n end", "def average_rating\n\t\tall_ratings = self.reviews.map{|review| review.rating}\n\t\taverage_rating = all_ratings.reduce(0){|sum, rating| sum + rating} / all_ratings.count.to_f\n\t\t'%.1f' % average_rating \n\tend", "def mean()\n sum = 0\n @difference.each do |item|\n sum += item\n end\n @mean = sum / @difference.length\n return @mean\n end", "def average_rating(&block)\n total = 0\n countable_ratings = block ? ratings.select(&block) : ratings\n countable_ratings.each do |rating|\n total += rating.rating\n end\n average_rating = countable_ratings.empty? ? 0 : (0.0 + total) / countable_ratings.size\n # only 1 decimal.\n [(0.0 + (average_rating * 10).round) / 10, countable_ratings.size]\n end", "def average_calories\n calories = self.desserts.map {|dessert| dessert.calories}\n length = calories.length\n calories.sum.to_f / length.to_f\n end", "def find_avg(offers)\n if offers.count != 0\n temp =[]\n offers[0].each{|i|\n temp << i.price\n }\n temp.sum.to_f/temp.count\n else\n 0\n end\n\n end", "def mean()\n\t\taverage = 0.0\n\t\t@results.each do |row|\n\t\t\taverage += (row[\"rating\"].to_f - row[\"predicted\"]).abs\n\t\tend\n\n\t\treturn average/results.length\n\tend", "def average_rating(trips)\n result = trips.map do |driver, trip|\n amount = trip.map { |ride| ride[:rating]}.sum\n average_rating = (amount.to_f/trip.size).round(2)\n {:driver => driver, :avg_rating => average_rating}\n end\n return result\nend", "def average_rating\n self.ratings.reduce(0.0) { |sum, score| sum += score } / self.ratings.length\n end", "def average\n total_sum = @person_array.inject(0){ |sum, p| sum += p.awesomeness } \n size = @person_array.size \n return (total_sum / size)\n end", "def average_ratings\n movies.reduce(0) do |sum, movie|\n sum + movie.rating\n end / movies.length\n end", "def average_rating(rideshare)\n # set variables for total rating and total sum\n total_rating = {}\n sum = 0\n # loop through\n rideshare.each do |driver, trips|\n trips.each do |trip|\n # calculate total rating \n sum += trip[:rating]\n avg_rating = sum / trips.length.to_f\n total_rating[driver] = avg_rating\n end \n sum = 0\n end\n return total_rating\nend", "def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end", "def average_ask\n asks = @asks.map { |x| x.fetch(:price) }\n asks.inject(:+) / asks.count\n end", "def average_karma\n QuestionsDatabase.get_first_value(<<-SQL, self.id)\n SELECT\n CAST(COUNT(question_likes.id) AS FLOAT) / \n COUNT(DISTINCT(questions.id)) AS avg_karma\n FROM\n questions\n LEFT JOIN\n question_likes\n ON\n question_likes.question_id = questions.id\n WHERE\n questions.author_id = ?\n SQL\n end", "def get_average\n record_hash = {}\n record_hash['avg_cat1'] = course_ratings.average(:cat1) || 0\n record_hash['avg_cat2'] = course_ratings.average(:cat2) || 0\n record_hash['avg_cat3'] = course_ratings.average(:cat3) || 0\n record_hash['avg_cat4'] = course_ratings.average(:cat4) || 0\n record_hash['avg_cat5'] = course_ratings.average(:cat5) || 0\n record_hash['total_reviews'] = course_ratings.length\n return record_hash\n end", "def average_rating\n self.reviews.sum(:score) / reviews.size\n rescue ZeroDivisionError\n 0\n end", "def avg_rate_card_amount_cents\n all_rate_cards = {}\n \n # Extract all custom rate cards\n if self.client_rate_cards.present?\n self.client_rate_cards.each do |client_rate_card|\n all_rate_cards[client_rate_card.rate_card_id] = client_rate_card.daily_cost_cents\n end\n end\n \n # Add all core rate cards in if custom one doesnt exist\n cl_account = self.account\n if cl_account.rate_cards.present?\n cl_account.rate_cards.each do |rate_card|\n all_rate_cards[rate_card.id] = rate_card.daily_cost_cents unless all_rate_cards.has_key?(rate_card.id)\n end\n end\n \n # Work out avg\n if all_rate_cards.length > 0\n total = all_rate_cards.values.inject(0) {|a,b|a+b}\n (total.to_s.to_d / all_rate_cards.length).to_i\n else\n 0\n end\n end", "def avg_price_categoria\n obj = Array.new\n Category.all.each do |c|\n\n c.anuncios.average(:preco) == nil ? (val = 0) : (val = c.anuncios.average(:preco).to_f)\n \n obj.push([ c.nome, val ] )\n\n end\n\n return obj\n end", "def class_average(data)\n ind_avgs = averages(data).values\n ind_avgs.sum/ind_avgs.length\nend" ]
[ "0.7714796", "0.6421369", "0.6334133", "0.62264735", "0.5987185", "0.5926142", "0.5879872", "0.58662117", "0.58555657", "0.58237153", "0.5821276", "0.5821276", "0.5821276", "0.5821276", "0.58069533", "0.58027786", "0.5755036", "0.5729838", "0.57120043", "0.5711469", "0.57050574", "0.5696253", "0.5693125", "0.5672134", "0.56662226", "0.56579655", "0.5648156", "0.56460404", "0.5630992", "0.5628269", "0.56226426", "0.5612323", "0.5609009", "0.5595781", "0.5593076", "0.5588198", "0.55684894", "0.55679435", "0.5563344", "0.5562485", "0.55520856", "0.5535866", "0.5533017", "0.5530704", "0.55258375", "0.5525271", "0.5519294", "0.55147284", "0.5512797", "0.5512314", "0.5493861", "0.54792815", "0.5469337", "0.54674006", "0.54659796", "0.5457935", "0.5457935", "0.5453557", "0.54529434", "0.54522264", "0.5438594", "0.54360145", "0.541849", "0.5415365", "0.54012", "0.5399777", "0.5396166", "0.53895336", "0.53855515", "0.5375629", "0.5368131", "0.5365876", "0.53651553", "0.5364156", "0.53640515", "0.5354487", "0.5350394", "0.53467345", "0.53428984", "0.5333167", "0.53329957", "0.53297913", "0.5324909", "0.5322905", "0.5319394", "0.5317344", "0.5316259", "0.5313764", "0.53052455", "0.5304833", "0.5301459", "0.52962476", "0.5294984", "0.5293941", "0.5292176", "0.5288429", "0.52845055", "0.5283547", "0.5269359", "0.5261823" ]
0.8391852
0
Average Order Items Per Customer
def get_average_order_items_per_customer(customer_type=nil) (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_orders_per_customer(customer_type=nil)\n (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil)\n if get_orders_count(order_type, start_date, end_date) > 0\n (get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0)\n else\n 0\n end\n end", "def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end", "def average_items_per_merchant\n groups = merchant_stores\n vals = merchant_store_item_counts(groups)\n mean = average(vals)\n return mean.round(2)\n end", "def product_avg_price(array_item)\n\tproduct_tot_sales(array_item)/product_tot_purchases(array_item)\nend", "def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)\n (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)\n end", "def total_earned\n totals = []\n\n self.orders.each do |order|\n totals << order.total_price\n end \n\n return totals.inject{ |sum, n| sum + n } \n end", "def average_price\n sum = menu_items.sum {|item| item.price}.to_f\n avg = sum/menu_items.count\n avg.round(2)\n end", "def index\n # uses the customer_orders scope to retrieve all the orders that the current customer has made\n @orders = Order.customer_orders(current_customer)\n # uses the customer_average_order_cost scope to calculate the average cost of all the orders that the\n # current customer has made\n @average_cost_of_orders = Order.customer_average_order_cost(current_customer)\n end", "def average_rating\n sum = self.queue_items.map {|item| item.rating}.reduce(:+)\n length = self.queue_items.length\n sum / length\n end", "def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end", "def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end", "def average_price\n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end", "def test_average_invoices_per_merchant\n\n sa = SalesAnalyst.new(se)\n info = sa.se.merchants.all.map {|merchant| merchant.invoices.count}\n result = average(info)\n assert_equal sa.average_invoices_per_merchant, result\n end", "def avg\n array = []\n# this DO-loop will put all the star ratings into an array\n @reviews.each do |count|\n array.push(count.star.to_i)\n end\n# this line will calculate the actual average of all the star ratings\n outavg = array.inject(0.0) { |sum, el| sum + el } / array.size\n end", "def average_amount\n (paid_infos.values.inject(:+) / paid_infos.size).round(2)\n end", "def avg_price(products)\n # subtotal=0\n # products.map do |product|\n # subtotal = subtotal + product[:price]\n # end\n # (subtotal / products.count).round(2)\n #ou\n #subtotal = subtotal / products.count\n #subtotal.round(2)\n\n ##reduce\n subtotal = products.reduce(0) do |total, product|\n total = total + product[:price]\n end\n (subtotal / products.count).round(2)\nend", "def average_rating\n cal_average_rating(@products)\n end", "def average_price\n # CARYN SAYS: make sure you're testing! I can tell you didn't because menu_item should be pluralized\n # like the method defined above \n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def average_rent\n unit_rent = @units.each_key do |unit, value|\n unit[:monthly_rent]\n end\n (unit_rent.sum / 2).round(1)\n end", "def item_average_rating\n item_rating / count_properties_names rescue 0\n end", "def compute(order)\n rate = self.calculable\n line_items = order.line_items.select { |i| i.product.tax_category == rate.tax_category }\n line_items.inject(0) {|sum, line_item|\n sum += (line_item.price * rate.amount * line_item.quantity)\n }\n end", "def avg_reviews_with_owner(before = DateTime.new(2050,01,01))\n code_reviews(before).average(:total_reviews_with_owner)\n end", "def average_price\n item_receipts = @item.item_receipts.where(created_at: @range)\n return '0' unless item_receipts.present?\n result = item_receipts.sum(:price) / item_receipts.count\n Money.new(result * 100).to_s\n end", "def brand_avg_price(array_item)\n\tprice_total = brand_stock_list(array_item).map {| one_stock | one_stock[\"full-price\"].to_f}\n \t(price_total.inject(:+)/price_total.length).round(2)\nend", "def average_unit_price\n orders_in_last_30_days = orders.in_last_days(30)\n summed_price_of_orders(orders_in_last_30_days) / summed_units_of_orders(orders_in_last_30_days) unless orders.empty?\n end", "def get_average_price(toy)\n\treturn get_total_sales(toy) / get_total_purchases(toy)\nend", "def avg_rating\n @reviews = @product.reviews\n @avg_rating = nil\n\n if @reviews.size > 0\n @avg_rating = (@reviews.inject(0.0) { |sum, el| sum + el.rating }.to_f / @reviews.size).round(1)\n end\n end", "def get_mean(collection)\n collection_length = collection.length\n total = 0\n total = collection.inject( nil ) { |sum,x| sum ? sum+x : x }\n (total.to_f / collection_length.to_f)\n end", "def calculate_total\n order_items.sum(:total)\n end", "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def average_credit_score\n @tenants.inject{ |sum, t| sum + t.credit_score }.to_f / @tenants.size\n end", "def product_avg_discount(array_item)\n\tproduct_full_price(array_item).to_f-product_avg_price(array_item)\nend", "def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)\n orders_count = get_orders_count(order_type, start_date, end_date)\n return (get_revenue(order_type, start_date, end_date)/orders_count).round(2)\n end", "def average(ratings)\n ratings.inject(0.0) { |sum, el| sum + el.to_f } / ratings.size\n end", "def average_ask\n asks = @asks.map { |x| x.fetch(:price) }\n asks.inject(:+) / asks.count\n end", "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end", "def average(producer)\n total = 0\n @values.each do |result|\n total += producer.call(result)\n end\n avg = total / @values.length\n return avg.to_f\n end", "def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end", "def average_price(micro)\n sum = 0\n i = 0\n micro.products.each do |item|\n sum += item.price\n i += 1\n end\n @aver_price = sum / micro.products.length\n end", "def total_weight(order)\n weight = 0\n order.line_items.each do |line_item|\n line_item.variant.weight ? weight += (line_item.quantity * line_item.variant.weight) : 0\n end\n weight\n end", "def average_price(products)\n \t\tprice_array = products.map { |product| product.price.to_f}\n \t\tavg = price_array.reduce(:+) / price_array.size.to_f\n \t\tavg.round(2)\n \tend", "def average_price_brand item\n\t$brand_price = 0.0\n\t$same_brand.each {|toy| $brand_price += toy[\"full-price\"].to_f}\n\t$average_price = 0.0\n\t$same_brand.each {|toy| $average_price = ($brand_price / $same_brand.length)}\nend", "def product_avg_discount_per(array_item)\n\t(product_avg_discount(array_item)/product_full_price(array_item).to_f * 100).round(2)\n\t#avg_price_dis/retail_pr.to_f * 100).round(2)}%\"\n\nend", "def order_total\n order.items.sum(:price)\n end", "def getAverages(account)\n\tcataAvg = []\n\t@people[account].each_value {|catagoryTotal| cataAvg.push((catagoryTotal.sum.round(2) / catagoryTotal.length).round(2))}\n\treturn cataAvg\nend", "def find_avg(offers)\n if offers.count != 0\n temp =[]\n offers[0].each{|i|\n temp << i.price\n }\n temp.sum.to_f/temp.count\n else\n 0\n end\n\n end", "def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend", "def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end", "def average_rating(trips)\n result = trips.map do |driver, trip|\n amount = trip.map { |ride| ride[:rating]}.sum\n average_rating = (amount.to_f/trip.size).round(2)\n {:driver => driver, :avg_rating => average_rating}\n end\n return result\nend", "def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end", "def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end", "def update_for_customer\n reviews = Review.find_for_all_product_of_customer(customer.id)\n nb_reviews = reviews.size\n score_reviews = reviews.average(:score)\n customer.nb_reviews = nb_reviews\n customer.score_reviews = score_reviews\n customer.save\n end", "def avg\n only_with('avg', 'DateTime', 'Numeric')\n itms = items.compact\n size = itms.size.to_d\n if type == 'DateTime'\n avg_jd = itms.map(&:jd).sum / size\n DateTime.jd(avg_jd)\n else\n itms.sum / size\n end\n end", "def average_rating(rideshare)\n # set variables for total rating and total sum\n total_rating = {}\n sum = 0\n # loop through\n rideshare.each do |driver, trips|\n trips.each do |trip|\n # calculate total rating \n sum += trip[:rating]\n avg_rating = sum / trips.length.to_f\n total_rating[driver] = avg_rating\n end \n sum = 0\n end\n return total_rating\nend", "def average_price toy\n\t$average_price = $total_amount / toy[\"purchases\"].length\nend", "def average_rating\r\n comments.average(:rating).to_f\r\n end", "def total\n \torder_items.collect { |order_item| order_item.subtotal }.sum\n end", "def total_price\r\n total = 0\r\n\r\n #Adds the prices of the orders up\r\n order_items.each do |order_item|\r\n total += order_item.item.price*order_item.quantity\r\n end\r\n\r\n #Applies any discounts\r\n if(campaign)\r\n discount = campaign.campaign_type.percentage_reduced\r\n if discount != 100\r\n total -= (total * discount / 100)\r\n elsif discount == 100\r\n i = []\r\n order_items.each do |order_item|\r\n i.push(order_item.item.price)\r\n end\r\n total -= i.min\r\n end\r\n end\r\n return total\r\n end", "def user_average_rating(user)\n #av = promedio (avarage), counter = contador(para calcular el total de reviews realizada)\n av, counter = 0.0, 0.0\n \n Review.where(user_id: user.id).each_with_index do |review, i|\n if review.rating\n av = av + review.rating\n counter = counter + 1.0\n end\n end\n\n av / counter\n end", "def total_weight\n order_items.collect { |oi| oi.weight }.inject { |sum, x| sum + x } || 0\n end", "def average_ratings\n ratings.average(:int_value)\n end", "def average_amount_operations\n \tif operations.any?\n \t total = operations.sum(:amount)\n \t count = operations.count\n \t total/count\n \tend\n end", "def average_rating(&block)\n total = 0\n countable_ratings = block ? ratings.select(&block) : ratings\n countable_ratings.each do |rating|\n total += rating.rating\n end\n average_rating = countable_ratings.empty? ? 0 : (0.0 + total) / countable_ratings.size\n # only 1 decimal.\n [(0.0 + (average_rating * 10).round) / 10, countable_ratings.size]\n end", "def avg(prevs)\n avg = prevs.reduce(:+) / prevs.size\n avg.round(3)\nend", "def average_rating\n comments.average(:rating).to_f\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def average_rating\n comments.average(:rating).to_f\n end", "def average_calories\n calories = self.desserts.map {|dessert| dessert.calories}\n length = calories.length\n calories.sum.to_f / length.to_f\n end", "def rating_average(obj)\n if obj.reviews.count >= 1\n array = []\n obj.reviews.each do |review|\n array.push(review.rating)\n end\n return (array.inject{ |sum, el| sum + el }.to_f / array.size).to_i\n else\n if obj.class.name == \"SharespaceVenue\"\n \"No reviews yet.\"\n else\n \"No reviews yet.\"\n end\n end\n\n\n\n end", "def average_rent(units = @units)\n average_rent = 0\n units.each do |unit|\n average_rent += unit.monthly_rent.to_f\n end\n average_rent / units.length.to_f\n end", "def average_rating\n reviews.average(:rating)\n end", "def userAvgCalculator\n\t\t\ttotal = 0\t\t\t\t\t\t\t\t\t# Initial total prayers\n\t\t\t# Loop through each all the Day prayers\n\t\t\t@rawData.each do |day|\n\t\t\t\ttotal += 1 if day[:fajr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:zuhr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:asr] == 2\t\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:maghrib] == 2\t\t# Add one to total if prayer performed\n\t\t\t\ttotal += 1 if day[:isha] == 2\t\t\t# Add one to total if prayer performed\n\t\t\tend\n\t\t\t# Calculate how many days the user was requested for a response,\n\t\t\t# and the user responded and or the email was deactivated\n\t\t\tavg = (total / @timesRequestSent.to_f).round(2) # Calculate the average\n\t\tend", "def average_rating\n ratings.inject(0.0) {|sum, num| sum +=num} / ratings.length\n end", "def total_cost\n order_items.map { |order_item| order_item.subtotal }.sum.round(2)\n end", "def calculate_average_rating\n weighted_drinks_ratings.sum.to_f / weighted_drinks_ratings.count\n end", "def calculate_points(item)\n if @customers.include?(item[\"customer\"])\n time_of_order = DateTime.parse(item[\"timestamp\"])\n customer = @customers[item[\"customer\"]]\n customer[:total_amount]= customer[:total_amount] + item[\"amount\"]\n\n # Reward points calculation based on the schedule\n if (time_of_order.hour >= 12 && time_of_order.hour < 13)\n temp_points = (item[\"amount\"]/3).ceil\n elsif (time_of_order.hour >= 11 && time_of_order.hour < 12) || (time_of_order.hour >= 13 && time_of_order.hour < 14)\n temp_points = (item[\"amount\"]/2).ceil\n elsif (time_of_order.hour >= 10 && time_of_order.hour < 11) || (time_of_order.hour >= 14 && time_of_order.hour < 15)\n temp_points = (item[\"amount\"]).ceil\n else\n temp_points = (item[\"amount\"]*0.25).ceil\n end\n if (temp_points >= 3 && temp_points < 21)\n customer[:orders] = customer[:orders] + 1\n customer[:points] = customer[:points] + temp_points\n end\n \n customer[:average_points] = (customer[:points]/customer[:orders])\n else\n add_customer(item)\n end\n end", "def total\n total = order_items.inject(0) { |sum, p| sum + p.subtotal }\n end", "def driver_avg_rating(driver)\n all_ratings = driver[:rides].map { |ride| ride[:rating] }\n avg_rating = all_ratings.sum.to_f / all_ratings.length.to_f\n return avg_rating\nend", "def avg_rating\n stars_array = []\n ratings.each do |rating|\n stars_array << rating.stars\n end\n return stars_array.inject{ |sum, el| sum + el }.to_f / stars_array.size\n end", "def get_avg\n recentReviewed = get_user_cards(Result.all)\n filteredDates = get_dates(recentReviewed)\n totalScore = filteredDates.reduce(0) {|curr,n| curr + n.score} \n totalScore/filteredDates.count \n end", "def average_variance\n return '0' unless item_receipts_with_variance.present?\n result = item_receipts_with_variance.map{ |ir| (ir.price - ir.item_order.price).abs }.reduce(&:+) / item_receipts_with_variance.count\n Money.new(result * 100).to_s\n end", "def average\n total_sum = @person_array.inject(0){ |sum, p| sum += p.awesomeness } \n size = @person_array.size \n return (total_sum / size)\n end", "def average_review_rating\n self.reviews.all.average(:rating)\n end", "def average_credit_score\n\n #Validation\n if @apt_tenants.size <= 0\n p \"No Tenants!\"\n else\n #Isolating credit Scores\n every_credit = self.apt_tenants.map { |i| i.credit_score }\n\n #Summing total, then dividing by arr size\n average_credit = every_credit.reduce(:+) / every_credit.size\n\n #passing to class instance\n @apt_avg_c = average_credit\n end\n end", "def total_weight\n order_items.inject(BigDecimal(0)) { |t,i| t + i.total_weight}\n end", "def product_tot_sales(array_item)\n\tprice_only = array_item[\"purchases\"].map {| my_price | my_price[\"price\"]}\n \tprice_only.inject(:+)\nend", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def avg_reviews\n @avg = self.reviews.average(:rating) \n @avg ? @avg : 0\nend", "def average_rating\n self.ratings.reduce(0.0) { |sum, score| sum += score } / self.ratings.length\n end", "def average_score\n if reviews.size > 0\n (reviews.sum(:rating) / reviews.size).round(1)\n else\n 0.0\n end\n end", "def reviews_avg\n number_with_precision(self.member_reviews.avg(:rating), precision: 1)\n end", "def calculate_average\n return 0 unless reviews.size.positive?\n avg = self.reviews.average(:rating) #.to_f.round(2) # * 100\n update_column(:rating, avg)\n end", "def average_ratings\n movies.reduce(0) do |sum, movie|\n sum + movie.rating\n end / movies.length\n end", "def avg_rating u\n \tuser_ratings = @userdata[u.to_s.to_sym]\n \tavg = 0\n \tuser_ratings.each do |id, rating|\n \t\tavg += rating\n \tend\n \tavg = avg / user_ratings.size.to_f\n \treturn avg\n end", "def mean()\n diff = @list.collect {|item| item[:prediction] - item[:rating]}\n sum(diff) / diff.length\n end", "def findAverage arr\n sum = 0\n for ocenka in arr do\n sum = sum + ocenka \n \n end\n average = sum / arr.length\n return average\nend" ]
[ "0.7987969", "0.7031677", "0.69518197", "0.69072133", "0.64569676", "0.6449781", "0.6093867", "0.60916364", "0.60746455", "0.60615057", "0.60306484", "0.6023318", "0.60215765", "0.6014028", "0.6007907", "0.5994727", "0.59940296", "0.597378", "0.59695953", "0.5968002", "0.5966755", "0.596235", "0.59570014", "0.59317553", "0.5929764", "0.59285825", "0.5919834", "0.5901342", "0.5871159", "0.5868253", "0.58669597", "0.5849872", "0.5844439", "0.58434016", "0.5832605", "0.5828497", "0.5818747", "0.5817573", "0.5816129", "0.58151376", "0.5785228", "0.5779265", "0.57787764", "0.57769185", "0.577132", "0.5770894", "0.5763134", "0.57619846", "0.57562464", "0.5755688", "0.57530314", "0.5748162", "0.5737333", "0.5733609", "0.57135004", "0.57033217", "0.5698465", "0.5697216", "0.56964594", "0.56837624", "0.5683234", "0.56816864", "0.56811374", "0.5668114", "0.56625104", "0.5660201", "0.5651051", "0.5651051", "0.5651051", "0.5651051", "0.56486917", "0.5646821", "0.5635778", "0.56351143", "0.56324136", "0.5631026", "0.56308377", "0.5627961", "0.5619376", "0.5614716", "0.5613771", "0.5612709", "0.561118", "0.56046164", "0.5599581", "0.5594957", "0.55949175", "0.55924153", "0.55836207", "0.558267", "0.558267", "0.5580524", "0.5580059", "0.55798304", "0.5575241", "0.5565041", "0.5564049", "0.55605483", "0.5557905", "0.55499256" ]
0.8338892
0
Average Items Per Order
def get_average_items_per_order(order_type=nil, start_date=nil, end_date=nil) if get_orders_count(order_type, start_date, end_date) > 0 (get_items_sold_count(order_type, start_date, end_date)/get_orders_count(order_type, start_date, end_date)).round(0) else 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_total_price\n summed_price_of_orders(orders) / orders.size unless orders.empty?\n end", "def get_average_order_items_per_customer(customer_type=nil)\n (get_items_sold_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def average_price\n sum = menu_items.sum {|item| item.price}.to_f\n avg = sum/menu_items.count\n avg.round(2)\n end", "def average_items_per_merchant\n groups = merchant_stores\n vals = merchant_store_item_counts(groups)\n mean = average(vals)\n return mean.round(2)\n end", "def average_price\n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def get_average_revenue_per_order_item(order_type=nil, start_date=nil, end_date=nil)\n (get_revenue(order_type, start_date, end_date)/get_items_sold_count(order_type, start_date, end_date)).round(2)\n end", "def average_rating\n sum = self.queue_items.map {|item| item.rating}.reduce(:+)\n length = self.queue_items.length\n sum / length\n end", "def average_price\n # CARYN SAYS: make sure you're testing! I can tell you didn't because menu_item should be pluralized\n # like the method defined above \n self.menu_item.reduce(0){ |sum, price| sum + (menu_item.price/self.menu_item.count) }\n end", "def brand_avg_price(array_item)\n\tprice_total = brand_stock_list(array_item).map {| one_stock | one_stock[\"full-price\"].to_f}\n \t(price_total.inject(:+)/price_total.length).round(2)\nend", "def product_avg_price(array_item)\n\tproduct_tot_sales(array_item)/product_tot_purchases(array_item)\nend", "def average_price_brand item\n\t$brand_price = 0.0\n\t$same_brand.each {|toy| $brand_price += toy[\"full-price\"].to_f}\n\t$average_price = 0.0\n\t$same_brand.each {|toy| $average_price = ($brand_price / $same_brand.length)}\nend", "def item_average_rating\n item_rating / count_properties_names rescue 0\n end", "def average_price\n item_receipts = @item.item_receipts.where(created_at: @range)\n return '0' unless item_receipts.present?\n result = item_receipts.sum(:price) / item_receipts.count\n Money.new(result * 100).to_s\n end", "def average_ask\n asks = @asks.map { |x| x.fetch(:price) }\n asks.inject(:+) / asks.count\n end", "def find_avg(offers)\n if offers.count != 0\n temp =[]\n offers[0].each{|i|\n temp << i.price\n }\n temp.sum.to_f/temp.count\n else\n 0\n end\n\n end", "def total_earned\n totals = []\n\n self.orders.each do |order|\n totals << order.total_price\n end \n\n return totals.inject{ |sum, n| sum + n } \n end", "def avg\n only_with('avg', 'DateTime', 'Numeric')\n itms = items.compact\n size = itms.size.to_d\n if type == 'DateTime'\n avg_jd = itms.map(&:jd).sum / size\n DateTime.jd(avg_jd)\n else\n itms.sum / size\n end\n end", "def avg_price(products)\n # subtotal=0\n # products.map do |product|\n # subtotal = subtotal + product[:price]\n # end\n # (subtotal / products.count).round(2)\n #ou\n #subtotal = subtotal / products.count\n #subtotal.round(2)\n\n ##reduce\n subtotal = products.reduce(0) do |total, product|\n total = total + product[:price]\n end\n (subtotal / products.count).round(2)\nend", "def average_price(micro)\n sum = 0\n i = 0\n micro.products.each do |item|\n sum += item.price\n i += 1\n end\n @aver_price = sum / micro.products.length\n end", "def avg\n array = []\n# this DO-loop will put all the star ratings into an array\n @reviews.each do |count|\n array.push(count.star.to_i)\n end\n# this line will calculate the actual average of all the star ratings\n outavg = array.inject(0.0) { |sum, el| sum + el } / array.size\n end", "def product_avg_discount(array_item)\n\tproduct_full_price(array_item).to_f-product_avg_price(array_item)\nend", "def average_unit_price\n orders_in_last_30_days = orders.in_last_days(30)\n summed_price_of_orders(orders_in_last_30_days) / summed_units_of_orders(orders_in_last_30_days) unless orders.empty?\n end", "def order_total\n order.items.sum(:price)\n end", "def total_weight(order)\n weight = 0\n order.line_items.each do |line_item|\n line_item.variant.weight ? weight += (line_item.quantity * line_item.variant.weight) : 0\n end\n weight\n end", "def average_variance\n return '0' unless item_receipts_with_variance.present?\n result = item_receipts_with_variance.map{ |ir| (ir.price - ir.item_order.price).abs }.reduce(&:+) / item_receipts_with_variance.count\n Money.new(result * 100).to_s\n end", "def average_bid\n bids = @bids.map { |x| x.fetch(:price) }\n bids.inject(:+) / bids.count\n end", "def total_weight\n order_items.collect { |oi| oi.weight }.inject { |sum, x| sum + x } || 0\n end", "def avg(list)\n total = 0\n\n list.each do |n|\n total += n\n end\n return total / list.size.to_f\nend", "def product_avg_discount_per(array_item)\n\t(product_avg_discount(array_item)/product_full_price(array_item).to_f * 100).round(2)\n\t#avg_price_dis/retail_pr.to_f * 100).round(2)}%\"\n\nend", "def avg(list)\n total = 0\n list.each do |n|\n total += n\n end\n return total / list.size.to_f\nend", "def average_price()\n sum = 0.0\n n = 0\n listings.each do |listing|\n sum += listing.price\n n += 1\n end\n return(sum/n) if n != 0\n n.to_f\n end", "def average_amount\n (paid_infos.values.inject(:+) / paid_infos.size).round(2)\n end", "def calculate_total\n order_items.sum(:total)\n end", "def mean(ary)\n\tsum=0.0\n\tary.each {|item| sum+=item}\n\tsum/ary.count\nend", "def avg(prevs)\n avg = prevs.reduce(:+) / prevs.size\n avg.round(3)\nend", "def average_price(products)\n \t\tprice_array = products.map { |product| product.price.to_f}\n \t\tavg = price_array.reduce(:+) / price_array.size.to_f\n \t\tavg.round(2)\n \tend", "def average_rating\n cal_average_rating(@products)\n end", "def brand_average_price(brand) \n full_price_brand = 0 \n brands_items(brand).each do |toy| \n full_price_brand += toy[\"full-price\"].to_f \n end \n $report_file.puts \"Average price #{brand}: #{(full_price_brand/brands_items(brand).length).round(2)}\" \nend", "def mean()\n diff = @list.collect {|item| item[:prediction] - item[:rating]}\n sum(diff) / diff.length\n end", "def average_calories\n tot_calories = self.ingredients.sum {ingredient| ingredient.calories}\n tot_calories/self.desserts_count\n end", "def get_average_orders_per_customer(customer_type=nil)\n (get_orders_count(customer_type, nil, nil)/get_customers_count(customer_type, nil, nil)).round(0)\n end", "def item_count\n order_items.map(&:quantity).sum\n end", "def average_amount_operations\n \tif operations.any?\n \t total = operations.sum(:amount)\n \t count = operations.count\n \t total/count\n \tend\n end", "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end", "def total\n \torder_items.collect { |order_item| order_item.subtotal }.sum\n end", "def compute(order)\n rate = self.calculable\n line_items = order.line_items.select { |i| i.product.tax_category == rate.tax_category }\n line_items.inject(0) {|sum, line_item|\n sum += (line_item.price * rate.amount * line_item.quantity)\n }\n end", "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end", "def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end", "def average(ratings)\n ratings.inject(0.0) { |sum, el| sum + el.to_f } / ratings.size\n end", "def total_items\n order_items.inject(0) { |t, i| t + i.quantity }\n end", "def total_items\n order_items.inject(0) { |t, i| t + i.quantity }\n end", "def total_items\n order_items.inject(0) { |t,i| t + i.quantity }\n end", "def grade_average\n @grades.inject(:+) / @grades.size\n end", "def average(ary)\n ary.sum / ary.length\nend", "def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end", "def total_volume(order)\n volume = 0\n order.line_items.each do |line_item|\n line_item.variant.volume ? volume += (line_item.quantity * line_item.variant.volume) : 0\n end\n volume\n end", "def average_rating\n (ratings.sum(:rating).to_f / num_ratings).round(1)\nend", "def mean(ary)\n # your implementation here\n avg = ary.reduce(0) {|item,acc| acc + item} / ary.length\n avg\nend", "def calculateAverage notes\n total_note = 0\n notes.each do |note|\n total_note += note\n end\n total_note / notes.length\nend", "def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end", "def order_profit(items)\r\n order_profit = 0\r\n for item in items\r\n order_profit += item.profit\r\n end\r\n puts \"Order Profit: $#{'%.2f' % order_profit}\"\r\n end", "def avg(sample)\n sample.inject{ |sum, trial| sum + trial }.to_f / sample.size \nend", "def total_weight\n order_items.inject(BigDecimal(0)) { |t,i| t + i.total_weight}\n end", "def average_rating(driver)\n sum = 0.0\n \n driver.each do |find_rating|\n driver_rating = find_rating[:rating]\n sum += driver_rating\n end\n\n average = sum / driver.length\n\n return average\nend", "def calculate_average_rating\n weighted_drinks_ratings.sum.to_f / weighted_drinks_ratings.count\n end", "def avg(heading)\n sum(heading)/rows.size.to_f\n end", "def average_rating\n total = 0\n self.reviews.each do |review|\n total += review.rating\n end\n average = total.to_f / self.reviews.count\n end", "def average arr\n sum = 0\n arr.each {|i| sum += i}\n average = sum/(arr.size) \nend", "def average_rating\n ratings.inject(0.0) {|sum, num| sum +=num} / ratings.length\n end", "def recalculate!\n attributes = { price: 0, item_count: 0 }\n self.order_items(true).map do |order_item|\n attributes[:price] += order_item.price * order_item.quantity\n attributes[:item_count] += order_item.quantity\n end\n update attributes\n end", "def findAverage arr\n sum = 0\n for ocenka in arr do\n sum = sum + ocenka \n \n end\n average = sum / arr.length\n return average\nend", "def total\n total = order_items.inject(0) { |sum, p| sum + p.subtotal }\n end", "def avg_rating\n stars_array = []\n ratings.each do |rating|\n stars_array << rating.stars\n end\n return stars_array.inject{ |sum, el| sum + el }.to_f / stars_array.size\n end", "def average(array)\n total = 0\n array.each do |number|\n total = total + number\n end\n total / array.size\nend", "def get_rating_averages\n set = GumRatingRelationship.where(:gum_id => self.id)\n return([set.average(:rank_1), set.average(:rank_2), set.average(:rank_3), set.average(:rank_4), set.average(:rank_5) ])\n end", "def average(grade_list)\n sum = 0\n grade_list.each do |grade|\n sum += grade\n end\n\n sum / grade_list.size.to_f\nend", "def average(grade_list)\n sum = 0\n grade_list.each do |grade|\n sum += grade\n end\n\n sum / grade_list.size.to_f\nend", "def average(array)\n result = array.inject(:+)\n result / array.count\nend", "def average_rating(trips)\n result = trips.map do |driver, trip|\n amount = trip.map { |ride| ride[:rating]}.sum\n average_rating = (amount.to_f/trip.size).round(2)\n {:driver => driver, :avg_rating => average_rating}\n end\n return result\nend", "def total_score\n rank_items.to_a.sum { |item| item.rank_score * item.weight }\n end", "def average_rating\n average = 0\n count = 0 \n self.trips.each do |trip|\n average += trip.rating.to_i\n count += 1\n end\n return average / count\n end", "def get_mean(collection)\n collection_length = collection.length\n total = 0\n total = collection.inject( nil ) { |sum,x| sum ? sum+x : x }\n (total.to_f / collection_length.to_f)\n end", "def total\n total = 0.00\n #accesses the subtotal of each of the order items\n order_items.each do |item|\n total += item.subtotal\n end\n return total.round(2)\n end", "def calculate_average(values)\n count = values.count\n total = values.map(&:first).inject(:+)\n average = (total).fdiv(count)\n (\"%.3f\" % average).to_f\n end", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def get_average_revenue_per_order(order_type=nil, start_date=nil, end_date=nil)\n orders_count = get_orders_count(order_type, start_date, end_date)\n return (get_revenue(order_type, start_date, end_date)/orders_count).round(2)\n end", "def golden_items # items with prices above 2 std of average price\n prices = FinderClass.make_array(@items.all, :unit_price)\n above = find_exceptional(@items.all, prices, 2, :unit_price)\n end", "def get_average_price_brand(brands_hash)\n\ttotal_price_brand = 0\n average_price_brand = 0\n brands_hash.each do |item|\n \ttotal_price_brand += item['full-price'].to_f\n \taverage_price_brand = (total_price_brand / brands_hash.length).round(2)\n end\n return average_price_brand\nend", "def total\n sum = 0\n order_items.each do |order_item|\n if order_item.item.price.present? && order_item.quantity.present?\n sum += order_item.item.price * order_item.quantity\n end\n end\n return sum\n end", "def average\n value = frequency.inject(:+) \n\n value / frequency.length.to_f\n end", "def average(get_grades)\n get_grades.inject(:+) / get_grades.length\nend", "def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend", "def average_rating\n\n all_ratings = self.reviews.to_a.map do |review|\n review.rating\n end\n\n return 0 unless all_ratings.length > 0\n\n all_ratings.sum / all_ratings.length\n end", "def average(producer)\n total = 0\n @values.each do |result|\n total += producer.call(result)\n end\n avg = total / @values.length\n return avg.to_f\n end", "def average(arr)\n arr.sum / arr.size\nend", "def class_average(data)\n ind_avgs = averages(data).values\n ind_avgs.sum/ind_avgs.length\nend", "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def average(ary)\n ary.inject(&:+) / ary.size\nend", "def average_rent\n @units.sum(&:monthly_rent) / 2.0\n end" ]
[ "0.74473006", "0.71956444", "0.70686513", "0.691084", "0.6897596", "0.6855064", "0.6811624", "0.6795871", "0.6785261", "0.6724578", "0.65883505", "0.6569625", "0.64554936", "0.6412604", "0.6408691", "0.63903147", "0.6371128", "0.63479805", "0.63293904", "0.6308164", "0.6300507", "0.62747353", "0.6265927", "0.6264821", "0.6263602", "0.6252859", "0.6225275", "0.6219348", "0.6208802", "0.62002534", "0.61989033", "0.6193965", "0.6193039", "0.6179601", "0.61722326", "0.6148813", "0.61356914", "0.6121951", "0.61152655", "0.6112803", "0.6103295", "0.60998076", "0.6094332", "0.6086652", "0.6076177", "0.6074768", "0.6073171", "0.60720944", "0.60565853", "0.6050647", "0.6050647", "0.60476756", "0.6035548", "0.60347754", "0.6033311", "0.6032593", "0.60309607", "0.6018817", "0.60118955", "0.6002993", "0.5998668", "0.5993316", "0.598867", "0.59815824", "0.59746534", "0.59684193", "0.59626293", "0.595392", "0.59485424", "0.5945665", "0.5933859", "0.59318316", "0.5927655", "0.5927061", "0.59244764", "0.59231514", "0.59231514", "0.59147894", "0.5914531", "0.591301", "0.5909435", "0.5909291", "0.59045297", "0.58845055", "0.5874809", "0.5874809", "0.58707976", "0.5868467", "0.586817", "0.5868102", "0.5856822", "0.58563125", "0.5851473", "0.58468366", "0.5846693", "0.584563", "0.5840735", "0.5837025", "0.58357906", "0.58238226" ]
0.7611944
0
return true if tracks have only one value for 'parameter_name'
def unique?( tracks, parameter_name ) values = [] tracks.each do |track| values << track.send( parameter_name ) end return values.uniq.length == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uses_par?(parameter); @params.values.include?(parameter); end", "def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end", "def has_param(name) \n return (@params.has_key? name)\n end", "def has_param?(name)\n\n end", "def parameter?(var_name)\n @@user_supplied_parameters.has_key?(var_name)\n end", "def has_value?(value)\n each_value.include?(convert_value_to_parameters(value))\n end", "def multiparam?\n !!@multiparam\n end", "def has_param?(name)\n @input.has_key?(name)\n end", "def single_param(param_name, description=\"\")\n @used_params << param_name\n values = @params.fetch(param_name, [])\n if values.size > 1\n @errors << %{Too many values (#{values.size}) for parameter \"#{param_name}\"#{description} (must occur at most once)}\n end\n values.first\n end", "def data_exist?(parameter)\n !parameter.nil? && !parameter.empty?\n end", "def has?(param)\n \tparam and param.length > 0\n end", "def parameter(key)\n values = @tree.data\n .select { |e| e[:key] == key }\n .map { |e| e[:value] }\n\n return false if values.empty?\n return values if values.size > 1\n return true if values.first == true\n\n values.first\n end", "def uniquely_identified_by_any_peptides?\n unique_spectra > 0\n end", "def full_params_include?(value)\n params = request_params\n return false if params.nil?\n each_key_value_for_hash(params) do |param|\n return true if param == value\n end\n false\n end", "def single_param(param_name, description = \"\")\n @used_params << param_name\n values = @params.fetch(param_name, [])\n if values.size > 1\n @errors << %{Too many values (#{values.size}) for parameter \"#{param_name}\"#{description} (must occur at most once)}\n end\n values.first\n end", "def exists?(param_name)\n return !@params[param_name].nil?\n end", "def user_wants_distinct_results?\n params[:distinct].to_i == 1\n end", "def has_value?(p0) end", "def includes? track\n\t\t@tracks.include? track\n\tend", "def has_param?(key)\n @params.internal_parameters.has_key?(key)\n end", "def profile_complete?\n\t\tparameters_with_values = generate_array_of_param_with_value\n\n\t\tparameters_with_values.each do |p|\n\t\t\treturn false if !p\n\t\tend\n\n\t\treturn true\n\tend", "def no_parameters?\n @parameters.nil? or @parameters.empty?\n end", "def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end", "def param?(item)\n return item.eql?(item.match(/[|a-z0-9-]+/m).to_s) ? true : false\n end", "def parameter_changed?(*params)\n options = params.last.is_a?(Hash) ? params.pop : {}\n last = flow.instance_variable_get(:@_last_parameters_)\n if last\n params.any? { |p| options[p] != last[p] }\n else\n false\n end\n end", "def facet_in_params?(field, value)\n params[:f] and params[:f][field] and params[:f][field].include?(value)\n end", "def is_track_value\n return ( 'tracks' == @top_level_key ) && [\n '/plist/dict/dict/dict/integer',\n '/plist/dict/dict/dict/string',\n '/plist/dict/dict/dict/true',\n '/plist/dict/dict/dict/false',\n '/plist/dict/dict/dict/date'\n ].any? { |bc|\n @breadcrumb === bc\n }\n end", "def parameters_are?(parameters)\n @parameters.to_s == parameters\n end", "def exists?(param_name)\n return !@h[param_name].nil?\n end", "def has_valid?(params)\n params.none?{|key,value| value.empty?}\n end", "def params_valid(param,value)\n unless param.nil?\n if value == param\n return true\n else\n return false\n end \n else\n return false\n end\n end", "def param_posted?(symbol)\n request.post? and (not params[symbol].blank?)\n end", "def hasVar?( name )\n\t\t\t\tArgTest::type( \"name\", name, String )\n\t\t\t\tname.strip!()\n\t\t\t\tArgTest::stringLength( \"name\", name, 1 )\n\t\t\t\treturn @vars.has_key?( name )\n\t\t\tend", "def has_known_value?\n all?(&:has_known_value?)\n end", "def check_and_write_parameter(param)\n\n # read value from device and database\n read_parameter_from_device(param['id'])\n param['value_db'] = @bot_dbaccess.read_parameter_with_default(param['name'], 0)\n\n differences_found = false\n\n # if the parameter value between device and database is different, write value to device\n if param['value_db'] != param ['value_ar']\n differences_found = true\n write_parameter_to_device(param['id'],param['value_db'])\n end\n\n return differences_found\n\n end", "def check_and_write_parameter(param)\n\n # read value from device and database\n read_parameter_from_device(param['id'])\n param['value_db'] = @bot_dbaccess.read_parameter_with_default(param['name'], 0)\n\n differences_found = false\n\n # if the parameter value between device and database is different, write value to device\n if param['value_db'] != param ['value_ar']\n differences_found = true\n write_parameter_to_device(param['id'],param['value_db'])\n end\n\n return differences_found\n\n end", "def param_present?(obj)\n @config_params.value?(obj)\n end", "def blank_date_parameter?\n (1..3).any? { |position| values[position].blank? }\n end", "def has_value?\n false\n end", "def has_value?\n true\n end", "def value?\n @count > 0\n end", "def select_param?(param_name, value)\n puts session[param_name]\n session[param_name] and session[param_name].include? value ? ' SELECTED ' : ''\n end", "def has_value?(value); end", "def one_subfield?(**args)\n self.subfield_search(args).count == 1\n end", "def params_include?(value)\n params = request_params\n return false if params.nil?\n each_value_for_hash(params) do |param|\n return true if param == value\n end\n false\n end", "def validate_parameters(sent_parameters)\n valid_parameters = nil\n if sent_parameters.is_a?(JamendoParameters)\n valid_parameters = sent_parameters.to_hash\n elsif sent_parameters.is_a?(Hash)\n valid_parameters = format_parameters(sent_parameters)\n elsif sent_parameters.is_a?(String)\n valid_parameters = Hash.new\n valid_parameters = { artist: sent_parameters }\n else\n raise JamendoError(\"Imposible to handle parameter you provided.\")\n end\n return valid_parameters\n #sent_parameters.select! { | param, value | valid_parameters.include?(param) }\n end", "def param_column?\n column_names.include?(param_column)\n end", "def param_column?\n column_names.include?(param_column)\n end", "def valid_param?(key, value = nil)\n params = value ? WRITE_PARAMS : READ_PARAMS.merge(WRITE_PARAMS)\n\n return false unless params.has_key?(key.to_sym)\n\n if value\n return false if value.is_a?(String) && value.empty?\n return false if params[key.to_sym].is_a?(Array) && !params[key.to_sym].include?(value)\n return false if params[key.to_sym].is_a?(Regexp) && value !~ params[key.to_sym]\n end\n\n return true\n end", "def several?\n several = (count > 1) if several.nil?\n end", "def describes_parameter?(name)\n return false if name.nil?\n describe_parameter_regexps(name).any? do |pattern|\n @text.index(pattern)\n end\n end", "def single_data_value?\n RECORD_INFO[type].single_data_value?\n end", "def mentions_parameter?(name)\n return false if name.nil?\n mention_parameter_regexps(name).any? do |pattern|\n @text.index(pattern)\n end\n end", "def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n end", "def has_field?(field_name)\n @data.has_key?(AudioMetadata.field_name_for(field_name))\n end", "def video_is_unique\n if self.new_record? && self.external_id.present? && Video.where(:external_id => self.external_id, :type => self.class.to_s).count > 0\n self.errors.add(:external_id, 'is not unique')\n false\n else\n true\n end\n end", "def empty_param?(x)\n return true if params[x].nil?\n if params[x].is_a?(String)\n params[x].strip.empty?\n else\n params[x].empty?\n end\n end", "def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end", "def rebus_value?(v)\n v && v.size > 1\n end", "def unique?\r\n @opts[:unique]\r\n end", "def invalid_params?\n @invalid_params.keys.length == 0\n end", "def has_key?(key)\n params.keys.include?(key)\n end", "def validate_parameter(*param)\n param.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end", "def check_params\n self.exit_with_error unless @current_track\n self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty?\n self.exit_with_error if @current_track[:song].nil? or @current_track[:song].empty?\n end", "def included?(fields)\n (fields.values.first == 1 && fields[name.to_s] == 1) ||\n (fields.values.first == 0 && !fields.has_key?(name.to_s))\n end", "def propertydefined?(name)\n name = name.intern unless name.is_a? Symbol\n @parameters.include?(name)\n end", "def bracket_champion_selected?(params)\n params.keys.include?(Team.region_names_championship.first)\n end", "def params_has_key *args\n args.each do |key|\n unless params.has_key? key.to_s\n return false\n end\n end\n return true\nend", "def param_posted?(symbol)\n request and params[symbol]\n end", "def adjacent_params?\n @has_adjacent_params\n end", "def found_multiple?\n @flags.size > 1\n end", "def one_and_only_one_selection(params)\r\n params[:account_list] && params[:account_list].count == 1\r\n end", "def unique?(field)\n !multiple?(field)\n end", "def blank_param?(data)\n data.blank? || data.try(:values).try(:all?, &:blank?)\n end", "def has_value? value; value? value; end", "def has_param?(key)\n params[key] || dyn_params[key]\n end", "def exists?\n values.exists?\n end", "def name\n albums = tracks.map{|t| t.album}.compact\n albums.uniq.size == 1 and albums.first\n end", "def value? value\n include? value\n end", "def generic_results?\n filter_param_keys = [\n 'filter', 'product_group_query', 'branded', 'color1', 'color2',\n 'size', 'sex', 'price_between', 'keywords'\n ]\n \n filter_param_keys.none? {|k| params.keys.member?(k)}\n end", "def validate_parameters?\n opts = OptionParser.new\n opts.parse!(@parameters) rescue return false\n @parameters.length >= 2\n end", "def is_parm?(long_form)\n return !@parm_names[long_form].nil?\n end", "def true?(param)\n params[param] == 'on'\n end", "def single_value?\n return false\n end", "def cfn_params_chagned?\n resp = cfn.describe_stacks(stack_name: new_resource.stack_name)\n resp.stacks[0].parameters.each do |existing_param|\n new_params = new_resource.parameters\n index = new_params.index { |x| x[:parameter_key] == existing_param[:parameter_key] }\n next if index.nil?\n return true unless new_params[index][:parameter_value] == existing_param[:parameter_value]\n end\n false\n end", "def value?(value)\n values.include? value\n end", "def pvp_define?\n !pvp.blank?\n end", "def args?\n\t\treturn !self.fields.empty?\n\tend", "def can_have_quick_param?\n @definition[:allow_quick_param]\n end", "def params?\n !(params.input_filters.required_inputs.empty? && params.input_filters.optional_inputs.empty?)\n end", "def api_has_param?(key)\n @api[:optional].has_key?(key)\n end", "def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end", "def is_upload?(var)\n self[var.to_sym].is_a?(Array) && self[var.to_sym].all? { |up_hash| up_hash.is_a?(Hash) && up_hash.key?(:name) && up_hash.key?(:name) }\n end", "def has_videos?\n videos[:list][I18n.locale.to_sym].length > 0 || videos[:mpg][I18n.locale.to_sym].length > 0\n end", "def blank?(param)\n param.nil? || param.empty?\n end", "def missing_mandatory_params?(params)\n mandatory_params.each { |mandatory_param| @missing_params << mandatory_param if params[mandatory_param].to_s.empty? }\n return !@missing_params.empty?\n end", "def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend", "def param_equals?(key, value)\n\t\tret = @myparams.include?(key) && @myparams[key] == value\n\t\t#puts \"#{controller_name}.#{__method__}:#{key}.#{value}=#{ret}\"\n\t\tret\n\tend", "def one_and_only_one_selection(params)\r\n params[:contact_list] && params[:contact_list].count == 1\r\n end", "def field_provided?(key)\n @params.has_key?(key)\n end" ]
[ "0.6470434", "0.62602895", "0.62574023", "0.62445563", "0.61386085", "0.6073199", "0.60357475", "0.60012776", "0.5968408", "0.5965425", "0.59523284", "0.5917802", "0.5906149", "0.5894024", "0.58608276", "0.5858045", "0.5830624", "0.5816976", "0.5757066", "0.5751734", "0.5735299", "0.573498", "0.57060593", "0.5695569", "0.56609267", "0.5659934", "0.5647901", "0.561859", "0.5616104", "0.55982006", "0.55907124", "0.55792844", "0.5573598", "0.5546993", "0.553215", "0.553215", "0.55199087", "0.5515818", "0.55121744", "0.54946923", "0.5484718", "0.5481351", "0.54791135", "0.54571366", "0.54479396", "0.54335797", "0.5430123", "0.5430123", "0.5429533", "0.5428263", "0.54251796", "0.54224676", "0.54166335", "0.5404359", "0.54031897", "0.5401031", "0.54009837", "0.54001415", "0.53965193", "0.5391391", "0.5384587", "0.537923", "0.53748614", "0.5362414", "0.5357085", "0.53534865", "0.53463143", "0.53458124", "0.5341542", "0.53401345", "0.5334102", "0.53328115", "0.5329098", "0.5328964", "0.5309758", "0.53065044", "0.53061193", "0.52935064", "0.5290934", "0.5290816", "0.5288211", "0.5287464", "0.52811575", "0.52808636", "0.5278552", "0.5273404", "0.52674323", "0.5266156", "0.52631944", "0.5261757", "0.5257887", "0.5256183", "0.52517915", "0.52512634", "0.5250739", "0.5246283", "0.5243755", "0.5243755", "0.52429914", "0.5242156" ]
0.8034076
0
other things we could test write support. duplicate key handling
def test_pseudo_properties # load some compressed rtf data data = File.read File.dirname(__FILE__) + '/test_rtf.data' props = PropertySet.new PropertySet::Key.new(0x1009) => StringIO.new(data) # all these get generated from the rtf. still need tests for the way the priorities work # here, and also the html embedded in rtf stuff.... assert_equal((<<-'end').chomp.gsub(/\n/, "\n\r"), props.body_rtf) {\rtf1\ansi\ansicpg1252\fromtext \deff0{\fonttbl {\f0\fswiss Arial;} {\f1\fmodern Courier New;} {\f2\fnil\fcharset2 Symbol;} {\f3\fmodern\fcharset0 Courier New;}} {\colortbl\red0\green0\blue0;\red0\green0\blue255;} \uc1\pard\plain\deftab360 \f0\fs20 \par I will be out of the office starting 15.02.2007 and will not return until\par 27.02.2007.\par \par I will respond to your message when I return. For urgent enquiries please\par contact Motherine Jacson.\par \par } end assert_equal <<-'end', props.body_html <html> <body> <br>I will be out of the office starting 15.02.2007 and will not return until <br>27.02.2007. <br> <br>I will respond to your message when I return. For urgent enquiries please <br>contact Motherine Jacson. <br> <br></body> </html> end assert_equal <<-'end', props.body I will be out of the office starting 15.02.2007 and will not return until 27.02.2007. I will respond to your message when I return. For urgent enquiries please contact Motherine Jacson. end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_modifyingfile\n keys = []\n names = []\n 3.times {\n k = mkkey\n #h[:ensure] = :present\n #h.retrieve\n keys << k\n names << k.name\n }\n assert_apply(*keys)\n keys.clear\n\n @catalog.clear(true)\n @catalog = nil\n\n newkey = mkkey\n #newkey[:ensure] = :present\n names << newkey.name\n assert_apply(newkey)\n\n # Verify we can retrieve that info\n assert_nothing_raised(\"Could not retrieve after second write\") {\n newkey.provider.prefetch\n }\n\n assert(newkey.provider.exists?, \"Did not see key in file\")\n end", "def _writeSingleTest(key, data)\n t = Scalaroid::Transaction.new()\n\n t.write(@testTime.to_s + key, data)\n # now try to read the data:\n assert_equal(data, t.read(@testTime.to_s + key))\n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaroid::Transaction.new()\n assert_equal(data, t.read(@testTime.to_s + key))\n\n t.close_connection()\n end", "def write_key(*key); end", "def duplicate_primary_key(duplicate_row:, key:, node_id:)\n # nothing\n end", "def check_write_key!\n fail ArgumentError, 'Write key must be initialized' if @write_key.nil?\n end", "def write_entry(key, value, options) # :nodoc:\n method = if options[:unless_exists] || options[:unless_exist]\n :add\n else\n :set\n end\n if ttl = options.delete(:expires_in)\n options[:ttl] ||= ttl\n end\n @data.send(method, key, value, options)\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n false\n end", "def test_set_key_if_it_exists\n # Given\n refute @redis.exists( @key )\n\n # When\n @redis.set @key, @val, xx: true\n\n # Then \n refute @redis.get( @key )\n\n # ...and...\n\n # Given\n @redis.set @key, \"\"\n assert @redis.exists( @key )\n\n # When\n @redis.set @key, @val, xx: true\n\n # Then \n assert_equal @val, @redis.get( @key )\n end", "def write_entry(key, entry, options) # :nodoc:\n cleanup(@max_cleanup_time)\n\n method = exist?(key) ? :update : :insert\n\n @data.send(method, {key: key, value: Marshal.dump(entry)})\n true\n rescue Sequel::Error => e\n logger.error(\"Sequel::Error (#{e}): #{e.message}\") if logger\n false\n end", "def test_normal_append\n @store.set(@key, @flag, @exp_time, @size, @value, @no_reply)\n\n assert_equal(STORED, @store.append(@key, @size_append, @value_append, @no_reply), STORED_MESSAGE)\n end", "def _writeSingleTest(key, data)\n t = Scalaris::Transaction.new()\n \n t.write(@testTime.to_s + key, data)\n # now try to read the data:\n assert_equal(data, t.read(@testTime.to_s + key))\n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaris::Transaction.new()\n assert_equal(data, t.read(@testTime.to_s + key))\n \n t.close_connection()\n end", "def _writeSingleTest(key, data)\n t = Scalaris::Transaction.new()\n \n t.write(@testTime.to_s + key, data)\n # now try to read the data:\n assert_equal(data, t.read(@testTime.to_s + key))\n # commit the transaction and try to read the data with a new one:\n t.commit()\n t = Scalaris::Transaction.new()\n assert_equal(data, t.read(@testTime.to_s + key))\n \n t.close_connection()\n end", "def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::JDBCError) && exception.to_s.include?('Duplicate entry')\n end", "def test_put_delete_put\n skip \"https://issues.apache.org/jira/browse/HBASE-2847\"\n\n rowkey = next_rowkey\n data = { 'cf1:pdp' => { 1250000000000 => 'A1' } }\n @table.put rowkey => data\n assert_equal 'A1', @table.get(rowkey).string('cf1:pdp')\n @table.delete rowkey\n assert_nil @table.get(rowkey)\n @table.put rowkey => data\n assert_equal 'A1', @table.get(rowkey).string('cf1:pdp')\n end", "def test_set_key_unless_it_exists\n # Given\n refute @redis.exists( @key )\n\n # When\n @redis.set @key, @val1, nx: true\n\n # Then \n assert_equal @val1, @redis.get( @key )\n\n # ...and...\n\n # When\n @redis.set @key, @val2, nx: true\n\n # Then \n refute_equal @val2, @redis.get( @key )\n assert_equal @val1, @redis.get( @key )\n end", "def warn_about_duplicate_keys(h1, h2); end", "def write(file_name, unique_keys, data, options = {})\n mode = (!options.empty? && options[:overwrite]) ? \"w\" : \"a\"\n open(file_name + \".json\", mode) do |f|\n unless rec_exists?(file_name, unique_keys, data)\n f.puts data\n end\n end\nend", "def write_key(key, value)\n raise RuntimeError.new(\"write_key not implemented!\")\n end", "def rekey_as_needed; end", "def hash_record_low_mem! set, rec, duplicate_type\n key = make_key rec, duplicate_type\n\n set << key\nend", "def _write(key, value, options = nil)\n method = options && options[:unless_exist] ? :add : :set\n response = @data.send(method, key, value, expires_in(options), raw?(options))\n return true if response.nil?\n response == Response::STORED\n rescue MemCache::MemCacheError => e\n logger.error(\"MemCacheError (#{e}): #{e.message}\")\n false\n end", "def should_fail_to_create(key, value, error, message)\n # Create and update are identical; both use PUT\n should_fail_to_change(key, value, error, message, false, true)\n end", "def test_it_can_handle_keys_longer_than_250_characters\n long_key = 'a' * 260\n assert store.write(long_key, 123)\n assert_equal 123, store.read(long_key)\n end", "def reserve_key(key); end", "def supports_unique_keys?\n false\n end", "def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')\n end", "def write_unless_exists(name, value)\n @redis.setnx(name, Oj.dump(value, mode: :compat, time_format: :ruby))\n end", "def write_entry(key, value, options) # :nodoc:\n # cleanup LocalCache\n cleanup if options[:unless_exist]\n method = options[:unless_exist] ? :add : :set\n expires_in = options[:expires_in]\n connection = options.delete(:connection)\n connection.send(method, key, value, expires_in, options)\n rescue Dalli::DalliError => e\n log_dalli_error(e)\n instrument_error(e) if instrument_errors?\n raise if raise_errors?\n false\n end", "def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end", "def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end", "def check_or_create_for!(hash, key)\n hash[key] = \"\" unless hash.include?(key)\n end", "def insert(key)\n end", "def on_upsert\n #\n end", "def replicate_on_write?\n @replicate_on_write\n end", "def test_no_duplicated_file\n #emulate the saving of a file whose content is 'test content'\n @writer.save_file('test content')\n #an exception should be raised by ioservice if file is attempted to be saved twice\n assert_nothing_thrown do\n @writer.save_file('test content')\n end\n end", "def persist(key); end", "def persist(key); end", "def invoke_write_key(key)\n write_key(key)\n end", "def duplicate_primary_key(duplicate_row:, key:, node_id:)\n puts \"Duplicate primary key in '#{duplicate_row}' for key '#{key}' in #{node_id}\"\n end", "def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_again'))\n false\n else\n raise e\n end\n end\n end", "def write_entry(key, entry, options)\n if options && options[:unless_exist]\n @hash.add(key, entry)\n else\n @hash[key] = entry\n end\n end", "def before_write\n end", "def pending_write?; end", "def resident_key?; end", "def duplicate(new_key_label)\n connection.zunionstore(new_key_label, [key_label]) if exists?\n end", "def determine_duplicate_error(existing)\n if existing.user == User.current\n errors.add(:key, l(:error_key_in_use_by_you, name: existing.title))\n elsif User.current.admin?\n errors.add(:key, l(:error_key_in_use_by_other, login: existing.user.login, name: existing.title))\n else\n errors.add(:key, l(:error_key_in_use_by_someone))\n end\n end", "def add_if_not_exists()\n\tif record_exists()\n\t\tprintf(\"EXISTS %s\\n\",self.digest)\n\t\treturn 0\n\tend\n\tsave()\n\treturn 1\nend", "def sneaky_save(avoid_insert_conflict: nil)\n begin\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n rescue ActiveRecord::StatementInvalid\n false\n end\n end", "def write(key, data)\n responsible_clients(key).each do |v|\n with_retries { v.logical.write(wrap_key(key), data) }\n end\n end", "def test_delete_not_existing_key()\n key = \"_Delete_NotExistingKey\"\n rdht = Scalaroid::ReplicatedDHT.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n rdht.close_connection()\n end", "def should_fail_to_create_metadata(key, value, error, message)\n should_fail_to_change_metadata(key, value, error, message, true)\n end", "def duplicate_entry?(entry_hash)\n unless entry_hash.include? \"id\" # conditional for record updates\n formatted = format_hash(entry_hash)\n db_hash = get_entry(formatted[\"fname\"], formatted[\"lname\"])\n difference = (formatted.to_a - db_hash.to_a).flatten\n difference.size > 0 ? false : true\n else\n false\n end\nend", "def put(key, value); end", "def hash_dup\n save\n end", "def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end", "def can_set_write_concern?\n !sharded? || !scram_sha_256_enabled?\nend", "def create!\n Upsert.logger.info \"[upsert] Creating or replacing database function #{name.inspect} on table #{table_name.inspect} for selector #{selector_keys.map(&:inspect).join(', ')} and setter #{setter_keys.map(&:inspect).join(', ')}\"\n first_try = true\n connection.execute(%{\n CREATE OR REPLACE FUNCTION #{name}(#{(selector_column_definitions.map(&:to_selector_arg) + setter_column_definitions.map(&:to_setter_arg) + hstore_delete_handlers.map(&:to_arg)).join(', ')}) RETURNS VOID AS\n $$\n DECLARE\n first_try INTEGER := 1;\n BEGIN\n LOOP\n -- first try to update the key\n UPDATE #{quoted_table_name} SET #{update_column_definitions.map(&:to_setter).join(', ')}\n WHERE #{selector_column_definitions.map(&:to_selector).join(' AND ') };\n IF found THEN\n #{hstore_delete_handlers.map(&:to_pgsql).join(' ')}\n RETURN;\n END IF;\n -- not there, so try to insert the key\n -- if someone else inserts the same key concurrently,\n -- we could get a unique-key failure\n BEGIN\n INSERT INTO #{quoted_table_name}(#{setter_column_definitions.map(&:quoted_name).join(', ')}) VALUES (#{setter_column_definitions.map(&:to_setter_value).join(', ')});\n #{hstore_delete_handlers.map(&:to_pgsql).join(' ')}\n RETURN;\n EXCEPTION WHEN unique_violation THEN\n -- seamusabshere 9/20/12 only retry once\n IF (first_try = 1) THEN\n first_try := 0;\n ELSE\n RETURN;\n END IF;\n -- Do nothing, and loop to try the UPDATE again.\n END;\n END LOOP;\n END;\n $$\n LANGUAGE plpgsql;\n })\n rescue\n if first_try and $!.message =~ /tuple concurrently updated/\n first_try = false\n retry\n else\n raise $!\n end\n end", "def allows_unique?\n true\n end", "def upsert key, value\n # Check if there is already an entry for the given key. If there is one, we have to update the value and return.\n if (slot = find_slot(key))\n slot.value = value\n return\n end \n \n #If the entry does not exist, we have to check if there is enough room to add it to the table. \n # If the number of slots is too small, \n # we have to trigger a rebuild operation to ensure that the new entry fits into the internal storage\n rebuild if self.size > (@slots / 2)\n\n # Once we are sure that there is enough space, we have to hash the key and map it to a position into the internal storage. \n # In our case, we do that by double hashing the key’s hash code until we find an empty slot or run out of positions\n 0.upto(@slots - 1) do |i|\n index = double_hash key.hash, i\n slot = @table[index]\n if slot.nil? || slot.vacated \n # Once we successfully mapped a key to a position in the internal array, we increase the table size and return\n @table[index] = Slot.new key, value\n self.size += 1\n return\n end\n end\n raise \"Weak hash function.\"\nend", "def test_uniqueness_of\n # Create a page named 'test' and save it\n page1 = new_page()\n assert page1.save\n\n # Duplicate page name won't work\n page2 = new_page()\n assert !page2.save\n assert page2.errors.on(:name)\n\n # Fix name and it should work\n page2.name = 'test2'\n assert page2.save\n end", "def validate_unique(child, child_type)\n if child_id_of.has_key?(child_type[0]) and child_id_of[child_type[0]].has_key?(child[child_type[1]])\n raise TPX_2_2::DuplicateElementInsertError, \"Duplicate input object id #{child[child_type[1]]} provided to #{self.class}!\"\n end\n end", "def add_key_value?(key, val)\n @store.transaction do\n return false if @store.to_h.key? key\n @store[key]=val\n end\n true\n end", "def test_duplicate_tags\n existing_tag = create(:node_tag)\n assert_equal true, existing_tag.node.changeset.user.data_public\n # setup auth\n basic_authorization existing_tag.node.changeset.user.email, \"test\"\n\n # add an identical tag to the node\n tag_xml = XML::Node.new(\"tag\")\n tag_xml[\"k\"] = existing_tag.k\n tag_xml[\"v\"] = existing_tag.v\n\n # add the tag into the existing xml\n node_xml = existing_tag.node.to_xml\n node_xml.find(\"//osm/node\").first << tag_xml\n\n # try and upload it\n content node_xml\n put :update, :params => { :id => existing_tag.node.id }\n assert_response :bad_request,\n \"adding duplicate tags to a node should fail with 'bad request'\"\n assert_equal \"Element node/#{existing_tag.node.id} has duplicate tags with key #{existing_tag.k}\", @response.body\n end", "def put(key, value)\n \n end", "def add_stored(entry, src_path, &continue_on_exists_proc); end", "def should_create_metadata(key, value, *tags)\n should_change_metadata(key, value, nil, 200, *tags)\n end", "def test_duplicate_on_first_insert_with_locking\n reset_transaction do\n with_locking do\n duped_env = @env.dup\n base_session = SessionHash.new(SmartSessionApp, duped_env)\n base_session.send :load!\n\n setup_base_session {|s| s[:name] = 'fred'}\n\n base_session[:foo] = 'bar'\n SmartSessionApp.send :set_session, duped_env, '123456', base_session.to_hash, {}\n\n assert_final_session 'foo' => 'bar', 'name' => 'fred'\n\n end\n end\n end", "def process_setnx(command)\n key = command[0]\n val = command[1]\n options = {:record_exists_action => ::Aerospike::RecordExistsAction::CREATE_ONLY}\n @connection.put(as_key(key), {@bin => val}, options)\n return 1\n rescue ::Aerospike::Exceptions::Aerospike => e\n if (e.result_code == ::Aerospike::ResultCode::KEY_EXISTS_ERROR)\n return 0\n else\n raise\n end\n end", "def check_duplicate_item(db, tbl,field_name,value)\r\n check_command = \"Select * from ? where ? = ?\",[tbl, field_name,value]\r\n if db.execute(check_command).length > 0\r\n return true\r\n else \r\n return false \r\n end \r\nend", "def create!\n Upsert.logger.info \"[upsert] Creating or replacing database function #{name.inspect} on table #{buffer.parent.table_name.inspect} for selector #{selector.map(&:inspect).join(', ')} and columns #{columns.map(&:inspect).join(', ')}\"\n column_definitions = get_column_definitions\n connection.execute <<-EOS\nCREATE OR REPLACE FUNCTION #{name}(#{column_definitions.map { |c| \"#{c.quoted_input_name} #{c.sql_type} DEFAULT #{c.default || 'NULL'}\" }.join(',') }) RETURNS VOID AS\n$$\nBEGIN\n LOOP\n -- first try to update the key\n UPDATE #{quoted_table_name} SET #{column_definitions.map { |c| \"#{c.quoted_name} = #{c.quoted_input_name}\" }.join(',')}\n WHERE #{selector.map { |k| \"#{connection.quote_ident(k)} = #{connection.quote_ident([k,'input'].join('_'))}\" }.join(' AND ') };\n IF found THEN\n RETURN;\n END IF;\n -- not there, so try to insert the key\n -- if someone else inserts the same key concurrently,\n -- we could get a unique-key failure\n BEGIN\n INSERT INTO #{quoted_table_name}(#{column_definitions.map { |c| c.quoted_name }.join(',')}) VALUES (#{column_definitions.map { |c| c.quoted_input_name }.join(',')});\n RETURN;\n EXCEPTION WHEN unique_violation THEN\n -- Do nothing, and loop to try the UPDATE again.\n END;\n END LOOP;\nEND;\n$$\nLANGUAGE plpgsql;\nEOS\n end", "def if_needs_rekey?; end", "def write_unless_exists(name, value)\n !exist?(name).tap do |exists|\n write(name, value) unless exists\n end\n end", "def write_entry(key, entry, **options)\n raise NotImplementedError.new\n end", "def create_unique_key\n begin\n self.unique_key = UrlShort.generate_key\n rescue ActiveRecord::RecordNotUnique\n if (count +=1) < 5\n retry\n else\n raise\n end\n end\n end", "def ensure_item_exists key, value\n item = Item.find(:key => key, :host_id => host.id)\n unless item\n Item.new(:key => key, :host_id => host.id, :applications => applications, :value_type => Item.value_type_from_value(value)).save\n\n # There is a time lag of about 15-30 seconds between (successfully)\n # creating an item on the Zabbix server and having the Zabbix accept\n # new data for that item.\n #\n # If it is crucial that *every single* data point be written, dial\n # up this sleep period. The first data point for a new key will put\n # the wrapper to sleep for this period of time, in hopes that the\n # Zabbix server will catch up and be ready to accept new data\n # points.\n #\n # If you don't care that you're going to lose the first few data\n # points you send to Zabbix, then don't worry about it.\n sleep settings['create_item_sleep']\n end\n end", "def test_stale_save\n collection = Collection.create!(parent_url: @config.fedora_url,\n requested_slug: SLUGS[0],\n key: 'cats')\n\n item = Item.create!(parent_url: collection.repository_url,\n requested_slug: SLUGS[1])\n item.collection = collection\n item.save!\n\n collection.key = 'dogs'\n collection.save! # absence of an error is a pass\n end", "def save\n\n @data_object.user_acc_name.downcase! if @data_object.user_acc_name\n\n# unless @data_object.existing_record?\n tmp = User.with_name(@data_object.user_acc_name)\n if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id)\n raise DionException.new(\"Sorry, but that nickname has been taken\")\n end\n \n# tmp = User.with_email(contact.con_email)\n# if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id)\n# raise DionException.new(\"A user with that e-mail address already exists\" +\n# \" #{tmp.user_id}, #{@data_object.user_id}\")\n# end\n# end\n\n\n # This is tacky, but I can't see an easy way around it. If we fail inserting the\n # user record because of a duplicate nickname, then we'll have already written\n # out the contact record. The rollback will delete that out (or reset its field\n # values), but the in-store copy won't know that. So, we save away the contact\n # stuff and restore it in case of an exception\n\n# $store.transaction do\n\n begin\n\n# saved_contact = Marshal.dump(contact)\n\n# prev_con_id = @data_object.user_contact\n \n @data_object.user_contact = contact.save\n\n begin\n super\n rescue Exception => e\n# @contact = Marshal.load(saved_contact)\n# @data_object.user_contact = saved_contact\n raise\n end\n \n rescue DBI::ProgrammingError => e\n $stderr.puts e.message\n $stderr.puts e.backtrace\n\n case e.message\n when /duplicate key into unique index contact_con_email_key/,\n /duplicate key violates unique constraint \"contact_con_email_key\"/\n raise DionException.new(\"A user with that e-mail address already exists\")\n when /duplicate key into unique index user_table_user_acc_name_key/\n raise DionException.new(\"Sorry, but that nickname has been taken\")\n else\n raise\n end\n end\n\n# end\n end", "def testDelete_notExistingKey()\n key = \"_Delete_NotExistingKey\"\n rdht = Scalaris::ReplicatedDHT.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n rdht.close_connection()\n end", "def test_no_duplicate_id\n dup = {\"_id\" => \"foo\", :_id => \"foo\"}\n one = {\"_id\" => \"foo\"}\n\n assert_equal @encoder.serialize(one, false, true).to_a, @encoder.serialize(dup, false, true).to_a\n end", "def set_exists(policy, key)\n begin_cmd\n field_count = estimate_key_size(key)\n\n predexp_size = estimate_predexp(policy.predexp)\n field_count += 1 if predexp_size > 0\n\n exp_size = estimate_expression_size(@policy.filter_exp)\n field_count += 1 if exp_size > 0\n\n size_buffer\n write_header(policy, INFO1_READ | INFO1_NOBINDATA, 0, field_count, 0)\n write_key(key)\n write_predexp(policy.predexp, predexp_size)\n write_filter_exp(@policy.filter_exp, exp_size)\n end_cmd\n end", "def write(key, value, options = nil)\n super\n method = options && options[:unless_exist] ? :add : :set\n # memcache-client will break the connection if you send it an integer\n # in raw mode, so we convert it to a string to be sure it continues working.\n value = value.to_s if raw?(options)\n response = @data.send(method, key, value, expires_in(options), raw?(options))\n response == Response::STORED\n rescue MemCache::MemCacheError => e\n logger.error(\"MemCacheError (#{e}): #{e.message}\")\n false\n end", "def write_entry(key, entry, options) # :nodoc:\n method = options && options[:unless_exist] ? :add : :set\n expires_in = options[:expires_in].to_i\n expires_in = nil if expires_in == 0\n entry = Marshal.dump(entry)\n @data.send(method, key, entry, expires_in)\n rescue => e\n logger.error(\"KyotoTycoonError (#{e}): #{e.message}\") if logger\n false\n end", "def test_append_existing\n @cache.add('Key', 'Data1', 0, Time.now.to_i + 60)\n result = @cache.append('Key', '&Data2', 0, Time.now.to_i + 60)\n cache = @cache.get('Key').args\n\n assert_true result.success\n assert_equal 'STORED', result.message.chomp.split(\"\\s\")[0]\n assert_equal 'Data1&Data2', cache.data\n end", "def save(username, password)\n code = create(username, password)\n if ErrSecDuplicateItem == code\n update(username, password)\n else\n code\n end\n end", "def check_and_write(bucket)\n if bucket_full? bucket\n write_and_flush bucket\n end\n end", "def test_read_write\n key = 'storekey' + Time.now.to_f.to_s\n @store.write key, @test_data\n\n data = @store.read key\n assert_equal @test_data, data\n\n cache = Cache.new @config\n data = cache.read key\n assert_equal @test_data, data\n\n assert File.file? File.join(@store.directory, \"#{key}.json\")\n end", "def snapshot_key\n # no-op\n end", "def test_put_too_many_locktokens_given\n new_coll 'httplock'\n new_file 'httplock/a', StringIO.new(\"hello\")\n new_file 'httplock/b', StringIO.new(\"world\")\n\n b_locktoken = lock('httplock/b', :depth => 0).token\n a_locktoken = lock('httplock/a', :depth => 0).token\n\n response = @request.put('httplock/a', StringIO.new('hello'), :if => [a_locktoken, b_locktoken])\n assert_equal '412', response.status\n \n response = @request.put('httplock/a', StringIO.new('hello'), { :if => [a_locktoken, b_locktoken], :strict_if => false } )\n assert_equal '204', response.status \n\n # cleanup\n unlock('httplock/a', a_locktoken)\n unlock('httplock/b', b_locktoken)\n delete_coll('httplock')\n end", "def write(key, value, options = nil)\r\n super\r\n method = (options && options[:unless_exist]) ? :add : :set\r\n @cache.send(method, valid_key(key), value, expires_in(options), marshal?(options))\r\n true\r\n rescue Memcached::Error => e\r\n log_error(e)\r\n false\r\n end", "def save_hashes_for_write\n \n end", "def create_or_update(entry)\n EntryRepository.create(entry)\n rescue Hanami::Model::UniqueConstraintViolationError\n entry = read(entry.key)\n database.update(entry)\n rescue Hanami::Model::Error => err\n database.create(entry)\n end", "def add_exercise(name)\n #want to check for duplicates, will attempt later\n #exercises = db.execute(\"SELECT name FROM Exercise\")\n #exercises.each do |ex|\n #if name != ex[0]\n $db.execute(\"INSERT OR IGNORE INTO Exercise (name) VALUES (?)\", [name])\nend", "def hash_record! ht, rec, duplicate_type\n case duplicate_type\n when 1 # whole header match\n unless ht.has_key? rec.header\n ht[rec.header] = rec\n end\n when 2 # header ID match\n unless ht.has_key? rec.id\n ht[rec.id] = rec\n end\n when 3 # whole seq match\n unless ht.has_key? rec.seq\n ht[rec.seq] = rec\n end\n when 4 # whole seq + whole header\n key = \"#{rec.header}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n when 5 # whole seq + hedaer ID\n key = \"#{rec.id}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n end\nend", "def add item\n self[index item] = item if check item\n# check item ? super : free key # delete key\n end", "def create!\n Upsert.logger.info \"[upsert] Creating or replacing database function #{name.inspect} on table #{table_name.inspect} for selector #{selector_keys.map(&:inspect).join(', ')} and setter #{setter_keys.map(&:inspect).join(', ')}\"\n\n selector_column_definitions = column_definitions.select { |cd| selector_keys.include?(cd.name) }\n setter_column_definitions = column_definitions.select { |cd| setter_keys.include?(cd.name) }\n update_column_definitions = setter_column_definitions.select { |cd| cd.name !~ CREATED_COL_REGEX && !options[\"ignore_on_update\"].include?(cd.name) }\n\n first_try = true\n connection.execute(%{\n CREATE OR REPLACE FUNCTION #{name}(#{(selector_column_definitions.map(&:to_selector_arg) + setter_column_definitions.map(&:to_setter_arg)).join(', ')}) RETURNS VOID AS\n $$\n DECLARE\n first_try INTEGER := 1;\n BEGIN\n LOOP\n -- first try to update the key\n UPDATE #{quoted_table_name} SET #{update_column_definitions.map(&:to_setter).join(', ')}\n WHERE #{selector_column_definitions.map(&:to_selector).join(' AND ') };\n IF found THEN\n RETURN;\n END IF;\n -- not there, so try to insert the key\n -- if someone else inserts the same key concurrently,\n -- we could get a unique-key failure\n BEGIN\n INSERT INTO #{quoted_table_name}(#{setter_column_definitions.map(&:quoted_name).join(', ')}) VALUES (#{setter_column_definitions.map(&:to_setter_value).join(', ')});\n RETURN;\n EXCEPTION WHEN unique_violation THEN\n -- seamusabshere 9/20/12 only retry once\n IF (first_try = 1) THEN\n first_try := 0;\n ELSE\n RETURN;\n END IF;\n -- Do nothing, and loop to try the UPDATE again.\n END;\n END LOOP;\n END;\n $$\n LANGUAGE plpgsql;\n })\n rescue\n if first_try and $!.message =~ /tuple concurrently updated/\n first_try = false\n retry\n else\n raise $!\n end\n end", "def write(obj, str, tag)\n obj[tag] = str\n if obj.save\n return true\n else\n return false\n end\nend", "def needs_rekey?; end", "def testDelete_notExistingKey()\n key = \"_Delete_NotExistingKey\"\n rdht = Scalaris::ReplicatedDHT.new()\n rt = Scalaris::RoutingTable.new\n r = rt.get_replication_factor\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(r, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n rdht.close_connection()\n end", "def write_entry(key, entry, options = nil)\n method = (options && options[:unless_exist]) ? :add : :set\n value = options[:raw] ? entry.value.to_s : entry\n\n @cache.send(method, key, value, expires_in(options), marshal?(options))\n true\n rescue Memcached::Error => e\n log_error(e)\n false\n end", "def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end", "def key=(key); end", "def write_entry(key, entry, options) # :nodoc:\n method = options && options[:unless_exist] ? :add : :set\n value = options[:raw] ? entry.value.to_s : entry\n expires_in = options[:expires_in].to_i\n if expires_in > 0 && !options[:raw]\n # Set the memcache expire a few minutes in the future to support race condition ttls on read\n expires_in += 5.minutes\n end\n @client.send(method, key, value, expires_in, options)\n rescue Spymemcached::Error => e\n logger.error(\"Spymemcached::Error (#{e}): #{e.message}\") if logger\n false\n end" ]
[ "0.6342405", "0.6278296", "0.62424046", "0.61876214", "0.61232096", "0.6108877", "0.6082207", "0.6052111", "0.6037649", "0.60310304", "0.60310304", "0.6023723", "0.6023371", "0.6023234", "0.5981422", "0.5955789", "0.59496254", "0.5945464", "0.5943789", "0.58714414", "0.58666444", "0.5841884", "0.5841826", "0.5816421", "0.5804948", "0.5801658", "0.57973206", "0.57855755", "0.57855755", "0.57808167", "0.57624954", "0.5759589", "0.5758893", "0.57306856", "0.572615", "0.572615", "0.57160974", "0.57109004", "0.5694464", "0.5686559", "0.5684318", "0.5677187", "0.5676955", "0.5643009", "0.56326133", "0.5618431", "0.5617227", "0.56147504", "0.5609218", "0.5589482", "0.55883634", "0.5584939", "0.55758023", "0.55751866", "0.5574506", "0.55695564", "0.55637044", "0.5563616", "0.55509317", "0.55477417", "0.55409783", "0.55356455", "0.5522839", "0.5521994", "0.5506598", "0.5493404", "0.5483645", "0.5471908", "0.547026", "0.54608744", "0.5456077", "0.5453122", "0.5447584", "0.5431179", "0.54306364", "0.5429529", "0.5428536", "0.5415402", "0.5414503", "0.5413894", "0.5412054", "0.5407842", "0.540729", "0.5385477", "0.5381017", "0.53785133", "0.5362915", "0.53621435", "0.53617865", "0.53607875", "0.53579485", "0.5355136", "0.53547174", "0.5348047", "0.5347804", "0.5347461", "0.53471816", "0.53399926", "0.5321245", "0.5319676", "0.53179437" ]
0.0
-1
Creates and initializes a new instance of the IntegrationRuntimeNodes class.
def initialize(client) @client = client end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @nodes = []\n end", "def initialize\n @nodes = []\n end", "def initialize\n @j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetServer\n end", "def init\n @calls = []\n @accept_nodes = []\n @connected_nodes = nil\n @remote_bash_code = nil\n end", "def init_node\n end", "def init_node\n end", "def nodes\n @nodes ||= list_of_nonterminated_instances.collect_with_index do |inst, i|\n RemoteInstance.new(inst.merge({:number => i}))\n end\n end", "def initialize\n\t\t@nodes = []\n\tend", "def initialize_node(options={})\n raise NotImplementedError\n end", "def initialize\n @j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetClient\n end", "def initialize(config_path)\n @nodes = Marshal.load(config_path) || []\n @config_path = config_path\n end", "def initialize(*nodes, attributes: {}, infos: nil)\n\t\t\t@nodes=[]\n\t\t\t# a node can be a Hash or a Node\n\t\t\t# so nodes really is a list of subgraphs\n\t\t\tbuild(*nodes, attributes: attributes, infos: infos)\n\t\tend", "def initialize # :notnew:\n evaluate PRELUDE, PRELUDE_PATH, 1\n global.Johnson.runtime = self\n global['Ruby'] = Object\n evaluate CORE, CORE_PATH, 1\n end", "def initialize\n @nodes = []\n @connections = []\n @names = []\n @core_name = nil\n @country = nil\n @core_node = nil\n end", "def initialize(runtime=nil)\n runtime ||= ExecJS.runtime\n @context = runtime.compile(self.class.source)\n end", "def initialize()\n self.kind = CIAT::Processors::Interpreter.new\n self.description = \"Parrot virtual machine\"\n self.libraries = []\n yield self if block_given?\n end", "def SetUpNodes\n \n @nodes.each do |node|\n\n if node.type==\"R\" or node.type==\"A\" or node.type==\"G\"\n \t\n\tSetMode(node)\n\n\tEnforceChannels(node)\n\t\n\tSetEssid(node) # after this stage, with omf-5.4 the wlan interface is created.\n\t\n\tSetWifiPower(node)\n\n\tSetMtu(node)\n\t\n\tSetIp(node)\n\t\n\tNode(node.id).exec(\"sysctl -w net.ipv4.conf.all.send_redirects=0\")\n \n EnforceRates(node)\n\t\n end\n #final settings\n #self.GetGroupInterface(node, ifn).txqueuelen=\"10\"\n end\n end", "def initialize(\n node,\n environment: 'production',\n logger: Logger.new($stdout),\n logger_stderr: Logger.new($stderr),\n config: Config.new,\n cmd_runner: CmdRunner.new,\n nodes_handler: NodesHandler.new,\n actions_executor: ActionsExecutor.new\n )\n super(logger: logger, logger_stderr: logger_stderr, config: config)\n @node = node\n @environment = environment\n @cmd_runner = cmd_runner\n @nodes_handler = nodes_handler\n @actions_executor = actions_executor\n end", "def nodesCreate\n nodes=Array.new\n @parser.getAllNodes.each do |node|\n nodes.push(Node.new(@parser.getNodeName(node), @parser.getOS(node)))\n nodes.last.interfaces=interfacesCreate(node)\n nodes.last.toInstall=listToInstall(node)\n end\n return nodes\n end", "def initialize( config={} )\n\t\t\t# Node Metadata\n\t\t\t@uuid = config[:uuid] || nil\n\t\t\t# Network Variables\n\t\t\t@host = config[:host] || '127.0.0.1'\n\t\t\t@port = config[:port] || '3333'\n\t\t\t@name = config[:name] || config[:host]\n\t\t\t@description = config[:description] || @name\n\n\t\t\t@socket = config[:socket] || nil\n\t\t\t@status = :disconnected\n\t\t\t@ssl_on = config[:ssl_on] || false\n\n\t\t\t# Storage values\n\t\t\t@hive_version\t= config[:hive_version]\n\t\t\t@created_at\t= config[:created_at]\n\t\t\t@updated_at\t= config[:updated_at]\n\t\t\t@latency\t= config[:latency]\n\t\t\t@known_peers\t= config[:known_peers]\n\n\t\t\t# Lists\n\t\t\t@networks = []\n\n\t\t\t# Runtime stats\n\t\t\t@stats = {\n\t\t\t\t:connect_attempt => nil,\n\t\t\t\t:connect_success => nil,\n\t\t\t\t:lastread => nil,\n\t\t\t\t:lastwrite => nil\n\t\t\t}\n\n\t\t\t# Log Iniitalization\n\t\t\t#\tswdebug \"Swarm node:#{uuid} initialized.\"\n\n\t\t\treturn self\n\t\tend", "def initialize\n @host = '127.0.0.1'\n @port = 12600\n @width = 20\n @height = 20\n @threads = 5\n\n yield self if block_given?\n\n @graph = Graph.new do |g|\n g.width = @width\n g.height = @height\n end.graph\n\n @server = TCPServer.new(@host, @port)\n async.run\n end", "def initialize(parent_multiplier=5)\n @dependencies = Souffle::Node::RunList.new\n @run_list = Souffle::Node::RunList.new\n @parents = []\n @children = []\n @options = {\n :attributes => Hash.new\n }\n @parent_multiplier = parent_multiplier\n end", "def initialize(\n logger: Logger.new($stdout),\n logger_stderr: Logger.new($stderr),\n config: Config.new,\n cmd_runner: CmdRunner.new,\n platforms_handler: PlatformsHandler.new,\n nodes_handler: NodesHandler.new,\n actions_executor: ActionsExecutor.new\n )\n init_loggers(logger, logger_stderr)\n @config = config\n @cmd_runner = cmd_runner\n @platforms_handler = platforms_handler\n @nodes_handler = nodes_handler\n @actions_executor = actions_executor\n @platforms_handler.inject_dependencies(nodes_handler: @nodes_handler, actions_executor: @actions_executor)\n end", "def initialize(config, remote_host, remote_port)\n @config = config\n @remote_nodes = []\n @local_node = Node.new(@config[\"local_host\"], @config[\"local_port\"])\n @need_token = false\n @has_token = false\n @ricart_agrawala = RicartAgrawala.new(self)\n join_network(remote_host, remote_port)\n start_server\n end", "def runtime\n @runtime ||= Runtime.new(dataset, graph)\n end", "def initialize(inputNodes, hiddenNodes, outputNodes, learningRate=0.3, momentum=0.2)\n # Make sure we add the bias node to the input\n @inputNodes = inputNodes + 1\n @hiddenNodes = hiddenNodes\n @outputNodes = outputNodes\n\n @learningRate = learningRate\n @momentum = momentum\n\n @w_1 = NeuralNetwork::create_matrix(@inputNodes, @hiddenNodes, 0.0)\n @w_2 = NeuralNetwork::create_matrix(@hiddenNodes, @outputNodes, 0.0)\n \n # Randomize the values of Nthe nodes [-0.5, 0.5]\n @w_1.map! { |arr| arr.map { |v| rand(-0.5..0.5) } }\n @w_2.map! { |arr| arr.map { |v| rand(-0.5..0.5) } }\n\n # It helps to store the current state of node activations\n @activation_input = [1.0] * @inputNodes\n @activation_hidden = [1.0] * @hiddenNodes\n @activation_output = [1.0] * @outputNodes\n\n @din = NeuralNetwork::create_matrix(@inputNodes, @hiddenNodes, 0.0)\n @dout = NeuralNetwork::create_matrix(@hiddenNodes, @outputNodes, 0.0)\n\n puts \"\\n================================================================================================\\n[+]Weights from input to hidden nodes [#{@inputNodes}x#{@hiddenNodes}] has been initialized with small random values\"\n puts \"[+]Weights from hidden to output nodes [#{@hiddenNodes}x#{@outputNodes}] has been nitialized to small random values\\n================================================================================================\\n\"\n\n puts \"Neural network initialized with values \\n \\t Input Nodes:[{#{@inputNodes}]\\t Hidden Nodes: [#{@hiddenNodes}]\\t Output Nodes: [#{@outputNodes}]} \\n--------------------------------------------------------------------------------\\n\"\n puts \"\"\n\n end", "def initialize(id=nil, user=nil, timestamp=nil, nodes=[], uid=-1, version=1, visible=nil)\n @nodes = nodes.collect{ |node| node.kind_of?(OSMLib::Element::Node) ? node.id : node }\n super(id, user, timestamp, uid, version, visible)\n end", "def init_without_node\n @internal_node = Neo4j.instance.create_node\n self.classname = self.class.to_s\n Neo4j.instance.ref_node.connect(self) \n\n self.class.fire_event NodeCreatedEvent.new(self) \n $NEO_LOGGER.debug {\"created new node '#{self.class.to_s}' node id: #{@internal_node.getId()}\"} \n end", "def initialize(bus = Systemd::Helpers.system_bus)\n @service = bus.service(Importd::SERVICE)\n @object = @service.object(NODE)\n @object.default_iface = INTERFACE\n @object.introspect\n end", "def build_node\n Chef::Log.trace(\"Building node object for #{@node_name}\")\n @node = Chef::Node.find_or_create(node_name)\n ohai_data = @ohai.data.merge(@node.automatic_attrs)\n @node.consume_external_attrs(ohai_data, nil)\n @run_list_expansion = @node.expand!(\"server\")\n @expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings\n Chef::Log.info(\"Run List is [#{@node.run_list}]\")\n Chef::Log.info(\"Run List expands to [#{@expanded_run_list_with_versions.join(\", \")}]\")\n @node\n end", "def setup(options = {})\n # Stringify keys :/\n options = options.inject({}) { |h,(k,v)| h[k.to_s] = v; h }\n\n @config_lock.synchronize do\n @configuration = {\n 'id' => generate_node_id,\n 'addr' => \"tcp://127.0.0.1:*\",\n 'registry' => {'adapter' => 'redis', 'server' => 'localhost'}\n }.merge(options)\n\n @me = Node.new @configuration['id'], nil\n\n registry_adapter = @configuration['registry'][:adapter] || @configuration['registry']['adapter']\n raise ArgumentError, \"no registry adapter given in config\" unless registry_adapter\n\n registry_class_name = registry_adapter.split(\"_\").map(&:capitalize).join << \"Adapter\"\n\n begin\n registry_class = DCell::Registry.const_get registry_class_name\n rescue NameError\n raise ArgumentError, \"invalid registry adapter: #{@configuration['registry']['adapter']}\"\n end\n\n @registry = registry_class.new(@configuration['registry'])\n\n ObjectSpace.define_finalizer(me, proc {Directory.remove @configuration['id']})\n end\n\n me\n end", "def initialize(bus = Systemd::Helpers.system_bus)\n @service = bus.service(Systemd::SERVICE)\n @object = @service.object(NODE)\n @object.default_iface = INTERFACE\n @object.introspect\n end", "def initialize(nodes, edges)\n super()\n self.nodes = nodes\n self.edges = edges.map { |e| Edge.new(e[0], e[1], e[2]) }\n\n self.build\n end", "def initialize_nodes\r\n stations.each {|x|\r\n node.push(Node.new(x.station))\r\n }\r\n end", "def initialize(app:, number:, diameter:, center:)\n @diameter = diameter\n @app = app\n # Create the nodes\n @nodes = (0..number).map { Node.new(app: app, location: center.add(TVec2D.randomVector)) }\n # Connect all the nodes with a Spring\n nodes[1..nodes.size - 1].each_with_index do |pi, i|\n nodes[0..i].each do |pj|\n physics.addSpring(Physics::VerletSpring2D.new(pi, pj, diameter, 0.01))\n end\n end\n end", "def initialize our_node, our_db, remote_node, remote_db, event_block\n @our_node = our_node\n @our_db = our_db\n @remote_node = remote_node\n @remote_db = remote_db\n @name = \"#{our_db}->#{remote_db}\"\n @keep_alive = true\n @status = \"NOTRUNNING\"\n @event_block = event_block\n end", "def init\n self['env'] ||= 'development'\n\n n = (self['port'] || 3000).to_i\n assert n >= 0 && n <= 65535\n self['port'] = n\n\n n = (self['workers'] || self['worker'] || ((CpuCounter.count + 1)/ 2)).to_i\n assert n > 0 && n < 1000\n self['workers'] = n\n\n unless self['root']\n set :root, Dir.pwd\n end\n self['root'] = File.realpath File.expand_path self['root']\n\n # todo warn paths not under project?\n self['views'] = project_path(self['views'] || 'views')\n if self['public']\n self['public'] = project_path(self['public'])\n end\n\n if self['assets']\n self['assets'] = project_path(self['assets'])\n end\n\n self.logger = create_logger\n\n assert !self['before_fork'] || self['before_fork'].respond_to?('call')\n assert !self['after_fork'] || self['after_fork'].respond_to?('call')\n\n self['timeout'] ||= 120\n timeout = self['timeout'].to_i\n assert timeout > 0 && timeout < 2**30\n self['timeout'] = timeout\n Ext.set_inactive_timeout timeout\n end", "def initialize()\n # The password, or secret phrase, that is required for callers to access\n # methods exposed via SOAP.\n @@secret = HelperFunctions.get_secret()\n\n # An Array of Hashes, where each Hash contains a log message and the time\n # it was logged.\n @@logs_buffer = []\n\n STDOUT.sync = true\n @@log = Logger.new(STDOUT)\n @@log.level = Logger::DEBUG\n\n @nodes = []\n @my_index = nil\n @my_public_ip = nil\n @my_private_ip = nil\n @creds = {}\n @app_names = []\n @apps_loaded = []\n @apps_to_restart = []\n @kill_sig_received = false\n @done_initializing = false\n @done_loading = false\n @userappserver_public_ip = \"not-up-yet\"\n @userappserver_private_ip = \"not-up-yet\"\n @state = \"AppController just started\"\n @num_appengines = 1\n @restored = false\n @api_status = {}\n @all_stats = []\n @last_updated = 0\n @state_change_lock = Monitor.new()\n @app_info_map = {}\n\n @scaling_in_progress = false\n @last_decision = {}\n @initialized_apps = {}\n @total_req_rate = {}\n @last_sampling_time = {}\n @last_scaling_time = Time.now.to_i\n @app_upload_reservations = {}\n @last_api_status = 0\n end", "def initialize(amq, registry, serializer, identity, options)\n @amq = amq\n @registry = registry\n @serializer = serializer\n @identity = identity\n @options = options\n @evmclass = EM\n @evmclass.threadpool_size = (@options[:threadpool_size] || 20).to_i\n end", "def initialize(dag)\n vars = {}\n @net = Sbn::Net.new(title)\n \n vertices.each do |v|\n vars[v] = Sbn::Variable.new(@net, v.name.to_sym)\n end\n \n edges.each do |e|\n vars[e.source].add_child(vars[e.target])\n end\n end", "def initialize(namespace = '')\n self.graph = Tensorflow::Graph.new\n self.namemap = {}\n self.namespace = namespace\n end", "def nodes # :nodoc:\n return @nodes if defined?(@nodes) \n node_ids = (1..Configuration.numbers['total_nodes'])\n @nodes = node_ids.map do |id| \n {\n id: id,\n host: \"node_#{id}_#{Worker::VERSION}\"\n }.to_struct\n end\n end", "def initialize(groupName = nil)\n # for safety!\n if self.frozen?\n raise \"Can't define any more nodes after 'allNodes' has been called\"\n end\n @mutex = Mutex.new\n @applications = Hash.new\n @deferred = [] # store any messages if nodes aren't up yet\n @onUpBlock = nil # Block to execute for every node checking in\n @groupName = groupName != nil ? groupName.to_s : nil\n if @groupName == nil\n @groupName = \"_#{@@groupCnt += 1}\"\n else\n if @groupName[0] == '/'[0]\n @groupName = @groupName[1..-1]\n end\n end\n super(\"set::#{@groupName}\") # set debug name\n if (groupName == \"_ALL_\")\n @nodeSelector = \"*\"\n else\n @nodeSelector = \"#{@groupName}\"\n eachNode { |n|\n n.addGroupName(@groupName)\n }\n add_observer(NodeSet.ROOT)\n @@groups[@groupName] = self\n end\n eachNode { |n|\n n.add_observer(self)\n }\n end", "def initialize\n @registry = Registry.new\n end", "def initialize(name,&ruby_block)\n # Check and set the name of the task.\n @name = name.to_sym\n # Generate a name for the scope containing the signals of\n # the task.\n @scope_name = HDLRuby.uniq_name\n\n # # Sets the scope.\n # @scope = HDLRuby::High.cur_scope\n\n # Keep access to self.\n obj = self\n\n \n # The runner input ports by name.\n @runner_inputs = {}\n # The runner output ports by name.\n @runner_outputs = {}\n # The runner inout ports by name.\n @runner_inouts = {}\n \n # # The stopper input ports by name.\n # @stopper_inputs = {}\n # # The stopper output ports by name.\n # @stopper_outputs = {}\n # # The stopper inout ports by name.\n # @stopper_inouts = {}\n \n # The finisher input ports by name.\n @finisher_inputs = {}\n # The finisher output ports by name.\n @finisher_outputs = {}\n # The finisher inout ports by name.\n @finisher_inouts = {}\n\n # Create the namespaces for building the task, its readers\n # its writers and its accessers.\n\n # Creates the namespace of the task.\n @namespace = Namespace.new(self)\n # Make it give access to the internal of the class.\n @namespace.add_method(:runner_input, &method(:runner_input))\n @namespace.add_method(:runner_output, &method(:runner_output))\n @namespace.add_method(:runner_inout, &method(:runner_inout))\n # @namespace.add_method(:stopper_input, &method(:stopper_input))\n # @namespace.add_method(:stopper_output, &method(:stopper_output))\n # @namespace.add_method(:stopper_inout, &method(:stopper_inout))\n @namespace.add_method(:finisher_input, &method(:finisher_input))\n @namespace.add_method(:finisher_output, &method(:finisher_output))\n @namespace.add_method(:finisher_inout, &method(:finisher_inout))\n @namespace.add_method(:runner, &method(:runner))\n # @namespace.add_method(:stopper, &method(:stopper))\n @namespace.add_method(:finisher, &method(:finisher))\n\n # Creates the namespace of the runner.\n @runner_namespace = Namespace.new(self)\n # # Creates the namespace of the stopper.\n # @stopper_namespace = Namespace.new(self)\n # Creates the namespace of the finisher.\n @finisher_namespace = Namespace.new(self)\n @controller_namespace = Namespace.new(self)\n\n # Builds the task within a new scope.\n HDLRuby::High.space_push(@namespace)\n # puts \"top_user=#{HDLRuby::High.top_user}\"\n scope_name = @scope_name\n scope = nil\n HDLRuby::High.top_user.instance_eval do \n sub(scope_name) do\n # Generate the task code.\n ruby_block.call\n end\n end\n HDLRuby::High.space_pop\n\n # Keep access to the scope containing the code of the task.\n @scope = @namespace.send(scope_name)\n # puts \"@scope=#{@scope}\"\n # Adds the name space of the scope to the namespace of the\n # task\n @namespace.concat_namespace(@scope.namespace)\n\n # Gives access to the task by registering its name.\n obj = self\n # HDLRuby::High.space_reg(@name) { self }\n HDLRuby::High.space_reg(@name) { obj }\n end", "def initialize(*args)\n # was a neo java node provided ?\n if args.length == 1 && args[0].kind_of?(org.neo4j.graphdb.Node)\n # yes, it was loaded from the database\n init_with_node(args[0])\n elsif self.respond_to?(:init_node)\n # does the class provide an initialization method ?\n init_without_node({})\n init_node(*args)\n else\n # no, but maybe it had a hash of properties to initialize it with, create node\n init_without_node(args[0] || {})\n end\n # was a block given in order to initialize the neo4j node ?\n yield self if block_given?\n # must call super with no arguments so that chaining of the initialize method works\n super()\n end", "def node(*args)\n Node.new(self, *args)\n end", "def node(*args)\n Node.new(self, *args)\n end", "def initialize(options)\n logger.info(\"Redis Node Manager v#{VERSION} starting (#{RUBY_DESCRIPTION})\")\n @options = options\n @required_node_managers = options.fetch(:required_node_managers, 1)\n @root_znode = options.fetch(:znode_path, Util::DEFAULT_ROOT_ZNODE_PATH)\n @node_strategy = NodeStrategy.for(options.fetch(:node_strategy, :majority))\n @failover_strategy = FailoverStrategy.for(options.fetch(:failover_strategy, :latency))\n @nodes = Array(@options[:nodes]).map { |opts| Node.new(opts) }.uniq\n @master_manager = false\n @master_promotion_attempts = 0\n @sufficient_node_managers = false\n @lock = Monitor.new\n @shutdown = false\n end", "def initialize(chef_server_rest: nil, logger: nil)\n @chef_server_rest = chef_server_rest\n @name = nil\n @logger = logger || Chef::Log.with_child(subsystem: \"node\")\n\n @chef_environment = \"_default\"\n @primary_runlist = Chef::RunList.new\n @override_runlist = Chef::RunList.new\n\n @policy_name = nil\n @policy_group = nil\n\n @attributes = Chef::Node::Attribute.new({}, {}, {}, {}, self)\n\n @run_state = {}\n end", "def initialize(name,&ruby_block)\n # Checks and sets the name.\n @name = name.to_sym\n # Sets the block for instantiating a task.\n @ruby_block = ruby_block\n # Sets the instantiation procedure if named.\n return if @name.empty?\n obj = self\n HDLRuby::High.space_reg(@name) do |*args|\n obj.instantiate(*args)\n end\n end", "def initialize\n init\n end", "def create_new_graph\n self.graph = Deployment::Graph.new(self)\n end", "def initialize( max_queue_size, server_port, batch_time, realtime, backend, backend_params )\n mirror_hostlist=backend_params.split(',')\n @@log.info \"Initializing \"+backend+\" backend.\" \n cls = Object.const_get(backend)\n @sender_plugin = cls.new(mirror_hostlist);\n\n # Queue to store the data\n @data = SizedQueue.new(max_queue_size)\n @server_port = server_port\n @batch_time = batch_time\n @realtime = realtime\n end", "def initialize(opts={})\n self.verbosity = opts[:verbosity]\n self.can_install = opts[:install]\n\tself.manifest = \"init.pp\"\n self.node_manager = NodeManager.new(self)\n end", "def initialize(*args)\n # was a neo java node provided ?\n if args.length == 1 and args[0].kind_of?(org.neo4j.api.core.Node)\n Transaction.run {init_with_node(args[0])} unless Transaction.running?\n init_with_node(args[0]) if Transaction.running?\n elsif block_given? \n Transaction.run {init_without_node; yield self} unless Transaction.running? \n begin init_without_node; yield self end if Transaction.running? \n else \n Transaction.run {init_without_node} unless Transaction.running? \n init_without_node if Transaction.running? \n end\n \n # must call super with no arguments so that chaining of initialize method will work\n super() \n end", "def initialize(name, options = {})\n runtime = defined?(Runtime) ? Runtime : {}\n \n options = {\n :parent => runtime['Object'], \n :is_ghost => false, \n :is_module => false\n }.update(options)\n \n @name = name\n @runtime_methods = {}\n @parent = options[:parent]\n @is_ghost = options[:is_ghost]\n @is_module = options[:is_module]\n \n # Check if we're bootstrapping (launching the runtime). During this process the \n # runtime is not fully initialized and core classes do not yet exists, so we defer \n # using those once the language is bootstrapped.\n # This solves the chicken-or-the-egg problem with the Class class. We can \n # initialize Class then set Class.class = Class.\n runtime_class = runtime['Class']\n \n super runtime_class\n \n # Create the ghost class (if not already a ghost), deriving it from the ghost class of the current class's parent.\n # This will allow for the inheritance of the so called \"class\" methods.\n singleton_class(options[:parent].singleton_class) if !options[:is_ghost] && runtime_class\n end", "def initialize(superclass = 'Object', type = 'Dynamic', _ = [], name = 'Object')\n @runtime_methods = {}\n @runtime_class = Constants['Class']\n @runtime_superclass = Constants[superclass]\n @superclass_name = superclass\n @type = type\n\n @ruby_value = type\n @name = name\n end", "def initialize_runtime_fields\n @experiment = Experiment.find_by_id(self.experiment_id)\n @resources_interface = ExperimentResourcesInterface.new(@experiment, self.user_id, self.allowed_resource_configurations)\n @experiment_metrics = ExperimentMetrics.new(@experiment, @resources_interface)\n self\n end", "def node\n @node ||=\n begin\n node = Chef::Node.new(chef_server_rest: client_rest)\n node.name(node_name)\n node.run_list(normalized_run_list)\n node.normal_attrs = first_boot_attributes if first_boot_attributes\n node.environment(environment) if environment\n node.policy_name = policy_name if policy_name\n node.policy_group = policy_group if policy_group\n (config[:tags] || []).each do |tag|\n node.tags << tag\n end\n node\n end\n end", "def initialize\n dependencies = if defined?(::Rails)\n [:environment]\n else\n []\n end\n\n define_tasks(dependencies)\n end", "def initialize()\n @root = Node.new(nil)\n end", "def node\n @node ||= begin\n s = Ohai::System.new\n s.all_plugins\n s\n end\n end", "def initialize(options)\n @options = options\n @subscribers = []\n @discovered_nodes = []\n end", "def initialize (network_id)\n @network_id = network_id\n @node_list = []\n end", "def initialize\n DebugOutput.debug_level = DEBUG_LEVEL\n\n @is_running = false\n\n @parser = Parser.new self\n @tokenizer = Tokenizer.new\n @symbol_table = SymbolTable.new\n\n init_constants\n end", "def initialize(id, user=nil, timestamp=nil, nodes=[])\n @nodes = nodes\n super(id, user, timestamp)\n end", "def init\n if @args.first.nil?\n @ui.error('Please specify the node')\n return ARGUMENT_ERROR_RESULT\n end\n @mdbci_config = Configuration.new(@args.first, @env.labels)\n result = NetworkSettings.from_file(@mdbci_config.network_settings_file)\n if result.error?\n @ui.error(result.error)\n return ARGUMENT_ERROR_RESULT\n end\n\n @network_settings = result.value\n @product = @env.nodeProduct\n @product_version = @env.productVersion\n if @product.nil? || @product_version.nil?\n @ui.error('You must specify the name and version of the product')\n return ARGUMENT_ERROR_RESULT\n end\n\n @machine_configurator = MachineConfigurator.new(@ui)\n\n SUCCESS_RESULT\n end", "def build_node(*args)\n node_class.new(*args)\n end", "def initialize()\n begin\n puts \"Eis::Runner::init called\" if $DEBUG\n @loaded_modules = []\n generate_module_list()\n handle = InputHandler.new()\n set_environment()\n rescue ArgumentError =>e\n puts \"\\e[31mERROR\\e[0m: No config file given...\" + e\n puts \"--------------------------------------------\"\n raise\n end\n end", "def new_with_value(value)\n RuntimeObject.new(self, value)\n end", "def initialize\n @nodes_hash = Hash.new\n end", "def initialize(prefix, environment, node_ip, graphite_hosts, datacenter, environment_name)\n @prefix = prefix\n @environment = environment\n @node_ip = node_ip\n @graphite_hosts = graphite_hosts\n @datacenter = datacenter\n @environment_name = environment_name\n end", "def initialize\n @queue = Queue.new\n @workers = []\n @workers_count = 5\n end", "def initialize(server_url, command, nodes, timeout)\n @server_url = server_url\n @command = command\n @nodes = nodes.map { |n| n.name }\n @timeout = timeout\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n @rest = Chef::REST.new(Chef::Config[:chef_server_url])\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n end", "def initialize\n self.tasks = Array.new\n self.run_queue = Queue.new\n self.schedule\n end", "def initialize(*args, &block)\n super(&nil)\n synchronize { ns_initialize(*args, &block) }\n end", "def build\n raise \"Nodes must implement #build\"\n end", "def initialize(nodes_v, nodes_s)\n @nodes_v = nodes_v\n @nodes_s = nodes_s\n @cost = nil\n end", "def initialize\n\t\t@classes = Array.new\n\t\t# A set instead of the hashes would be a nicer choice, but \n\t\t# RubyToDot should not depend on any library to allow more complete graphs.\n\t\t@modules = Hash.new\n\t\t@ignored = Hash.new\n\t\t@ignored_tree = Hash.new\n\t\tset_defaults\n\tend", "def create params\n raise_start_server unless Server::node\n new params\n end", "def initialize(objects = nil)\n @nodes = []\n objects.each { |object| add_node(object) } if objects && !objects.empty?\n end", "def init_activation_nodes\n @activation_nodes = Array.new(@structure.length) do |n|\n Array.new(@structure[n], 1.0)\n end\n if not disable_bias\n @activation_nodes[0...-1].each {|layer| layer << 1.0 }\n end\n end", "def node_init node\n @messages\n end", "def initialize\n super\n # Default operators\n @evaluator = Evaluator.new self\n @expressor = Expressor.new self\n @evolver = Evolver.new self\n end", "def initialize\n require 'zmq'\n super\n end", "def initialize( generator = Generators::Universe::Basic, options = { :universe => { :size => 32 } } )\n\t\t\n\t\t@generator = generator\n\t\t@options = options\n\t\t@players = []\n\t\t@runner = create_simulation\n\t\t@instance = Instance.new\n\tend", "def initialize(stream, jid, nodename = nil, create_if_not_exist = true)\n super(stream,jid)\n @nodename = nodename\n @jid = jid\n @stream = stream\n\n if create_if_not_exist and not node_exist?\n # if no nodename is given a instant node will created\n # (if the service supports instant nodes)\n @nodename = create_node\n else\n get_subscriptions\n end\n end", "def initialize main_scope, options={}\n require 'redis'\n begin\n require 'redis-namespace'\n rescue LoadError\n require 'redis/namespace'\n end\n @main_scope = main_scope\n @redis = Redis.new(options)\n @namespace = options[:namespace] || 'graphiterb'\n @accumulators = Redis::Namespace.new(namespace, :redis => redis)\n end", "def initialize\n require 'java'\n \n naether_jar = Naether::Configuration.naether_jar\n \n @loaded_paths = []\n \n load_paths(naether_jar) \n @class_loader = com.tobedevoured.naether.PathClassLoader.new()\n internal_load_paths(naether_jar) \n end", "def initialize(data)\n @node_data = data\n end", "def run\n node = Node.new(:instance_type => Aws.instance_type, :instance_id => Aws.instance_id)\n node.save\n write_pid\n process_loop\n end", "def initialize(info = {})\n super\n\n # Initialize the pending_connections counter to 0\n self.pending_connections = 0\n\n # Initialize the sessions counter to 0\n self.sessions = 0\n\n # Create the waiter event with auto_reset set to false so that\n # if a session is ever created, waiting on it returns immediately.\n self.session_waiter_event = Rex::Sync::Event.new(false, false)\n end", "def initialize(interpreter)\n @app = interpreter\n @state = :ready\n @state_arg = nil\n end", "def initialize\n @root_node = Node.new\n end", "def initialize(site, environment, nodes, options = {})\n @site = site\n @environment = environment\n @nodes = nodes\n @good_nodes = []\n @bad_nodes = Array.new(@nodes)\n @api_options = options\n\n if @api_options[:ssh_public_key]\n @api_options[:key] = @ssh_public_key = @api_options.delete(:ssh_public_key)\n end\n submit_deployment\n end", "def instantiate_node(node_type,*args)\n if node_type.respond_to? :new \n node_type.new(*args)\n else\n SyntaxNode.new(*args).extend(node_type)\n end\n end", "def initialize(nodes_fragement)\n @nodes_xml = nodes_fragement\n @children = set_children\n end", "def initialize(center)\n @nodes = []; @edges = []\n @center = center\n end", "def node\n return @node if @node\n\n @node = client.build_node\n @node.instance_variable_set(:@runner, self)\n @node.class.send(:attr_reader, :runner)\n @node\n end", "def initialize\n @id = self.class.uid\n @connections = Connections.new({}, {}, {})\n @error = Error.new(0.0, 0.0, 0.0)\n @trace = Trace.new({}, {}, {})\n\n @state = @old = @activation = 0.0\n @selfconnection = Synaptical::Connection.new(self, self, 0.0)\n @squash = Synaptical::Squash::Logistic\n @neighbors = {}\n @bias = rand * 0.2 - 0.1\n end" ]
[ "0.58970994", "0.58326286", "0.5754967", "0.5741659", "0.56740236", "0.56740236", "0.5673526", "0.56384444", "0.55885", "0.5552643", "0.55380803", "0.5520146", "0.55010283", "0.5471777", "0.54543453", "0.5453141", "0.54517883", "0.5444576", "0.5435255", "0.5383976", "0.5352716", "0.53352255", "0.5333064", "0.53269196", "0.5294917", "0.5281458", "0.524572", "0.5245035", "0.5244544", "0.5237039", "0.5222728", "0.5189703", "0.51806486", "0.51712954", "0.51625395", "0.51573545", "0.5156152", "0.5148065", "0.5126363", "0.51177126", "0.511034", "0.5105633", "0.51046866", "0.5100594", "0.5098203", "0.50883603", "0.507906", "0.507906", "0.50757825", "0.506981", "0.5063141", "0.50552315", "0.5052219", "0.50485224", "0.50451934", "0.5039187", "0.5039109", "0.5039105", "0.5034501", "0.5034199", "0.5031001", "0.5009767", "0.5009546", "0.50025254", "0.5001995", "0.4990433", "0.4983182", "0.4983132", "0.49826622", "0.49767563", "0.4973988", "0.49726313", "0.49690294", "0.49637854", "0.4959372", "0.4950359", "0.4946127", "0.49455246", "0.49413872", "0.49401155", "0.4937303", "0.4935306", "0.49344575", "0.4930862", "0.49303967", "0.4923456", "0.4922881", "0.49222657", "0.49211547", "0.4920768", "0.4917845", "0.49103308", "0.49100253", "0.49086696", "0.48999104", "0.4897791", "0.489774", "0.4895924", "0.48945805", "0.48930332", "0.48904338" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_section @section = Section.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def section_params params.require(:section).permit(:name, :semester, :schedule, :teacher_id, :subject_id, teaching_loads_attributes: [:teacher_id, :subject_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_debt_management3 @debt_management3 = DebtManagement3.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def debt_management3_params params.require(:debt_management3).permit(:Public_Debt_Repayment_Liabilities, :Amounts, :Year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
GET /categories GET /categories.xml
def index if params[:category] @search = Category.search :name_like => params[:category][:name] params.clear else @search = Category.search(params[:search]) end @categories = @search.paginate(:per_page => "20", :page => params[:page]) redirect_to admin_category_path(@categories.first, params) and return if (@categories.size.eql?(1)) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @categories } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @roots = Category.roots\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def categories\n get('venues/categories').categories\n end", "def catses\n REXML::XPath.match(@xml, './app:categories', Names::XmlNamespaces)\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end", "def index\n @categories = Category.roots\n end", "def index\n @categories=Category.root\n respond_with @categories\n end", "def list_customer_categories\n doc = Hpricot::XML(request.raw_post) \n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc)\n @customer_categories = Customer::CustomerCrud.list_customer_categories(doc)\n render_view( @customer_categories,'customer_categories','L')\n end", "def index\r\n @categories = Category.find(:all)\r\n respond_to do |format|\r\n format.html\r\n format.atom\r\n end\r\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def index \t\n @categories = Category.pages(params[:page], params[:q]) \t\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @categories }\r\n end\r\n end", "def index\n @tags = @category.tags.all\n\n respond_to do |format|\n format.html { redirect_to @category }\n format.xml { render :xml => @tags }\n end\n end", "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def list\n\t\t@ssccategories = Ssccategory.paginate :page => params[:page], :per_page => 10\t#Pagination for 10 Records\n \trespond_to do |format|\t\t\n \t\t format.html # list.html.erb\n \t\t\tformat.xml { render :xml => @ssccategories }\t#Render to XML File\n \tend\n\tend", "def index\n @categories = CategoryService.index\n end", "def index\n @post_categories = PostCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @post_categories }\n end\n end", "def get_categories\n @categories = Category.all\n end", "def index\n @list_cats = ListCat.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_cats }\n end\n end", "def index\n respond_to do |format|\n format.html do\n @recipe_categories = RecipeCategory.paginate(:page => params[:page], :order => 'name', :per_page => 5)\n end # index.html.haml\n format.xml do\n @recipe_categories = RecipeCategory.find(:all, :order => 'name')\n render :xml => @recipe_categories\n end\n end\n end", "def index\n\t@categories = Category.all\n\tend", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def index\n respond_with Category.all\n end", "def index\n @books_categories = BooksCategory.all(:order => \"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books_categories }\n end\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def show\n @title = t(\"h2.categories\")\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def category(id)\n response = establish_connection(\"categories/#{id}.xml\")\n parse_single_category_xml(response.at(:category))\n end", "def index\n @information_categories = InformationCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @information_categories }\n end\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @category }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def index\n @training_categories = @ministry.training_categories\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @training_categories }\n end\n end", "def index\n @asset_categories = AssetCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asset_categories }\n end\n end", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "def index\n sort_by = params[:sort_by]\n sort_by ||= :id\n @categories = Category.find(:all, :order => sort_by)\n \n respond_to do |wants|\n wants.html\n wants.xml\n end\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def index\n @department_categories = DepartmentCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @department_categories }\n end\n end", "def index\n redirect_to category_child_url(@main_category,@category)\n #@descriptions = @category.descriptions\n #respond_to do |format|\n # format.xml\n #end\n end", "def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end", "def index\n if params[:roots]\n @categories = Category.roots\n else\n @categories = Category.children\n end\n\n @categories = @categories.paginate(:page => params[:page], :per_page => 25)\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n\n\n @categories = Category.all\n @htmlmenu = infoaddresstree\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n\n end", "def index\n @categories = collections_config.values\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def index\r\n @ccategories = Ccategory.all\r\n\t@cart = current_cart\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @ccategories }\r\n end\r\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def index\n @categoria_comidas = CategoriaComida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categoria_comidas }\n end\n end", "def index\n @categories = Category.all\n end", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @category = Category.new\n \n @categories = Category.find_all_by_parent_id(nil)\n @parent_categories_options = get_category_options_array \n @default_parent_option = \"\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def categories\n []\n end", "def show\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @recipe_category }\n end\n end", "def index\n @categories = Category.all\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def categories\n # list results from search results piped in from side nav categories\n @experiments = Experiment.find(:status => true)\n respond_to do |format|\n format.html { render :action => \"list\" }\n format.xml { render :xml => @experiments }\n end\n\n end", "def show\n\t\t@ssccategory = Ssccategory.find(params[:id])\n \trespond_to do |format|\n \t\t format.html # show.html.erb\n \t\t\tformat.xml { render :xml => @ssccategories }\n \tend\n\t\t\n\tend" ]
[ "0.7949818", "0.73486304", "0.73486304", "0.73188496", "0.7292199", "0.7285156", "0.7230788", "0.71587074", "0.7076353", "0.7019252", "0.70091593", "0.69999546", "0.697133", "0.68882805", "0.6817585", "0.6806651", "0.6784837", "0.6759062", "0.675618", "0.66560626", "0.6647625", "0.66363066", "0.66316384", "0.66075736", "0.6601813", "0.6598359", "0.6592821", "0.6577886", "0.6575714", "0.65721637", "0.65660036", "0.6558827", "0.6554133", "0.6533696", "0.65267557", "0.6523985", "0.65224534", "0.6521481", "0.6518879", "0.65180326", "0.65090936", "0.649797", "0.64766127", "0.6475725", "0.6475725", "0.64676285", "0.6463684", "0.6457397", "0.6447099", "0.64447975", "0.64425427", "0.6434409", "0.6430323", "0.6424991", "0.6424314", "0.64142245", "0.64037293", "0.63945895", "0.6389218", "0.63873035", "0.63863987", "0.6385598", "0.6383003", "0.6382282", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.63766783", "0.6375023", "0.6352023", "0.63514274", "0.6346029", "0.6345902", "0.63059765", "0.6301132", "0.6296591", "0.62877315", "0.62790006", "0.62790006", "0.6269224", "0.62690026" ]
0.0
-1
GET /categories/1 GET /categories/1.xml
def show @category = Category.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @roots = Category.roots\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def category(id)\n response = establish_connection(\"categories/#{id}.xml\")\n parse_single_category_xml(response.at(:category))\n end", "def show\n @title = t(\"h2.categories\")\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @category }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @menus }\n end\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def show\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @recipe_category }\n end\n end", "def index\n @list_cats = ListCat.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_cats }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end", "def index\n redirect_to category_child_url(@main_category,@category)\n #@descriptions = @category.descriptions\n #respond_to do |format|\n # format.xml\n #end\n end", "def index \t\n @categories = Category.pages(params[:page], params[:q]) \t\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @categories }\r\n end\r\n end", "def index\n respond_to do |format|\n format.html do\n @recipe_categories = RecipeCategory.paginate(:page => params[:page], :order => 'name', :per_page => 5)\n end # index.html.haml\n format.xml do\n @recipe_categories = RecipeCategory.find(:all, :order => 'name')\n render :xml => @recipe_categories\n end\n end\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def index\n @categories=Category.root\n respond_with @categories\n end", "def index\n @categories = Category.roots\n end", "def index\n @post_categories = PostCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @post_categories }\n end\n end", "def index\r\n @categories = Category.find(:all)\r\n respond_to do |format|\r\n format.html\r\n format.atom\r\n end\r\n end", "def index\n @tags = @category.tags.all\n\n respond_to do |format|\n format.html { redirect_to @category }\n format.xml { render :xml => @tags }\n end\n end", "def show\n @categorization = Categorization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categorization }\n end\n end", "def show\r\n @category = Category.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @category }\r\n end\r\n end", "def catses\n REXML::XPath.match(@xml, './app:categories', Names::XmlNamespaces)\n end", "def index\n @information_categories = InformationCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @information_categories }\n end\n end", "def index\n @category = Category.new\n \n @categories = Category.find_all_by_parent_id(nil)\n @parent_categories_options = get_category_options_array \n @default_parent_option = \"\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def show\n\t\t@ssccategory = Ssccategory.find(params[:id])\n \trespond_to do |format|\n \t\t format.html # show.html.erb\n \t\t\tformat.xml { render :xml => @ssccategories }\n \tend\n\t\t\n\tend", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def list_customer_categories\n doc = Hpricot::XML(request.raw_post) \n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc)\n @customer_categories = Customer::CustomerCrud.list_customer_categories(doc)\n render_view( @customer_categories,'customer_categories','L')\n end", "def show\n @categorie = Categorie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categorie }\n end\n end", "def index\n @books_categories = BooksCategory.all(:order => \"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books_categories }\n end\n end", "def index\n @asset_categories = AssetCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asset_categories }\n end\n end", "def index\n sort_by = params[:sort_by]\n sort_by ||= :id\n @categories = Category.find(:all, :order => sort_by)\n \n respond_to do |wants|\n wants.html\n wants.xml\n end\n end", "def show\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def index\n @training_categories = @ministry.training_categories\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @training_categories }\n end\n end", "def list\n\t\t@ssccategories = Ssccategory.paginate :page => params[:page], :per_page => 10\t#Pagination for 10 Records\n \trespond_to do |format|\t\t\n \t\t format.html # list.html.erb\n \t\t\tformat.xml { render :xml => @ssccategories }\t#Render to XML File\n \tend\n\tend", "def index\n @categories = CategoryService.index\n end", "def index\n @department_categories = DepartmentCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @department_categories }\n end\n end", "def index\r\n @ccategories = Ccategory.all\r\n\t@cart = current_cart\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @ccategories }\r\n end\r\n end", "def index\n\t@categories = Category.all\n\tend", "def show\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def show\n @list_cat = ListCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_cat }\n end\n end", "def show\n @otml_category = OtrunkExample::OtmlCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @otml_category }\n end\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @categoria_comidas = CategoriaComida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categoria_comidas }\n end\n end", "def index\n if params[:roots]\n @categories = Category.roots\n else\n @categories = Category.children\n end\n\n @categories = @categories.paginate(:page => params[:page], :per_page => 25)\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def show\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe_category }\n end\n end", "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def index\n\n\n @categories = Category.all\n @htmlmenu = infoaddresstree\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n\n end", "def index\n respond_with Category.all\n end", "def index\n @category_collections = CategoryCollection.all\n session[:current_location] = categories_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @collection_categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def categories\n get('venues/categories').categories\n end", "def new\n @categorization = Categorization.new\n @categories = category_list\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categorization }\n end\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end", "def show\n @page_title = params[:id].capitalize\n @things = Thing.paginate(:page => page, :per_page => Setting.articles_per_page, :order => \"created_at DESC\", 'categories.name' => params[:id])\n @sources = Source.all('categories.name' => params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @business_categories = BusinessCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @business_categories }\n end\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def index\n @categories = Categorie.find(:all, :conditions => {:parametres_cabinet_id => current_user.parametres_cabinet_id})\n\n respond_to do |format|\n format.html {render :layout => \"light\"} # index.html.erb\n format.xml { render :xml => @categories }\n format.json {render :json => {\"success\"=>true,\"data\"=>@categories}}\n \n end\n end", "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def index\n @category=Category.find(params[:category_id])\n @novels =@category.novels\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @novels }\n end\n end", "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end" ]
[ "0.75137776", "0.73183477", "0.73183477", "0.7282174", "0.7237171", "0.6928893", "0.6908232", "0.6871056", "0.6851294", "0.68342465", "0.6810015", "0.6787032", "0.6780212", "0.66883856", "0.66748106", "0.66291744", "0.66271156", "0.66271156", "0.662619", "0.6606129", "0.65962535", "0.65951264", "0.65941674", "0.65838313", "0.65763825", "0.6575215", "0.6558156", "0.65500766", "0.6523145", "0.6519237", "0.6514723", "0.65139985", "0.65038264", "0.64952636", "0.6494391", "0.64908797", "0.64904577", "0.64807826", "0.6474831", "0.6470762", "0.64682573", "0.6419531", "0.6402342", "0.6398493", "0.63929343", "0.6385382", "0.6372084", "0.6346548", "0.63072526", "0.6301965", "0.62991756", "0.6298498", "0.62963784", "0.6290078", "0.62876827", "0.62757546", "0.62757474", "0.62755805", "0.6269164", "0.62623495", "0.62540925", "0.6253262", "0.6253262", "0.6238776", "0.6232016", "0.6231068", "0.6228037", "0.6226816", "0.6224689", "0.62214255", "0.62135166", "0.6204493", "0.6196555", "0.6194681", "0.6193902", "0.6193449", "0.618837", "0.618594", "0.6177873", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557", "0.6165557" ]
0.6690318
13
GET /categories/new GET /categories/new.xml
def new @category = Category.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @category } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @title = t(\"h2.categories\")\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end", "def new\n @tag = @category.tags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end", "def new\n @collection = Collection.find(params[:collection_id])\n @category_collection = CategoryCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category_collection }\n end\n end", "def new\n @categorization = Categorization.new\n @categories = category_list\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categorization }\n end\n end", "def new\n puts @category.inspect\n @internal = @category.internals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internal }\n end\n end", "def new\n @categorie = Categorie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categorie }\n end\n end", "def new\n @activity = Activity.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end", "def new\n# @category = Category.by_company(current_company.id).new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @news_category = NewsCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_category }\n end\n end", "def new\n @category_page = CategoryPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category_page }\n end\n end", "def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categoria }\n end\n end", "def new\n @list_cat = ListCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_cat }\n end\n end", "def new\n @recipe_category = RecipeCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe_category }\n end\n end", "def new\n @story = Story.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end", "def new\n @category = Category.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @menu = Menu.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu }\n end\n end", "def new\n @category = Category.new\n @rollover = Rollover.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category}\n end\n end", "def new\n @article = Article.new\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @article = Article.new\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end", "def new\n @otml_category = OtrunkExample::OtmlCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @otml_category }\n end\n end", "def new\n @article_category = ArticleCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_category }\n end\n end", "def new\n @post_category = PostCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post_category }\n end\n end", "def new\n @project_category = ProjectCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_category }\n end\n end", "def new\n @recipe_category = RecipeCategory.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @recipe_category }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\r\n @ccategory = Ccategory.new\r\n @titles = ptitles\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @ccategory }\r\n end\r\n end", "def new\n category\n @categories = Category.order('name')\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end", "def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end", "def new\n\t @category = Category.new\n\n\t respond_to do |format|\n\t\tformat.html # new.html.erb\n\t end\n\tend", "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", "def new\n @books_category = BooksCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @books_category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @menu }\n end\n end", "def new\n @admin_section = true\n @course_category = CourseCategory.new\n @page_title = \"New Course Category\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @course_category }\n end\n end", "def new\n @parent_id = params[:parent_id]\n @category = Category.new(:parent_id => @parent_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def new\n @information_category = InformationCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @information_category }\n end\n end", "def new\n @category = current_mall.categories.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @component_category = ComponentCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @component_category }\n end\n end", "def new\n @post_category = PostCategory.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post_category }\n end\n end", "def new\n @element = Element.new\n @root_category = Category.find(272)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @element }\n end\n end", "def new\n @categorymaster = Categorymaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categorymaster }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @nspirefile = Nspirefile.new\n @categories = get_categories\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nspirefile }\n end\n end", "def new\n @blog_category = BlogCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_category }\n end\n end", "def new\n @category = Category.new\n\n # @categories = Category.all\n\n # respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @category }\n # end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @book = Book.new\n @categories = Category.order(:names_depth_cache).map { |c| [\"-\" * c.depth + c.name,c.id] }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "def new\n @contact_category = ContactCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact_category }\n end\n end", "def new\n @taxonomy_category = TaxonomyCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_category }\n end\n end", "def new\n @asset_category = AssetCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset_category }\n end\n end", "def new\n @category2 = Category2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category2 }\n end\n end", "def new\n @topic = Topic.new\n @super_categories = Topic.ordered_roots\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @topic }\n end\n end", "def new\n @classified_person_category = ClassifiedPersonCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified_person_category }\n end\n end", "def new\n @category = Category.new\n @title = \"Новая категория\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @feature_category = FeatureCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feature_category }\n end\n end", "def new\n @categoria_comida = CategoriaComida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categoria_comida }\n end\n end", "def new\n @post = Post.new\n @categoria = Categorium.find(:all, :order => 'nombre ASC').collect {|m| [m.nombre, m.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => [@post, @categoria] }\n end\n end", "def new\n @category = Category.new\n respond_with do |format|\n format.html { render :new, :layout => false}\n end\n end", "def create\n @cat = Cat.new(params[:cat])\n\n respond_to do |format|\n if @cat.save\n format.html { redirect_to(@cat, :notice => 'Cat was successfully created.') }\n format.xml { render :xml => @cat, :status => :created, :location => @cat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @sotto_categoria = SottoCategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sotto_categoria }\n end\n end", "def new\n @art_category = ArtCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @art_category }\n end\n end", "def new\n\t\t@book = Book.new\n\t\t@all_categories = get_all_categories\n\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\tend\n\tend", "def new\n @activity = Activity.new\n @attcategories = Attcategory.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end", "def new\n @category = Category.new\n respond_with(@category)\n end", "def new\n @category = Category.new\n respond_with(@category)\n end", "def new\n @category = Category.new\n respond_with(@category)\n end", "def new\n @feed_category = FeedCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @feed_category }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @retailer_category = RetailerCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retailer_category }\n end\n end", "def new\n @business_category = BusinessCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @business_category }\n end\n end", "def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(admin_categories_path) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @cat = Category.new\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @faq_category }\n end\n end", "def new\r\n @post = Post.new\r\n @categories = Category.order('name ASC')\r\n\r\n respond_to do |format|\r\n format.html { render :layout => 'admin' }\r\n format.xml { render :xml => @post }\r\n end\r\n end", "def new\n @goods_categories = GoodsCategory.roots\n @goods_category = GoodsCategory.new\n\n respond_to do |format|\n format.html {render action: \"index\"}\n format.json { render json: @goods_category }\n end\n end", "def new\n @documentocategoria = Documentocategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentocategoria }\n end\n end", "def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category_type = CategoryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_type }\n end\n end", "def new\n @news = News.new\n @cats = News.all.distinct(:category)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "def new\n @categorias_tipo = CatTipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorias_tipo }\n end\n end", "def new\n\t\t@category = Category.new\n\tend", "def new\n\t\t@category = Category.new\n\tend", "def new\r\n @administration_category = Category.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @administration_category }\r\n end\r\n end" ]
[ "0.760369", "0.760369", "0.760369", "0.760369", "0.7591787", "0.74941653", "0.7377025", "0.73087305", "0.7287367", "0.72565544", "0.7239733", "0.72310567", "0.7174033", "0.7167501", "0.7121368", "0.711047", "0.71100324", "0.7090954", "0.70723087", "0.70644605", "0.7063358", "0.7063358", "0.7063358", "0.7063358", "0.7063358", "0.7063358", "0.7063358", "0.7063358", "0.7063358", "0.70621234", "0.7047826", "0.7024981", "0.7024775", "0.7024775", "0.69979393", "0.6992419", "0.6990727", "0.69713837", "0.69675195", "0.69673723", "0.69489795", "0.694642", "0.6938474", "0.6938474", "0.69219196", "0.691364", "0.6908066", "0.69054115", "0.69040793", "0.6898654", "0.6886536", "0.6880275", "0.687527", "0.6859833", "0.68595976", "0.68517625", "0.6847053", "0.6838326", "0.6830324", "0.68182844", "0.6793939", "0.6793939", "0.67843556", "0.6781261", "0.6762286", "0.6755512", "0.675152", "0.67513573", "0.67469764", "0.6732951", "0.672472", "0.6718677", "0.6712582", "0.67031944", "0.6695388", "0.66879743", "0.6677232", "0.6676694", "0.6672985", "0.66680485", "0.66680485", "0.66680485", "0.6662242", "0.66584563", "0.66538084", "0.66522086", "0.66203886", "0.66147983", "0.660577", "0.6605484", "0.6599331", "0.6593122", "0.65927637", "0.6585402", "0.6583996", "0.6583618", "0.65790474", "0.6573651", "0.6573651", "0.65735424" ]
0.76277685
0
POST /categories POST /categories.xml
def create @category = Category.new(params[:category]) respond_to do |format| if @category.save flash[:notice] = 'Kategoria została stworzona poprawnie.' format.html { redirect_to([:admin, @category]) } format.xml { render :xml => @category, :status => :created, :location => @category } else format.html { render :action => "new" } format.xml { render :xml => @category.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end", "def test_find_categories\n @request.env[\"RAW_POST_DATA\"] = \"act\"\n xhr :post, :find_categories, :type => 1, :name => 'genre'\n assert_success\n assert @response.body.include?('add_genre(\\'' + categories(:action).id.to_s + '\\');')\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(admin_categories_path) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n flash[:success] = 'Category was successfully created.'\n format.html { redirect_to(admin_categories_url) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n flash[:error] = 'Category could not be created. See errors below.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.create(params[:category])\n respond_with(@category, location: categories_url)\n end", "def create\n @category = @collection.categories.new(category_params)\n\n if @category.save\n ActionCable.server.broadcast 'categories',\n title: @category.title,\n collection_id: @category.collection_id\n head :ok\n else\n\n end\n end", "def create\n @categories = Category.all\n\n @category = Category.create(category_params)\n flash[:notice]=\"Catégorie créer avec succès!!!\"\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def postCategoryMappings( category_id, type, id, name)\n params = Hash.new\n params['category_id'] = category_id\n params['type'] = type\n params['id'] = id\n params['name'] = name\n return doCurl(\"post\",\"/category/mappings\",params)\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to(@category, :notice => 'Category was successfully created.') }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to(@category, :notice => 'Category was successfully created.') }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to(@categoria, :notice => 'Categoria was successfully created.') }\n format.xml { render :xml => @categoria, :status => :created, :location => @categoria }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(@category) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def list_customer_categories\n doc = Hpricot::XML(request.raw_post) \n doc = doc.to_s.gsub(\"&amp;\",\"&\") \n doc = Hpricot::XML(doc)\n @customer_categories = Customer::CustomerCrud.list_customer_categories(doc)\n render_view( @customer_categories,'customer_categories','L')\n end", "def create\n json_create(category_params, Category)\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorie = Categorie.new(params[:categorie])\n\n if @categorie.save\n redirect_to :action => :index\n else\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorie.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n category = Documents::Category.create(category_params)\n if category.save\n redirect_to categories_path\n else\n redirect_to categories_path, alert: I18n.t('admin.categories.validation_error')\n end\n end", "def post_category(category_name, options={ })\n self.post('/categories.json',\n options.merge(\n :body => { :category => {\n :name => category_name\n } }.to_json\n )\n )['category']\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Категория добавлена.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def new\n @categorization = Categorization.new\n @categories = category_list\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @categorization }\n end\n end", "def create\n @cat = Cat.new(params[:cat])\n\n respond_to do |format|\n if @cat.save\n format.html { redirect_to(@cat, :notice => 'Cat was successfully created.') }\n format.xml { render :xml => @cat, :status => :created, :location => @cat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n flash[:notice] = '分类创建成功.'\n format.html { redirect_to(cpanel_categories_url) }\n format.xml { render :xml => @menu, :status => :created, :location => @menu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @menu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Категория была успешно создана'}\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n flash[:notice] = 'Category was successfully created.'\n format.html { redirect_to(categories_url) }\n format.xml { render :xml => @category, :status => :created, :location => @category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n @categoria = Categorium.find(:all, :order => 'nombre ASC').collect {|m| [m.nombre, m.id]}\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Un nuevo post creado.') }\n format.xml { render :xml => [@post, @categoria], :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => [@post.errors, @categoria], :status => :unprocessable_entity }\n end\n end\n end", "def create\n @categories_post = CategoriesPost.new(categories_post_params)\n\n respond_to do |format|\n if @categories_post.save\n format.html { redirect_to @categories_post, notice: 'Categories post was successfully created.' }\n format.json { render :show, status: :created, location: @categories_post }\n else\n format.html { render :new }\n format.json { render json: @categories_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category_collection = CategoryCollection.new(params[:category_collection])\n @collection = @category_collection.collection\n\n respond_to do |format|\n if @category_collection.save\n flash[:notice] = 'CategoryCollection was successfully created.'\n format.html { redirect_to(@collection) }\n format.xml { render :xml => @category_collection, :status => :created, :location => @category_collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category_collection.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_categories_url, notice: 'Добавлена новая категоря.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @recipe_category = RecipeCategory.new(params[:recipe_category])\n\n respond_to do |format|\n if @recipe_category.save\n flash[:notice] = l(:flash_notice_recipe_category_created)\n format.html { redirect_to RecipeCategory.new }\n format.xml { render :xml => @recipe_category, :status => :created, :location => @recipe_category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def fetch_categories\r\n page = File.open(\"#{Rails.root}/public/Categories.html\") { |f| Nokogiri::HTML(f) }\r\n Category.save_fetched_categories_and_subcategories(page)\r\n end", "def create\n @recipe_category = RecipeCategory.new(params[:recipe_category])\n\n respond_to do |format|\n if @recipe_category.save\n flash[:notice] = 'RecipeCategory was successfully created.'\n format.html { redirect_to(@recipe_category) }\n format.xml { render :xml => @recipe_category, :status => :created, :location => @recipe_category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post_category = PostCategory.new(params[:post_category])\n \n respond_to do |format|\n if @post_category.save\n format.html { redirect_to(@post_category, :notice => 'Category was successfully created.') }\n format.xml { render :xml => @post_category, :status => :created, :location => @post_category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_url, notice: 'Category was successfully created.' }\n end\n end\n end", "def create\n @taxonomy_category = TaxonomyCategory.new(params[:taxonomy_category])\n\n respond_to do |format|\n if @taxonomy_category.save\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully created.' }\n format.json { render json: @taxonomy_category, status: :created, location: @taxonomy_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @ccategory = Ccategory.new(params[:ccategory])\r\n @titles = ptitles\r\n\r\n respond_to do |format|\r\n if @ccategory.save\r\n format.html { redirect_to(@ccategory, :notice => 'Ccategory was successfully created.') }\r\n format.xml { render :xml => @ccategory, :status => :created, :location => @ccategory }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @ccategory.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end", "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно создана\" }\n format.json { render :show, status: :created, location: adminpanel_categories_path }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def uhook_create_category\n category = ::Category.new(params[:category])\n category.locale = current_locale\n category\n end", "def create\n @post_category = PostCategory.new(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n flash[:notice] = 'PostCategory was successfully created.'\n format.html { redirect_to(@post_category) }\n format.xml { render :xml => @post_category, :status => :created, :location => @post_category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #...\n params[:cat].permit(...:tag_ids: []) #allow tag_ids and expect it to be an Array\n end", "def catses\n REXML::XPath.match(@xml, './app:categories', Names::XmlNamespaces)\n end", "def postEntityCategory( entity_id, category_id, category_type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['category_id'] = category_id\n params['category_type'] = category_type\n return doCurl(\"post\",\"/entity/category\",params)\n end", "def create\n @otml_category = OtrunkExample::OtmlCategory.new(params[:otml_category])\n\n respond_to do |format|\n if @otml_category.save\n flash[:notice] = 'OtrunkExample::OtmlCategory was successfully created.'\n format.html { redirect_to(@otml_category) }\n format.xml { render :xml => @otml_category, :status => :created, :location => @otml_category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @otml_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @categories = Category.where(validity: true)\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:category_created) }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Category.create\n\n redirect_to admin_ads_path\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag = @category.tags.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to([@category,@tag], :notice => 'Tag was successfully created.') }\n format.xml { render :xml => @tag, :status => :created, :location => [@category,@tag] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @mk_categoria = MkCategoria.new(mk_categoria_params)\n\n respond_to do |format|\n if @mk_categoria.save\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully created.' }\n format.json { render :show, status: :created, location: @mk_categoria }\n else\n format.html { render :new }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_avail_category\n file = ::File.new(\"#{node['opennms']['conf']['home']}/etc/categories.xml\", \"r\")\n doc = REXML::Document.new file\n file.close\n cg_el = doc.elements[\"/catinfo/categorygroup[name[text()[contains(.,'#{new_resource.category_group}')]]]/categories\"]\n cat_el = cg_el.add_element 'category'\n label_el = cat_el.add_element 'label'\n label_el.add_text(REXML::CData.new(new_resource.label))\n comment_el = cat_el.add_element 'comment'\n comment_el.add_text new_resource.comment\n normal_el = cat_el.add_element 'normal'\n normal_el.add_text \"#{new_resource.normal}\" # really ruby? really?\n warning_el = cat_el.add_element 'warning'\n warning_el.add_text \"#{new_resource.warning}\"\n new_resource.services.each do |s|\n s_el = cat_el.add_element 'service'\n s_el.add_text s\n end\n rule_el = cat_el.add_element 'rule'\n rule_el.add_text(REXML::CData.new(new_resource.rule))\n out = \"\"\n formatter = REXML::Formatters::Pretty.new(2)\n formatter.compact = true\n formatter.write(doc, out)\n ::File.open(\"#{node['opennms']['conf']['home']}/etc/categories.xml\", \"w\"){ |file| file.puts(out) }\nend", "def index\n @roots = Category.roots\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def categories=(categories)\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def create\n @category = CategoryService.create\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category_form_url = forum_categories_path\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category]) \n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:created_category_success)}\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n redirect_to category_child_url(@main_category,@category)\n #@descriptions = @category.descriptions\n #respond_to do |format|\n # format.xml\n #end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html {\n redirect_to @category, notice: 'Category was successfully created.'\n }\n format.json {\n render json: @category, status: :created, location: @category\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :created }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories=(value)\n @categories = value\n end", "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully created.' }\n format.json { render json: @categoria, status: :created, location: @categoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sotto_categoria = SottoCategoria.new(params[:sotto_categoria])\n\n respond_to do |format|\n if @sotto_categoria.save\n format.html { redirect_to(@sotto_categoria, :notice => 'Sotto categoria was successfully created.') }\n format.xml { render :xml => @sotto_categoria, :status => :created, :location => @sotto_categoria }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sotto_categoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(category_params)\n authorize! :create, @category\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def create\n @xcategory = Xcategory.new(xcategory_params)\n\n respond_to do |format|\n if @xcategory.save\n format.html { redirect_to @xcategory, notice: 'Xcategory was successfully created.' }\n format.json { render :show, status: :created, location: @xcategory }\n else\n format.html { render :new }\n format.json { render json: @xcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to Category.find(@category.category_id), notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6691622", "0.6525031", "0.6454988", "0.6193545", "0.6099787", "0.6094962", "0.60859716", "0.6065166", "0.6060535", "0.6051126", "0.604862", "0.6043285", "0.60214573", "0.6020132", "0.6020132", "0.60124165", "0.5995836", "0.5967278", "0.59510535", "0.5931672", "0.591819", "0.58904475", "0.5876409", "0.5873543", "0.58653307", "0.5861762", "0.58550394", "0.58542717", "0.5844224", "0.58401924", "0.5839151", "0.58277905", "0.58119464", "0.57994497", "0.57771224", "0.57751065", "0.57717717", "0.5760711", "0.5760195", "0.57559", "0.5751908", "0.5743955", "0.57431036", "0.5742734", "0.5734475", "0.5732322", "0.57309854", "0.5718495", "0.5714416", "0.57105654", "0.570784", "0.570747", "0.5706628", "0.5697827", "0.56901854", "0.5687385", "0.56790227", "0.5675636", "0.56705046", "0.56700486", "0.5667871", "0.5667059", "0.5666897", "0.56644195", "0.56642693", "0.56560963", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.56551826", "0.565078", "0.565078", "0.565078", "0.565078", "0.565078", "0.56488115", "0.5646516", "0.56461126", "0.56392574", "0.5637894", "0.5627126", "0.56127304", "0.56114364", "0.56104636", "0.5610037", "0.5609791", "0.56015295", "0.56000423", "0.55957866", "0.55885655", "0.55885595", "0.55853057", "0.5583992" ]
0.6010239
16
PUT /categories/1 PUT /categories/1.xml
def update @category = Category.find(params[:id]) respond_to do |format| if @category.update_attributes(params[:category]) flash[:notice] = 'Kategoria została zapisana poprawnie.' format.html { redirect_to([:admin, @category]) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @category.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def putCategory( category_id, language, name)\n params = Hash.new\n params['category_id'] = category_id\n params['language'] = language\n params['name'] = name\n return doCurl(\"put\",\"/category\",params)\n end", "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end", "def update\n json_update(category,category_params, Category)\n end", "def update\n category = Documents::Category.find(params[:id])\n category.update!(category_params)\n redirect_to categories_path\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update! {admin_categories_path}\n end", "def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end", "def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:success] = 'Category was successfully updated.'\n format.html { redirect_to(admin_categories_url) }\n format.xml { head :ok }\n else\n flash[:error] = 'Category could not be updated. Please see errors below.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n @store.categories = Category.find(params[:category_ids]) if params[:category_ids]\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(@category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to(@category, :notice => 'Category was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to(@category, :notice => 'Category was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { render \"add_categories\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @otml_category = OtrunkExample::OtmlCategory.find(params[:id])\n\n respond_to do |format|\n if @otml_category.update_attributes(params[:otml_category])\n flash[:notice] = 'OtrunkExample::OtmlCategory was successfully updated.'\n format.html { redirect_to(@otml_category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @otml_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_categories(cats=[])\n rescue_extra_data\n cats = cats.to_i\n old_categories = categories.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")\n delete_categories = old_categories - cats\n news_categories = cats - old_categories\n term_relationships.where(\"term_taxonomy_id in (?)\", delete_categories ).destroy_all if delete_categories.present?\n news_categories.each do |key|\n term_relationships.create(:term_taxonomy_id => key)\n end\n update_counters(\"categories\")\n end", "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to(@cat, :notice => 'Cat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(admin_categories_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @category_collection = CategoryCollection.find(params[:id])\n @collection = @category_collection.collection\n\n respond_to do |format|\n if @category_collection.update_attributes(params[:category_collection])\n flash[:notice] = 'CategoryCollection was successfully updated.'\n format.html { redirect_to(@collection) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category_collection.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Категория изменена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_category_edit\n @user = User.where(contact: params[:contact]).first\n @user.categories.destroy_all\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-categories\", data: \"categories updated\"}, status: :ok\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n _update_topics \n format.html { redirect_to action: \"edit\", notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend", "def set_categories(ids)\n self.categories = Category.find(ids)\n self.save\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = '分类修改成功.'\n format.html { redirect_to(cpanel_categories_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @menu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_url, notice: 'Category was successfully updated.' }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n params[:company][:category_ids] ||= []\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category.update(category_params)\n end", "def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categorie = Categorie.find(params[:id])\n\n respond_to do |format|\n if @categorie.update_attributes(params[:categorie])\n format.html { redirect_to(@categorie, :notice => 'Categorie was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@categorie}}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorie.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(@category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to(@categoria, :notice => 'Categoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalog_category.update(catalog_category_params)\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :ok, location: @catalog_category }\n else\n format.html { render :edit }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n\n respond_to do |format|\n if @taxonomy_category.update_attributes(params[:taxonomy_category])\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html {\n redirect_to @category, notice: 'Category was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\r\n @ccategory = Ccategory.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @ccategory.update_attributes(params[:ccategory])\r\n format.html { redirect_to(pcategories_path, :notice => 'Ccategory was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @ccategory.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: t('update.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense.categories_expenses.destroy_all\n if (params[:expense][:categories]) \n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n end\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n flash[:notice] = 'Expense was successfully updated.'\n format.html { redirect_to(@expense) }\n format.xml { head :ok }\n format.iphone { redirect_to :controller => \"welcome\", :action => \"home\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"edit\" }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def set_category\n @categories = Category.find(params[:id])\n end", "def update\n category= Category.find(params[:id])\n category.update(category_params)\n \n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update\n @categoria = Categoria.find(params[:id])\n\n @categoria.update_attributes(params[:categoria])\n render :layout => false\n end", "def update\n @category = Category.find(params[:id])\n @title = 'Kategorie ' + @category.title + ' bearbeiten'\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end", "def update\n if @category.update_attributes(params[:category])\n flash[:notice] = \"Категория успешно изменена\"\n else\n flash[:alert] = \"Ошибка изменения категории: #{@category.errors.full_messages}\"\n end\n respond_to do |format|\n format.html { redirect_to categories_path }\n end\n end", "def update\n Category.update(params[:category].keys, params[:category].values)\n\n redirect_to admin_ads_path\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to @cat, notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sotto_categoria = SottoCategoria.find(params[:id])\n\n respond_to do |format|\n if @sotto_categoria.update_attributes(params[:sotto_categoria])\n format.html { redirect_to(@sotto_categoria, :notice => 'Sotto categoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sotto_categoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Категория была успешно изменена' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def editCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.update(name: params[:name])\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def update\n respond_to do |format|\n if @xcategory.update(xcategory_params)\n format.html { redirect_to @xcategory, notice: 'Xcategory was successfully updated.' }\n format.json { render :show, status: :ok, location: @xcategory }\n else\n format.html { render :edit }\n format.json { render json: @xcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n flash[:notice] = 'RecipeCategory was successfully updated.'\n format.html { redirect_to(@recipe_category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @books_category = BooksCategory.find(params[:id])\n\n respond_to do |format|\n if @books_category.update_attributes(params[:books_category])\n format.html { redirect_to(@books_category, :notice => 'BooksCategory was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @books_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contract_doc_category = ContractDocCategory.find(params[:id])\n\n respond_to do |format|\n if @contract_doc_category.update_attributes(params[:contract_doc_category])\n format.html { redirect_to @contract_doc_category, notice: 'Contract doc category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_doc_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n # format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie zaktualizowano kategorię.' }\n format.json { head :no_content }\n else\n # format.html { render action: \"edit\" }\n format.html { redirect_to units_path, :flash => { :error => 'Nie udało się zaktualizować kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n if @categorias_tipo.update_attributes(params[:cat_tipo])\n \t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n format.html { redirect_to cat_tipos_path, notice: 'Categorias tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to :back, notice: 'category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n flash[:notice] = l(:flash_notice_recipe_category_updated)\n format.html { redirect_to RecipeCategory.new }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n path = admin_categories_path\n if @category.category_id\n path = admin_category_path(@category.category_id)\n end\n\n if @category.update(params[:category].permit(:name))\n redirect_to path\n end\n end", "def update\n @components_category = Components::Category.find(params[:id])\n index\n respond_to do |format|\n if @components_category.update_attributes(params[:components_category])\n format.js { \n @notice = 'Categoria actualizada correctamente' \n render 'index'\n }\n else\n format.js { \n @notice = \"Error al actualizar categoria\"\n render action: \"edit\" }\n end\n end\n end", "def update\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @word_list = current_user.word_list\n\n #need to first remove categories from the word\n @word.categories.each do |category|\n @word.categories.delete category\n end\n\n #then push categories in from the category_params\n if params[\"category\"].include?(:category_ids)\n (params[\"category\"])[\"category_ids\"].each do |i|\n next if i.to_i == 0\n @word.categories << Category.find(i.to_i) unless @word.categories.include?(Category.find(i.to_i))\n end\n end\n\n if category_params.include?(:title) && ((params[\"category\"])[\"title\"]) != \"\"\n @word.categories << @word_list.categories.build(title: (params[\"category\"])[\"title\"])\n end\n\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word_list, notice: 'Word was successfully updated.' }\n #format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n #format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Updated!', \"Category [#{@category.description}] was successfully updated.\") \n }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schema_category.update(schema_category_params)\n format.html { redirect_to schema_categories_path, notice: 'Schema category was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_category }\n else\n format.html { render :edit }\n format.json { render json: @schema_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to category_index_path, notice: 'Categorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @forum_cat_l1 = ForumCatL1.find(params[:id])\n\n respond_to do |format|\n if @forum_cat_l1.update_attributes(params[:forum_cat_l1])\n flash[:notice] = t(:category_updated)\n format.html { redirect_to(@forum_cat_l1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @forum_cat_l1.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @component_category = ComponentCategory.find(params[:id])\n\n respond_to do |format|\n if @component_category.update_attributes(params[:component_category])\n flash[:notice] = 'ComponentCategory was successfully updated.'\n format.html { redirect_to(component_categories_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @component_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end", "def save(category = nil)\n params = { id: read_attribute(:name) }\n params[:category] = category if category\n client.post('/api/save', params)\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70238113", "0.68414366", "0.6461406", "0.6284337", "0.62295425", "0.62170756", "0.61702573", "0.61506844", "0.61276215", "0.6036525", "0.6021104", "0.6012928", "0.6012055", "0.599599", "0.59765", "0.59765", "0.59625256", "0.5953942", "0.59451157", "0.5928523", "0.590998", "0.59079665", "0.5907227", "0.5881502", "0.58220226", "0.58219", "0.5821403", "0.5807918", "0.5805191", "0.5801572", "0.57900923", "0.5784693", "0.57728106", "0.57718927", "0.57596546", "0.57533514", "0.5751009", "0.57463485", "0.5740738", "0.5723185", "0.57211345", "0.5718607", "0.5717514", "0.5716039", "0.5713567", "0.57047516", "0.5702329", "0.5702175", "0.5702155", "0.5702155", "0.5702155", "0.5702155", "0.5702155", "0.5702155", "0.5702155", "0.57018894", "0.570175", "0.56805545", "0.56737673", "0.567282", "0.56592745", "0.56592745", "0.565408", "0.56535125", "0.5630907", "0.56280243", "0.5625282", "0.5622185", "0.56196356", "0.56165636", "0.5614521", "0.56119376", "0.56090564", "0.5602296", "0.5598012", "0.55784184", "0.55768543", "0.5567568", "0.55427766", "0.554124", "0.55228764", "0.5522618", "0.5521809", "0.5521285", "0.5510555", "0.55050975", "0.5503633", "0.55024266", "0.5500643", "0.54932636", "0.5492531", "0.5490557", "0.5489924", "0.5488161", "0.54861194", "0.54831064", "0.5478069", "0.5466422", "0.5466422", "0.5466422" ]
0.5902622
23
DELETE /categories/1 DELETE /categories/1.xml
def destroy @category = Category.find(params[:id]) @category.destroy if @category.destroyed? flash[:notice] = 'Kategoria została usunięta poprawnie.' else flash[:notice] = 'Wystąpił błąd podczas usuwania kategorii.' end respond_to do |format| format.html { redirect_to(admin_categories_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @ccategory = Ccategory.find(params[:id])\r\n @ccategory.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(ccategories_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to(cats_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_categories_path) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @cat1 = Cat1.find(params[:id])\r\n @cat1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(cat1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_categories_url) }\n format.xml { head :ok }\n end\n end", "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(cpanel_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @otml_category = OtrunkExample::OtmlCategory.find(params[:id])\n @otml_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(otrunk_example_otml_categories_url) }\n format.xml { head :ok }\n end\n end", "def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete CATEGORIES, id ).code\n\t\t\t\t\tend\n\t\t\t\tend", "def destroy\n @category.destroy\n head :no_content\n end", "def destroy\n params[:id].each{|id| \n article_category = ArticleCategory.find(id.to_i)\n article_category.destroy\n }\n\n respond_to do |format|\n format.html { redirect_to(article_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(categorias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @categorie = Categorie.find(params[:id])\n @categorie.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n end\n end", "def destroy\n @categorization = Categorization.find(params[:id])\n @categorization.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_categorizations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n begin\n @category.destroy\n rescue ActiveRecord::DeleteRestrictionError\n error = 'Эта категория не может быть удалена, пока с ней связан хоть один файл.'\n ensure\n respond_to do |format|\n format.html { redirect_to categories_url, notice: error }\n format.json { head :ok }\n end\n end\n end", "def destroy\n @categories=Category.all\n @category.destroy\n flash[:notice]=\"Supprimé avec succès!!!\"\n \n end", "def destroy\n @category.delete\n end", "def destroy\n @recipe_category = RecipeCategory.find(params[:id])\n @recipe_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipe_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @forum_cat_l1 = ForumCatL1.find(params[:id])\n @forum_cat_l1.destroy\n\n respond_to do |format|\n format.html { redirect_to(forum_cat_l1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category_collection = CategoryCollection.find(params[:id])\n @collection = @category_collection.collection\n @category_collection.destroy\n\n respond_to do |format|\n format.html { redirect_to(@collection) }\n format.xml { head :ok }\n end\n end", "def destroy\n @catena = Catena.find(params[:id])\n @catena.destroy\n\n respond_to do |format|\n format.html { redirect_to(catenas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sotto_categoria = SottoCategoria.find(params[:id])\n @sotto_categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(sotto_categorie_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n category = Documents::Category.find(params[:id])\n category.destroy\n\n redirect_to categories_path\n end", "def destroy\n @news_category = NewsCategory.find(params[:id])\n @news_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url, notice: 'Вы удалили категорию и список услуг.' }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n flash[:success] = 'Category was deleted.'\n format.html { redirect_to(admin_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alien_category.destroy\n respond_to do |format|\n format.html { redirect_to alien_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @books_category = BooksCategory.find(params[:id])\n @books_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @course_category = CourseCategory.find(params[:id])\n @course_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: \"Journal was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "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", "def destroy\n @category.destroy\n end", "def destroy\n @categoria_comida = CategoriaComida.find(params[:id])\n @categoria_comida.destroy\n\n respond_to do |format|\n format.html { redirect_to(categoria_comidas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @documentocategoria = Documentocategoria.find(params[:id])\n @documentocategoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentocategorias_url) }\n format.xml { head :ok }\n end\n end", "def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end", "def destroy\n @post_category = PostCategory.find(params[:id])\n @post_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(post_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = @collection.category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n end", "def destroy\n @xcategory.destroy\n respond_to do |format|\n format.html { redirect_to xcategories_url, notice: 'Xcategory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorymaster = Categorymaster.find(params[:id])\n @categorymaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(categorymasters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @category = Category.find(params[:id])\r\n @categorization = Categorization.find(:all, :conditions=>[\"category_id = ?\", params[:id]])\r\n if @categorization.size > 0\r\n flash[:notice] = 'You cannot delete the category it is linked to Companies.'\r\n else\r\n @category.destroy\r\n end \r\n\r\n respond_to do |format|\r\n format.html { redirect_to(admin_categories_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @business_category = BusinessCategory.find(params[:id])\n @business_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(business_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: t('destroy.notice', name: t('activerecord.models.category')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n render json: { notice: 'Categoria eliminada exitosamente' }\n end", "def destroy\n category = set_category\n if category.destroy\n head :no_content\n else\n render json: { status: 500 }\n end\n \n end", "def destroy\n @mk_categoria.destroy\n respond_to do |format|\n format.html { redirect_to mk_categories_url, notice: 'Mk categoria was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to cm_post_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.delete_context #there you go, this little fatty kills em all!\n #fred and post have equal methods, makes it slim and easy\n\n respond_to do |format|\n format.html { redirect_to categories_url, :method => :get, :notice => t(:deleted_category_success) }\n format.json { head :ok }\n end\n end", "def destroy\n @contract_doc_category = ContractDocCategory.find(params[:id])\n @contract_doc_category.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_doc_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @categoria.destroy\n respond_to do |format|\n format.html { redirect_to categorias_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end", "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", "def destroy\n @retailer_category = RetailerCategory.find(params[:id])\n @retailer_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(retailer_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @component_category = ComponentCategory.find(params[:id])\n @component_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(component_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n respond_to do |format|\n if @category.documents.empty?\n @category.destroy\n format.html { redirect_to categories_url, notice: 'Категория была удалена.' }\n else\n logger.info 'else'\n format.html { redirect_to categories_url, :flash => {:error => 'Нельзя удалять категорию, у нее есть связанные документы.'} }\n end\n end\n end", "def destroy\n @sys_category.destroy\n respond_to do |format|\n format.html { redirect_to sys_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categoria_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categorie = Categorie.find(params[:id])\n @categorie.destroy\n end", "def destroy\n @category2 = Category2.find(params[:id])\n @category2.destroy\n\n respond_to do |format|\n format.html { redirect_to(category2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityCategory( 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/category\",params)\n end", "def destroy\n Category.find(params[:id]).destroy\n\n redirect_to admin_ads_path\n end", "def delete\n\t\tSsccategory.find(params[:id]).destroy\n\t\tredirect_to :action => 'list'\n\tend", "def destroy\n @pcategory = Pcategory.find(params[:id])\n @pcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to(pcategories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact_category = ContactCategory.find(params[:id])\n @contact_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(contact_categories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_good_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t @category = Category.find(params[:id])\n\t @category.destroy\n\n\t respond_to do |format|\n\t\tformat.html { redirect_to admin_categories_url, notice: 'Categoria eliminada exitosamente.' }\n\t end\n\tend", "def destroy\n @category = current_mall.categories.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_wmall_categories_url }\n format.json { head :no_content }\n end\n end", "def remove_category category_name\r\n delete category_name\r\n end", "def destroy\n @content_category = ContentCategory.find(params[:id])\n @content_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_home_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @categorias_tipo = CatTipo.find(params[:id])\n @categorias_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to cat_tipos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @category_db.destroy\n respond_to do |format|\n format.html { redirect_to category_dbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kategory = Kategory.find(params[:id])\n @kategory.destroy\n\n respond_to do |format|\n format.html { redirect_to kategories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @categ.destroy\n respond_to do |format|\n format.html { redirect_to categs_url, notice: 'Categ was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cats_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7066325", "0.7036115", "0.69916683", "0.69916683", "0.69916683", "0.6986449", "0.69760543", "0.6969206", "0.69483775", "0.69109625", "0.6908067", "0.6906969", "0.6884139", "0.6871092", "0.68673575", "0.68592954", "0.6852229", "0.6787517", "0.6735929", "0.67167944", "0.6711199", "0.6706087", "0.6685811", "0.66857356", "0.66798204", "0.6678184", "0.66768503", "0.6671416", "0.6648866", "0.66346973", "0.66241926", "0.66144603", "0.66108483", "0.66045773", "0.65929997", "0.65874887", "0.65821433", "0.6574396", "0.6568164", "0.65672714", "0.6566302", "0.65536463", "0.6529584", "0.651874", "0.6506354", "0.6503409", "0.6497118", "0.64928126", "0.6487119", "0.64795274", "0.64763564", "0.6473465", "0.6458545", "0.64519715", "0.6450577", "0.64471525", "0.64459234", "0.64433426", "0.6437136", "0.64349574", "0.6428131", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.64280856", "0.6427618", "0.6427514", "0.6415661", "0.64139044", "0.6413886", "0.6406199", "0.64041436", "0.6402333", "0.64012754", "0.64012754", "0.64012754", "0.6400512", "0.6392888", "0.6386706", "0.63848954", "0.63705385", "0.6367484", "0.6366211", "0.63636434", "0.6359637", "0.6352426", "0.6339097", "0.6337399", "0.63313615", "0.6328036", "0.6325463", "0.63230807" ]
0.6434453
60